SDK Shadow mapping sample

Started by
2 comments, last by Kurt-olsson 11 years, 7 months ago
Hi

i am trying to learn how to use shadow mapping in directx9.
i have downloaded the sample from the DX9 SDK and i am now trying to get rid of all code that has nothing to do with shadow mapping.

i HATE the DXUtil classes, it messes me up and i don´t understand the whole idea of having a pointer to the d3d device etc.

What does this mean?

DXUTSetCallbackD3D9FrameRender( OnFrameRender );

OnFrameRender is a function declared but how can this function be drawn at the end of every frame?
Does DXUtil listen to some callback and trigger this function?

I am trying to run the function after EndScene() but then the code no longer works...

If anyone know a good sample of shadow-mapping without dxutil judder/jidder, let me know. =)
Advertisement
If I had to guess they have a function that will call the sample's Render function at a specified point, and that's the function that's used to register the function. So I would guess if you want to use that code you either need your own Render function and then copy that code into it, or put a breakpoint in the function and see where it's getting called from.
Perception is when one imagination clashes with another
Hi,

Here is some info on shadow mapping and also some slides with audio from GameFest 2010, both by David Tuft.
Maybe it’s easier for you to get the intentions in the sample code, if you have read/heard this.

DxUtil is just some helper stuff, which manages the message loop, the events of loading and unloading scene data (e.g. on resize) and the invocation of the update (OnFrameMove) and render (OnFrameRender) pass. What's important is:
What are the resources involved for shadow mapping? How are they created? How is the shadow map rendered? How is the shadow map used later to get the shadows? Once you have refreshed your knowledge on the basic concept (see the slides), it will be easier to spot the important lines in the code.

Cheers!
Thanks.
I am continuing to strip the code for better understanding.

You are right fellas, i need to read up more on the shadow-mapping itself.

DxUtil i think is good when you have good understanding of the direct3d API and Win32 API, but right now it just makes things harder.
But i have soreted out that there is pretty much only this:

1, init texture shadowmap and other stuff to make shadow work
2 run a function that renders the scene (like the render_frame()) i have now, only i have to have a boolean so i can render with different techniques seperate time
If the shadowmap-buffer and texture exists, render it, otherwise render the scnene as "usual".

I think i have to use the effect every time i render a mesh/triangle/spehere etc, i thought before that you could set this global, but now i think i have to run the Effect for each time i render a Primitive.

thanks again for your help.

This topic is closed to new replies.

Advertisement