Re: Optimized Shadow Volume Rendering
From: Jack Hoxley (Jack.Hoxley_at_DirectX4VB.Com)
Date: 07/17/04
- Next message: Hanna-Barbera: "Re: opengl"
- Previous message: Jack Hoxley: "Re: Optimized Shadow Volume Rendering"
- In reply to: GuitarBill: "Re: Optimized Shadow Volume Rendering"
- Messages sorted by: [ date ] [ thread ]
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
> >
> >
>
>
- Next message: Hanna-Barbera: "Re: opengl"
- Previous message: Jack Hoxley: "Re: Optimized Shadow Volume Rendering"
- In reply to: GuitarBill: "Re: Optimized Shadow Volume Rendering"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|