2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
heightFog
#157755
09/29/07 13:43
09/29/07 13:43
|
Joined: Oct 2002
Posts: 8,939 planet.earth
ello
OP
Senior Expert
|
OP
Senior Expert
Joined: Oct 2002
Posts: 8,939
planet.earth
|
well, its nothing special, but while i was using it i thought maybe someone else will have usage for it, too. in the screenshot its applied to a skydome and gives a quite nice transition to the sky. Code:
float4x4 matWorldViewProj;
float4 vecFog;
struct VS_IN { float4 position : POSITION; float2 texCoord : TEXCOORD0; };
struct VS_OUT { float4 position : POSITION; float2 texCoord : TEXCOORD0; float Fog : FOG; };
VS_OUT mainVS (VS_IN In) { VS_OUT Out; Out.position = mul(In.position,matWorldViewProj); Out.Fog = (In.position.y/1500)-0.25; // you may need to adjust these values till it fits Out.texCoord = In.texCoord; return Out; }
texture entSkin1;
sampler basemap = sampler_state { Texture = <entSkin1>; MipFilter = LINEAR; MinFilter = LINEAR; MagFilter = LINEAR; AddressU = Wrap; Addressv = Wrap; };
float4 mainPS (VS_OUT In) : COLOR0 { return tex2D(basemap,In.texCoord); }
technique heightFog { pass p0 { VertexShader = compile vs_1_1 mainVS(); PixelShader = compile ps_1_1 mainPS(); } }
www.earthcontrol.dequoted: We want to maintain a clean, decent, American family suited forum look... which means you may post zombies or chainsaw massacres, but no erotic.
|
|
|
Re: heightFog
[Re: broozar]
#157757
09/29/07 14:39
09/29/07 14:39
|
Joined: Oct 2002
Posts: 8,939 planet.earth
ello
OP
Senior Expert
|
OP
Senior Expert
Joined: Oct 2002
Posts: 8,939
planet.earth
|
Quote:
screenshot looks good, except for the goofy bunny. the illusion of landscape depth is awesome. some qs: - what does the shader do exactly (heightfog- onöy fog on top or on all sides of the dome/cube?), - how's the impact on frame rate and - can i choose colors or will it be adjusted according to the sky texture? - does it work wit a6 and - can it be applied to a sky cube that's only generated by script (without a model, just a +6 bmp)?
well, the fog just uses the vertical position as you can tell from the code. the impact on the framerate is 0 and the color is the one you have set for the fog. it works with a6 for sure but you need to test yourself how it works with a skycube (it should work)
hey, dont tell bad things about that great bunny i am very happy badapple did that one
www.earthcontrol.dequoted: We want to maintain a clean, decent, American family suited forum look... which means you may post zombies or chainsaw massacres, but no erotic.
|
|
|
Re: heightFog
[Re: ello]
#157758
09/30/07 14:54
09/30/07 14:54
|
Joined: Mar 2006
Posts: 2,758 Antwerp,Belgium
frazzle
Expert
|
Expert
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
|
The transition is nice indeed, I guess the color to color passage works via the sampler which is included in the colormap you attached to the skydome relative to the color you set in WED or in SED. Btw, why didn't you set it through the horizontical position ?? Thanks for the effort and UC ello !! Cheers Frazzle
Antec® Case Intel® X58 Chipset Intel® i7 975 Quad Core 8 GB RAM DDR3 SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB NVIDIA® GeForce GTX 295 Memory 1795GB
|
|
|
Re: heightFog
[Re: ello]
#157760
09/30/07 16:37
09/30/07 16:37
|
Joined: Mar 2006
Posts: 2,758 Antwerp,Belgium
frazzle
Expert
|
Expert
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
|
Yes I know, but I wonder why you did it via the vertical and not the horizontical position ?? Cheers Frazzle
Antec® Case Intel® X58 Chipset Intel® i7 975 Quad Core 8 GB RAM DDR3 SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB NVIDIA® GeForce GTX 295 Memory 1795GB
|
|
|
Re: heightFog
[Re: ello]
#157762
09/30/07 18:04
09/30/07 18:04
|
Joined: Jul 2001
Posts: 6,904
HeelX
Senior Expert
|
Senior Expert
Joined: Jul 2001
Posts: 6,904
|
Nice job!
I assume the fog transists with the position of the camera. Can I adjust it by.. uhm.. lets say a global variable? Can I also adjust the other variables which determine the fading and density behaviour with global variables (or whatever)?.. better question: how do I do this?
Last edited by HeelX; 09/30/07 18:05.
|
|
|
Re: heightFog
[Re: HeelX]
#157763
09/30/07 18:32
09/30/07 18:32
|
Joined: Oct 2002
Posts: 8,939 planet.earth
ello
OP
Senior Expert
|
OP
Senior Expert
Joined: Oct 2002
Posts: 8,939
planet.earth
|
yes, one would just need to replace the values in the following line by material or entity skills: Code:
Out.Fog = (In.position.y/1500)-0.25;
the 1500 is used for scaling the fade. and the other number goves a density offset. just change the values and see what happens btw, you can use the following line and set a vertical offset by the new value: Code:
Out.Fog = ((In.position.y-1100)/1500)-0.25;
|
|
|
|