Direct3D11 common shader changes.

This commit is contained in:
rextimmy 2016-03-20 21:50:21 +10:00
parent 1ff6f221fb
commit 3a9b50f702
283 changed files with 3547 additions and 1834 deletions

View file

@ -20,29 +20,29 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "shadergen:/autogenConditioners.h"
#include "../../shaderModelAutoGen.hlsl"
#include "../postFx.hlsl"
uniform sampler2D backBuffer : register( s0 ); // The original backbuffer.
uniform sampler2D prepassTex : register( s1 ); // The pre-pass depth and normals.
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 1);
uniform float brightScalar;
static const float3 LUMINANCE_VECTOR = float3(0.3125f, 0.6154f, 0.0721f);
float4 main( PFXVertToPix IN ) : COLOR0
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{
float4 col = float4( 0, 0, 0, 1 );
// Get the depth at this pixel.
float depth = prepassUncondition( prepassTex, IN.uv0 ).w;
float depth = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).w;
// If the depth is equal to 1.0, read from the backbuffer
// and perform the exposure calculation on the result.
if ( depth >= 0.999 )
{
col = tex2D( backBuffer, IN.uv0 );
col = TORQUE_TEX2D( backBuffer, IN.uv0 );
//col = 1 - exp(-120000 * col);
col += dot( col.rgb, LUMINANCE_VECTOR ) + 0.0001f;

View file

@ -22,28 +22,29 @@
#include "../postFx.hlsl"
uniform sampler2D frameSampler : register( s0 );
uniform sampler2D backBuffer : register( s1 );
TORQUE_UNIFORM_SAMPLER2D(frameSampler, 0);
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 1);
uniform float3 camForward;
uniform int numSamples;
uniform float3 lightDirection;
uniform float density;
uniform float2 screenSunPos;
uniform float2 oneOverTargetSize;
uniform int numSamples;
uniform float density;
uniform float weight;
uniform float decay;
uniform float exposure;
float4 main( PFXVertToPix IN ) : COLOR0
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{
float4 texCoord = float4( IN.uv0.xy, 0, 0 );
// Store initial sample.
half3 color = (half3)tex2D( frameSampler, texCoord.xy ).rgb;
half3 color = (half3)TORQUE_TEX2D( frameSampler, texCoord.xy ).rgb;
// Store original bb color.
float4 bbCol = tex2D( backBuffer, IN.uv1 );
float4 bbCol = TORQUE_TEX2D( backBuffer, IN.uv1 );
// Set up illumination decay factor.
half illuminationDecay = 1.0;
@ -68,7 +69,7 @@ float4 main( PFXVertToPix IN ) : COLOR0
texCoord.xy -= deltaTexCoord;
// Retrieve sample at new location.
half3 sample = (half3)tex2Dlod( frameSampler, texCoord );
half3 sample = (half3)TORQUE_TEX2DLOD( frameSampler, texCoord );
// Apply sample attenuation scale/decay factors.
sample *= half(illuminationDecay * weight);