View Full Version : mental ray distance between support problem

04 April 2004, 07:26 AM
guys help out, i have a network that controls a ramp V value based on distance from a sampler info point on surface to a locator. i am using the distance between node to calc the distance, problem is mental ray SEEMS not to support this node in some way. i am not getting any gradiation when i use that node in mr, but it works fine in maya.
any ideas how i can bypass this? find a replacement for the distance calculation for each point on the surface of the shader on the object to a locator in the scene.

i attached the network graph (btw thanks mdme_sadie)

the sampler info global position point and locator world pos are connected to the distance between, that is connected to a multiply by x to control scale and clamped to 0-1 to control V on the ramp.
right now the ramp colors the shader just to test it, later on it will be used to control reflection decay,blurriness and so on..

if you can tell me of a workaround to make this work with mr i'd be most grateful.
thank you

04 April 2004, 05:02 PM
i got same problem with distanceBetween Node ,I think it shoud
be instead by use vectorProduct node and multiply node to calculate the distance between two vector ,but, i almost forget
all of maths i have learned,so......someone can help ?

04 April 2004, 01:02 AM
hey guys, well you can do it the longer way, distance between two points is just :

the square root of ( x1*x2 + y1*y2 + z1*z2 )

so i'll see if i can quickly put the network together that will do this for you in maya ple, and then you should be able to happily go on your way.

04 April 2004, 09:54 AM
thx Mdme,but i have some confusion:

x1*x2 + y1*y2 + z1*z2 is a dotProduct to get the cosine of the
angle between 2 vector and in maya distanceBetween Node is
but i don't kown which node can be used for "the square root"...if i won't use expression.....[IMG]
thx for respond :-)

04 April 2004, 07:14 PM
but i've tried using an expression on the multiply node to do the calculation from the sampler info and the locator. it seems it only does it once or just for the entire object. not per pixel.. i am getting no gradiation just like using the distance between node in mr.
hmm maybe there is something there..if both result to the same thing, could it be an unnsuported hmm math convertsion of sqrt() from maya to mr?

still no go.. anyone else have any ideas? i'm hanging on straws here.. any mr shader gurus, i'd love a working distance between node..plz ;)

04 April 2004, 03:57 AM
The distance between node doesn't appear to be directly supported by mental ray. It's not even read in durring mental ray's initial shader decleration durring rendering, so it doesn't appear to be supported.

CGTalk Moderation
01 January 2006, 11:00 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.