Simple sky shader
- Mangetsu
- Kobold
- Posts: 28
- Joined: Sun Jul 17, 2005 6:15 pm
- Location: Sweden
Simple sky shader
ATI Render Monkey's "Atmospheric - Blue Sky" adapted to OGRE. Rather slow and dirty! Someone might find it useful though...
skyshader_demo.zip - modified SkyDome demo - dlls but no media dir.
shader & material
Image 2
Image 2
Image 2
Image 2
Image 2
Sorry about the green sun btw, didn't bother to change it to a decent color.
EDIT: updated post (changed some links & "hid" some images)
skyshader_demo.zip - modified SkyDome demo - dlls but no media dir.
shader & material
Image 2
Image 2
Image 2
Image 2
Image 2
Sorry about the green sun btw, didn't bother to change it to a decent color.
EDIT: updated post (changed some links & "hid" some images)
Last edited by Mangetsu on Mon Jul 18, 2005 7:13 pm, edited 2 times in total.
- SpannerMan
- Gold Sponsor
- Posts: 446
- Joined: Fri May 02, 2003 10:05 am
- Location: UK
- Contact:
Hi Mangetsu, this looks very interesting indeed. Currently I cant test this on my dev box, so instead Ive got some questions for ya.
You mentioned that this effect is slow...how slow? Is this the sort of effect that you could plug into, say, a first person shooter without taking too much overhead for just the sky effects?
You mentioned that this effect is slow...how slow? Is this the sort of effect that you could plug into, say, a first person shooter without taking too much overhead for just the sky effects?
- Mangetsu
- Kobold
- Posts: 28
- Joined: Sun Jul 17, 2005 6:15 pm
- Location: Sweden
Another image showing color customization:
EDIT: removed some images
EDIT: "new" demo files can now be found in original post
@SpannerMan:
On my machine (P4 2.53GHz, 512 MB RAM, GeForce FX 5600 Ultra, running Windows XP) the framerate in SkyDome demo drops from ~450 to ~70 after changing to this shader...
I'm completly new to both CG and material scripts, and have only played around a little bit with OGRE and 3d programming in general, but i suppose you could somehow use LOD materials and/or do like :wumpus: said. Clouds usually doesn't move all that fast, and the cloud formation speed that you can get in this script is plain ridiculous. Can create some nice effects though...
If you want to play with the settings I recommend downloading ATI RenderMonkey (DX effects, Atmosperic.rfx - Blue Sky).
EDIT: If anyone is interested, the effect is created by using perlin volume noise (perlinvolume.dds in media dir). Customizable parameters include cloud, sky & sun color, cloud coverage (noiseScale), sun direction, fallof & sharpness, cloud formation speed(cloudSpeed) and cloud movement speed(noiseSpeed).
EDIT: removed some images
EDIT: "new" demo files can now be found in original post
@SpannerMan:
On my machine (P4 2.53GHz, 512 MB RAM, GeForce FX 5600 Ultra, running Windows XP) the framerate in SkyDome demo drops from ~450 to ~70 after changing to this shader...
I'm completly new to both CG and material scripts, and have only played around a little bit with OGRE and 3d programming in general, but i suppose you could somehow use LOD materials and/or do like :wumpus: said. Clouds usually doesn't move all that fast, and the cloud formation speed that you can get in this script is plain ridiculous. Can create some nice effects though...
If you want to play with the settings I recommend downloading ATI RenderMonkey (DX effects, Atmosperic.rfx - Blue Sky).
EDIT: If anyone is interested, the effect is created by using perlin volume noise (perlinvolume.dds in media dir). Customizable parameters include cloud, sky & sun color, cloud coverage (noiseScale), sun direction, fallof & sharpness, cloud formation speed(cloudSpeed) and cloud movement speed(noiseSpeed).
Last edited by Mangetsu on Mon Jul 18, 2005 7:22 pm, edited 1 time in total.
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
Sorry for butting in, but with a little change of that script you can make some really impressive results. Like so!
Bigger: http://www.ihoed.com/public/clouds.jpg
I put the material around huge sphere just flattened by half at the Y axis.
Then I changed part of the material to:
Then added a little fog!
Thats it!
Also, this is my first post after lurking here almost for a year, so hello everyone!
Bigger: http://www.ihoed.com/public/clouds.jpg
I put the material around huge sphere just flattened by half at the Y axis.
Then I changed part of the material to:
Code: Select all
param_named cloudColor float4 1.0 1.0 1.0 1.0
param_named skyColor float4 0.11 0.24 0.53 1.0
param_named noiseScale float 4.1
param_named noiseBias float -1.0
param_named lightDir float4 0.92056 0.28344 0.26876 0.0
param_named sunColor float4 1.0 1.0 0.5 1.0
param_named sunFallOff float 3.5
param_named sunSharpness float 0.42
param_named cloudSpeed float 0.002
param_named noiseSpeed float 0.002
Code: Select all
mSceneMgr->setFog(Ogre::FOG_EXP2,ColourValue(0.87,0.98,1,0.5),0.0025,9000,20000);
Also, this is my first post after lurking here almost for a year, so hello everyone!
- Mangetsu
- Kobold
- Posts: 28
- Joined: Sun Jul 17, 2005 6:15 pm
- Location: Sweden
Nice!
It's good to see that there are people who aren't as lazy as me and actually creates something good-looking .
The main reason for uploading was to see what others would do with it (and to have others improve it for me ). The main issue is the speed though. If someone fix this, please let us now!
It's good to see that there are people who aren't as lazy as me and actually creates something good-looking .
The main reason for uploading was to see what others would do with it (and to have others improve it for me ). The main issue is the speed though. If someone fix this, please let us now!
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
I'm getting between 60-80 FPS on a Radeon 9500. Which is not to bad, considering I have 128 OgreNewt cubes in the same scene falling on to a huge TreeCollision mesh.
I've also discovered if you, set the alpha of the background of the shader material to 0 so it's transparent. And put another sky sphere behind that (with the same colour but darker shade), you can come up with some even more convincing clouds.. Well the clouds around here look like that; full of water, ready to rain.
But Wumpus is correct, if the shader could be only "ran" every x frames, it'll certainly speed things up.
I've also discovered if you, set the alpha of the background of the shader material to 0 so it's transparent. And put another sky sphere behind that (with the same colour but darker shade), you can come up with some even more convincing clouds.. Well the clouds around here look like that; full of water, ready to rain.
But Wumpus is correct, if the shader could be only "ran" every x frames, it'll certainly speed things up.
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Hey, this thread is cool!
It's good to see some Ogre shaders in action.
It's good to see some Ogre shaders in action.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
- Mangetsu
- Kobold
- Posts: 28
- Joined: Sun Jul 17, 2005 6:15 pm
- Location: Sweden
Yes, but the shader is running on the GPU, and the physics on the CPU? One of the benefits of using shaders is reducing the load on the CPU.I'm getting between 60-80 FPS on a Radeon 9500. Which is not to bad, considering I have 128 OgreNewt cubes in the same scene falling on to a huge TreeCollision mesh.
Does anyone know how to do this? I'm rather new to 3d programming so if someone could tell me how to do it that would be nice . As far as I can tell you can't do it directly with material script, and adding it to the shader might slow it down and make it require a better profile (the material script uses ps_2_0 already though). Is there any way to change the technique used directly from code or something?But Wumpus is correct, if the shader could be only "ran" every x frames, it'll certainly speed things up.
- Kencho
- OGRE Retired Moderator
- Posts: 4011
- Joined: Fri Sep 19, 2003 6:28 pm
- Location: Burgos, Spain
- x 2
- Contact:
I'm not sure but, can't this be done with dynamic textures? I would bet it can be done. Also, a more controlled effect could give a 3D look (this is, adding some illumination) and dynamic colouring to the clouds. I planned on doing this for the Caelum project, but there was no dynamic texture support yet, and I didn't (still don't) know about how to generate the clouds (noise functions and such...)
I guess it's time to prepare a demo
I guess it's time to prepare a demo
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
I've found putting the clouds on it's own sphere with a transparent background and adding another sphere surrounding it with a shade of colours is a pretty good effect.
I've been trying to change the cloudColour via changing the parameters of the material within the program. Without any luck I may add.
But I'm looking forward to Caelum2 though!
I've been trying to change the cloudColour via changing the parameters of the material within the program. Without any luck I may add.
But I'm looking forward to Caelum2 though!
- Mangetsu
- Kobold
- Posts: 28
- Joined: Sun Jul 17, 2005 6:15 pm
- Location: Sweden
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
- Mangetsu
- Kobold
- Posts: 28
- Joined: Sun Jul 17, 2005 6:15 pm
- Location: Sweden
Check here. APIs are invaluable .
But for non-compex meshes, you can do
to change the color of the clouds to green with full alpha. Any help?
[EDIT]
Sorry, too late
What do you mean by sun? Better than the one provided i suppose? Or do you use that for scattering effects?
[/EDIT]
But for non-compex meshes, you can do
Code: Select all
Entity->getSubEntity(0)->setCustomParameter(1, Vector4(0.0, 1.0, 0.0, 1.0));
[EDIT]
Sorry, too late
What do you mean by sun? Better than the one provided i suppose? Or do you use that for scattering effects?
[/EDIT]
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
Late, but thanks.
[Edit]
Well thats just a yellow (Well green in the case of yours) flare. I want a proper HDR one that melts your ice cream by looking at it.
The one that I can't export in the RenderMonkey demo's would do quite nicely. It also means that I can accurately track and move it and have nice sunset and sunrises.
[Edit]
Well thats just a yellow (Well green in the case of yours) flare. I want a proper HDR one that melts your ice cream by looking at it.
The one that I can't export in the RenderMonkey demo's would do quite nicely. It also means that I can accurately track and move it and have nice sunset and sunrises.
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
I believe there's a sun shader somewhere in the plsm2 map editor project?betajaen wrote:The one that I can't export in the RenderMonkey demo's would do quite nicely. It also means that I can accurately track and move it and have nice sunset and sunrises.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
- Mangetsu
- Kobold
- Posts: 28
- Joined: Sun Jul 17, 2005 6:15 pm
- Location: Sweden
Now, what's this yellow thing here? A new interesting shader perhaps?
Still needs some work though, so i'm not releasing it yet...
EDIT:
BTW, the clouds uses premade noise, but could be changed to create it's own noise for a bit more variation. I don't think I'm going to work on such things for now however...
Still needs some work though, so i'm not releasing it yet...
EDIT:
A bit of a late reply but yeah, it can probably be done with render to texture. I've decided to work on some shaders for now though. About the clouds illumination/coloring, that's what Terragen does, isn't it? I'm new to shaders so I don't really now how to do that. Might slow down quite a lot as well. Might not though...Kencho wrote:I'm not sure but, can't this be done with dynamic textures? I would bet it can be done. Also, a more controlled effect could give a 3D look (this is, adding some illumination) and dynamic colouring to the clouds. I planned on doing this for the Caelum project, but there was no dynamic texture support yet, and I didn't (still don't) know about how to generate the clouds (noise functions and such...)
BTW, the clouds uses premade noise, but could be changed to create it's own noise for a bit more variation. I don't think I'm going to work on such things for now however...
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
Oh you jammy monkey. I must have it.Mangetsu wrote:Now, what's this yellow thing here? A new interesting shader perhaps?
Still needs some work though, so i'm not releasing it yet...
- Azatoth
- Gnome
- Posts: 327
- Joined: Sat Jul 10, 2004 6:46 pm
- Location: Sweden
- x 4
- Contact:
This is looking really good! How similiar is it to this? http://www.alienstealth.de/mig/skysystem/
- skullfire
- Gremlin
- Posts: 150
- Joined: Sat Mar 19, 2005 7:51 pm
- Location: San Jose, Costa Rica
- Contact:
omg that sky system is awesome! Look at this!Azatoth wrote:This is looking really good! How similiar is it to this? http://www.alienstealth.de/mig/skysystem/
http://www.alienstealth.de/mig/skysyste ... o_dusk.avi
I may have alzheimer, but at least I dont have alzheimer.