Author Topic: MDL Two Tone Fabric Help  (Read 227 times)

I'm working on making a two toned MDL material, following the MDL handbook:

But I can't figure out how to bend the normal vector. I get that to achieve this result you have to blend BSDF layers after bending them in opposite directions, but I haven't been able to successfully bend them in the way they show here. I've attached a screenshot of my current node setup. Any advice would be much appreciated!

Hi skenemilne,

You were very close to translate the mdlhandbook example to MDL graph.

You need to first multiply the tangent_u with the bend_factor before adding it to the geometrical normal.

For example this :
float3 left_normal = math::normalize(
   + state::texture_tangent_u(0)
   * -bend_factor);
float3 right_normal = math::normalize(
   + state::texture_tangent_u(0)
   * bend_factor);

becomes this in MDL Graph

Moreover, if you want to apply a modify normal to a bsdf you need to use of the layering functions in MDL.
In your example you connected the output of the normalize operation to the tangent_u parameter of your glossy bsdf.

Instead you need to create a df::weighted_layer node to match the handbook example, and connect the modified normal to the normal parameter on that node.

Here is the final MDL graph matching the mdlhandbook example.

Hi Andrea,

Thank you so much! This was super helpful

Just wanted to follow up and see if this set up is correct for combining the warp and weft layers?