Re: Optimized Shadow Volume Rendering

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Jack Hoxley (Jack.Hoxley_at_DirectX4VB.Com)
Date: 07/17/04


Date: Sat, 17 Jul 2004 13:40:22 +0100

It works reasonably well actually...

I experimented with it in simple cases (didn't perfect it), and for a
correct delta you can get a 20-30% speed increase with a minimal loss of
visual accuracy. Especially if the object (or light) is slow moving..

I had a slider in my example, and at lowest (==0.0f) then it worked as if no
delta was employed, at a delta of 2,3 or 4 then the shadow started to
noticeably drop behind some of the objects, yet added an extra 30-40fps. Set
it to 0.0->1.5 and you'd only notice the update delay if you looked for
it...

Jack

"GuitarBill" <GuitarBill_at_cox_dot_net> wrote in message
news:eGF3g07aEHA.1656@TK2MSFTNGP09.phx.gbl...
> The delta checking doesn't really sound worthwhile - you have to sustain
> framerate even when everything has moved anyway; all you're doing is
> optimizing occasional frames whilst adding extra processing to every
frame.
> Also you would probably have to retain information on incremental
movements
> (n frames below threshold could aggregate to significant distance).
>
> Bill
>
> "Jack Hoxley" <Jack.Hoxley@DirectX4VB.Com> wrote in message
> news:OBQFSB5aEHA.3352@TK2MSFTNGP10.phx.gbl...
> > Hello all,
> >
> > I had the enjoyable day of sitting in a van for 8hrs, and as such spent
> many
> > of those hours pondering some D3D/Graphics "problems"... One of which I
> > worked on is as follows...
> >
> > I wrote an article for GameDev.Net a while back: "An example of shadow
> > rendering in Direct3D9" [
> > http://www.gamedev.net/columns/hardcore/shadowvol/default.asp ], and
have
> > wondered for a while how I can improve it - the 65fps I clocked was
> > acceptable, but not impressive.
> >
> > I know the following is not specifically Direct3D, but it's the only API
I
> > use - hence this (generic) code is all D3D9 in my head :-)
> >
> > Now, I thought along two line of optimization:
> >
> > Temporal:
> > ----------
> >
> > If you have lights and meshes that (since the last frame) are either
> static
> > or moved, you can generate the following rules:
> >
> > 1. If the light is STATIC and object is STATIC, no changes need be made
> > 2. If the light is MOVED and object(s) is STATIC, recalculate volumes
for
> > all (affected) objects
> > 3. If the light is STATIC and object(s) is MOVED, recalculate volume for
> > single object
> > 4. if the light is MOVED and object(s) is MOVED, recalculate everything
> >
> > As an extra optimization (through previously trial and error), a
> screenspace
> > error metric can be used to determine movement. Such that anything above
a
> > certain threshold is updated, and anything below ignored. This solves
> > problems for high end systems that update every frame for a light that
> seems
> > to move 0.000001m per frame - either due to amazingly high frame rate,
or
> > amazingly slow moving light. I refer to this as a time-delta.
> >
> >
> > Spacial:
> > --------
> >
> > Based on the positions of lights and/or objects, you can get the
following
> > rules:
> >
> > 1. If the light is out-of-range of the light, then it should not be
> rendered
> > in that pass and no shadow volume should be generated
> > 2. if the light is out-of-range of the camera, then the whole pass
should
> be
> > discounted
> > 3. Any shadow volume extruded from any geometry should be extruded only
as
> > far as the light has influence (not sure if this works for Z-Fail).
> >
> >
> >
> > Now, if you take those properties into a traditional render loop - that
> is,
> > no explicit use of effect files and/or shaders:
> >
> > Begin Frame
> > [
> > Clear Buffers
> > Z-Fill pass
> > For Each Light
> > [
> > If( Light_Enabled && Light_Influences_Screen)
> > [
> > Clear Stencil Buffer
> > Set render states
> > For All Objects
> > [
> > If ( Light_Influences_Object )
> > [
> > If ( Light_Has_Moved || Geometry_Has_Changed )
> > [
> > UpdateShadowVolume( )
> > ]
> > RenderShadowVolume( )
> > ]
> > ] //For All Objects
> > RenderScene( )
> > ] //If Light enabled
> > ] //For each light
> > Present_Image_To_Screen()
> > ] //End frame
> >
> > Bare in mind this is just my doodlings really, but I know there are
plenty
> > of clever people out there :-) I'm also aware of several great papers on
> > stencil shadowing... and a few of which make references to this sort of
> > technique (although I'd like to think the delta update is my own) but
none
> > that refer to all in one paper...
> >
> > Does anyone have any thoughts on this? I thinking of updating the
example
> > code for the aforementioned article to reflect these changes... I reckon
> > that with a larger number of lights and objects that this framework
could
> > improve upon the existing source code.
> >
> > Best regards,
> > Jack
> >
> >
>
>



Relevant Pages

  • Problem while resizing JInternalFrame Modal + Solution to get Modal Floating Component
    ... Here is teh code I made to get Floating Modal Components on a Frame, ... private JFrame frame; ... * @param desiredLocation is the prefered Location on this container ... (Component c,Component origin,Point delta) ...
    (comp.lang.java.gui)
  • Re: FTL and references to works
    ... From Rindler, Introduction to Special Relativity, page 17. ... delta x> 0. ... Then in the usual second frame S' travelling at velocity v ... The simple solution of this problem is a preferred frame. ...
    (sci.physics.relativity)
  • Re: FTL and references to works
    ... From Rindler, Introduction to Special Relativity, page 17. ... delta x> 0. ... Then in the usual second frame S' travelling at velocity v ... The simple solution of this problem is a preferred frame. ...
    (sci.physics.relativity)
  • Re: Optimized Shadow Volume Rendering
    ... The delta checking doesn't really sound worthwhile - you have to sustain ... optimizing occasional frames whilst adding extra processing to every frame. ... I thought along two line of optimization: ... Any shadow volume extruded from any geometry should be extruded only as ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Moving From ProTools to Linux? Good or bad?
    ... However, using Mudio Delta 1010 as an example, you do have to play with the ... sample rates etc especially if using asio drivers so ... I still had to manually start JACK in order for audio applications to work. ... There's a mixer that looks like a sound card mixer called QAMix. ...
    (rec.audio.pro)