* Implementation of sRGB image support. Overhauls the linearization setup to utilize the sRGB image types, as well as refactors the use of ColorF and ColorI to be properly internally consistent. ColorIs are used only for front-facing/editing/UI settings, and ColorFs, now renamed to LinearColorF to reduce confusion of purpose, are used for color info in the engine itself. This avoids confusing and expensive conversions back and forth between types and avoids botches with linearity. Majority work done by @rextimmy

This commit is contained in:
Areloch 2017-07-08 02:56:09 -05:00
parent 296ab5b532
commit d07abe8ad2
41 changed files with 69 additions and 184 deletions

View file

@ -35,6 +35,7 @@ new GFXStateBlockData( AL_DeferredShadingState : PFX_DefaultStateBlock )
samplerStates[1] = SamplerWrapLinear;
samplerStates[2] = SamplerWrapLinear;
samplerStates[3] = SamplerWrapLinear;
samplerStates[4] = SamplerWrapLinear;
};
new ShaderData( AL_DeferredShader )

View file

@ -36,7 +36,7 @@ new GFXStateBlockData( AL_VectorLightState )
samplersDefined = true;
samplerStates[0] = SamplerClampPoint; // G-buffer
mSamplerNames[0] = "prePassBuffer";
mSamplerNames[0] = "deferredBuffer";
samplerStates[1] = SamplerClampPoint; // Shadow Map (Do not change this to linear, as all cards can not filter equally.)
mSamplerNames[1] = "shadowMap";
samplerStates[2] = SamplerClampPoint; // Shadow Map (Do not change this to linear, as all cards can not filter equally.)
@ -66,7 +66,7 @@ new ShaderData( AL_VectorLightShader )
OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/farFrustumQuadV.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/vectorLightP.glsl";
samplerNames[0] = "$prePassBuffer";
samplerNames[0] = "$deferredBuffer";
samplerNames[1] = "$shadowMap";
samplerNames[2] = "$dynamicShadowMap";
samplerNames[3] = "$ssaoMask";
@ -83,7 +83,7 @@ new CustomMaterial( AL_VectorLightMaterial )
shader = AL_VectorLightShader;
stateBlock = AL_VectorLightState;
sampler["prePassBuffer"] = "#deferred";
sampler["deferredBuffer"] = "#deferred";
sampler["shadowMap"] = "$dynamiclight";
sampler["dynamicShadowMap"] = "$dynamicShadowMap";
sampler["ssaoMask"] = "#ssaoMask";
@ -114,7 +114,7 @@ new GFXStateBlockData( AL_ConvexLightState )
samplersDefined = true;
samplerStates[0] = SamplerClampPoint; // G-buffer
mSamplerNames[0] = "prePassBuffer";
mSamplerNames[0] = "deferredBuffer";
samplerStates[1] = SamplerClampPoint; // Shadow Map (Do not use linear, these are perspective projections)
mSamplerNames[1] = "shadowMap";
samplerStates[2] = SamplerClampPoint; // Shadow Map (Do not use linear, these are perspective projections)
@ -143,7 +143,7 @@ new ShaderData( AL_PointLightShader )
OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/convexGeometryV.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/pointLightP.glsl";
samplerNames[0] = "$prePassBuffer";
samplerNames[0] = "$deferredBuffer";
samplerNames[1] = "$shadowMap";
samplerNames[2] = "$dynamicShadowMap";
samplerNames[3] = "$cookieMap";
@ -160,7 +160,7 @@ new CustomMaterial( AL_PointLightMaterial )
shader = AL_PointLightShader;
stateBlock = AL_ConvexLightState;
sampler["prePassBuffer"] = "#deferred";
sampler["deferredBuffer"] = "#deferred";
sampler["shadowMap"] = "$dynamiclight";
sampler["dynamicShadowMap"] = "$dynamicShadowMap";
sampler["cookieMap"] = "$dynamiclightmask";
@ -182,7 +182,7 @@ new ShaderData( AL_SpotLightShader )
OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/convexGeometryV.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/spotLightP.glsl";
samplerNames[0] = "$prePassBuffer";
samplerNames[0] = "$deferredBuffer";
samplerNames[1] = "$shadowMap";
samplerNames[2] = "$dynamicShadowMap";
samplerNames[3] = "$cookieMap";
@ -199,7 +199,7 @@ new CustomMaterial( AL_SpotLightMaterial )
shader = AL_SpotLightShader;
stateBlock = AL_ConvexLightState;
sampler["prePassBuffer"] = "#deferred";
sampler["deferredBuffer"] = "#deferred";
sampler["shadowMap"] = "$dynamiclight";
sampler["dynamicShadowMap"] = "$dynamicShadowMap";
sampler["cookieMap"] = "$dynamiclightmask";
@ -259,7 +259,7 @@ new ShaderData( AL_ParticlePointLightShader )
OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/convexGeometryV.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/pointLightP.glsl";
samplerNames[0] = "$prePassBuffer";
samplerNames[0] = "$deferredBuffer";
pixVersion = 3.0;
};
@ -269,7 +269,7 @@ new CustomMaterial( AL_ParticlePointLightMaterial )
shader = AL_ParticlePointLightShader;
stateBlock = AL_ConvexLightState;
sampler["prePassBuffer"] = "#deferred";
sampler["deferredBuffer"] = "#deferred";
target = "lightinfo";
pixVersion = 3.0;

