tinyusdz icon indicating copy to clipboard operation
tinyusdz copied to clipboard

[How to] Two-sided(double-sided) material binding

Open syoyo opened this issue 1 year ago • 1 comments

What is two-sided material?

https://docs.chaos.com/display/VMAX/VRay2SidedMtl

Assign different material to front face and back face, respectively.

doubleSided attribute in USD(control the face culling)

https://openusd.org/dev/api/class_usd_geom_gprim.html#a63367a54086e014dda98cc79ad5f8602

doubleSided attribute indicates whether to use front-side only or use both sides of mesh surface. Thus doubleSided != two-sided(double-sided) material in USD!

So how to do two-sided material mapping in USD?

Bind material

Two-sided material mapping could be achieved by using purpose in material binding. Something like...

rel material:binding:preview = </frontMat>
rel material:binding:back:preview = </backMat>

We need a user's instruction which purpose name is treated as back-face material.

per-face material by GeomSubset

Possible solution would be describing multiple material bindings as the above in GeomSubset

uniform token subsetFamily:materialBind:familyType = "partition"

def GeomSubset "dbl_mat"
{
      uniform token elementType = "face"
      uniform token familyName = "materialBind"
      int[] indices = [0, 1, 5, ...]
      rel material:binding:preview = </frontMat>
      rel material:binding:back:preview = </backMat>
}

TODO

  • [ ] Consider it is possible to utilize Collection API for two-sided material assignment.
  • [] Move to wiki

syoyo avatar Jan 26 '24 14:01 syoyo