From 13c57e65627655917e351507a1b5de5148ed250f Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 27 Dec 2016 10:27:25 -0600 Subject: [PATCH] brings empty up to date for core and shader dirs --- .../Empty/game/core/scripts/client/postFx/fog.cs | 1 + .../game/core/scripts/client/renderManager.cs | 4 ++-- .../Empty/game/shaders/common/gl/torque.glsl | 16 ++++++++-------- Templates/Empty/game/shaders/common/torque.hlsl | 16 ++++++++-------- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/Templates/Empty/game/core/scripts/client/postFx/fog.cs b/Templates/Empty/game/core/scripts/client/postFx/fog.cs index 78b2a8924..ea59a3f4c 100644 --- a/Templates/Empty/game/core/scripts/client/postFx/fog.cs +++ b/Templates/Empty/game/core/scripts/client/postFx/fog.cs @@ -62,6 +62,7 @@ singleton PostEffect( FogPostFx ) renderPriority = 5; + targetFormat = getBestHDRFormat(); isEnabled = true; }; diff --git a/Templates/Empty/game/core/scripts/client/renderManager.cs b/Templates/Empty/game/core/scripts/client/renderManager.cs index f746c4527..ea7f84d03 100644 --- a/Templates/Empty/game/core/scripts/client/renderManager.cs +++ b/Templates/Empty/game/core/scripts/client/renderManager.cs @@ -33,7 +33,7 @@ function initRenderManager() { enabled = "false"; - format = "GFXFormatR16G16B16A16F"; + format = getBestHDRFormat(); depthFormat = "GFXFormatD24S8"; aaLevel = 0; // -1 = match backbuffer @@ -59,7 +59,7 @@ function initRenderManager() DiffuseRenderPassManager.addManager( new RenderMeshMgr(MeshBin) { bintype = "Mesh"; renderOrder = 0.5; processAddOrder = 0.5; basicOnly = true; } ); DiffuseRenderPassManager.addManager( new RenderImposterMgr(ImposterBin) { renderOrder = 0.56; processAddOrder = 0.56; } ); DiffuseRenderPassManager.addManager( new RenderObjectMgr(ObjectBin) { bintype = "Object"; renderOrder = 0.6; processAddOrder = 0.6; } ); - + DiffuseRenderPassManager.addManager( new RenderObjectMgr(ShadowBin) { bintype = "Shadow"; renderOrder = 0.7; processAddOrder = 0.7; } ); DiffuseRenderPassManager.addManager( new RenderMeshMgr(DecalRoadBin) { bintype = "DecalRoad"; renderOrder = 0.8; processAddOrder = 0.8; } ); DiffuseRenderPassManager.addManager( new RenderMeshMgr(DecalBin) { bintype = "Decal"; renderOrder = 0.81; processAddOrder = 0.81; } ); diff --git a/Templates/Empty/game/shaders/common/gl/torque.glsl b/Templates/Empty/game/shaders/common/gl/torque.glsl index abe1cd76d..6e369bd5e 100644 --- a/Templates/Empty/game/shaders/common/gl/torque.glsl +++ b/Templates/Empty/game/shaders/common/gl/torque.glsl @@ -138,13 +138,13 @@ mat3x3 quatToMat( vec4 quat ) /// vec2 parallaxOffset( sampler2D texMap, vec2 texCoord, vec3 negViewTS, float depthScale ) { - float depth = texture( texMap, texCoord ).a; - vec2 offset = negViewTS.xy * vec2( depth * depthScale ); + float depth = texture( texMap, texCoord ).a/(PARALLAX_REFINE_STEPS*2); + vec2 offset = negViewTS.xy * vec2( depth * depthScale )/vec2(PARALLAX_REFINE_STEPS*2); for ( int i=0; i < PARALLAX_REFINE_STEPS; i++ ) { - depth = ( depth + texture( texMap, texCoord + offset ).a ) * 0.5; - offset = negViewTS.xy * vec2( depth * depthScale ); + depth = ( depth + texture( texMap, texCoord + offset ).a )/(PARALLAX_REFINE_STEPS*2); + offset = negViewTS.xy * vec2( depth * depthScale )/vec2(PARALLAX_REFINE_STEPS*2); } return offset; @@ -153,13 +153,13 @@ vec2 parallaxOffset( sampler2D texMap, vec2 texCoord, vec3 negViewTS, float dept /// Same as parallaxOffset but for dxtnm where depth is stored in the red channel instead of the alpha vec2 parallaxOffsetDxtnm(sampler2D texMap, vec2 texCoord, vec3 negViewTS, float depthScale) { - float depth = texture(texMap, texCoord).r; - vec2 offset = negViewTS.xy * vec2(depth * depthScale); + float depth = texture(texMap, texCoord).r/(PARALLAX_REFINE_STEPS*2); + vec2 offset = negViewTS.xy * vec2(depth * depthScale)/vec2(PARALLAX_REFINE_STEPS*2); for (int i = 0; i < PARALLAX_REFINE_STEPS; i++) { - depth = (depth + texture(texMap, texCoord + offset).r) * 0.5; - offset = negViewTS.xy * vec2(depth * depthScale); + depth = (depth + texture(texMap, texCoord + offset).r)/(PARALLAX_REFINE_STEPS*2); + offset = negViewTS.xy * vec2(depth * depthScale)/vec2(PARALLAX_REFINE_STEPS*2); } return offset; diff --git a/Templates/Empty/game/shaders/common/torque.hlsl b/Templates/Empty/game/shaders/common/torque.hlsl index f1099abf8..7081c7153 100644 --- a/Templates/Empty/game/shaders/common/torque.hlsl +++ b/Templates/Empty/game/shaders/common/torque.hlsl @@ -140,13 +140,13 @@ float3x3 quatToMat( float4 quat ) /// float2 parallaxOffset(TORQUE_SAMPLER2D(texMap), float2 texCoord, float3 negViewTS, float depthScale) { - float depth = TORQUE_TEX2D(texMap, texCoord).a; - float2 offset = negViewTS.xy * (depth * depthScale); + float depth = TORQUE_TEX2D(texMap, texCoord).a/(PARALLAX_REFINE_STEPS*2); + float2 offset = negViewTS.xy * (depth * depthScale)/(PARALLAX_REFINE_STEPS); for (int i = 0; i < PARALLAX_REFINE_STEPS; i++) { - depth = (depth + TORQUE_TEX2D(texMap, texCoord + offset).a) * 0.5; - offset = negViewTS.xy * (depth * depthScale); + depth = (depth + TORQUE_TEX2D(texMap, texCoord + offset).a)/(PARALLAX_REFINE_STEPS*2); + offset = negViewTS.xy * (depth * depthScale)/(PARALLAX_REFINE_STEPS); } return offset; @@ -155,13 +155,13 @@ float2 parallaxOffset(TORQUE_SAMPLER2D(texMap), float2 texCoord, float3 negViewT /// Same as parallaxOffset but for dxtnm where depth is stored in the red channel instead of the alpha float2 parallaxOffsetDxtnm(TORQUE_SAMPLER2D(texMap), float2 texCoord, float3 negViewTS, float depthScale) { - float depth = TORQUE_TEX2D(texMap, texCoord).r; - float2 offset = negViewTS.xy * (depth * depthScale); + float depth = TORQUE_TEX2D(texMap, texCoord).r/(PARALLAX_REFINE_STEPS*2); + float2 offset = negViewTS.xy * (depth * depthScale)/(PARALLAX_REFINE_STEPS*2); for (int i = 0; i < PARALLAX_REFINE_STEPS; i++) { - depth = (depth + TORQUE_TEX2D(texMap, texCoord + offset).r) * 0.5; - offset = negViewTS.xy * (depth * depthScale); + depth = (depth + TORQUE_TEX2D(texMap, texCoord + offset).r)/(PARALLAX_REFINE_STEPS*2); + offset = negViewTS.xy * (depth * depthScale)/(PARALLAX_REFINE_STEPS*2); } return offset;