Reflect-O-Matic

Reflect-O-Matic

This script allows you to automatically create lights or geometry that will reflect onto the currently selected polygons (if more than one is selected, the "first" polygon will be picked). It was inspired by this thread.

The math is fairly straightforward: it figures out where the camera is, where the polygon is, and using that information sticks a light in the scene twice as far away from the position of the polygon as the camera is along the vector of incidence.

The images show a polygon selection, the rendered result, the rendered result with the polygon selection overlaid.

Reflect-o-matic web page.
 

Attachments

  • Reflect-o-matic Tool.js.zip
    2 KB · Views: 493
  • poly-selection.jpg
    poly-selection.jpg
    318.3 KB · Views: 605
  • render.png
    render.png
    90.3 KB · Views: 592
  • overlay.jpg
    overlay.jpg
    128.3 KB · Views: 596
Last edited:
It looks like the script only works for objects positioned at the origin (in part because the lights get placed as children of the selection). I'll see if I can make it a bit more robust.
 
I've added some fixes/changes:

  • Creates one light for each selected face (rather than just the first face)
  • Handles meshes not at origin / zero rotation
 
It's now a tool.

It creates area lights or geometry (planes), and it adds a Target tag to point them at the object (not the exact polygon, unfortunately).

(I tried manually setting the Euler rotations but I screwed up my math somewhere, gave up, and picked the easy option ;-) — it's probably more useful this way.)
 
I tracked down some more bugs (exposed when I rotated the subject mesh, and moved the scene away from the origin). I've also added polygon targets for each reflection source, making the reflections ridiculously accurate (as the new pictures demonstrate).

I hope this is useful for someone :)
 
One more note: I tried using the tool to render hero shots of rigged figures — it doesn't work unless you collapse the skeleton tag because the polygon positions and normals are not reported correctly to the script (they're the pre-deformation values).

So in a worst case scenario — imagine C3D finally supports motion blur and you want a hero render with motion blur — you'd need to duplicate and collapse the mesh in question, use it to generate reflection sources, then delete the duplicate and render the original mesh.
 
Back
Top