Maya Shader Networks request

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  05 May 2013
Maya Shader Networks request

Hey all, I'm trying to figure out how to create a special shader in Maya.

The Idea is pretty simple, I want to use a distance based shader in order to be able to separate two areas. Then, I apply an ambient occlusion shader in one area and another one in the other area.

Now, we can easily do this with the "lightInfo" node connected to a condition node. We've got the 'target' mesh where we apply the shader and, we've got another one used to determinate the area that we want to isolate. This mesh is connected to the lightInfo node, and his coordinates are used to the computation.

The problem is the lightInfo node use only the center point of the object instead of the shape itself to pick information.

Is it a way to use the shape of an object to achieve the same effect ?
+ is it possible to create a kind of falloff between the two areas ?
  05 May 2013
I have seen such things with the use of fluid shapes, where you can just query the luminance to drive the same kind of thing.

but in any case, why not a projection with a radial ramp from top?
but yes maybe because it's not in x,y,z space.

then look up the google for fluid node/ maya network/ 3d gradient or something like that.

  05 May 2013
Well, thanks Sorath for your answer.

As you mentioned, maybe isn't a good idea to think with x,y,z space because
I need something that works without location defined.

Also, the idea behind that stuff is to mimic an aera illuminated by some lights (as light is defined by a custom shape) in order to use a shader within this specific area.

I have two constraints: I can't use any UVs, and I can't use any light. This would mean that the system is interactive, at least at the render time.

I don't think a fluid based shapes solution is reliable. I did some search on google, and I didn't find any things useful. Thanks to an answer on Polycount, I've got maybe an idea ...

So the idea is to use the samplerInfo to obtain a sample point and closestPointOnMesh to obtain another one. Then, I need to find a way to compute the vector between the two points (samplerInfo point >>> closestPointOnMesh) and compute also the angle between the two vectors.

If this angle is greater than 90 degree, the point is inside the mesh. So it give me
my condition.

Here a schema

I'm not good at all when it comes to do computation, and nodes connection related to mathematical stuff .

I need your help !
  05 May 2013
Unfortunately my company locked cgtalk for the artists, i'm on my phone now. I have a workingcopy of the file you need here, got it working with a fluid 3d texture, please send me your mailadress by pm and i send u the file, maybe you can upload it here afterwards. Cheers bastian
  05 May 2013
nevermind, they just unlocked me

hope that is roughly what you've been looking for, I hooked the blend colors into the diffuse of the lamberts, of course then the occ is less visible.
But in basics, you can just hook it into a surface shader to use it as b/w mask in post.
Or directly hook shading/ textures or whatever into the blend color node.

ps, this is working in 3d space so x,y,z is supported!
Attached Images
File Type: jpg occFallofffLow.jpg (94.3 KB, 12 views)
Attached Files
File Type: zip (10.6 KB, 3 views)
  05 May 2013
Thank you very much Sorath for taking the time to make me a file !
Your shader works well, but unfortunately it is not exactly the effect
I want to achieve. With your shader, I've got a falloff, and control over it,
that's great, but I can't use any shapes as actual volume, only the box
containing the volume shader. So, maybe it could help if I didn't find the solution,
but I hope we will find another one !

Here is another schema, maybe it could help.

Cheers Mathias

  05 May 2013
Hi Bastian!

Mathias, in the last example you could use a Mip_Rayswitch shader with a seperate shader assigned to the Refraction Rays,

But i suspect what you want is a Boolean shader, where you get a seperate shader where object interesect.

Boolean Shaders are found here:
: my website :
  05 May 2013
hey Mason, hope everything is well in Vienna!

sorry Mathias, didn't read proberly.
I was also thinking of the shaderbool, but the rayswitch solution suggested by Mason sounds pretty awesome

edit: just saw neighter of those will give you a soft dropoff, idk. about the shaderbool maybe. So I tried with assigning the fluid to a custom polygon shape, unfortunately that emits fluids only outside on the faces, but the object itself is a hole.
Other then starting programming with c++ I can't think of anything.

In houdini you could just nodeconnect it, with ray depth/ray hit calc.
I'm not a shaderprogrammer, so I can't help you from here :/

Last edited by Sorath : 05 May 2013 at 09:53 AM.
  05 May 2013
Hi Mason and Bastian, thanks for your answers.

I tried both solutions, but unfortunately I can't achieve good results.
The first idea with mip shader was smart, but if I plug for example
an AO shader into the refraction slot of my "custom" mesh, then
the effect occurs only inside the mesh instead of the other meshes.

Also, I've got the "p" shader library and I know the boolean one, but you've
a big limitation: you just can use two meshes as input, so it doesn't work
in this case.

Here is a link that give me the second idea with the computation of angle, maybe it could help;
I really think it is possible to use the same logical approach by using sampled points instead of particles.

  05 May 2013
Combine the geometry, but do not delete the Combine node. Keep the history, leaving you control.

Also, for arguments sake, if you cannot get the effect inside the render engine, resort to old school hacks and do it in compositing. ie: render both versions, and a third render with the mask of the intersection.
: my website :

Last edited by MasonDoran : 05 May 2013 at 04:14 PM.
  05 May 2013
If you're unable to get the soft dropoff with just the bool shader (which makes sense, as boolean variables only have two values), then you could use ambient occlusion to create an illusion of a falloff on the edge. The occlusion itself would then be used as a mask for blending from one shader into another. With the use of condition/multiply divide/layered/remap nodes, I don't think that should be too hard. I don't know what the bool shader is/how it works, but if it is able to define regions inside or outside of a mesh, I would think this should work.

If you're not sure what I'm saying, let me know. I might be able to help more if I knew more about the bool shader.
  05 May 2013
I almost got it working here with a tripple shading switch and a ambient occlusion in an mib_continue inside a blend colors to have a soft dropoff driven by another ambient occlusion.
but without programming and maya which is the worst tool for shading this is just as always stuck at 90%.
Cause the thing creates occlusion behind the last wall aswell, so I need to put a mib_continue into the second ray hit.
Also nice to look into is the mib_glossy_refraction which gives you volume depht calculation.
maybe you can pipe something with these nodes and the bool.
Attached Images
File Type: jpg occ dropoff2.jpg (90.4 KB, 10 views)
  05 May 2013
Thanks a lot for your answers,

Sorath, I have to try your shader network, it sounds good. I will also try to follow
your idea with the mib_glossy_refraction.

I will post as soon as possible news and tests.

PS: Sorath, I tried to reproduce your shader network, but I don't have the same result as your.
Could you please send me the scene ?

Last edited by MrFrags : 05 May 2013 at 01:04 AM.
  05 May 2013
Hey Mathias,

try this, maybe you get it working.

Attached Files
File Type: zip (20.6 KB, 2 views)
  05 May 2013
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 08:17 AM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.