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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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:)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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?
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:)