You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We render an object with the MeshPhysicalMaterial with transmission set to 1. We allow users to apply clipping planes to that object. Because we want to render the "inside" of the object, we set the side to DoubleSide. However, we also want to render the object with a specific color.
Displaying the object with a certain color is tricky with this configuration though, because when side is set to DoubleSide the object will be rendered in the transmission pass with side set to BackSide and consequently transmit through itself, as it were. This is often desirable, I guess, but in our case it will distort the color in a way we do not want. We want to use double side rendering just to show the backsides of the object when clipping is applied.
Rendered with FrontSide:
Rendered with DoubleSide:
Introduce a local (material-level) or a global flag to control whether objects with transmission !== 0 and side === DoubleSide will be rendered in the transmission pass. The current behavior could be preserved by setting the flag to true by default.
If it is agreed upon that this is a desirable feature, I'd be willing to contribute a PR.
Alternatives
We can work around the problem by setting the drawRange.count to 0 via the onBeforeRender for just the transmission pass, effectively hiding the object. This, however, has the shortcoming of still issuing a draw call during the transmission pass for the object.
Additional context
No response
The text was updated successfully, but these errors were encountered:
Description
We render an object with the
MeshPhysicalMaterial
withtransmission
set to1
. We allow users to apply clipping planes to that object. Because we want to render the "inside" of the object, we set theside
toDoubleSide
. However, we also want to render the object with a specific color.Displaying the object with a certain color is tricky with this configuration though, because when
side
is set toDoubleSide
the object will be rendered in the transmission pass withside
set toBackSide
and consequently transmit through itself, as it were. This is often desirable, I guess, but in our case it will distort the color in a way we do not want. We want to use double side rendering just to show the backsides of the object when clipping is applied.Rendered with
FrontSide
:Rendered with
DoubleSide
:You can also see the effect here: https://codesandbox.io/p/sandbox/2jpp8k (Modify line 32 to switch between front side and double side rendering)
An entry to the relevant code can be found here: https://github.com/mrdoob/three.js/blob/dev/src/renderers/WebGLRenderer.js#L1542
Solution
Introduce a local (material-level) or a global flag to control whether objects with
transmission !== 0
andside === DoubleSide
will be rendered in the transmission pass. The current behavior could be preserved by setting the flag totrue
by default.If it is agreed upon that this is a desirable feature, I'd be willing to contribute a PR.
Alternatives
We can work around the problem by setting the
drawRange.count
to 0 via theonBeforeRender
for just the transmission pass, effectively hiding the object. This, however, has the shortcoming of still issuing a draw call during the transmission pass for the object.Additional context
No response
The text was updated successfully, but these errors were encountered: