PrepassRenderer support for ShaderMaterial

Only color channel in the prepassRenderer is supported for ShaderMaterial, is there any plans to support other channels?

You have to write to all the targets yourself, if you want to use a custom shader material with the pre-pass renderer. You can see how it is done in the standard material:

If it’s an option for you, you will be able to use a node material once this PR is merged:

1 Like

It is acceptable to write all the targets in the shader, however the question is I have to hack the code to prepare the defines for prepass when using ShaderMaterial, is it possible to support this?

Indeed, you’ll have to do a bit of work on your own if you want to support the prepass renderer in a shader material.

There are no plans to extend the ShaderMaterial to support everything in the framework (for example, lights are not supported), as this class exists primarily to allow the user to write raw glsl code for their materials.

That said, if you’d like to make a PR to add support for the prepass renderer in the ShaderMaterial, we’d be happy to review it!

1 Like

Thanks for the explanation! I’ll try to see if it is possible to make a PR.

1 Like