Announcement

Collapse
No announcement yet.

Post Translate: stick lights to geo?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Post Translate: stick lights to geo?

    Hello,

    I'm working on scenes with large amounts of assets to which I'd like to add lights as a post translate process. I have a simple setup that works with translation offsets, but once asset rotation comes into play I don't know how to make the distributed lights stick. I've attached a test scene which illustrates the problem.

    Here's a simplified version of the script:
    Code:
    import vray.utils as vr
    
    lightGeos = vr.findByType('Node')
    for i, lightGeo in enumerate(lightGeos):
    	light = vr.create('LightSphere', 'light'+lightGeo.name()+str(i))
    	
    	transform = lightGeo.get('transform')
    	transform.offs+=vr.Vector([-6, 0, 0])
    
    	light.set('transform', transform)
    	light.set('intensity', 100)
    Any help with setting the rotation to make the lights stick to the end of the cylinders, would be greatly appreciated.

    Cheers!
    /Dan

  • #2
    ... And here is the file: vray_postTranslateLightTransform.ma.zip

    Comment


    • #3
      You cannot just modify the offset, you'll have to use transform multiplications to concatenate transformations correct.

      Check the script below and let me know if it does what you want to achieve?
      Code:
      import vray.utils as vr
      
      lightGeos = vr.findByType('Node')
      for i, lightGeo in enumerate(lightGeos):
      	light = vr.create('LightSphere', 'light'+lightGeo.name()+str(i))
      	
      	transform = lightGeo.get('transform')
      
      	matTr=vr.Transform(vr.Matrix(1), vr.Vector([0, 6, 0]))
      	transform*=matTr
      
      	light.set('transform', transform)
      	light.set('intensity', 100)
      V-Ray developer

      Comment


      • #4
        That's exactly what I wanted to achieve. Big thanks, you saved the day

        Comment

        Working...
        X