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 / Dynamic Cube Mapping in DarkGDK

Author
Message
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 2nd Sep 2009 06:00
Hello All...

I hope you have all had a browse through the September Newsletter by now. If you have, you will have noticed Lee's CubeMapping example/tutorial in there(using a shader by Green Gandalf).

The technique is very cool looking, and is very close to something that I needed to accomplish for some other project's.. with that in mind, I decided to see if the technique would port to GDK without too many problems.

My only concern was the fact that in Lee's article in the newletter, he mentions that these techniques for cube mapping are working in the U7.5 DBPro beta, due to a "Tweak" of some kind. He doesnt actually mention what the tweak is in relation to, but I suspect it was something to do with Shader Textures... as I can get the technique working, but I have to tell the shader to use it's own textures(even though it doesnt have any named ones inside it, it only works when it thinks it's using it's own textures-wheras in the DBPro code, its loaded NOT using its own textures, doing that in GDK results in a black untextured object lol)

Ok, I have ported the technique over to GDK and it works fine, both with and without the shader normal mapping... Yes, you can have just the dynamic cube map(which is what I am interested in actually) without the textures too in this demo - although doing it in a game would be more complex as you would need to manage the texture stages properly(it doesnt like anything in tex stage 0, I had to tell it to texture itself with a nonexistant image in stage 0 to get it to work - which still surprises me lol).

The DEMO that I have put together is based almost 1:1 from the DBPro source that you can get from September's Newsletter, with only a few minor changes for C++ made, and some small tweaks to GDK.

Press [SPACEBAR] to change the object and keep the Normal Mapping shader applied.
Press [RETURN] to change the object with only the Dynamic Cube Map applied.

Here are 2 screenies of the program running :

With Normal Mapping :



Without Normal Mapping, just cube map :



The Attachment contains the Source code file, the FX file and the media required, and also a compiled and working EXE to demonstrate. The EXE was compiled with GDK7.4 and March09 DXSDK.

My reason for posting this is that the technique is really cool, and something I believe people may have a use for.

I am continuing to experiment with this technique and simplifying it. If I end up with anything interesting Ill post bak to let everyone know, but I mainly wanted to get cube mapping down as its used in a number of shaders that I am playing with for both reflections and shadows, usually calling the DBpro Render Dynamic Cube Map command, which causes exceptions in GDK... hopefully this technique should be able to be slotted right in if I can get it to work properly.....(shouldnt be too hard to make it use a single camera and swap out render targets or something....)

Lastly, I would like to Thank both Lee and Green Gandalf, for putting their time into getting a cube mapping demo done for us.
The Shader file the Green Gandalf made hasnt been touched at all, and is exactly the same as the DBpro version. Lee's source has only been changed minimally.

If it ain't broke.... DONT FIX IT !!!

Attachments

Login to view attachments
prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 2nd Sep 2009 11:44
Beast. I see you have finally got the most annoying problem with DGDK sorted When I saw it in the newsletter, I was thinking that you were talking about cubemaps in your shader thread. Cool demo, but do I need the march 09 sdk or can I just use an old version?


Your signature has been erased by a mod
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 2nd Sep 2009 12:31
you should be right to use any SDK, the important thing is GDK 7.3+ although I used 7.4, there were no commands that I used that arent in 7.3 so it should also work, prior version to that wont though(it might, but I dont think so).... I just mentioned it as people trying to run the supplied EXE will get errors without the latest version of directX


And you are right, the cubic mapping was one of the last problems I am solving for evolved's deferred library lol.... Im glad they stuk this in the newsletter, I actually had a little set of functions worked up that used native DX code to generate a cubemap, but was having trouble integrating it with GDK in a modular way(it worked but not how I wanted), GDK doesnt like certain DX methods ive noticed and while I can use just about all of them, in some respects its one or the other as making GDK work with native DX sometimes isnt very easy lol.

If it ain't broke.... DONT FIX IT !!!
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 2nd Sep 2009 13:12
MISTA rocked the house again!

I saw this in the newsletter, and thought to myself "now we have to wait 2 or 3 months to see gdk 7.5 and use this"
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 2nd Sep 2009 13:41 Edited at: 2nd Sep 2009 13:47
hey Thanx It isnt exactly the same as in the newsletter though...

There are a couple of small differences between what I had to do to get it to work and what worked in DBPro.
I had to call dbLoadEffect telling the shader to use it's own textures(it doesnt have any named textures's in it, but it obviously makes some difference to the way it's treated by GDK) where in the DBPro code, its loaded with the parameter to NOT use it's own textures.

Other than that, everything related to the actual shader worked fine, but applying the cubemap to the object without the shader, I had to texture the object with a non-existant texture(yes, I know that sounds funny and wrong, but it tricks GDK into setting the cube mapping into the correct texture stage, if there is an actual texture there, the cubemapping command wont render properly-though i didnt test too much with that)

If it ain't broke.... DONT FIX IT !!!
Franck22000
15
Years of Service
User Offline
Joined: 7th May 2009
Location:
Posted: 3rd Sep 2009 15:25
Like always nice work !

looking forward for the new defered shaders

Login to post a reply

Server time is: 2024-10-01 12:39:07
Your offset time is: 2024-10-01 12:39:07