View Full Version : sampling hypershades 3d fractal noise in world space to use it on particles opacityPP

04 April 2010, 03:23 AM
Hey guys,

I have a particle grid in my scene.
And I have 3d noise texture say...... a 3D fractal or brownian in hypershade.
Is there any way to control the opacity of my particles in the particle grid based on the 3d texture?

In other words I need to sample the 3d fractal noise provided in hypershade with respect to the world space in my scene and use it to govern the opacityPP or any other attribute of my particle shape.

Any timely help will be greatly appreciated!!! Thanks in advance for helping me out.

04 April 2010, 03:50 AM
More details would be useful, do you want to sample in the viewport (means cache out the 3d noise value to the opacityPP) or at the render time (using the particleSamplerInfo) ?

Sample a 3d Texture node in the viewport is not really common in Maya. In the Maya API, the function sampleShadingNetwork (MRenderUtil) is quite handy for instance for a noise deformer as it will sample any textures in the viewport (2d/3d). But you will need to get it as a node in order to connect it to your particles.

So if you want to cache out the 3d value to the OpacityPP, I would suggest you to use the dnoise function which is based on the Perlin Noise.

something like that :

float $freq = .2;
float $amp = 1.0;

vector $pos = particleShape1.position;
vector $dnoise = dnoise($pos*$freq)*$amp;
particleShape1.rgbPP = $dnoise;

04 April 2010, 05:16 PM
Hey Akril !
Thanks a lot for replying. Actually I want to sample in the viewport and have already used the dnoise function to control it. But I thought being able to sample a 3d texture would give me so much more flexibility and intuitive control as well as more options.

Any wayz thanks for mentioning the Maya function and the api class. My knowledge of maya api is limited but I will see what I can do with it. Getting it as a node and plugging it into particle values is what you suggest........hmm.... lets see what I can do with it.

Thanks a lot for the info!!! :)

CGTalk Moderation
04 April 2010, 05:16 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.