Camera to display only solid colour representations of entities?

Is it possible to have an object that displays one material with one camera but a different material (or just a solid colour) in another camera?

Specifically I want my ‘regular’ camera (that the player sees through) to display regular materials/textures but a camera that is rendering to a texture at the same time to only see solid colours (no lighting etc).

Possible?

Yep. See PlayCanvas Examples - the debug rendering mode in the HUD. You can also override this chunk and output what you want for your camera, if you’re not happy with the debug options: engine/debug-output.js at main · playcanvas/engine · GitHub

here’s the documentation:

1 Like

Thanks, this is interesting but how exactly do I define the new CUSTOM_RENDERING_PASS. In a script somewhere? The chess demo doesnt seem to have any reference to how things get rendered nor does the camera component script link as far as I can tell.
Sorry, but I am very new when it comes to anything to do with shaders. Any clue how I could just render as a solid colour for each object for a different camera?

Cheers

The hints are in my post above.

  1. set up a shader pass for the camera you render to texture with. For example
cameraEntity.camera.setShaderPass('custom_rendering');
  1. override debugOutputPS chunk on your materials, to tell it what you need for this pass
material.chunks.debugOutputPS  = `
#ifdef CUSTOM_RENDERING_PASS
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
#endif
`;
1 Like

Thanks. How exactly do I do that bit? In which script?!? Do I make a new script?

Check some of the demo projects here, especially the ones using shader chunks on how to do that:

https://developer.playcanvas.com/en/tutorials/?tags=shaders