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 / Water Shader(Evolved's) - reflecting / refracting above below water

Author
Message
Rampage
16
Years of Service
User Offline
Joined: 4th Feb 2008
Location: New Zealand
Posted: 12th Aug 2009 10:36
Great. Truley brilliant. I love all Evolved's stuff.
Kudos.



Eidos!
KirDael
15
Years of Service
User Offline
Joined: 22nd Jan 2009
Location:
Posted: 12th Aug 2009 13:44
Should i make a WaterShader like in Evolved's Deferred Shading Demo?
Mista Wilson
15
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 12th Aug 2009 14:58
The very first post in this thread is evolved's water shader, it doesnt have any deferred shading or anything, just basic water effects on advanced terrain with a cool fog that gets thicker underwater and the further you are from it...

Im working on porting over a copy of evolved deferred shading library, its mostly complete just ironing out the kinks, but ive had to disable a whole heap of it because of missing commands in GDK, and I had to use directx manually to access a bunch of the shader stuff to get that to work. But if you want to take a shot at porting it over aswell, I'd love to see your code when your done if thats cool, always good to get another person's take on things.

If it ain't broke.... DONT FIX IT !!!
AFishStudios
14
Years of Service
User Offline
Joined: 22nd May 2009
Location: Australia
Posted: 12th Aug 2009 15:59
Wow thanks a lot for posting these, saves time converting dbpro to gdk, creates more time for making games .

Btw I didn't know Evolved had a cartoon shader that actually works properly! Thanks for digging out that one.
silken
19
Years of Service
User Offline
Joined: 13th May 2004
Location:
Posted: 16th Aug 2009 00:57
Hi, thx for all Sample..

I have got a prob for Depth of field shader with GDK.

Have you Try it?
Mista Wilson
15
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 16th Aug 2009 02:54
@Silken, I have a depth of field demo(I think it's evolved's, but i would have to check) here. Ill port it over to GDK for you and post it bak when im done. Should be sometime today or tomoro (its early morning here, just got out of bed lol)

If it ain't broke.... DONT FIX IT !!!
Mireben
15
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 16th Aug 2009 11:49
I'm still a long way from using shaders in my programs, but I'll definitely use some of these sooner or later, so I'd like to thank you for the work you are doing for the community.
Mista Wilson
15
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 16th Aug 2009 14:54
EVOLVED's Depth of Field Shader

Here is the Depth of Field shader as requested.

Looks pretty cool I think, has normal mapping thrown in the demo too.

The attached ZIP contains the source code, a compiled working EXE(not this EXE was compiled with GDK 7.4) and the media and Shader files. Note that this demo uses DarkGDK's inbuilt stencil shadows and as such required that GDK supplied stencilshadow.fx to be in the EXE file's folder. I have included all of the GDK built-in effect FX files.

Here are the screenies :

Normal render view :


Blur texture pasted to screen :


Hope this helps

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: 16th Aug 2009 16:01 Edited at: 16th Aug 2009 17:21
EDIT: It now works, but I see a problem (as with most Evolved shaders) that you can't have DOF without normal mapping, and if you have normal mapping, you can't texture each part of your model separately and you have to apply a normal map to all of the model and the same diffuse texture to all of the model


Your signature has been erased by a mod
Mista Wilson
15
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 16th Aug 2009 17:46
I dont see why you couldnt apply different textures/normals maps to different limbs of an object and set the effect onto the object the same way, I think that would work.

You could modify the shader to not use the normal maps I guess, but thats just evolved's demo, I think the normal mapping is there more to make it look nicer than because it has to be.

If you have a look at the 4 textures it's using while the program is running, you can see the ones that are normal mapped, the depth pass isnt normal mapped as far as I can tell....

I think it would require a bit of playing and probably a bit of HLSL to modify the shader to do what you want, but its possible...

Its something ill have a look at, I have a couple of different bloom and depth shadow mapping examples aswell, some using normal maps or relief maps etc and some not using any media at all bar the FX files...(see a couple of posts above for the bloom one) and they have a very similar setup to the depth of field shader so I think I should be able to put together something with a little effort.

At the moment though, im still working on getting the deferred shading lib working, now that GDK7.4 is working, im going to see if I have any time to put into it, once I get my GDK coding challenge entry out the way(Deferred shading lib is the priority after my coding challenge entry is done), im just polishing that off aswell..
(I actually have a few active projects that I am working on concurrently, a modular terrain system that supports shaders, collision, environment mapping, alpha mapping and with a little luck texture blending, an editting/Lightmapping tool that will handle above terrain system aswell as normal models, deferred shading lib, Newton game dynamics physics(partially working wrapper for GDK as a darkphys alternative) and a bunch more lol. A few of them, like the deferred lib, will be released to the community when im done with them but most are just personal projects im using to teach myself various things...)

If it ain't broke.... DONT FIX IT !!!
prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 16th Aug 2009 18:02
You are very busy lol. What I'm probably going to do is in my modeling program, I will change the limb names to something like "Bump DIFFUSE,NORMAL" and "PerPixel DIFFUSE" and my program just applies textures and effects to the limbs.


Your signature has been erased by a mod
Mista Wilson
15
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 16th Aug 2009 18:12 Edited at: 16th Aug 2009 18:13
Thats a good idea, let us know if it works for you, I know that you cant apply more than 1 shader to a model, so you would need to modify a single shader to do whatever you wanted it to.

Like you cant have both "shader1.fx" and "shader2.fx" applied to the same model at the same time, im pretty sure you cant apply effects to individual limbs with GDK either, but i may be wrong about that.
But you could combine what shader1 and shader2 do into a single shader file, shader3 and apply that to the model... doing that is well beyond my shader knowldge at the moment though lol, it would require getting intimate with some HLSL code.... something I plan to do one day, but well, lol, there just arent enough hours in the day...

If it ain't broke.... DONT FIX IT !!!
prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 16th Aug 2009 18:15
You can set individual limbs different effects: dbSetLimbEffect(); which is a very useful command


Your signature has been erased by a mod
Mista Wilson
15
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 16th Aug 2009 18:16
Oh there you go, I didnt even realise that command existed lol.. time to go have a play with it I think..

Cheers prasoc

If it ain't broke.... DONT FIX IT !!!
silken
19
Years of Service
User Offline
Joined: 13th May 2004
Location:
Posted: 16th Aug 2009 19:25
@Mista Wilson

Thank you , I looked at the code to see where I am wrong
Mista Wilson
15
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 19th Aug 2009 14:18
EVOLVED's Post Process Bloom Shader

Here is another bloom shader, this one is a little more complex and consists of a number more render passes than the previous example, aswell as normal mapping and some cool lighting..

Anyway, code and media is in the ZIP file, its around 2.5mb... with a compiled EXE... the EXE was compiled with GDK 7.4

Screenies :







Depth shadow mapping in the next post

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

Attachments

Login to view attachments
Mista Wilson
15
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 19th Aug 2009 14:24
EVOLVED's Depth Shadow Mapping Shader - with procedural mask generation

Here is evolved shadow mapping shader demo, I have altered it a little, so that you have a choice of either using the pre-made mask and jittermap(see screeny) or a procedurally generated mask/map..

There is a simple const variable at the top of the code, chage it to 1 to use generated media, 0 to load pre-made media...

The attachment contains all the media/shader files, source code and a compiled working EXE(using GDK7.4).

Pre-Made Jittermap and Shadowmask :




Procedurally(run-time) Generated Jittermap and Shadowmask :





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

Attachments

Login to view attachments
Mista Wilson
15
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 26th Aug 2009 03:53
-> SIMPLE <- Deferred Lighting Example

Here is a port of Evolved's very first Deferred Lighting shader. It only handles PointLights, and is very very basic compared to his later set of deferred functions, but, it demonstrates the ACTUAL Deferred Technique, without all of the extra complexities of extra effects being used at the same time.

I am still working on porting over the latest version of Evolved's Deferred Lighting lib, but the DarkShader Dynamic Cubemap bug in GDK is making things difficult.

In his latest version, all of the shadows(depth) are done using the dynamic cubemaps, and a bunch of the other effects rely on those cubemaps themselves to look correct.... so its kind of like a jigsaw with some of the pieces just not fitting in.

I have worked around the majority of the darkshader GDK flaws, such as the lack of object masking and shader vector arrays, but the Dynamic Cube maps have got me a little stuck. I know I can emulate the actual dynamic cube map using directX manually and just manually rendering it and applying it, but I havent implemented a solution for that yet, and I have a feeling that it will be fairly inefficient if I do, possible causing a bottleneck in the rendering phase(im a bit of a DX noob still lol, big learning curve to get dynamic cube mapping done and working with GDK properly.... I have no doubt I will get it done, but I have no timeframe as the moment im sorry.

Im actually considering implementing a few different shading "extras" into this simple demo, just to see how it will look with some simple depth shadows and maybe some post processing bloom, and some water/terrain, though of course, I will be steering away from the DarkShader stuff as much as I can(at least until it's fixed, if its ever fixed, it's been broken since I started using GDK lol)

Anway, here are the screenies of the simple pointlight deferred lighting demo :

Final Scene Render :



World Normals Pass :



Light Render Pass :



The attachment contains the usual compiled EXE(using GDK 7.4 and march09 DXSDK), the Source code and all of the media/shader files.

If anybody has any ideas for improving this or anything else in this thread, or just wants to make a request or comment, please feel free

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

Attachments

Login to view attachments
sydbod
15
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 26th Aug 2009 05:50
It looks very interesting.

Have you by chance done a comparison between deferred rendering and ordinary forward rendering.
I am very interested in determining what the difference in FPS is between the 2 for something with maybe around 6 lights being active.
With only one light the standard forward rendering should be significantly faster. The interesting question is at what point does deferred rendering show an advantage?

By the way, thanks for sharing all your work.
Mista Wilson
15
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 26th Aug 2009 06:11 Edited at: 26th Aug 2009 06:16
I havent done a comparison, but you have my thinking now lol... I think i will, for my own curiosity at least lol

Anyway, Im not sure how accurate/well the comparison would be though, as GDK's native lights are hardware lights and are limited to 8 active at one time... The lights in the above demo are all shader driver, and you can have as many as you want, there are actually 30 active point lights in that demo, they are just all rendered by shader, and are essentially "software" lights.

My thought on the speed though, before any testing is that the deferred technique will be faster, if for example we had 100 deferred lights in there, and we setup a render/sync mask loop to switch on and off our 8 hardware lights in GDK and render them at various positions to equate to 100 lights, I think the deferred lighting technique would win hands down. If though, we have only the 2 or 3 lights, GDK can display them without any extra render passes or render targets, wheras in the shader, we still need to use the same amount of render passes to render the gbuffer regardless of the amount of lights and in that case, I think GDK lights would win quite easily, thought maybe not by as large a margin as in the reverse case.... will be interesting to see lol

Edit : I think there are actually 29 lights in the demo lol, not 30, and to answer your question, sorry I forgot, The point where the deferred technique would be faster would be somewhere over 8 active lights, as thats is GDK's limit and where you would have to start setting up render targets and turning lights on and off etc

If it ain't broke.... DONT FIX IT !!!
sydbod
15
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 26th Aug 2009 06:34
I had a quick "Naughty Thaughty" about deferred rendering, and maybe you can confirm a few things for me.

With forward rendering I can break up the view frustum into 2 or 3 different distances and build up my view, just by rendering the furthest view distance, then overwriting the next closest view range, then overwriting the next closer view distance range again ... etc.

I use this process in a small flight sim project I am working on, so that I can have a huge front plane to back plane ratio without Z fighting problems (Z buffer 24bit).

From my understanding, this sort of simple approach is not possible with deferred rendering.
Have you any experience with moving Z buffer functionality into the pixel shader?

The other question is , is it true that deferred rendering can not support AA mode properly and as such one is required to run at higher resolutions to get a good screen image?
Mista Wilson
15
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 26th Aug 2009 07:18
I have never tried to use that technique with shaders to be honest, Ive only used it with GDK's built in shadow shading for the same reason, z-fighting in the 24bit buffer at large angles/distances , but it's handling all of the rendering for that internally so all I had to do was set the various camera ranges and that was it lol...

Ill have a play around and see, I dont think it would be too hard to have "groups" of 2 or 3 cameras, and when setting up the shader, just set it up with those cameras, making the ranges appropriate...

Quote: "Have you any experience with moving Z buffer functionality into the pixel shader?
"


I havent moved the zbuffer fuctionality into a pixel shader at all, I dont have alot of experience in using shaders, but im learning lol, using DX atm to render a terrain with shaders for texture splatting and .X meshes as statics, there are NO gdk objects, but its using gdk to render, i just took over the device lol

Quote: "The other question is , is it true that deferred rendering can not support AA mode properly and as such one is required to run at higher resolutions to get a good screen image? "


I dont know about "true" deferred rendering and how it handles anti-aliasing, but this technique is just using a shader with render targets to defer the lighting, I think lol, so I guess we could say its a "pseudo-deferred" technique, but GDK Antialiasing seems to be working with it.

Before I posted the demo, I added in AA at the top of the program with a simple "check if available, and use if is" and made sure that it worked by visually comparing the difference in highres screenshots, its definately working, its only at 4 samples though, so its not perfect, but it is definately noticeable compared to having none.

If it ain't broke.... DONT FIX IT !!!
Try
19
Years of Service
User Offline
Joined: 16th Aug 2004
Location:
Posted: 26th Aug 2009 11:15 Edited at: 26th Aug 2009 11:36
@Mista Wilson,
I don't know how to thank this community and its loyal users, so, I'll just post one of Evolved's deferred shading that I've ported to DGDK many month ago, it's compiled under VS2005!!! I don't know if it works under 7.4 or not... Just trying to help and appreciate your great work buddy

P.S I don't know why but two of the shadow shading modes do NOT work as expected and the projected LightCube doesn't work (as expected) as well (must be the same problem) I have included the code as well as the compiled version (VS2005 though!!) so you can check for your self, hope it saves some of your time...

P.S 2: I'm not sure which version of deferred shading it is (long time!!!) but it has PCF shadows which for some reason Evolved doesn't use anymore!

Cheers,
-Try

Attachments

Login to view attachments
prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 26th Aug 2009 11:49
<3 I can now start having masses of lights Did you slim down those 3000 lines or was those lines for something more advanced?


Your signature has been erased by a mod
Mista Wilson
15
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 26th Aug 2009 11:54
Wow, thanx try

Ill have a look through for sure.

The version of deferred library that I am working on is the one you can download from evolved's webpage now, its using darkshader's dynamic cube mapping which doesnt work in GDK, its broken

Thanx again.... Im sure ill end up making use of your code

If it ain't broke.... DONT FIX IT !!!
Try
19
Years of Service
User Offline
Joined: 16th Aug 2004
Location:
Posted: 26th Aug 2009 13:12
@prasoc,
I'm afraid you cannot jump into it! This is not the latest version of Evolved's deferred shading, sorry to disappoint
The newer version which Mista Wilson is working on, is much better and well structured, be sure...!

@Mista Wilson,
No need to thank me... You're the one we should thank to

Well, I guess I have to try Dynamic Cube Maps in 7.4 as well, I'm sure they were OK back in VS2005 days...

BTW, sorry if the code is messy and some of it might differ from the original because I was playing with it somehow!!! (But it works!)

Cheers,
-Try
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 26th Aug 2009 13:19
this thread is the holy grail of gdk shading!

well done!
Mista Wilson
15
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 26th Aug 2009 13:46
@prasoc, no the demo above for defered lighting is Evolved's first deferred demo, before he added all the cube mapping and extra shaders and stuff in... I came across it in the dbpro forums accidentally lol - im still working on the latest one(3000 lines of code) but im finding that I need to learn a little more about DX so I can emulate the cubemapping properly... as its broken still

@try - Ive never had any luck with dynamic cube mapping. To be honest I never really tried it when I was using vs05, which was when I just started using GDK. But as soon as I actually learnt my way around and started with shading, ive never had the dynamic cube mapping working...... normal cube mapping works fine, I guess you could call it static cube mapping, where the image used is static.

I know how the process of cube mapping works, and I think I can emulate it without creating a performance bottleneck using native directX, but i havent implemented my solution yet. Im tossing up if I can actually do away with the cube mapping techniques and replace them with something similar but not using cubemapping.... ill have to see lol

@bjadams - Thanx, im glad you like it, I hope some of it helps you

If it ain't broke.... DONT FIX IT !!!
Try
19
Years of Service
User Offline
Joined: 16th Aug 2004
Location:
Posted: 26th Aug 2009 14:56
@Mista Wilson,
So, does this old demo work for you? did you change the shadowing modes? (SPACE BUTTON)
(They use Dynamic Cube Maps...)

I'll check Dynamic Cube Maps on my Notebook as soon as I get the chance to... (I need VS2008 you know!)

Cheers,
-Try
Mista Wilson
15
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 26th Aug 2009 15:48
The demo starts and runs, but as soon as you hit space(when the dbRenderDynamicCubeMap() is encountered) the program throws an exception, like its trying to write to an invalid device or something, although it does work in your pre-compiled exe, so i assume its an incompatibility with GDK from 16-11-07version to 7.4(which are the only versions I have atm, from 16-11-07 to 7.4 inclusive)

The command to make and apply the cube maps execute without exceptions, but the cubemap just wont render without throwin and exception.

I think the problem(with shadows in you pre-compiled EXE), after looking at the original code, was something to do with the syncmasking but I cant run it without the cubemap exception so I cant get shadows to work to debug it lol.....

Ill eventually get them working with native DX code, ive had a few breakthroughs in my understanding of it the last couple of days, like a whole bunch of things that I kinda half understood all fell into place and all make proper sense now lol(took a whole heap of study to get, but it was worth it... havent studied so hard since I was a schoolboy lol) so I should get something to emulate the cubemaps working soon...

Also, in Evolved's latest deferred lib, he was using Object Masking, and Vector Arrays in the shaders for light positions(dbpro- Set Effect Constant Vector Element, sets an element of a shader vector4 array). Neither of those commands are part of GDK(but I have emulated them both already so they dont matter and arent a problem, just cubemapping lol)

I have contacted TGC support about all of the above issues, so they are aware of it, I was told that the missing/broken commands would be looked at when they could, but nothing specific and I havent made any more enquiries since...

Thanx again for the code, I appreciate you sticking it up here for me and everyone to use.... now to make a dx dynamic cubemapping solution that works in recent GDK's... lol

If it ain't broke.... DONT FIX IT !!!
Franck22000
14
Years of Service
User Offline
Joined: 7th May 2009
Location:
Posted: 26th Aug 2009 16:35
Hello Mista, Thanks you for your fantastic work !

Is there any possibility for you to post a version of defered shading with light system + parallax mapping + shadows soon ?

Im looking forward for a new defered shading version with more effects
silken
19
Years of Service
User Offline
Joined: 13th May 2004
Location:
Posted: 10th Sep 2009 23:56 Edited at: 10th Sep 2009 23:57
Quote: "Also, it seems that darkphysics is not compatible with shaderdata.h, I havent tested dakrAI or any other plugins that I have. When you include calls to both "dbShaderDataStart()" and "dbPhyStart()" the program will not link, the error is a multiply defined symbol in one of the 2 libraries, shaderdata.lib or darkphysics.lib - the symbol is g_DeleteObject"



hi.. you can use DarKPhysic with Shaderdata...

Must Add in the project properties : Linker- commande Line this command : /FORCE:MULTIPLE

and it's good..
Try
19
Years of Service
User Offline
Joined: 16th Aug 2004
Location:
Posted: 13th Oct 2009 10:15
Hi Mista Wilson, are you working on Advanced Lighting or not? Have you seen it?

Cheers,
-Try
Mista Wilson
15
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 13th Oct 2009 11:25
Hey Try - Yes, I have seen the shader examples that I think you mean, I have been working on things other than GDK lately, have to make a living lol so game programming comes second sometimes, but if you are interested ill see if I can throw together a simple example of the shader in GDK.

If it ain't broke.... DONT FIX IT !!!
Try
19
Years of Service
User Offline
Joined: 16th Aug 2004
Location:
Posted: 14th Oct 2009 11:26
Quote: "... have to make a living lol ..."

LOL, I know what you mean

I wanted to start on the new one (Porting Advanced Lighting to GDK) so I thought I shall check out if you're working on it at the same time or not (You know what I mean )

Quote: "... but if you are interested ill see if I can throw together a simple example of the shader in GDK."

Sure, that would be great

Cheers,
-Try
Kruil
14
Years of Service
User Offline
Joined: 17th Oct 2009
Location:
Posted: 17th Oct 2009 14:10
Hello all!
I have some trouble with water shader. It not will be ok if i try to put my boat on the water surface . Refraction and reflection not correctly compute if i rotate camera.
Here i attach some screenshots:



Have any some ideas about it?

PS sorry for my english
cyangamer
15
Years of Service
User Offline
Joined: 2nd Jun 2008
Location: Houston, TX, USA
Posted: 4th Dec 2009 06:02
This is gold, man. Seriously.

Even if you never made another shader GDK, I would still say that you've given more than your fair share to the community. Of course, perhaps making GDK-compatible versions isn't as hard as it seems, but I dunno.

Anyway, the shaders I've tried look really nice, and I'll definitely be using them in my project. Thanks!

Currently working on - Enemy AI using Dark A.I. I probably should've looked at the reviews in the Dark Physics and Dark A.I. forum first.
entomophobiac
21
Years of Service
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 16th Feb 2010 14:35
Whatever happened to the larger library? I find Mista Wilson's work extremely useful, especially in how it was laid out in a very accessible and well-commented fashion.

Especially the simple deferred shader -- I'm trying to use it to the best of my abilities in a current project.
ZooMxLLL
15
Years of Service
User Offline
Joined: 7th Mar 2009
Location:
Posted: 18th Feb 2010 18:46
Error (Shadow Example)
Christopher Reeves
18
Years of Service
User Offline
Joined: 20th Dec 2005
Location: Texas, USA
Posted: 25th May 2010 07:07
Dude...you are the man, Mista Wilson. You are the man!

Login to post a reply

Server time is: 2024-05-03 10:07:32
Your offset time is: 2024-05-03 10:07:32