View file

@ -48,15 +48,14 @@ singleton PostEffect( GammaPostFX )
renderTime = "PFXBeforeBin";
renderBin = "EditorBin";
renderPriority = 9999;
renderPriority = 9998;
shader = GammaShader;
stateBlock = GammaStateBlock;
texture[0] = "$backBuffer";
texture[1] = $HDRPostFX::colorCorrectionRamp;
targetFormat = getBestHDRFormat();
textureSRGB[1] = true;
};
function GammaPostFX::preProcess( %this )

View file

@ -273,10 +273,6 @@ function HDRPostFX::preProcess( %this )
function HDRPostFX::onEnabled( %this )
{
// We don't allow hdr on OSX yet.
if ( $platform $= "macos" )
return false;
// See what HDR format would be best.
%format = getBestHDRFormat();
if ( %format $= "" || %format $= "GFXFormatR8G8B8A8" )

View file

@ -33,7 +33,8 @@ function initRenderManager()
{
enabled = "false";
format = getBestHDRFormat();
//When hdr is enabled this will be changed to the appropriate format
format = "GFXFormatR8G8B8A8_SRGB";
depthFormat = "GFXFormatD24S8";
aaLevel = 0; // -1 = match backbuffer

View file

@ -56,7 +56,7 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0
float2 uvscreen=((IN.htpos.xy/IN.htpos.w) + 1.0 ) / 2.0;
uvscreen.y = 1.0 - uvscreen.y;
float obj_test = TORQUE_PREPASS_UNCONDITION(deferredTex, uvscreen).w * preBias;
float obj_test = TORQUE_DEFERRED_UNCONDITION(deferredTex, uvscreen).w * preBias;
float depth = TORQUE_TEX2D(depthBuffer, uvscreen).r;
float front = TORQUE_TEX2D(frontBuffer, uvscreen).r;

View file

@ -36,7 +36,7 @@
uniform float oneOverFar;
uniform sampler2D deferredTex;
//uniform vec3 vEye;
uniform vec4 prePassTargetParams;
uniform vec4 deferredTargetParams;
#endif
#define CLIP_Z // TODO: Make this a proper macro
@ -86,7 +86,7 @@ void main()
#ifdef SOFTPARTICLES
vec2 tc = IN_pos.xy * vec2(1.0, -1.0) / IN_pos.w;
tc = viewportCoordToRenderTarget(saturate( ( tc + 1.0 ) * 0.5 ), prePassTargetParams);
tc = viewportCoordToRenderTarget(saturate( ( tc + 1.0 ) * 0.5 ), deferredTargetParams);
float sceneDepth = deferredUncondition( deferredTex, tc ).w;
float depth = IN_pos.w * oneOverFar;

View file

@ -35,7 +35,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
float4 colorBuffer = TORQUE_TEX2D( colorBufferTex, IN.uv0 );
float4 matInfo = TORQUE_TEX2D( matInfoTex, IN.uv0 );
float specular = saturate(lightBuffer.a);
float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w;
float depth = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ).w;
if (depth>0.9999)
return float4(0,0,0,0);

View file

@ -103,7 +103,7 @@ uniform samplerCube cookieMap ;
#endif
uniform sampler2D prePassBuffer;
uniform sampler2D deferredBuffer;
#ifdef SHADOW_CUBE
uniform samplerCube shadowMap;
@ -159,7 +159,7 @@ void main()
}
// Sample/unpack the normal/z data
vec4 deferredSample = deferredUncondition( prePassBuffer, uvScene );
vec4 deferredSample = deferredUncondition( deferredBuffer, uvScene );
vec3 normal = deferredSample.rgb;
float depth = deferredSample.a;

View file

@ -46,7 +46,7 @@ uniform sampler2D cookieMap;
#endif
uniform sampler2D prePassBuffer;
uniform sampler2D deferredBuffer;
uniform sampler2D shadowMap;
uniform sampler2D dynamicShadowMap;
@ -101,7 +101,7 @@ void main()
}
// Sample/unpack the normal/z data
vec4 deferredSample = deferredUncondition( prePassBuffer, uvScene );
vec4 deferredSample = deferredUncondition( deferredBuffer, uvScene );
vec3 normal = deferredSample.rgb;
float depth = deferredSample.a;

View file

@ -42,7 +42,7 @@ uniform sampler2D ssaoMask ;
uniform vec4 rtParams3;
#endif
uniform sampler2D prePassBuffer;
uniform sampler2D deferredBuffer;
uniform sampler2D lightBuffer;
uniform sampler2D colorBuffer;
uniform sampler2D matInfoBuffer;
@ -214,7 +214,7 @@ void main()
}
// Sample/unpack the normal/z data
vec4 deferredSample = deferredUncondition( prePassBuffer, uv0 );
vec4 deferredSample = deferredUncondition( deferredBuffer, uv0 );
vec3 normal = deferredSample.rgb;
float depth = deferredSample.a;

View file

@ -34,7 +34,7 @@ struct ConvexConnectP
float3 vsEyeDir : TEXCOORD1;
};
TORQUE_UNIFORM_SAMPLER2D(prePassBuffer, 0);
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
uniform float4 lightPosition;
uniform float4 lightColor;
@ -49,7 +49,7 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
float2 uvScene = getUVFromSSPos(ssPos, rtParams0);
// Sample/unpack the normal/z data
float4 deferredSample = TORQUE_PREPASS_UNCONDITION(prePassBuffer, uvScene);
float4 deferredSample = TORQUE_DEFERRED_UNCONDITION(deferredBuffer, uvScene);
float3 normal = deferredSample.rgb;
float depth = deferredSample.a;

View file

@ -106,7 +106,7 @@ TORQUE_UNIFORM_SAMPLERCUBE(cookieMap, 3);
#endif
TORQUE_UNIFORM_SAMPLER2D(prePassBuffer, 0);
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
#ifdef SHADOW_CUBE
TORQUE_UNIFORM_SAMPLERCUBE(shadowMap, 1);
@ -161,7 +161,7 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
}
// Sample/unpack the normal/z data
float4 deferredSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, uvScene );
float4 deferredSample = TORQUE_DEFERRED_UNCONDITION( deferredBuffer, uvScene );
float3 normal = deferredSample.rgb;
float depth = deferredSample.a;

View file

@ -38,7 +38,7 @@ struct ConvexConnectP
float4 vsEyeDir : TEXCOORD2;
};
TORQUE_UNIFORM_SAMPLER2D(prePassBuffer, 0);
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1);
TORQUE_UNIFORM_SAMPLER2D(dynamicShadowMap,2);
@ -99,7 +99,7 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
}
// Sample/unpack the normal/z data
float4 deferredSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, uvScene );
float4 deferredSample = TORQUE_DEFERRED_UNCONDITION( deferredBuffer, uvScene );
float3 normal = deferredSample.rgb;
float depth = deferredSample.a;

View file

@ -30,7 +30,7 @@
#include "../shadowMap/shadowMapIO_HLSL.h"
#include "softShadow.hlsl"
TORQUE_UNIFORM_SAMPLER2D(prePassBuffer, 0);
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1);
TORQUE_UNIFORM_SAMPLER2D(dynamicShadowMap, 2);
@ -213,7 +213,7 @@ float4 main( FarFrustumQuadConnectP IN ) : TORQUE_TARGET0
subsurface = float3(0.337255, 0.772549, 0.262745);
}
// Sample/unpack the normal/z data
float4 deferredSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, IN.uv0 );
float4 deferredSample = TORQUE_DEFERRED_UNCONDITION( deferredBuffer, IN.uv0 );
float3 normal = deferredSample.rgb;
float depth = deferredSample.a;

View file

@ -35,7 +35,7 @@
uniform float oneOverFar;
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1);
//uniform float3 vEye;
uniform float4 prePassTargetParams;
uniform float4 deferredTargetParams;
#endif
#define CLIP_Z // TODO: Make this a proper macro
@ -82,9 +82,9 @@ float4 main( Conn IN ) : TORQUE_TARGET0
#ifdef SOFTPARTICLES
float2 tc = IN.pos.xy * float2(1.0, -1.0) / IN.pos.w;
tc = viewportCoordToRenderTarget(saturate( ( tc + 1.0 ) * 0.5 ), prePassTargetParams);
tc = viewportCoordToRenderTarget(saturate( ( tc + 1.0 ) * 0.5 ), deferredTargetParams);
float sceneDepth = TORQUE_PREPASS_UNCONDITION(deferredTex, tc).w;
float sceneDepth = TORQUE_DEFERRED_UNCONDITION(deferredTex, tc).w;
float depth = IN.pos.w * oneOverFar;
float diff = sceneDepth - depth;
#ifdef CLIP_Z

View file

@ -40,10 +40,10 @@ float distanceToPlane(float4 plane, float3 pos)
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{
//Sample the pre-pass
float4 prePass = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 );
float4 deferred = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 );
//Get depth
float depth = prePass.w;
float depth = deferred.w;
if(depth > 0.9999)
return float4(0,0,0,0);
@ -71,7 +71,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
//Use normal Z to modulate caustics
//float waterDepth = 1 - saturate(pos.z + waterFogPlane.w + 1);
caustics *= saturate(prePass.z) * pow(abs(1-depth), 64) * waterDepth;
caustics *= saturate(deferred.z) * pow(abs(1-depth), 64) * waterDepth;
return caustics;
}

View file

@ -44,10 +44,10 @@ float distanceToPlane(vec4 plane, vec3 pos)
void main()
{
//Sample the pre-pass
vec4 prePass = deferredUncondition( deferredTex, IN_uv0 );
vec4 deferred = deferredUncondition( deferredTex, IN_uv0 );
//Get depth
float depth = prePass.w;
float depth = deferred.w;
if(depth > 0.9999)
{
OUT_col = vec4(0,0,0,0);
@ -81,7 +81,7 @@ void main()
//Use normal Z to modulate caustics
//float waterDepth = 1 - saturate(pos.z + waterFogPlane.w + 1);
caustics *= saturate(prePass.z) * pow(1-depth, 64) * waterDepth;
caustics *= saturate(deferred.z) * pow(1-depth, 64) * waterDepth;
OUT_col = caustics;
}

View file

@ -88,10 +88,10 @@ half4 main( Pixel IN ) : TORQUE_TARGET0
[unroll] // coc[i] causes this anyway
for (int i = 0; i < 4; i++)
{
depth[0] = TORQUE_PREPASS_UNCONDITION(depthSampler, (IN.tcDepth0.xy + rowOfs[i])).w;
depth[1] = TORQUE_PREPASS_UNCONDITION(depthSampler, (IN.tcDepth1.xy + rowOfs[i])).w;
depth[2] = TORQUE_PREPASS_UNCONDITION(depthSampler, (IN.tcDepth2.xy + rowOfs[i])).w;
depth[3] = TORQUE_PREPASS_UNCONDITION(depthSampler, (IN.tcDepth3.xy + rowOfs[i])).w;
depth[0] = TORQUE_DEFERRED_UNCONDITION(depthSampler, (IN.tcDepth0.xy + rowOfs[i])).w;
depth[1] = TORQUE_DEFERRED_UNCONDITION(depthSampler, (IN.tcDepth1.xy + rowOfs[i])).w;
depth[2] = TORQUE_DEFERRED_UNCONDITION(depthSampler, (IN.tcDepth2.xy + rowOfs[i])).w;
depth[3] = TORQUE_DEFERRED_UNCONDITION(depthSampler, (IN.tcDepth3.xy + rowOfs[i])).w;
coc = max(coc, clamp(dofEqWorld4X * half4(depth)+dofEqWorld4Y, zero4, maxWorldCoC4));
}

View file

@ -71,7 +71,7 @@ half4 InterpolateDof( half3 small, half3 med, half3 large, half t )
// d0, the small to medium blur over distance d1, and the medium to
// large blur over distance d2, where d0 + d1 + d2 = 1.
//float4 dofLerpScale = float4( -1 / d0, -1 / d1, -1 / d2, 1 / d2 );
//float4 dofLerpBias = float4( 1, (1 d2) / d1, 1 / d2, (d2 1) / d2 );
//float4 dofLerpBias = float4( 1, (1 <EFBFBD> d2) / d1, 1 / d2, (d2 <20> 1) / d2 );
weights = half4(saturate( t * dofLerpScale + dofLerpBias ));
weights.yz = min( weights.yz, 1 - weights.xy );
@ -115,7 +115,7 @@ half4 main( PFXVertToPix IN ) : TORQUE_TARGET0
//med.rgb = large;
//nearCoc = 0;
depth = half(TORQUE_PREPASS_UNCONDITION( depthSampler, IN.uv3 ).w);
depth = half(TORQUE_DEFERRED_UNCONDITION( depthSampler, IN.uv3 ).w);
//return half4(depth.rrr,1);
//return half4(nearCoc.rrr,1.0);

View file

@ -50,7 +50,7 @@ float GetEdgeWeight(float2 uv0, in float2 targetSize)
for(int i = 0; i < 9; i++)
{
float2 uv = uv0 + offsets[i] * PixelSize;
float4 gbSample = TORQUE_PREPASS_UNCONDITION( deferredBuffer, uv );
float4 gbSample = TORQUE_DEFERRED_UNCONDITION( deferredBuffer, uv );
Depth[i] = gbSample.a;
Normal[i] = gbSample.rgb;
}

View file

@ -34,7 +34,7 @@ uniform float4 rtParams0;
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{
//float2 deferredCoord = ( IN.uv0.xy * rtParams0.zw ) + rtParams0.xy;
float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w;
float depth = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ).w;
//return float4( depth, 0, 0, 0.7 );
float factor = computeSceneFog( eyePosWorld,
@ -43,5 +43,5 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
fogData.y,
fogData.z );
return hdrEncode( float4( toLinear(fogColor.rgb), 1.0 - saturate( factor ) ) );
return hdrEncode( float4( fogColor.rgb, 1.0 - saturate( factor ) ) );
}

View file

@ -40,9 +40,6 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
color.g = TORQUE_TEX1D( colorCorrectionTex, color.g ).g;
color.b = TORQUE_TEX1D( colorCorrectionTex, color.b ).b;
// Apply gamma correction
color.rgb = pow( saturate(color.rgb), OneOverGamma );
// Apply contrast
color.rgb = ((color.rgb - 0.5f) * Contrast) + 0.5f;

View file

@ -48,5 +48,5 @@ void main()
fogData.y,
fogData.z );
OUT_col = hdrEncode( vec4( toLinear(fogColor.rgb), 1.0 - saturate( factor ) ) );
OUT_col = hdrEncode( vec4( fogColor.rgb, 1.0 - saturate( factor ) ) );
}

View file

@ -44,9 +44,6 @@ void main()
color.g = texture( colorCorrectionTex, color.g ).g;
color.b = texture( colorCorrectionTex, color.b ).b;
// Apply gamma correction
color.rgb = pow( clamp(color.rgb, vec3(0.0),vec3(1.0)), vec3(OneOverGamma) );
// Apply contrast
color.rgb = ((color.rgb - 0.5f) * Contrast) + 0.5f;

View file

@ -87,15 +87,6 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
sample.r = TORQUE_TEX1D( colorCorrectionTex, sample.r ).r;
sample.g = TORQUE_TEX1D( colorCorrectionTex, sample.g ).g;
sample.b = TORQUE_TEX1D( colorCorrectionTex, sample.b ).b;
// Apply gamma correction
sample.rgb = pow( saturate(sample.rgb), g_fOneOverGamma );
// Apply contrast
sample.rgb = ((sample.rgb - 0.5f) * Contrast) + 0.5f;
// Apply brightness
sample.rgb += Brightness;
return sample;
}

View file

@ -93,14 +93,5 @@ void main()
_sample.g = texture( colorCorrectionTex, _sample.g ).g;
_sample.b = texture( colorCorrectionTex, _sample.b ).b;
// Apply gamma correction
_sample.rgb = pow( _sample.rgb, vec3(g_fOneOverGamma) );
// Apply contrast
_sample.rgb = ((_sample.rgb - 0.5f) * Contrast) + 0.5f;
// Apply brightness
_sample.rgb += Brightness;
OUT_col = _sample;
}

View file

@ -36,7 +36,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
float4 col = float4( 0, 0, 0, 1 );
// Get the depth at this pixel.
float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w;
float depth = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ).w;
// If the depth is equal to 1.0, read from the backbuffer
// and perform the exposure calculation on the result.

View file

@ -37,7 +37,7 @@ float4 main(PFXVertToPix IN) : TORQUE_TARGET0
float samples = 5;
// First get the deferred texture for uv channel 0
float4 deferred = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 );
float4 deferred = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 );
// Next extract the depth
float depth = deferred.a;

View file

