Digital Art Zone

 
     
How do you “lock” Random to a object in Shader Mixer?
Posted: 14 July 2012 07:07 AM   [ Ignore ]
Member
Avatar
Rank
Total Posts:  184
Joined  0

I was playing around with a cell shader when I got the bright(?)  idea to add Pen’s Fur Shader, I found that by inserting a Compare/Less Than- or Bianry Operation/Smooth Step-brick after the Random-brick I can control the density of the fur. Problem is that the fur will look denser the closer it is to the camera. The two figures below has identical shaders.
I can’t figure out how to “lock” the output of the Random-brick to the object so that the fur always has the same density.
Any suggestions welcome?
Cheers! Oom

Image Attachments
Fur1.jpg
fur2.jpg
Profile
 
 
Posted: 14 July 2012 08:02 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  15674
Joined  2003-10-09

How about using a Ray Depth (or was it an option in the Variable brick?) to get the distance to P and then using that to modulate the density?

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 14 July 2012 12:29 PM   [ Ignore ]   [ # 2 ]
Member
Avatar
Rank
Total Posts:  184
Joined  0
Richard Haseltine - 14 July 2012 08:02 AM

How about using a Ray Depth (or was it an option in the Variable brick?) to get the distance to P and then using that to modulate the density?

That sounds a lot like the Depth-brick. On the left side the shader has a Depth component added and it is a clear improvement.
If I can make a usable control out of it is another question. I had to tweak the depth value a bit to get it to work.
I’m not even sure what I’m doing, The documentation is a bit short on the details, like what kind of unit the depth is given in.

This is a good start but I still have not “locked” the random value to the object it is now only less dependent on space.

Cheers! Oom

Image Attachments
fur3.jpg
Profile
 
 
Posted: 14 July 2012 01:22 PM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  15674
Joined  2003-10-09

DS units are generally cm, though that doesn’t guarantee 3Delight units are.

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 15 July 2012 02:45 AM   [ Ignore ]   [ # 4 ]
Member
Avatar
Rank
Total Posts:  184
Joined  0

Why do Random behave that way anyhow?

Random

Brickyard : Functions > Textures

Supplies a random value of the selected type for each individual element (depending on the shader network) rendered.


“element” indicates that Random is called on by the camera, don’t it? A simple test to confirm that: Two identical spheres at different distance from the camera with Random generated surfase. The surface will not change with the perspective. One render with Shading Rate 2.0 the other with 0.1


Looks like it will be impossible to do what I want with Random as a noise source. Other possible bricks for noise like Clouds, Granite and Fractal Sum tends to make clusters, not pure white noise. Hmmm…..


Cheers! Oom

Image Attachments
r2.jpg
r3.jpg
Profile
 
 
Posted: 15 July 2012 05:25 AM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  15674
Joined  2003-10-09

I think Random gives a new value for each sample - so a more distant item will have fewer samples, in proportion to its visual size. That’s why upping the shading rate increases the density of the “fur”.

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 15 July 2012 11:58 AM   [ Ignore ]   [ # 6 ]
Member
Avatar
Rank
Total Posts:  184
Joined  0

I agree and I think I found a better way to illustrate it.
This is six renders of a plane at 60 degrees angle to the camera. I have plugged six bricks from the Texture group directly into the Surface brick. I rotated the camera between the renders Can you tell what side or corner is closest to the camera in the renders?
The bricks are Fractal Sum, Spots, Checked, Granite, Clouds and Random. 
The Cloud render might a bit hard to tell but on the Random I give you 1-in-8 to get it right.

So the Random brick is not really a “texture” as it is projected on the camera not the surface.

Time for a visit to the Mantis and make a request I think.

Cheers! Oom

Image Attachments
r4.jpg
Profile
 
 
Posted: 15 July 2012 12:45 PM   [ Ignore ]   [ # 7 ]
Member
Avatar
Rank
Total Posts:  184
Joined  0

Said and done!

Stand Up For True Randomness In Your Renders!
PLEASE SUPPORT THIS REQUEST (#47395) !
Do It Today For Better Fur In The Future!

cheese Oom

Profile
 
 
Posted: 16 July 2012 02:09 PM   [ Ignore ]   [ # 8 ]
New Member
Total Posts:  6
Joined  2008-01-18

I think what you are looking for can be accomplished with the noise brick.

Add a noise brick, set the dimensions to 3d, Noise type to float.

Connect a transform brick to the point input on the noise brick.
Set the transform to be From current and To object space.

Let me know if this accomplishes what you are looking to do.

Profile
 
 
Posted: 16 July 2012 03:07 PM   [ Ignore ]   [ # 9 ]
Member
Avatar
Rank
Total Posts:  184
Joined  0

Thank you!
First test, the angled plane. worked out pretty good.
Second one, the fur shader, not so much.
I need to find a way to scale the noise. I tried to add a Tiler to the Transform brick with limited success.
How ever, it is a big step in the right direction.

Cheers Oom

Edit Wrong order on the renders, sorry

Image Attachments
RN.jpg
RN2.jpg
RN3.jpg
Profile
 
 
Posted: 17 July 2012 02:34 PM   [ Ignore ]   [ # 10 ]
Member
Avatar
Rank
Total Posts:  184
Joined  0

I think I figured out a way to scale the Noise.
It looks like the fur gets less dens with distance again. I don’t know if that comes from the scaling method or a resolution issue.

 

Image Attachments
NRb.jpg
RNa.jpg
Profile