-
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
KHR_materials_sheen #1688
KHR_materials_sheen #1688
Conversation
extensions/2.0/Khronos/KHR_materials_sheen/schema/glTF.KHR_materials_sheen.schema.json
Outdated
Show resolved
Hide resolved
Live example in the playground: https://www.babylonjs-playground.com/frame.html#BNIZX6#4 The model is available here: https://github.com/BabylonJS/MeshesLibrary/tree/master/Sheen so you can see the setup. |
Looks great. One comment, this uses the word "Factor" in a way that is not consistent with glTF's many other factors, all of which multiply with their respective textures. Textures and factors always come in pairs multiplied together. So, I would suggest a rename:
Alternately the texture could be split up into Thoughts? |
I am wondering why you decided to couple sheen and microfacet roughness. In my experience, sharing parameters is difficult if their visual effect is different, it breaks layering/parameter blending (see Sec. 5.7 in Disney paper). Assuming there are two materials: material A has sheenIntensity=1 and roughness=0.2, material B has sheenIntensity=0 and roughness=0.5. If an artist now creates a mask that layers material A on top of material B, for example to have a 30% semi-transparent fabric on top of a metal, the roughness behaves weird. The blended material has sheen=0.31 + 0.70=0.3 (ok) and roughness=0.30.2 + 0.70.5=0.41, shared by the sheen BRDF and the microfacet BRDF (not ok). This doesn't behave similar to BRDF blending (which is the ground-truth), in which case you would end up with 30% sheen with roughness 0.2 and 70% microfacet with roughness 0.5.
This is different from Imageworks "Production Friendly Microfacet Sheen BRDF". Did you deviate from their solution to make it simpler to compute? What I like a lot about the Imageworks sheen is the fact that it fits nicely into the microfacet framework. They also provide a (not so cheap to evaluate) shadowing term that is properly normalized. In the end, this gives an energy conserving and reciprocal BRDF (except their terminator softening), whereas the sheen BRDF proposed here is not energy conserving and, therefore, not well-suited for GI rendering.
I couldn't find a description of Maybe we could tweak the equations in this extension a bit to make it more raytracing-friendly (like the microfacet-based Imageworks model) and define it as the reference. This would allow rasterizers to do whatever approximation is best for the intended target platform and performance constraints. We plan to soon release an adaptation of the Imageworks model as part of the Enterprise PBR Material. |
You are totally right about layering, we were only thinking about reducing the number of parameters in our implementation to help with deferred renderers for instance.
Yes, totally, this is just the way we are using it in our code but could benefit from more clarity. I ll update it on Monday.
Yes, the idea was too make it faster too compute and easier too integrate in real time rendering engines as detailed in the Filament documentation.
This is basically the default F0 being 4% in metallic workflow but customizable through the proposed specular extension.
Yes, this is currently the main issue (aside of layering as you described above) and usually forces us to darken a lot the base color.
Would be nice if the chosen model was also really efficient for real time engines. Here, one of the nice trick by not relying on the fresnel for instance is the ability to store precomputed values in the BRDF lookup texture for the IBL part. |
See #1677 (comment) We should do the same to this extension if we decide that's the right solution. |
There is now a first draft (work in progress) for integrating Imagework's sheen into Enterprise PBR version 2021x. It adds two parameters in addition to Optimizations for real-time rendering are still to be done. Using the Ashikhmin visibility term might be a good approximation, the error needs to be checked. Layering is an open issue. |
About the factor renaming, what should be the final naming so that I could update the PR ? I have seen asked to rename : sheenFactor -> sheenIntensityFactor is that all the changes we want ? About the texture, I would like to keep it only one if possible merging color and intensity, do you think it makes sense ? At least this part would not change even if we adapt the formula. Also we should choose if the roughness needs to be a parameter as well or if it makes sense to reuse the material one to limit the number of params and be more Deferred rendering friendly ? |
My opinion (assuming we use one texture):
No need to keep putting sheen in the name since it's already under the sheen extension. "materials": [
{
"extensions": {
"KHR_materials_sheen": {
"intensityFactor": 0.9,
"colorFactor": [
0.0235294117647059,
0.0352941176470588,
0.2745098039215686
],
"colorIntensityTexture": {
"index": 0
}
}
}
}
] |
+1 for @bghgary's suggestion. |
This will prevent the use of JPG textures with this extension. Is that OK? I would like to think that Basis Universal will just become best practice for all of this, but I don't have a good sense for the pros/cons of packing these textures together with Basis. |
Ok so I ll first update to Gary's suggestion and depending on the outcome for the rest I ll go ahead and fix accordingly. I guess the texture packing discussion is probably bigger than only this extension :-) I will try to have it updated for Monday. |
Yes, good point. Happy to move that discussion elsewhere until we can come up with some best practice. |
All factors have been renamed according to @bghgary 's proposal and Babylon.js has been updated to reflect the changes as well as the babylon sample model. We can now focus on the need for roughness and equations to use :-) |
@proog128, I ll try soon the albedo scaling technique as despite the extra lookup it looks quite nice. How is the rendering quality of your analytical approach if any (thinking of smaller devices fallbacks) ? |
Also It wonder what do you think about not splitting the roughness parameter and reusing the base layer one ? |
@proog128 An analytical approximation is useful not necessarily for performance but to avoid using more samplers, which are limited in numbers on mobile I agree there definitely should be a separate sheen roughness parameter. |
Quick and dirty analytical approximation:
The error is around 3% (RMSE), which is quite high, but I didn't spend a lot of time on it. |
@proog128 Thanks, I was going to try (again) to come up with one. I'm also tempted to just put that lookup table in an extra channel of the DFG LUT (we already use the blue channel for the cloth/sheen BRDF). It would be higher resolution than needed but at least it would save a sampler. |
Before talking about performances, I'm concerned by how brighter V-Cavities is, even compared to the original model. The highlights are noticeably stronger, even around 0.4 roughness. Ashikmin masking feels much closer to the original paper. If we want to ditch that look and push for the V-Cavities route, I believe we should get an artistic feedback as well, Estevez-Kulla + Smith was favored for its smooth look. V-Cavities looks definitively sharper. As far as performances are concerned, looking at the formula, it is indeed costlier than Ashikmin masking but nowhere to a point that it'd make the proposal a no-go in my opinion. It is still cheap to evaluate. |
The benefit of Ashikmin and the main reason I picked it in Filament is that
it is visually fairly close to the term used by Estevez-Kulla. It is darker
at high roughness but it overall behaves fairly well (see the shadertoy
posted earlier which lets you switch between both terms easily).
|
We had a similar conclusion in Babylon than @romainguy exposed here and followed this path to already bring a bit of consistency in the ecosystem. |
OK, understood. I guess we can add the squared sheen roughness to the normative section without describing the "perfect" implementation in the non-normative section for now. As in the base material, implementations may choose any approximation they want, and the exact masking-shadowing term used in an implementation is certainly something that lends itself for approximations (so Ashikhmin, Smith, V-Cavities are all fine, but have different trade-offs regarding consistency, performance, physical accuracy, ...). I am somewhat optimistic that we can improve the fit given in the Estevez-Kulla paper so that it works well for low roughness values. I cannot tell at the moment when we will revisit this topic, but at some point it is probably going to happen. Once we have a better solution we can adapt the non-normative section. |
Would be great if we could add a sentence to the introduction that mentions the squared roughness, like in the attached patch: |
You are right, done and thanks a lot |
Earlier in this thread, we wrote:
We then decided to punt on the question, which affects other textures too, as a general question for
If we do someday produce a generic swizzle extension, it's presumably going to allow something like:
So, by including only a single texture slot for color and roughness, we permanently require them to share a single source texture, and a swizzle extension can't lift that requirement. As we did with clearcoat, my preference might be to allow but not require the packing arrangement. This would mean introducing another property:
This retains the capability to use only a single sampler for both textures, but also:
More generally — I believe our upcoming PBR Next extensions should avoid combining separate pieces of information into a single |
Another advantage of splitting In that scenario you'd probably want sheenColorTexture and baseColorTexture to be the same texture (with different factors?) but that's not possible if the |
If everybody agrees, I am happy to make the change but still afraid by the number of samplers we can already not support on some devices. It is probably edge case but I wonder how we could enforce and if we should enforce a max number of samplers ? |
I agree with this assessment, in my view it it also an engine implementation thing how the different texture channels may be packed into fewer samplers. |
I am against this type of enforcement - it sort of implies that we are tied to one type of technology and I would rather that we are agnostic in this area. |
Not an edge case — using a reasonable number of samplers is certainly important! — but I'm worried about downstream effects of enforcing a maximum. A safer option would be similar to the skin weights language, saying that clients are required to support at least __ samplers per material, so that exporters are more conscious of the constraints. But we can't do that in this extension; it may have to be a future 2.x or 3.0 thing... In the meantime I do think flexible packing will likely serve us better than strict pairings. |
SheenCloth model is now updated: KhronosGroup/glTF-Sample-Models#266 |
The idea is to start the discussion about the sheen extension, @bghgary and I will keep the thread updated with our implementation progress.