Jump to content
  • Advertisement
Sign in to follow this  
mauro78

OpenGL Scissor region from bounding sphere

This topic is 2208 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi All, I've spent all day trying to implement Lengyel method's for computing "Scissor" region for a spehere.

http://www.opengl.org/discussion_boards/showthread.php/151023-scissor-region-from-bounding-sphere

code is for OpenGL and I'm working on Directx. Basically my adaptation is:

  • Compute light pos in camera space and then negate Z component
  • Compute aspect ratio = (screenW/screenH)
  • Compute e (focal lenght) as 1/tan(FOV/2)
  • Invoke Project_Sphere function
  • Set scissor rect based on top function results (scaling them from [-1,1] to screen coords


    results are ok If I'm "inside" the light volume or light is not visible: problem arises when intersection are computed.
    Basically the returned rect is very small compared to results I'm expecting....any advice?

Share this post


Link to post
Share on other sites
Advertisement
The only problem that I can see in the above list is that the aspect ratio should be height / width. You might also need to negate the Y component of the camera-space light position.

Share this post


Link to post
Share on other sites
thanks for reply Eric happy.png

I finally solved the problem using some of your method's tests and the using sort of:

D3DXVec3Project(&posout[3],&pos4,&vp,&proj,&view,&mat);

To compute screen space bounds of the light; reusing proj mat computed previously....


"Scissoring" works pretty well as speed-up techniques on a deferred pipeline.

I'll explore stencil buffer (to mask out pixel that dosn't need to be shaded) to reduce the pixel processing even more.

Bye Edited by mauro78

Share this post


Link to post
Share on other sites
On this sample scene with 20 lights on screen I'm saving a lot of fillrate (on 1280x720 resolution):

VUyro.jpg

around 1.200.000 pixel processed per frame (with scissoring rectangle)

gLrvC.jpg

around 14.000.000 pixel processed per frame (without scissoring rectangle)

In terms of framerate I'm currently doubling it using that optimization....just nice ^__^ Edited by mauro78

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!