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 / Shader: Gradient Sky Shader (Make Skies like in bryce)

Author
Message
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 30th Dec 2007 08:27 Edited at: 30th Dec 2007 14:50

Well, here is a better solution than sky boxes or sky spheres with still images. In this one you can animate nearly anything and make easy day night cycles.

Here is the shader:



Attached is the project and media files that you need
EDIT: Dont forget to change Line 15 as it references the shader file "SkyGradient.fx" .however it needs to be "SkyShader.fx"
EDIT2: You might need your own sky sphere object to correct uv mapping and animation

Attachments

Login to view attachments
Pixel Perfect
17
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 30th Dec 2007 10:55
Hey that's really great CuCuMBeR .. very effective!

Just a few problems getting it running initially:

Line 15 references the shader file "SkyGradient.fx" .. it needs to be "SkyShader.fx"

Also, if enabling the animation by un-remming line 37 I found it ran far to fast, changing the iteration value of x on line 36 from 0.1 to 0.0001 gave much better results (probably just the shader running faster on my graphics card). Guess people will have to experiment with this.

No matter how good your code is, someone will improve on it
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 30th Dec 2007 14:24 Edited at: 30th Dec 2007 14:48
Quote: "Line 15 references the shader file "SkyGradient.fx" .. it needs to be "SkyShader.fx""

Well you are right, i had 2 versions in the same folder and skyGradient.fx was the first one i made using 3.0, however i forgot to change it there.

uhmm.. yeh the animation will vary trough diferent cards becaus e its not timer based, i just made somethin simple there..

try animating the zenith, horizon..etc colors too and get some nice fading between different skies.

Forexample try this:

Attachments

Login to view attachments
jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 20th Feb 2008 18:26
CuCumber - this is great first off.

Could you modify it to somehow loose the nasty poly lines when you look straight up?

Perhaps make the shader not do the gray part - do the WHOLE texture as sky/clouds or something?

Idea being if the terrain is "In" the skyphere - the horizon isn't your problem. (though your transition to the horizon looks good...)

No worries - time permitting if at all - but I do see this as a neat alternative - plus more dynamic than preloaded media - like skybox/sphere textures etc.

CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 20th Feb 2008 19:03
@jason p sage:

Try using a geosphere which you will eventually need to model in a seperate modelling application with correct uv settings..Then those nasty polys will disappear.

i lost my hands on 3d max for a while and will have it back next week then Ill post one if i can.

There is always one more imbecile than you counted on.
trogdor
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: Portsmouth, VA, USA
Posted: 24th Feb 2008 00:17
@CuCuMBeR:
That looks great

@jason p sage:
Here's the demo with a geospehre

Attachments

Login to view attachments
jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 24th Feb 2008 00:38
WOW - Thanx Guys - This is a DEFINATE Contender for Iron Infantry Skies! Thanx!

Omen
17
Years of Service
User Offline
Joined: 7th Nov 2006
Location: Maple Grove, MN US
Posted: 24th Feb 2008 05:36
Cucumber:

This is really brilliant - great job!!!

With a little tweaking, I was able to modify this so that it lerp'd between 6 different sky "sets" so that it would slowly change from midnight sky, to dawn, morning, etc...

Skip to the 2nd half of this video to see a nice daybreak ... too bad the video compression caused the "halo" artifacts around the clouds :/

http://www.youtube.com/watch?v=O16vFw7uBus

CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 24th Feb 2008 18:37
That looks real good Omen

There is always one more imbecile than you counted on.
JulesD
19
Years of Service
User Offline
Joined: 7th Feb 2005
Location:
Posted: 22nd Mar 2008 22:01 Edited at: 22nd Mar 2008 23:39
How did you get the sun in there?
And has anyone figured out how to get rid of the seams?
I have tried a geosphere and it's still there.
jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 23rd Mar 2008 16:30
I made a SkyDome - not a full sphere... like a upside down shallow bowl... I'll attach the model for you.

If you set the backdrop to same color as sky, and scale this dome thing just out of sight - YOU MIGHT get the look you want.

What I ultimately did was drop the shader - and apply a sky texture to this very dome, scaled so edges just out of cam range, set backdrop to sky color, same thing for the fog color - and I scroll the UV textures to get the same effect - NO SEAMS.

Note though that this SHADER is superior in other ways like being able to dynamically change colors of part or the entire sky ... and is really cool... You need to find a balance.

Like for Iron Infantry, I still have not Rulled out one way over the other. For Exmaple - in One scene - I may do the NON-shader method, then for a in Building level - perhaps I use the shader so I can make night fall during a mission at dusk ... Where I can hide such unpleasantries behind hills or something.

Attachments

Login to view attachments
YAURAH
17
Years of Service
User Offline
Joined: 12th Apr 2007
Location: Everywhere
Posted: 25th Mar 2008 08:23
Your post is helping me create a new game that involves a robot in a field, i was wondering if you might could help me...heres a code sample you just need space dragon .x model attached , but the code wont run the way ive configured it, could you or any take a look at it?

you may have to apply a mesh texture to the model ive included one...




CSJ 7000

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-20 09:27:09
Your offset time is: 2024-04-20 09:27:09