-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TwoSidedMaterial renders unlit white #23
Comments
FWI when i try the first one, i get this....
this is with a build from last week. |
Tl;dr: Get view3dscene from http://michalis.ii.uni.wroc.pl/view3dscene-snapshots/ , it supports Details: The documentation on https://castle-engine.io/ right now refers to the "snapshot" version of view3dscene, which you can get from http://michalis.ii.uni.wroc.pl/view3dscene-snapshots/ . Not to the last stable view3dscene 3.18.0.
So, please bear with me :) -- the docs right now describe the unstable view3dscene/CGE, and it will be fixed with new release of both view3dcene and CGE really soon now. Opening with latest view3dscene results in correct two-sided rendering: Some more notes about this test file:
|
See castle-engine/castle-model-viewer-mobile#1 , see #23 . The commit that broke it: castle-engine/castle-engine@a6fd30a
See #1 , see castle-engine/castle-model-viewer#23 . The commit that broke it: castle-engine/castle-engine@a6fd30a
AD 4 above - fixed in latest CGE/view3dscene, you will no longer fall down infinitely. |
The snapshot view3dscene also works with paulmasson/mathcell#15. I think I would vote for keeping a version of TwoSidedMaterial since it is something normal users would expect. Moving it into a twoSided field would be better, but then there needs to be way define the color of the backSide for regular Material. Help me understand: what is difference between separateBackColor='false', and normal Material with solid='false' ? |
Indeed. See http://web3d.org/pipermail/x3d-public_web3d.org/2019-December/011594.html : the conversion path for people using This "conversion path" is admittedly not trivial. So if many people use Note that this is only for
With solid = false, back faces are rendered. But how is lighting computed on these back faces?
The first case ("one-sided Note that in CGE implementation, I actually sometimes do "two-sided lighting" (invert normal) even in case of
IOW, I understand your confusion. In my eyes, if you would implement |
Thanks for pointing out the Lighting equation with the special dot product N dot L where N is the normal and L is the Light vector. Lets just look the diffuse contribution. Setting otherwise negative products to 0 means that lights on the other side of a triangle cannot suck light contributions from other lights back out, in my mind. Such lights just do not contribute. So back faces may or may not be black, depending on the light vector for a given light. separateBackColor=false still needs solid=false to render back faces at all. So at first glance it should mean the same as a regular Material. But I think what twoSidedMaterial changes is that back faces are now treated as second front faces, eg. with an outward pointing normal. Sorry for thinking aloud. Let me read again. |
https://castle-engine.io/x3d_implementation_shape.php#section_supported_nodes
says that TwoSidedMaterial is somewhat supported.
But
http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter05AppearanceMaterialTextures/TwoSidedMaterial.x3d
(https://x3dgraphics.com/examples/X3dForWebAuthors/Chapter05AppearanceMaterialTextures/TwoSidedMaterialIndex.html)
renders white in view3dscene 3.18
(see also paulmasson/mathcell#15)
The text was updated successfully, but these errors were encountered: