Skip to content
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

TEXMAP images with alpha trasparency error #57

Open
billthefish opened this issue Aug 15, 2022 · 5 comments
Open

TEXMAP images with alpha trasparency error #57

billthefish opened this issue Aug 15, 2022 · 5 comments

Comments

@billthefish
Copy link

billthefish commented Aug 15, 2022

Parts the have TEXMAPs with alpha transparency do not render correctly in physical color mode. The geometry covered by the TEXMAP renders transparent.

To Reproduce

  • Create a model that contains only a reference to a part that contains a TEXMAP image with alpha transparency.
    I used: '1 0 0 0 0 1 0 0 0 1 0 0 0 1 2454aps5.dat.
    Note: Only the unofficial version of 2454aps5 uses a TEXMAP image
  • Load into the software with physical color rendering turned on

Screenshots
Go to https://www.ldraw.org/cgi-bin/ptdetail.cgi?f=parts/2454aps5.dat to see the rendering in action. To turn on physical render mode, click the button with the "eye" icon.

@LasseD
Copy link
Owner

LasseD commented Aug 17, 2022

This is a known defect due to the physical materials using the standard materials from three.js. See end of LDRColorMaterials.js

if(!texmap) {
color.m = m;
}

The problem is that the color of a material blends together with the texture when using the standard materials. The "quick draw" materials I have made for instructions are completely controlled by builinstructions.js, which is why the issue does not appear there. Should we raise this as an issue with the three.js project?

@billthefish
Copy link
Author

It's up to you to report or not since you're the technical expert and can explain what is happening better than I can.

@LasseD
Copy link
Owner

LasseD commented Aug 29, 2022

See also: https://stackoverflow.com/questions/68834918/how-can-i-remove-influence-of-setting-color-in-meshs-material-in-three-js

@Mugen87 is one of the core authors of three.js, and the color mixing is unfortunately intended without the option to turn it off. Adding a check for "inside a texture" as our custom LDraw shaders have, would result in a performance degradation in rendering, so I doubt we will see success in getting three.js core changed. However. We could branch our own version with this feature. The downside is then that the branch has to be maintained by us.

@billthefish
Copy link
Author

"Rolling our own" Three.js is prolly a bad idea for a number of reasons. I'm willing to live with this quirk as long as you are since LDraw.org doesn't really use physical color rendering in any meaningful way.

@LasseD
Copy link
Owner

LasseD commented Aug 29, 2022

I'm still not happy with that. Let me see if I can "hack" the shader generator in any way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants