PDA

View Full Version : spec highlight placing script


mjs1
11-05-2005, 05:23 AM
I'd like to have a function that places a specular highlight via a mouse click on an object. The way it would work is that you select a light, then, viewing through the render camera, click on a selected object. The ray from the viewpoint to the surface point is calculated and reflected about the surface normal at that popint. The light is then placed along the reflected ray.

Does anyone have a script that already does that? If not, are there some MEL functions out there that can:

1. Convert mouse-selected screen coordinates to a 3D world space position on an object
2. Construct a ray from the camera to that point.
3. Get the surface normal for the point found on the surface
4. Reflect the incident camera ray around that normal
5. Align the spotlight position and aim vector along this reflected ray.

Thanks!

Hirni_NG
11-06-2005, 01:02 PM
I'd like to have a function that places a specular highlight via a mouse click on an object. The way it would work is that you select a light, then, viewing through the render camera, click on a selected object. The ray from the viewpoint to the surface point is calculated and reflected about the surface normal at that popint. The light is then placed along the reflected ray.

Does anyone have a script that already does that? If not, are there some MEL functions out there that can:

1. Convert mouse-selected screen coordinates to a 3D world space position on an object
2. Construct a ray from the camera to that point.
3. Get the surface normal for the point found on the surface
4. Reflect the incident camera ray around that normal
5. Align the spotlight position and aim vector along this reflected ray.

Thanks!

This would be certainly possible, although it will require probably a plug-in to aquire the mouse position in a viewport. But do you think it would be worth the effort? A spotlight with an aim-constraint enables one to position hightlights pretty much the same way.

CGTalk Moderation
11-06-2005, 01:02 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.