-
Notifications
You must be signed in to change notification settings - Fork 324
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
Basic export of KHR_materials_sheen factors. #1344
Conversation
On second thought, here is one other viewer we can compare: http://gltf.ux3d.io/. It looks pretty similar to BabylonJS in this case. |
Background for curious readers: sheen is a material property providing a light scattering effect at the edges of an object. It is generally used when rendering textiles, like velvet. |
@@ -317,6 +323,34 @@ def __gather_clearcoat_extension(blender_material, export_settings): | |||
|
|||
return Extension('KHR_materials_clearcoat', clearcoat_extension, False) | |||
|
|||
def __gather_sheen_extension(blender_material, export_settings): | |||
sheen_enabled = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable.
The color is actually lerped between white and (Note that the result will not necessarily be in the range [0,1], so you have to clamp That takes it to here: which is.... uh....... b-better? |
The (regular) roughness has no effect on sheen in Blender AFAICT. |
Thanks for these corrections @scurest, and sorry for the long delay. :) The implementation of sheen in three.js has been completed, which makes it much easier (for me at least) to do a more thorough comparison here...
Additional steps:
The screenshots above all used the current implementation of passing regular roughness (1) into sheen roughness. Decreasing the value to about 0.25 (as you suggest) we can get much closer to Blender: With that I think we're in the right ballpark, but the sheen color ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @donmccurdy Did you see that you have some KO unit tests?
Also seems you pushed with 2 differents emails, and 1 didn't signed the CLA
addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py
Outdated
Show resolved
Hide resolved
Apply sheen feedback.
Thanks @julienduroure - I've resolved those issues! Also, the lower roughness gets us more in the right range of general color and strength, but also makes the sheen appear noticeably "less rough" than it appears in Blender. Something doesn't seem to match up there. For another experiment I tried increasing the "Sheen" value beyond one, which brings us in the right direction visually, but also seems like the wrong solution. I'm not having much luck comparing Blender's implementation with the KHR_materials_sheen specification or three.js...
... but the fact that Blender is only scaling diffuse radiance sounds like a possible source of difference. @emackey @elalish Do you know of anyone who might be able to look at Blender's implementation and suggest a mapping to |
Some interesting discussion here in Blender Forums: Principled Shader needs ‘Sheen Roughness’...
|
Some thought about how we can manage "hard-coding" values needed for approximation when there is no 100% mapping between Blender and glTF. Example: sheen roughness Some possible solutions:
|
I'm hoping we can derive values of sheen and sheen roughness that are accurate, or close to it. If so, then I don't think it's necessary to expose additional settings. I am thinking of the "glTF Settings" node as a last resort, for concepts that exist in Blender (e.g. baking AO and thickness maps) but cannot otherwise be exported. |
I played with this a bit without getting anywhere. After some simplifying assumptions I managed to line up Three and Blender somewhat and did get to a form with two constants, F and R, your intensity and roughness.
They were supposed to be chosen to make two curves line up but the values I worked out (F=0.5, R=0.5) didn't work all that great when I actually tried it lol. I made some swatches instead. The lower left quadrant is most promising. I tried around F=0.3, R=0.4 but didn't come up with anything that good... (Also I'm not sure if it would be better to scale by 1/max instead of clamping for colors outside white.....) |
I had a look at this thread and the code but, unfortunately, there is not much I can add. Blender's Principled sheen BRDF doesn't map well to the (more flexible) BRDF defined in KHR_materials_sheen.
Overall this makes the sheen models look and behave significantly different. Unlike the specular extension there is no easy conversion between the two sheen models. |
Thanks for your feedback! |
Thank you @proog128! I wonder if this is worth raising with the developers of the Principled BSDF node? I would assume the principled node is intended to be energy-conserving. 🤔 |
We can now close this PR, as sheen is now in master, after merging #1646 |
Sheen in Blender's Principled BSDF node doesn't exactly match
KHR_materials_sheen
: glTF defines a sheen color. Blender defines a sheen factor (0-1), and defines color in a "tint" that can be lerped between white and the base color. Blender does not offer sheen roughness, but sheen appears to inherit the roughness of the material itself.This is a basic export implementation for
KHR_materials_sheen
, supporting only factors and not textures. If the approach seems reasonable I am happy to add tests, but I don't think I have bandwidth to extend this and also bake textures. The example below uses a "hot pink" base color, and full-strength white sheen. The effect appears stronger in BabylonJS than in Blender, but I don't know why and don't yet have other implementations to compare against.SheenTest.glb.zip