model = glGetDoublev(GL_MODELVIEW_MATRIX) proj = glGetDoublev(GL_PROJECTION_MATRIX) view = glGetIntegerv(GL_VIEWPORT) winx,winy,winz = gluProject(lightpos,lightpos,lightpos,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 and #0<winy<view, then the light is visible; draw the flare.
No replies to this topic
Crossbones+ - Reputation: 1764
Posted 24 June 2009 - 03:10 PM
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:
I used this technique to produce: The planet can occlude the sun's flare. It does so perfectly. Hope this helps, Geometrian