-
-
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
OBJ / MTLLoader: Label and convert textures and colors correctly in MTLLoader #23296
Conversation
Please be aware of #7290. Since |
Yes specular maps aren't adjusted here. Only the specular color is. |
Interesting. I always wondered why it was so plasticky... Could you re-generate the |
Does it work if you navigate into the |
Thanks but still no luck. Looks the same. Could the change in texture format be causing this? When I revert the |
Ah... Seems like the issue is that I checked out your branch and changed the puppeteer script to not be headless and I found this in devtools: @Mugen87 Any suggestions? Would it be better if the renderer was tolerant about this and rendered these textures wrong, better than failing and rendering black? |
I would not do that. Displaying the uncompressed data means undefined result. What the engine currently does (reporting errors/warning) is the best. BTW: I can generate the screenshot on my iMac without issues. This is the result: |
Oh... The we can merge and you can generate the new screenshot. But we'll probably have to add an exception in the e2e script: three.js/test/e2e/puppeteer.js Lines 25 to 55 in be9d017
|
Actually, I can just photoshop/gimp it 🤓 I'll take care of this. |
Thanks! |
Actually, a better solution would be to remove the dds textures from this example. Will do that. |
Indeed! Let's focus on S3TC in the |
BTW: three.js/examples/jsm/loaders/OBJLoader.js Line 754 in c77a176
It seems this change is only consistent if the attribute is converted to sRGB, too. |
Oh oops -- you're right. My understanding is that the vertex colors of a geometry need to be in Linear color since they undergo no transformation before or in the shader. I'll make a PR in a bit. |
gkjohnson Just a little curious here for my own understanding -- why do we need to convert the colors from SRGB to linear, in order to be compatible with a renderer using SRGB encoding? This seems counter-intuitive to me ( I would think this would happen the other way around ) but probably just some knowledge gap in my understanding about the lower level of renderer color encoding. |
Only the final image is output and displayed in sRGB. All of the math being done on the GPIU happens in Linear sRGB color space. |
Related issue: #23283
Description
Convert colors to Linear and label color textures as
sRGB
when loading MTL materials. Also update the OBJ demo with MTL files to useoutputEncoding = sRGBEncoding
.https://raw.githack.com/gkjohnson/three.js/srgb-obj/examples/webgl_loader_obj_mtl.html