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 ?
Replies
your trying to make an arbitrary 3d polygonal volume and apply a shader inside the volume?
does the volume move? ie 'interactive'
does the camera move?
it can probably be done with nodes tho. you need a way to test if the point being sampled is inside the world space volume, or something close to that. then you can use a simple condition like you have done already.
the nodes i was looking at are
samplerInfo
http://download.autodesk.com/global/docs/maya2014/en_us/Nodes/samplerInfo.html
closestPointOnMesh
http://download.autodesk.com/global/docs/maya2014/en_us/Nodes/closestPointOnMesh.html
samplerInfo will give you the world space point on the surface being sampled. and closestPointOnMesh will let you feed in any piece of geometry and a point and give you back the closest point on the surface of the geo. so you might be able to do a test between the sample point and the point on the mesh and determine if the point is inside/outside and throw your conditional based on that. you can also get the normal of the point on the surface. and you have 2 points so there is a few ways you could do the test. hooking up the right nodes is probably harder then the test itself.
thats where i would look. if i have some time i will look into it more.
I took a look at the two nodes, I knew the first one, but the second one seems interesting. It still a little complex to me, but I've got an idea. However, I need some help !
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