Hi!
So I’m trying to find out why the lights in my scene is not changing the brightness / affecting the texture of the grass that I’ve added here: https://codepen.io/brandflugan/pen/xxwXxdy
I’ve tried to add “lights: true” to my RawShaderMaterial but it isn’t working.
Does anyone have any suggestion or tips on how I can get the light to be working with the grass texture (and not only the plane?).
Best regards
Markus
As mentioned in the documentation, ShaderMaterial.lights
only provides light uniforms in the shader. That does not mean that they are automatically evaluated. As long as your grass fragment shader does not implement any lighting equations, lights in your scene will not show any effect.
Thanks for your response!
I’m not quite sure on how the custom uniforms are supposed to be added to the RawShaderMaterial.
I can see how it is added to the ShaderMaterial though.
Maybe I’m missing something quite obvious to do
Well, the shader code is not automatically injected. You have to enhance your shader manually and try to utilize the existing shader chunks of the library as good as possible.
Unfortunately, this is advanced stuff and requires a good understanding of the internal shaders. If you are new to all this, it might require some time to get familiar with it.
In most cases, it’s probably better to modify an existing lit material via Material.onBeforeCompile(). Or you try to dive into the experimental node based material.