View Single Post
  #5  
Old 10-25-2010, 02:44 PM
kopper kopper is offline
Member
 
Join Date: Apr 2010
Posts: 18
Thanks Masaki, it now works as expected.

I have another similar issue, but now it's with the projector extension. I'm using projected textures to emulate a spotlight in my application. It's not a realistic spotlight, but just a texture shaped like a torus that is semitransparent on the edges and has a transparent hole in the center.

It is used to define a guiding path for the user to follow with the eyes, and I did not use the spotlight lighting effect because it would be much more complex as I would've to tessellate the geometry faces, etc.

Anyway, this projected texture, I link it to the mainview position, and change it's orientation (pitch and yaw) in an animation path to be followed by the user.

Here is the code used for the creation of the spotlight and animation path:
Code:
import projector
spotlight = projector.add(viz.add('spotlight.png'))

spotlight.setEuler([15,0,90])

#State the geometry that can have the shadow cast upon them
spotlight.affect(model)

spotlight.setPosition(initial_pos)

spotlight_path = viz.addAnimationPath()

eulers = [[24.11, -4.72, 0.00], [12.95, -16.99, 0.00], ...]
times  = [0.07, 1.14, ...]

for x in enumerate(eulers):
	#Add the control point to the animation path
	#at the new time
	cp = viz.addControlPoint()
	cp.setEuler(eulers[x])
	spotlight_path.add(cp,times[x])

viz.link(spotlight_path, spotlight)

...

spotlight_path.play()

What I couldn't find a way to do was to apply the same offset that is applied to the HUD, now to the projected texture.

Attached is an image of the projected spotlight, with the two views. The idea is to have the spotlight (which is a projected texture) illuminating the same geometry in both images.

I hope that the explanation was clear enough.

Thank you for your help!

Regis
Attached Thumbnails
Click image for larger version

Name:	vizard-20101025-173322582.JPG
Views:	1004
Size:	645.3 KB
ID:	398  
Reply With Quote