Announcement

Collapse
No announcement yet.

Cloth BDRF

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cloth BDRF

    I'm looking to create a BDRF for cloth, particularly lots of parallel lines. I tried using Anisotropy but couldn't find a plausible hack (maybe I just need to try harder). Has anyone come up with a clever normal hack to simulate lots of parallel cylinders? I feel like this should be a pretty common problem (and was convinced Anisotropy should have have solved it). The problem with Anisotropy and bump map approaches are that they don't take into account occlusion, e.g. at occluding angles you can't see the back side of a bump facing away (there are bump map solutions that offer this feature but not apparently Vray that I can find).

    So on axis the XY normals are 0.5. Off Axis they flip from 0 to 1. I think it might be possible to create a map but if I'm missing an obvious cheat I would welcome that.

    Click image for larger version

Name:	Cloth..jpg
Views:	2
Size:	211.3 KB
ID:	882668
    Last edited by im.thatoneguy; 19-08-2015, 04:09 PM.
    Gavin Greenwalt
    im.thatoneguy[at]gmail.com || Gavin[at]SFStudios.com
    Straightface Studios

  • #2
    I don't know what type of cloth you try to recreate but a common way to cheat certain looks is to completely dectivate reflection and cheat the diffuse color change with a falloff map. Other than that you might get away with a low tail falloff value inside the ggx brdf (below 1.0).
    Cheers,
    Oliver

    https://www.artstation.com/mokiki

    Comment


    • #3
      Found the normal equation. Will need some transformations for rotation of thread. And I need to figure out how to put it into an OSL map with Vray. (Also thanks to Emanuele Lecchi for his off-the-forums help getting the alternative displacement map approach working pretty well.) Displacement kind of sort of usually works but falls apart at sub-sub-pixel levels. This should work perfectly infinitely close and infinitely far since it's an implicit sampler.
      x: (random pixel sample)
      v: camera vector length in 'thread space'.
      For x[0,2] and v [-1,0]
      Code:
      ((v^2-1)*x)-SQRT(v^2*x*(((v^2-1)*x)+(2*SQRT(1-v^2))))+SQRT(1-v^2)
      Compared to ground truth render of macro-facets (image 2) test scene in vray:
      Click image for larger version

Name:	InfinitelyBumpSurface .jpg
Views:	1
Size:	154.7 KB
ID:	858136 Click image for larger version

Name:	Cloth..jpg
Views:	2
Size:	211.3 KB
ID:	858137

      Also left "to do" in addition to per-pixel orientation of the thread structure is to expose user-controlled thread spacing.
      Last edited by im.thatoneguy; 20-08-2015, 11:00 PM.
      Gavin Greenwalt
      im.thatoneguy[at]gmail.com || Gavin[at]SFStudios.com
      Straightface Studios

      Comment


      • #4
        Originally posted by im.thatoneguy View Post
        Found the normal equation. Will need some transformations for rotation of thread. And I need to figure out how to put it into an OSL map with Vray. (Also thanks to Emanuele Lecchi for his off-the-forums help getting the alternative displacement map approach working pretty well.) Displacement kind of sort of usually works but falls apart at sub-sub-pixel levels. This should work perfectly infinitely close and infinitely far since it's an implicit sampler.
        x: (random pixel sample)
        v: camera vector length in 'thread space'.
        For x[0,2] and v [-1,0]
        Code:
        ((v^2-1)*x)-SQRT(v^2*x*(((v^2-1)*x)+(2*SQRT(1-v^2))))+SQRT(1-v^2)
        Compared to ground truth render of macro-facets (image 2) test scene in vray:
        [ATTACH=CONFIG]25631[/ATTACH] [ATTACH=CONFIG]25632[/ATTACH]

        Also left "to do" in addition to per-pixel orientation of the thread structure is to expose user-controlled thread spacing.
        This looks quite interesting, I'm excited to see what comes out of this.
        A.

        ---------------------
        www.digitaltwins.be

        Comment


        • #5
          Progress. First implementation. Left is an array of cylinders (threads) and the right is my BDRF modifier. Much less noisy and no Moire issues!

          Click image for larger version

Name:	ImplicitThreadNormal.jpg
Views:	1
Size:	39.2 KB
ID:	858183

          And with cross-grain weave. (The whole reason I started this endeavor.)
          Click image for larger version

Name:	Cloth.jpg
Views:	1
Size:	51.8 KB
ID:	858184
          Last edited by im.thatoneguy; 26-08-2015, 05:43 PM.
          Gavin Greenwalt
          im.thatoneguy[at]gmail.com || Gavin[at]SFStudios.com
          Straightface Studios

          Comment


          • #6
            has anyone tried out the Fabric OSL shader?

            http://docs.chaosgroup.com/display/O.../Fabric+shader

            thought I doubt it's capable of anything as detailed as what you're attempting, which is basically each strand of cloth?

            Comment


            • #7
              Some of the texture stretching might be alleviated with elliptical AA available on the VrayHDRI map. (Just use that instead of bitmap, if you aren't already.) Might clean up the transition a bit as well.

              Comment


              • #8
                Originally posted by Richard7666 View Post
                has anyone tried out the Fabric OSL shader?

                http://docs.chaosgroup.com/display/O.../Fabric+shader

                thought I doubt it's capable of anything as detailed as what you're attempting, which is basically each strand of cloth?
                Looking at it, what it mostly looks to accomplish is the backscatter effect. It should work properly used in conjunction with my shader since my shader is really just a normal modulating map. You would want to set anisotropy to zero though in the OSL shader since it 'naturally' arises from my normal distribution.
                Gavin Greenwalt
                im.thatoneguy[at]gmail.com || Gavin[at]SFStudios.com
                Straightface Studios

                Comment


                • #9
                  The osl shader is great. Sadly you can invert the sheen curve to simulate silk etc. But it is still quite handy. Thanks for sharing!
                  Cheers,
                  Oliver

                  https://www.artstation.com/mokiki

                  Comment

                  Working...
                  X