Model shading behaving strangely with default model material

I’m doing more 3D preparation and ran into this issue with the light shading. I can’t see why it would do this. Any ideas?

Edit:

Very quickly found the cause is having multiple of the same models in the same scene. I’m using the built in model material, nothing custom, not sending any information to the models.

FPS is also much faster with only a single copy of a model than multiple copies of the same model. Edit: Slowness was only due to detail of mesh and how many copies there are (very high ModelVertexBuffer), nothing else.

Edit2: Not caused by multiple copies of the same model? as tested with multiple models and one model as its own file and it still happens.

3 Likes

I had the same problem with my Tank Vs Meteors sample, solved by making a custom shader with fixes from @sven if I recall correctly. Basically some uniform variables are not what they seem.

2 Likes

Here they are for reference. No problems with the lighting behaving weird with multiple objects.

render.zip (1.2 KB)

I still need to fix all of the older DefFX shader programs as they were based on an even older version. Will be adding different kinds of 3d camera helpers soon.

1 Like

Now I have the same problem, big problem! Why the ModelVertexBuffer so high ? My game scene only has one model.

Now I have the same problem, big problem!

I don’t remember the exact fix for this, but the current builtin model material should be a correct reference for whatever is causing it.

Why the ModelVertexBuffer so high ?

Text contributes to this number. I think every character is a quad?

The model only has a few hundred vertices, but ModelVertexBuffer is hundreds of thousands. Is this bug of defold ?

I use bulitin model material.