Scissor region from bounding sphere

Started by
2 comments, last by mauro78 11 years, 10 months ago
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?
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.
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
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 ^__^

This topic is closed to new replies.

Advertisement