Skip to main content
GameDev.net gamedev.net
🔒 Locked

Lesson 44

Started by Geometrian Jun 24, 2009 at 9:10 PM 0 replies 1.8k views
Original Post
Geometrian
Geometrian
Hi, Lesson 44 is the lens flare tutorial. Apparently, it has occlusion testing. If the situation is right, it can be done vastly more efficiently. In Python:
model = glGetDoublev(GL_MODELVIEW_MATRIX)
proj = glGetDoublev(GL_PROJECTION_MATRIX)
view = glGetIntegerv(GL_VIEWPORT)
winx,winy,winz = gluProject(lightpos[0],lightpos[1],lightpos[2],model,proj,view)
winz = glReadPixels(winx,winy,1,1,GL_DEPTH_COMPONENT,GL_FLOAT)
pos = gluUnProject(winx,winy,winz,model,proj,view)
#if pos and lightpos are basically the same and 0<winx<view[2] and
#0<winy<view[3], then the light is visible; draw the flare.
I used this technique to produce: The planet can occlude the sun's flare. It does so perfectly. Hope this helps, Geometrian
[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.