Shade surface based off object normal comparison

Paul Brunson

New member
Does anyone know if the following is possible with nodes?

I have two similar objects loaded on top of each other. I'd like to create a node network that shades the one object's surface based off the distance to the other objects surface. The best way to describe it would be it would color the places on the one object that are different from the other object. And that is mainly the goal I'm after is to create a "shader" that looks at the two objects and colors one of the objects where its differs.

I've first tried spot info and item info nodes. But there is no way to get the spot info of another object. Now I'm leaning toward I may need to be looking at rays and somehow getting the rays info when it passes through one object and compare it to when it hits the other.

Hope that makes sense. Any nodal wizards out there who can point me in the right direction? Much appreciated.


Vacant, pretty vacant
You can use the raycast node for this. I can't remember the exact details of how I did it, but it does work. Off to bed now, and away daytime tomorrow, but I'll try and find the test I did when I get back in the evening.


TrueArt Support
When you have one object unseen by camera, and other one unseen by rays. Then Spot Info > World Position plug to Ray Trace > Cast, with Direction from Spot > Normal (or slightly disturbed/randomized), Length will be distance from hit geometry to other object.


Motion Design Lead
Yep, what Sensei said. Here's a demo of both depth (from camera) and surface (via inverted normal direction) distance shaders. If the invisible object is larger than the rendered object, you just need to remove the additional multiplication node (which inverts the surface normal to point inwards). If the invisible object is both larger AND smaller (in relation to surface direction) than the rendered object, you'll need to do a bit more work to combine the distance output of multiple raytracing nodes (one inward, one outward), but it's still quite doable. :)

View attachment
Last edited:
Top Bottom