Can objects with custom shaders be made to interact with lights?

I have been successfully using custom shaders (fragmentShaders) for color and alpha, but the objects do not respond to light. They look the same even with no lights. How can I make the objects render in a standard way? I have been invoking the shaders as indicated in the a-frame docs: material=“shader: my-custom”.

Can you share a photo of what you are seeing? More information would be helpful.

Have you tried adding a shadow component to them?





The image “petal” is of a sphere with a point light that should reflect in it. The light does reflect if I do not use the custom shader. “petal” is the same if I comment out all the lights.

The other attachments indicate that I am using input from the scene (many lily pads and blossoms) to drive the shape and colour of pads and blossoms.

Two of the attachments indicate that I am learning from Grid Glitch and also from The Book of Shaders.

Adding a “shadow component” is news to me. Can you expand on that?

Thanks for your advice.

You could implement a Lambertian Diffuse in your custom shader provided you have the transformation data of the light(s).

1 Like