[SOLVED] Why I can't use custom shader with cast shadows on render component or light component?

Hi @LorRrR and welcome,

Can you elaborate on how exactly are you structuring your code and shader?

In general if you are looking to leverage lighting/shadows then you should avoid writing a custom shader but instead use shader chunks (override part of the internal PlayCanvas rendering code). Example project:

https://developer.playcanvas.com/en/tutorials/tutorial-plasma-shader-chunk/

1 Like

https://developer.playcanvas.com/en/tutorials/custom-shaders/

I just copied shader project files into my project, but this error appears, and disappears when I turn off cast shadow either on render component or light comp.

As I said, you can’t use a custom shaders with PlayCanvas lighting/shadows. You need to use shader chunks for that.

1 Like

Thank you!

1 Like

Is there a tutorial on how to use shader chunks specifically for cast shadows?

Shaders generated for shadows casting are stripped down shaders from the standard material used in the forward pass. Not sure what’s the recommended way to override that, but a good place to study is the shadows pass here: