Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / New Shadow Mapping Demo

Author
Message
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 9th Oct 2009 16:03 Edited at: 9th Oct 2009 16:16
Salute fellow coders!

As some might remember I wrote a Shadow Mapping demo based on Evolved's DBPro sample. ( Thread )
Now I've written my own Shadow Mapping shader and made a small demo of it. It may be not as accurate or pretty as Evolved's, but it is a big step for me, since I had to do a lot of HLSL homework.
Currently the shader supports up to three dynamic lights and is pretty fast, but I didn't implement Normal Mapping yet.
The compiled demo and media is attached. I will post my code later on, since it's a little messy right now and I have to finish a few things up.

Here is a screenshot:



Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.

Attachments

Login to view attachments
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 9th Oct 2009 16:18
Very Nice. Looks like you have been busy indeed, im looking forward to seeing more

If it ain't broke.... DONT FIX IT !!!
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 9th Oct 2009 16:27
Thanks!
Yes, it was lots of work, but very satisfying now

Here is the code:

Main.cpp



Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.

Attachments

Login to view attachments
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 9th Oct 2009 16:40
looks good
Only thing I can see that you might want to have another look at is your usage of GDK vectors(not the fact you are using them) if you arent already aware, you seem to be making vectors over and over in you main loop without deleting them, im not 100% sure as ive not actually dont that, but I believe you will get better performance by creating them all at the start and then just setting them in the loop..

Im not even sure if GDK will recognize that its not meant to create a new one, it might eat up all your memory or it might just use the memory that it already had allocated, I guess its something too have a look at lol, I try to use GDK 3D maths as little as possible, its notoriously slow, if you can get away with using the D3DX structures that will also help performance.

If it ain't broke.... DONT FIX IT !!!
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 9th Oct 2009 16:50
Oh thanks, didn't even really recognize that!
But I guess you're right, I will upload an updated version soon...

I don't like DarkGDK's 3D Maths, too. It's a very strange system, they should have rather made it possible to use standart Vector3 instead.
Like you, I try to use them as little as possible, but unfortunatly they are necessary to pass data to shaders.

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 9th Oct 2009 17:02 Edited at: 9th Oct 2009 17:05
True, if you want to though, you can access the shader directly through the objects pointer( dbGetObject(); ) its in the pFrame->pMesh somehwere there(ill have a look in a tic and post at the bottom lol), a pointer in there to the actual directx shader, so you can call the directX commands to pass the shader the data that way ...

Here is the code I have used to set shader float arrays in HLSL shaders from GDK



Hope this helps some. (its a part of a function set that I made to emulate DBPro's SetEffectConstantVectorElement command, thats missing from GDK, when I ported from Evolved's DBPro deferred shading library)

If it ain't broke.... DONT FIX IT !!!
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 9th Oct 2009 17:07
Wow, that's awesome!!
Didn't know how that would be done. That gives me lots of ideas for optimization!
I'll work on it later, have to clear my head a little right now...

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.

Login to post a reply

Server time is: 2024-11-20 13:21:46
Your offset time is: 2024-11-20 13:21:46