Results 1 to 2 of 2

Thread: change object surface properties by proximity

  1. #1
    Registered User
    Join Date
    Jul 2017
    New Zealand

    change object surface properties by proximity

    Is it possible to change object surface properties by its proximity to another object. I'm sure it is but can't find any node to give me feedback on the proximity of one mesh to another. As a simple example I would like part of a sphere to turn green as it approaches a cube.
    Any suggestions ?

    update the moment I ask a question a solution comes to mind...
    use two item info nodes plugged into make colour node and moving the objects will change colour of object.

    Any other ideas.
    Last edited by IanRT; 07-01-2019 at 07:12 PM.

  2. #2
    Registered User
    Join Date
    Jan 2005
    Colorado Springs
    It depends on whether you want to change the Surface attributes of the entire Object, or only change the Surface close to the converging Object (i.e. a "spot" on the Surface rather than the whole Surface).

    Using the WorldPosition output of the two ItemInfo nodes you describe with a Math=>Vector=>Distance node will get the distance between the pivot points of the two Objects, which can then be used with a Gradient node to set the entire Surface color. If you want to change one of the Scalar components of the Surface (e.g. Luminosity), you can use the Alpha component of the Gradient's keys for Scalar output. It's too bad (IMO) that LW doesn't provide a simple ScalarGradient without mucking with the Alpha "percentage". There's a Layer=>Scalar node, but it doesn't allow a nodal Input.

    If you want to just change a "spot" on the surface close to the converging Object, the RayCastClosest node can be used to cast a "ray" from a World position to intersect another geometry. You can use a Vector Subtract node to get the direction from the WorldPosition of a "spot" on the Surface to the converging Object, plug that into the Direction input of the RayCastClosest node, and then use the Length output (length of the intersection ray) as input to the Color / Alpha Gradient.

    Attached is a sample scene which changes the color of a cube from red to green based upon the approach of a SmallBlueBall.

    Click image for larger version. 

Name:	Final_Render_015.jpg 
Views:	10 
Size:	95.7 KB 
ID:	145360 Click image for larger version. 

Name:	Final_Render_030.jpg 
Views:	11 
Size:	96.9 KB 
ID:	145361

    Click image for larger version. 

Name:	Final_Render_060.jpg 
Views:	10 
Size:	96.5 KB 
ID:	145362 Click image for larger version. 

Name:	Final_Render_090.jpg 
Views:	11 
Size:	95.5 KB 
ID:	145363

    MOV File: ColorBasedOnProximity.MOV

    The node setup is:

    Click image for larger version. 

Name:	01_ColorByProximity_Setup.jpg 
Views:	11 
Size:	1.26 MB 
ID:	145365

    Have fun!
    Attached Files Attached Files


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts