Log in

View Full Version : Environmental effects


Kruger
03-26-07, 07:01 AM
Since my game was stuttering a lot in fog, I disabled the environmental effects. Good....the game looks very nice and runs smoothly now. But...I've lost water transparency, I no longer see my boat under the waves. Is there a way to get rid of the volumetric fog but keep the water effects ?>

SAMiV
03-26-07, 07:35 AM
I'd like to know answer for this one too.
I also wonder, that would it be possible for the devs to add extra option, so that you can seperately turn the fog and transparent water on or off.

Hartmann
03-26-07, 03:44 PM
Yes, could be very interesting extra options.

perhaps when sh3 hex edit genius and modders look into game files and can discover about change water transparency or other graphic options. :88)

PeriscopeDepth
03-26-07, 03:51 PM
Yeah, I wish they seperated the fog and water transparency too, but currently it's either both or none. I wonder which is more of a performance hit, fog or transparent water?

PD

GoldenEagle8
03-26-07, 04:05 PM
What are the chances of that sort of opotion being in the next patch?

(slim to none?)

Mud
03-26-07, 05:06 PM
Guys test something please ,'cos I think this makes the fog disappear.
Main folder /Data/shaders/VolumetricFog/VolumetricFogPS.fx <--- open with notepad and copy & paste this .... MAKE A BACKUP though.

struct PS_IN
{
float4 WSPos : TEXCOORD0;
float CSZ: TEXCOORD1;
float2 Tex:TEXCOORD2;
};

float elapsedTimeMod1000: register(c0);
float intensity: register(c1);
float3 fogColor: register(c2);


sampler3D volnoise: register(s0);
sampler depthBuffer: register(s1);


float ExpCutoff(float v,float cover,float sharpness)
{
float c=cover-v;
c=max(c,0);
c = 1 - pow(sharpness,c);
return c;
}

float4 main( PS_IN In ) : COLOR
{
//return 0.1;
//return float4(In.WSPos.xyz,1);
float4 wsp=tex2D(depthBuffer,In.Tex);
//return In.WSPos.y;
//return 0;
//return In.CSZ/50;
if(wsp.a<=0)wsp.a=1e10;
clip(wsp.a-In.CSZ);
//if(wsp.a>0 && wsp.a-In.CSZ<=0)return 0;
//else{
//return In.WSPos;
//return float4(1,1,1,0.02);

float scale=0;
float speed=0.00;
float3 windDirection={0,-0,0};

float3 t0=scale*In.WSPos.xyz*0.0031+elapsedTimeMod1000*0. 11*speed*windDirection;
float3 t1=scale*In.WSPos.xyz*0.0037+elapsedTimeMod1000*0. 13*speed*windDirection;
float3 t2=scale*In.WSPos.xyz*0.0029+elapsedTimeMod1000*0. 17*speed*windDirection;
float3 t3=scale*In.WSPos.xyz*0.0023+elapsedTimeMod1000*0. 19*speed*windDirection;
//float3 t4=scale*In.WSPos.xyz*0.0031+elapsedTimeMod1000*0. 05*speed*windDirection;
//float3 t5=scale*In.WSPos.xyz*0.0041+elapsedTimeMod1000*0. 29*speed*windDirection;
//float3 t6=scale*In.WSPos.xyz*0.0043+elapsedTimeMod1000*0. 23*speed*windDirection;
//float3 t7=scale*In.WSPos.xyz*0.0047+elapsedTimeMod1000*0. 07*speed*windDirection;

//return float4(wsp,1);
float3 v=In.WSPos.xyz-wsp.xyz;
float L=saturate(In.WSPos.y/2);
//L=1;
//return float4(v,1);
//float L=saturate(length(v)/10);
//L=saturate(dot(v,v)/40);
//L=1;
//return float4(L,L,L,1);
intensity*=L;
intensity*=saturate(1-In.WSPos.y/40);


float f=tex3D(volnoise,t0)+
tex3D(volnoise,t1*2)/2+
tex3D(volnoise,t2*4)/4+
tex3D(volnoise,t3*8)/8;
/*tex3D(volnoise,t4*16)/16+
tex3D(volnoise,t5*32)/32;
tex3D(volnoise,t6*64)/64+
tex3D(volnoise,t7*128)/128*/;
//f=saturate((f-0.2)*2);
//f*=1;
//f-=1.5;
//f=ExpCutoff(f,0.3,0.1);
//f+=saturate(1-In.WSPos.y/30);
//float brightness=0.2;
/*float a0=0.4;
float a1=0.0;
float a2=0.0;
if(f>a2)f=0;
else if(f<a0)f=0;
else{
if(f<a1)f=(f-a0)/(a1-a0);
else f=(a2-f)/(a2-a1);
}

//f=step(0.4,f)-step(0.45,f);
fogColor=float3(1,0,0)*f;*/

//intensity=1;
float alpha=pow(f,0.0)*intensity;
//return intensity;
//fogColor=0.2;
return float4( fogColor/*+brightness*/, alpha*0.0);

The fog is gone but it need testing.

Mud

Probex
03-26-07, 05:18 PM
I tested this code and the fog wasn't visible anymore. BUT, I am curious whether the fog is simply not visible but still calculated by the hardware, therefore offering no benefit, or is it truly off.
I think that the DEVs might be in a better position to implement this properly.

What I did notice with the fog off, were the lightshafts now visible in the atmospehere.
I guess the lightshafts interact with the fog to give it more realistic look.

Ideally we would want to disable the lightshafts (ABOVE water and NOT under the water) along with the fog. Or perhaps only the shafts above the water and leave the fog on.

There is separate code for the shafts above and below the surface, so it makes sense that it may be disabled separately.

Just a few more display options in the menu.

malkuth74
03-26-07, 05:55 PM
I had to shut it off too and it sucks. Some kind of bug where your framerates drop to 1 if you look at a certain spot. Some people have taken pictures of these so called spots and something is not right.

DJSatane
03-26-07, 05:58 PM
Well, I hope you guys also know about the bug related to environmental effects that is displayed in detail in this thread:

http://www.subsim.com/radioroom/showthread.php?t=108938

I am curious whether that bug still occurs when you disable just the fog.

What we would really want is to fix that mysterious polygon that appears with Environmental effects on and kills fps, maybe removing some routines while still having water transparency is possible.