DS4.5 Shader Mixer: Problem using u,v variables (to create cable/rope shader) [solved]

3dcheapskate3dcheapskate Posts: 2,719

I needed some steel cable for a project I'm working on, and came up with a simple Poser 6 shader - here's the end result. The problem comes when I try to do the same in DAZ Studio...

Cable2.jpg
331 x 227 - 17K
Post edited by 3dcheapskate on

Comments

  • 3dcheapskate3dcheapskate Posts: 2,719
    edited January 2013

    To start off, here's the (working) Poser 6 shader, a simple implementation of a simple equation...

    f=abs(sin(10u+10v))

    The inset image shows the shader applied to a simple UV-mapped plane. By adjusting the u and v multipliers I can alter the pitch and angle of the lines. All's fine with this - it works as planned.

    P6_nw.jpg
    995 x 681 - 177K
    Post edited by 3dcheapskate on
  • 3dcheapskate3dcheapskate Posts: 2,719
    edited January 2013

    The problem occured when I tried to create the same thing in Shader Mixer (both in DS3A and DS4.5) - it's just not working as it should. (Attached image shows DS4.5 network plus an inset image of the shader applied to the same UV-mappped plane)

    The lines on the render should be at an angle like in the Poser render, and by adjusting the multipliers for u and v I should be able to alter the pitch and angle. But no matter what values I set the lines are always horizontal when I render (although the thumbnail preview renders of a sphere all look correct!)

    Does anybody have any idea what's going on here and why it doesn't work?

    DS4_nw.jpg
    976 x 834 - 139K
    Post edited by 3dcheapskate on
  • Richard HaseltineRichard Haseltine Posts: 100,765
    edited December 1969

    I used a Tiler brick, so i could control the number of strands (horizontal tiles) and twists (vertical tiles). I then multiplied by 360, so that 0-1 gave a full repeat, and converted to radians before feeding in to the Sine brick - and I think that the fact that DS' Since uses radians may be a major part of your issue.

    RopePattern.jpg
    1000 x 1000 - 51K
    RpePatternGenerator.JPG
    957 x 958 - 85K
  • BejaymacBejaymac Posts: 1,886
    edited January 2013

    Change the fixed variable bricks to s & t instead of u & v

    EDIT

    or you can use Richard's way with the tiler brick as it's the same thing.

    Post edited by Bejaymac on
  • mjc1016mjc1016 Posts: 15,001
    edited January 2013

    I used Richard's recipe, but moved the output of the 'twist' to Diffuse Strength. I then added an imagemap brick to Diffuse color. I also added a displacement root and DS Standard Displacemet bricks. I copied the 'twist' out put to the input of the displacement...and daaaaaaaaaam...doesn't it look purdy...


    Hmmm....I wonder if feeding this and an inverse (for getting twisting in the other direction) into the layers of your layered shader would give cross-hatching?

    cable.jpg
    800 x 1000 - 58K
    Post edited by mjc1016 on
  • 3dcheapskate3dcheapskate Posts: 2,719
    edited January 2013

    Richard/Bejaymac - Thanks, both suggestions work fine. But I don't understand why changing u, v to s, t works? Surely if you're not using tiling (or you've got horizontal/vertical tiles both set to 1) then s=u and t=v? I must be missing something here... if I had a penny for every time I said that... ;o)

    mjc1016 - now that I know what I was doing wrong in DS the fun can start! Using bump/displacement and texture images sounds good (I think for the Poser render in the first post I must have had the equation plugged into the bump channel judging by the specular highlights). Several other ideas spring to mind - e.g. another sine function to add smaller strands to the strands we already have, etc.
    Regarding cross-hatching (I guess you're thinking woven rope, like if you Google images for "12-Strand Rope"?) I think the trickiest bit would be the mask for the layered shader - but not that tricky...

    One last observation for now - this type of shader seems prone to moiré effects, especially if you apply it to e.g. a cable receding into the distance.

    Post edited by 3dcheapskate on
  • mjc1016mjc1016 Posts: 15,001
    edited December 1969

    One last observation for now - this type of shader seems prone to moiré effects, especially if you apply it to e.g. a cable receding into the distance.

    Did you try it on the Diffuse Strength channel? It seemed less prone to them when I was testing...that was one of the reasons I tried it in the first place. Because I noticed that higher tiling values/finer strands, the moiré seemed more pronounced when it was plugged into Diffuse Color.

    This one, like the layered one has a lot of potential uses (I've barely had a chance to play with the layered on, but wow...it will come in handy).

  • 3dcheapskate3dcheapskate Posts: 2,719
    edited December 1969

    No, didn't try the diffuse strength - but I will! My main focus at present is finalizing the model this is for ( these railings here ), and trying to get the morphs right.

  • 3dcheapskate3dcheapskate Posts: 2,719
    edited February 2013

    I've got my basic DAZ Studio cable shader now working as I wanted. I'm using the original idea with Bejaymac's s/t instead of u/v (purely to keep it as similar as possible to the working Poser shader I already had).

    I've added 'Mix' bricks using 'Layer Multiply' to combine the formula result with diffuse/specular-colour/strength and bump/displacement, and put the alpha values for these bricks onto the Surfaces tab (see attached image - Procedural > Factor Into), enabling the end user more flexibility without having to open shader mixer. I've also included bricks in the shader so that all the standard settings still appear on the surfaces tab too, so you'll be able to combine mapped diffuse/specular texture images with it.

    Here's an example of what I've managed to get in DS3 (the image is a provisional promo for the next freebie)
    Hoping to release this in the next few days as part of the next freebie, the railings I mentioned before.

    DS3_cable.jpg
    998 x 642 - 153K
    Post edited by 3dcheapskate on
  • PendraiaPendraia Posts: 3,598
    edited December 1969

    Wow...interesting stuff here! Thanks for the info...

    Does anyone know if these recipes are being added to the recipe list?

    I don't have access to update it anymore since we went to the new forums but we hate for these to not be on the list. They are such useful networks and info.

Sign In or Register to comment.