@ -49,7 +49,7 @@ uniform float blurNormalTol;
void sample( float2 uv, float weight, float4 centerTap, inout int usedCount, inout float occlusion, inout float total )
{
//return;
float4 tap = TORQUE_PREPASS_UNCONDITION( deferredMap, uv );
float4 tap = TORQUE_DEFERRED_UNCONDITION( deferredMap, uv );
if ( abs( tap.a - centerTap.a ) < blurDepthTol )
{
@ -65,7 +65,7 @@ void sample( float2 uv, float weight, float4 centerTap, inout int usedCount, ino
float4 main( VertToPix IN ) : TORQUE_TARGET0
{
//float4 centerTap;
float4 centerTap = TORQUE_PREPASS_UNCONDITION( deferredMap, IN.uv0.zw );
float4 centerTap = TORQUE_DEFERRED_UNCONDITION( deferredMap, IN.uv0.zw );
//return centerTap;

View file

@ -143,7 +143,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
float3 reflectNormal = normalize( TORQUE_TEX2DLOD( randNormalTex, noiseMapUV ).xyz * 2.0 - 1.0 );
//return float4( reflectNormal, 1 );
float4 deferred = TORQUE_PREPASS_UNCONDITION( deferredMap, IN.uv0 );
float4 deferred = TORQUE_DEFERRED_UNCONDITION( deferredMap, IN.uv0 );
float3 normal = deferred.xyz;
float depth = deferred.a;
//return float4( ( depth ).xxx, 1 );
@ -183,7 +183,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
//if ( radiusDepth.x < 1.0 / targetSize.x )
// return color;
//radiusDepth.xyz = 0.0009;
[unroll]
for ( i = 0; i < sSampleCount; i++ )
{
baseRay = reflect( ptSphere[i], reflectNormal );
@ -197,7 +197,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
se = ep + ray;
occluderFragment = TORQUE_PREPASS_UNCONDITION( deferredMap, se.xy );
occluderFragment = TORQUE_DEFERRED_UNCONDITION( deferredMap, se.xy );
depthDiff = se.z - occluderFragment.a;
@ -232,7 +232,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
//if ( radiusDepth.x < 1.0 / targetSize.x )
// return color;
//radiusDepth.xyz = 0.0009;
[unroll]
for ( i = sSampleCount; i < totalSampleCount; i++ )
{
baseRay = reflect( ptSphere[i], reflectNormal );
@ -246,7 +246,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
se = ep + ray;
occluderFragment = TORQUE_PREPASS_UNCONDITION( deferredMap, se.xy );
occluderFragment = TORQUE_DEFERRED_UNCONDITION( deferredMap, se.xy );
depthDiff = se.z - occluderFragment.a;

View file

@ -55,7 +55,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{
//float2 deferredCoord = IN.uv0;
//IN.uv0 = ( IN.uv0.xy * rtParams0.zw ) + rtParams0.xy;
float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w;
float depth = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ).w;
//return float4( depth.rrr, 1 );
// Skip fogging the extreme far plane so that

View file

@ -27,9 +27,9 @@
// Portability helpers for autogenConditioners
#if (TORQUE_SM >= 10 && TORQUE_SM <=30)
#define TORQUE_PREPASS_UNCONDITION(tex, coords) deferredUncondition(tex, coords)
#define TORQUE_DEFERRED_UNCONDITION(tex, coords) deferredUncondition(tex, coords)
#elif TORQUE_SM >= 40
#define TORQUE_PREPASS_UNCONDITION(tex, coords) deferredUncondition(tex, texture_##tex, coords)
#define TORQUE_DEFERRED_UNCONDITION(tex, coords) deferredUncondition(tex, texture_##tex, coords)
#endif
#endif //_TORQUE_SHADERMODEL_AUTOGEN_

View file

@ -120,7 +120,6 @@ void main()
{
// Modulate baseColor by the ambientColor.
vec4 waterBaseColor = baseColor * vec4( ambientColor.rgb, 1 );
waterBaseColor = toLinear(waterBaseColor);
// Get the bumpNorm...
vec3 bumpNorm = ( texture( bumpMap, IN_rippleTexCoord01.xy ).rgb * 2.0 - 1.0 ) * rippleMagnitude.x;

View file

@ -324,7 +324,6 @@ void main()
// Calculate the water "base" color based on depth.
vec4 waterBaseColor = baseColor * texture( depthGradMap, saturate( delta / depthGradMax ) );
waterBaseColor = toLinear(waterBaseColor);
// Modulate baseColor by the ambientColor.
waterBaseColor *= vec4( ambientColor.rgb, 1 );

View file

@ -117,7 +117,6 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0
{
// Modulate baseColor by the ambientColor.
float4 waterBaseColor = baseColor * float4( ambientColor.rgb, 1 );
waterBaseColor = toLinear(waterBaseColor);
// Get the bumpNorm...
float3 bumpNorm = ( TORQUE_TEX2D( bumpMap, IN.rippleTexCoord01.xy ).rgb * 2.0 - 1.0 ) * rippleMagnitude.x;

View file

@ -155,7 +155,7 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0
float2 deferredCoord = viewportCoordToRenderTarget( IN.posPostWave, rtParams1 );
float startDepth = TORQUE_PREPASS_UNCONDITION( deferredTex, deferredCoord ).w;
float startDepth = TORQUE_DEFERRED_UNCONDITION( deferredTex, deferredCoord ).w;
// The water depth in world units of the undistorted pixel.
float startDelta = ( startDepth - pixelDepth );
@ -180,7 +180,7 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0
deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 );
// Get deferred depth at the position of this distorted pixel.
float deferredDepth = TORQUE_PREPASS_UNCONDITION( deferredTex, deferredCoord ).w;
float deferredDepth = TORQUE_DEFERRED_UNCONDITION( deferredTex, deferredCoord ).w;
if ( deferredDepth > 0.99 )
deferredDepth = 5.0;
@ -212,7 +212,7 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0
deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 );
// Get deferred depth at the position of this distorted pixel.
deferredDepth = TORQUE_PREPASS_UNCONDITION( deferredTex, deferredCoord ).w;
deferredDepth = TORQUE_DEFERRED_UNCONDITION( deferredTex, deferredCoord ).w;
if ( deferredDepth > 0.99 )
deferredDepth = 5.0;
delta = ( deferredDepth - pixelDepth ) * farPlaneDist;
@ -311,7 +311,6 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0
// Calculate the water "base" color based on depth.
float4 waterBaseColor = baseColor * TORQUE_TEX1D( depthGradMap, saturate( delta / depthGradMax ) );
waterBaseColor = toLinear(waterBaseColor);
// Modulate baseColor by the ambientColor.
waterBaseColor *= float4( ambientColor.rgb, 1 );

View file

@ -865,65 +865,6 @@
canSaveDynamicFields = "0";
};
};
new GuiControl() {
position = "0 160";
extent = "450 20";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiTextCtrl() {
text = "Gamma";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "0 0";
extent = "175 20";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuTextProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiSliderCtrl() {
range = "2 2.5";
ticks = "0";
snap = "0";
value = "2";
position = "190 0";
extent = "261 20";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiSliderProfile";
visible = "1";
active = "1";
variable = "$pref::Video::Gamma";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiControl() {
position = "0 180";
extent = "450 20";

View file

@ -718,22 +718,6 @@
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiCheckBoxCtrl() {
text = "use sRGB";
groupNum = "-1";
buttonType = "ToggleButton";
useMouseEvents = "0";
position = "360 105";
extent = "66 16";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiCheckBoxProfile";
visible = "1";
active = "1";
variable = "$displayAsSRGB";
command = "useSRGBctrl($displayAsSRGB);";
};
};
};
//--- OBJECT WRITE END ---
@ -743,15 +727,6 @@ $ColorPickerCancelCallback = "";
$ColorPickerUpdateCallback = "";
$ColorCallbackType = 1; // ColorI
function useSRGBctrl(%colorScale)
{
ColorPickerDlg.useSRGB = %colorScale;
ColorRangeSelect.useSRGB = %colorScale;
ColorBlendSelect.useSRGB = %colorScale;
myColor.useSRGB = %colorScale;
oldColor.useSRGB = %colorScale;
}
// This function pushes the color picker dialog and returns to a callback the selected value
function GetColorI( %currentColor, %callback, %root, %updateCallback, %cancelCallback )
{

View file

@ -28,6 +28,6 @@ TORQUE_UNIFORM_SAMPLER1D(depthViz, 1);
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{
float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w;
float depth = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ).w;
return float4( TORQUE_TEX1D( depthViz, depth ).rgb, 1.0 );
}

View file

@ -27,6 +27,6 @@ TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{
float3 normal = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).xyz;
float3 normal = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ).xyz;
return float4( ( normal + 1.0 ) * 0.5, 1.0 );
}