Update lightning on Instance with NodeMaterial

Hi

I made the example PG of the problem. I noticed that after changing my mesh instances rotation the light shading is wrong. Some faces are pointing directly in the light direction but are black.

The result is like this:

How do I force an update of light from code after I position all my instances? Cause now the 3rd instance should have similar front face colors as the original but is black. I actually do not want to update this every frame, cause the mesh will be stationary so I actually like that the shading is not calculated all the time. Just need to update it once after I position all my instances.

Regards
Peter

Looks like a bug to me :frowning: adding @Evgeni_Popov who knows a lot about node materials

Hi Sebastian (pan w wanie)

You know, if it i’s a bug them maybe we can move it to bugs?

But I do not want to work fully as it should at least with some settings maybe. I like the fact that this is almost like backed shadows and It works super for me. I just want to force an update on it to recalculate the shading after positioning and then I will like it to be fully stationary.

Regards
Peter

Your node material is wrong, the transformation to use in the World normal block is not World, it is the output from the Instances block as you are using instances in your PG:

https://playground.babylonjs.com/#56LKV2#1

1 Like

You guys are the best :slight_smile:

Thanks
Peter

Sorry cause I got you on the topic.

How can I make shadows gray instead of black, with a light shadow node? The side that does not have any light is solid black and I need it to have some light like fake it.

PG:

https://playground.babylonjs.com/#56LKV2#2

Regards
Peter

You can either add an ambient component to your material or add a hemispheric light with a low intensity.

Using an ambient component:

https://playground.babylonjs.com/#56LKV2#3

Ok but this does not work with texture. I was hoping for a general rule to control shadow intensity that I do not know in NME.

Yes it works with textures too, you can add the ambient color to the texture values.

Note that you can control the shadow intensity when using a shadow generator, but the darker sides of the cubes in your PG are not shadows per see, it’s only that those faces receive less/no lights.

Blockquote @Evgeni_Popov
faces receive less/no lights

And this is exactly what I’m interested in tricking to not be black. And with textures, it’s not working for me at all. I get grey colour :confused: It there a way around it. To have a texture less shaded all arround? so I can control how much darker it will be in those less no shadows areas?

Regards
Peter

Thanks for fixing the Gradient Bug BTW

You should multiply the ambient color with the color texture to achieve what you want:

https://playground.babylonjs.com/#56LKV2#5

1 Like