Digital Art Zone

 
     
DS4.5 Shader Mixer: Problem using u,v variables (to create cable/rope shader) [solved]
Posted: 27 January 2013 10:44 AM   [ Ignore ]
Active Member
Avatar
RankRank
Total Posts:  432
Joined  2007-09-01

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…

Image Attachments
Cable2.jpg
 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 27 January 2013 10:44 AM   [ Ignore ]   [ # 1 ]
Active Member
Avatar
RankRank
Total Posts:  432
Joined  2007-09-01

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.

Image Attachments
P6_nw.jpg
 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 27 January 2013 10:44 AM   [ Ignore ]   [ # 2 ]
Active Member
Avatar
RankRank
Total Posts:  432
Joined  2007-09-01

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?

Image Attachments
DS4_nw.jpg
 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 27 January 2013 01:51 PM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  13441
Joined  2003-10-09

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.

Image Attachments
RpePatternGenerator.JPGRopePattern.jpg
 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 27 January 2013 01:59 PM   [ Ignore ]   [ # 4 ]
Active Member
Avatar
RankRank
Total Posts:  886
Joined  2007-01-04

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.

 Signature 

**shuffles of with a new headache** tongue wink

Profile
 
 
Posted: 27 January 2013 03:17 PM   [ Ignore ]   [ # 5 ]
Addict
Avatar
RankRankRankRank
Total Posts:  4545
Joined  2007-09-13

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?

Image Attachments
cable.jpg
 Signature 

1432 old posts

My ShareCG gallery.

Just because something costs a lot, doesn’t mean it’s the best…

It just means it’s expensive.

Profile
 
 
Posted: 27 January 2013 09:58 PM   [ Ignore ]   [ # 6 ]
Active Member
Avatar
RankRank
Total Posts:  432
Joined  2007-09-01

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.

 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 27 January 2013 10:13 PM   [ Ignore ]   [ # 7 ]
Addict
Avatar
RankRankRankRank
Total Posts:  4545
Joined  2007-09-13
3dcheapskate - 27 January 2013 09:58 PM

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).

 Signature 

1432 old posts

My ShareCG gallery.

Just because something costs a lot, doesn’t mean it’s the best…

It just means it’s expensive.

Profile
 
 
Posted: 28 January 2013 08:12 AM   [ Ignore ]   [ # 8 ]
Active Member
Avatar
RankRank
Total Posts:  432
Joined  2007-09-01

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.

 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 02 February 2013 01:42 AM   [ Ignore ]   [ # 9 ]
Active Member
Avatar
RankRank
Total Posts:  432
Joined  2007-09-01

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.

Image Attachments
DS3_cable.jpg
 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 01 March 2013 03:01 PM   [ Ignore ]   [ # 10 ]
Power Member
Avatar
RankRankRank
Total Posts:  2200
Joined  2005-09-05

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.

 Signature 

Shadermixer tutorials and recipes
My ShareCG Gallery
Shadermixer Documents

Profile