Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Print Thread
Rating: 5
Page 1 of 3 1 2 3
heightFog #157755
09/29/07 13:43
09/29/07 13:43
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline OP
Senior Expert
ello  Offline 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.de
quoted: 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] #157756
09/29/07 13:57
09/29/07 13:57
Joined: Jun 2005
Posts: 4,875
broozar Offline
Expert
broozar  Offline
Expert

Joined: Jun 2005
Posts: 4,875
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)?

Re: heightFog [Re: broozar] #157757
09/29/07 14:39
09/29/07 14:39
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline OP
Senior Expert
ello  Offline 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.de
quoted: 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 Offline
Expert
frazzle  Offline
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: frazzle] #157759
09/30/07 15:11
09/30/07 15:11
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline OP
Senior Expert
ello  Offline OP
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
?? i did set it via the vertical position


www.earthcontrol.de
quoted: 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] #157760
09/30/07 16:37
09/30/07 16:37
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
frazzle Offline
Expert
frazzle  Offline
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: frazzle] #157761
09/30/07 17:57
09/30/07 17:57
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline OP
Senior Expert
ello  Offline OP
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
really? if i want to fade something from bottom up, i have to use the vertical position. if i'd use the horizontal position the fog would fade from left to right, which really would look strange

Re: heightFog [Re: ello] #157762
09/30/07 18:04
09/30/07 18:04
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

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 Offline OP
Senior Expert
ello  Offline 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;




Re: heightFog [Re: ello] #157764
09/30/07 18:52
09/30/07 18:52
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline

Senior Expert
Orange Brat  Offline

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
This is a nice effect. Thanks for yet another useful contribution.


My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Page 1 of 3 1 2 3

Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1