-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
materials_unlit differences between renderers #1609
Comments
The sRGB is often approximated by raising to the power of 2.2.
|
If Kuesa is producing something like (255, 55, 0), then that's incorrect, and should be reported as a bug. |
I dont get why is incorrect. The specification says the output color should be the baseColorFactorbaseColorTexturevertexColor, if any. In this case, the vertex doesnt have any color, so is just baseColorFactor*baseColorTexture, and as we dont have a texture, we just output the baseColorFactor. which is (1,0.2176,0) which is (255,55,0) approx. What is wrong here? |
So, let's see if I can explain something that makes sense here. I'll use the newly updated Sample Viewer as a bit of a guide. The "color" textures (including base color and emissive, and excluding metal/rough and normal) are treated as sRGB, and are transformed into linear space prior to any calculations. Optionally, this transform may happen in hardware. After that, the (linear) factor is multiplied in. The sample code looks like this.
So now, Optionally, some tone mapping is applied. And finally, after all that, the fragment is converted from linear space back to sRGB, such that it can participate the normal way for the remainder of the graphics pipeline. The sample viewer calls this gamma correction, which I would claim is a misnomer, it's really the poor-man's linear to sRGB transfer function, undoing what was done in the first place. In the current viewer, this is implemented simply by setting the default final gamma correction to 2.2 instead of 1.0, but ideally I think this should be changed to hide the 2.2 from the user and make it clear that it's intended purpose is linear-to-sRGB. Of course, an unlit material short-circuits most of the fancy PBR calculations. But it still includes the "gamma correction" which is acting as the viewer's only linear-to-sRGB transfer.
So the full sequence of events for unlit materials is:
Since Hopefully this is making some kind of sense. |
Thanks, this clarifies all my doubts. |
@emackey almost think we should copy-paste some of this excellent explaining into the spec... |
@jjcasmar I'm not familiar with Kuesa, can you open a bug report with them on unlit colors? You can link here for the explanation. Thanks! |
Kuesa is a project we are developing at KDAB. I have already fix the code supporting KHR_materials_unlit extension. Not sure if I can post here the link to the repo, but if you want to have a look, just look for Kuesa here on github. It doesnt support yet completely glTF, althought we are nearly there. I completely agree with zellski suggestion about copying part of the explanation directly to the spec document. |
I have implemented the KHR_materials_unlit extension in Kuesa renderer and I dont understand the differences between my implementation and the sample output.
In the sample, the orange box have a baseColorFactor of
Picking the color of the sample output, it says its (255,127,0), which is around (1,0.5,0), far away from the value specified by the material.
Is the sample wrong? Am I understanding something incorrectly?
Kuesa renderer outputs exactly the color specified by the material.
The text was updated successfully, but these errors were encountered: