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.

DarkBASIC Professional Discussion / Evolved Normal Mapping with Linear FOG Enabled

Author
Message
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 29th Dec 2007 13:11 Edited at: 29th Dec 2007 13:19
Here is the shader:


Attached Is the easy to use and implement code

Here is the above mentioned code with some information added, just change the code in the attachment with this:

Attachments

Login to view attachments
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 29th Dec 2007 15:08 Edited at: 29th Dec 2007 15:10
I have the same problem... or maybe you just solved my problem.
http://forum.thegamecreators.com/?m=forum_view&t=107875&b=1

CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 29th Dec 2007 22:41 Edited at: 29th Dec 2007 22:41
I dont have a problem. I am telling you how to add fog support to shader :p
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 29th Dec 2007 22:58
Yes. Thanks.

jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 30th Dec 2007 18:50
Quote: "I dont have a problem."
Just had to Smile - that was funny!

I grabbed your fog shader CuCumber- for later analysis - I'm (on the side) collecting a lot of shader materials for when I'm ready to dive in I have a lot of examples, I grabbed the HLSL PDF reference guide yesterday - that should help alot.


Thanx for your submissions! Oh Mage - saw a screenie of your game - showing arms and stuff - cool!

CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 30th Dec 2007 19:57
jason: Just an advice, while collecting shaders around here, just work out the simplest shader you ever found and learn the structure of how it is made.
Then learn the semantic differences between dbpro and original shader language (i doubt theres any differences anymore though)

i believe there are still so many ways to send data from dbpro to a shader including mesh diffuse, specularity..etc. but i gotta find them first.

Anyhow, im just a newbie about shaders as well
However i want to learn the asm compiling of directx sdk real bad.
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 31st Dec 2007 00:51
Quote: "Thanx for your submissions! Oh Mage - saw a screenie of your game - showing arms and stuff - cool!"

Yeah thought it was good to mention since nobody seems to be doing it that way.

Also picked up your mentioning manual control of animations.
http://forum.thegamecreators.com/?m=forum_view&t=120334&b=1
I implemented this. Before I was simply adjusting the animation speed based on timer(). Now I can use additional cameras without animation problems. Thanks.

And thanks for the shaders, the volume fog shader is looking interesting, but this normal map shader with fog was what I was looking for for some time.

Oh... yeah i needed to find a normal map shader that supports at least 4 lights.

nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 31st Dec 2007 00:56
Thanks for this, Cucumber - this is exactly what I needed!!

Nice job

My Robotron remake - http://norrish.force9.co.uk/robotron
My I,Robot remake WIP - http://norrish.force9.co.uk/irobot
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 31st Dec 2007 09:24
There's one issue with your shader, on the line "length( IN.Pos - vCPS)", you are comparing IN.Pos(object space) coordinates to vCPS(world space), this will not work as you cannot compare the two(and get accurate results for objects that aren't positioned at 0,0,0), to fix this you should multiply the vertex's position(object space) by the World matrix then you get the World space position of it, the same as the light vector. However the faster method would be to transform the object's position into screen space by multiplying it by the WorldViewProjection matrix, this way you can simply get the pixel depth by reading the resultant vector z component.

Quote: "i believe there are still so many ways to send data from dbpro to a shader including mesh diffuse, specularity..etc. but i gotta find them first."


You can find a list of shader inputs and outputs on MSDN.

CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 31st Dec 2007 17:04
MAybe you can send a fixed and optimised one here Dark Coder?

Login to post a reply

Server time is: 2024-04-27 04:05:08
Your offset time is: 2024-04-27 04:05:08