-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Geometry with white alphaMap and transparency=true, opacity=1, is not rendered fully opaque #21987
Comments
I'm unable to reproduce this issue with the following fiddle: https://jsfiddle.net/vsoLhmq6/2/ BTW: When sharing a live example, it's better to use pure |
/cc @drcmda |
It would appear it is not. One reasonable guess is this is due to react-three-fiber tone mapping, sRGB encoding, and/or gamma correction in the render target. |
Except in Case 3 - same map, but fully opaque.
I guess next step is to try to update @Mugen87 's fiddle to use a Render Target instead of an image for the alphaMap to see if that reproduces the issue. |
if does autoconvert colors to srgb and tonemaps to acesfilmic. so either or <meshBasicMaterial color="white" toneMapped={false} /> both work, but i'd prefer # 2 because # 1 would then have incorrect gamma. if a threejs project is on srgb and mapping it could then give you the same (unexpected) result. that was just a matter of configuring the canvas slightly different. |
Quick follow up on this comment in my original post:
The answer is "yes" - without transparent=true, even though the alpha mask is applied, the full geometry occludes other objects (depth buffer, I assume? - not totally up to speed on the terminology here...). |
Describe the bug
A geometry with a standard material which has BOTH an alpha mask set and transparency set to true is not rendered fully opaque as expected.
Even though the alpha mask is solid white (i.e. fully opaque) and the opacity of the geometry is set to 1, the geometry is rendered partially transparent.
To Reproduce
Steps to reproduce the behavior:
Code
Example using react-three-fiber: a red plane is masked to circular area via the alpha mask, and is expected to be fully opaque. Behind the plane is a white box which should not be visible at all from default camera position, but it is in Case 1 below.
Case 1 (displays bug): Plane should be masked to a circle (via alphaMap) and should be solid red, but is rendered partially transparent:
Case 2 (as expected): Plane rendered to solid red, no transparency
Case 3 (as expected): Plane masked and rendered to solid red, no transparency
Live example
Expected behavior
Plane should be masked and solid red (i.e. as per Case 3 screenshot below) when both alphaMap is set AND transparent=true and opacity=1. Or if transparent=true is not valid in conjunction with use of an alphaMask, update docs to clarify.
(I'm not sure if there's any valid real world use case for using an alphaMap in conjunction with transparent=true, but somehow I stumbled into this situation in my own code, and was confused by the result I saw.)
Screenshots
Case 1:
Case 2:
Case 3:
Platform:
The text was updated successfully, but these errors were encountered: