Menu

Userdefined Shader

2017-09-28
2017-09-28
  • Tom Wieland

    Tom Wieland - 2017-09-28

    Hi,
    I don't know how to shade TIndexedFaceSetNode with different front and back color.
    I thought I could use TcomposedShaderNode with modified template_mobile.fs, but then there is no lighting.
    Or should I use effects?

     
  • Michalis Kamburelis

    Using the effects https://castle-engine.sourceforge.io/compositing_shaders.php gives usually more elegant result than using ComposedShader (the effects can be mixed with each other and with the standard rendering). So I usually advice them. But... as I quickly looked, I did not provide any "plug" in the effects to enable changing material color depending on the front or back face.

    So, you should use ComposedShader for now. Exactly the approach you describe, it should work.

    Be sure to flip the normal vector when looking at the back face.

    If you're still stuck, can you send me a source code (if possible, a simplest X3D file with IndexedFaceSet and ComposedShader) that demonstrates the problem? You can attach files here on this forum, or you can send them it to be privately (michalis.kambi AT gmail.com) if you prefer. I will need to see the exact code to tell what's wrong:)

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB