mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
Direct3D11 common shader changes.
This commit is contained in:
parent
1ff6f221fb
commit
3a9b50f702
283 changed files with 3547 additions and 1834 deletions
|
|
@ -21,10 +21,10 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../postFx.hlsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
float4 main( PFXVertToPix IN,
|
||||
uniform sampler2D edgeBuffer :register(S0) ) : COLOR0
|
||||
TORQUE_UNIFORM_SAMPLER2D(edgeBuffer);
|
||||
|
||||
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
||||
{
|
||||
return float4( tex2D( edgeBuffer, IN.uv0 ).rrr, 1.0 );
|
||||
return float4( TORQUE_TEX2D( edgeBuffer, IN.uv0 ).rrr, 1.0 );
|
||||
}
|
||||
|
|
@ -21,17 +21,17 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../postFx.hlsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
float4 main( PFXVertToPix IN,
|
||||
uniform sampler2D edgeBuffer : register(S0),
|
||||
uniform sampler2D backBuffer : register(S1),
|
||||
uniform float2 targetSize : register(C0) ) : COLOR0
|
||||
TORQUE_UNIFORM_SAMPLER2D(edgeBuffer,0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 1);
|
||||
uniform float2 targetSize;
|
||||
|
||||
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
||||
{
|
||||
float2 pixelSize = 1.0 / targetSize;
|
||||
|
||||
// Sample edge buffer, bail if not on an edge
|
||||
float edgeSample = tex2D(edgeBuffer, IN.uv0).r;
|
||||
float edgeSample = TORQUE_TEX2D(edgeBuffer, IN.uv0).r;
|
||||
clip(edgeSample - 1e-6);
|
||||
|
||||
// Ok we're on an edge, so multi-tap sample, average, and return
|
||||
|
|
@ -58,7 +58,7 @@ float4 main( PFXVertToPix IN,
|
|||
|
||||
float2 offsetUV = IN.uv1 + edgeSample * ( offsets[i] * 0.5 ) * pixelSize;//rtWidthHeightInvWidthNegHeight.zw;
|
||||
//offsetUV *= 0.999;
|
||||
accumColor+= tex2D(backBuffer, offsetUV);
|
||||
accumColor += TORQUE_TEX2D(backBuffer, offsetUV);
|
||||
}
|
||||
accumColor /= 9.0;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,10 +21,12 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../postFx.hlsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../../shaderModelAutoGen.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(prepassBuffer,0);
|
||||
|
||||
// GPU Gems 3, pg 443-444
|
||||
float GetEdgeWeight(float2 uv0, in sampler2D prepassBuffer, in float2 targetSize)
|
||||
float GetEdgeWeight(float2 uv0, in float2 targetSize)
|
||||
{
|
||||
float2 offsets[9] = {
|
||||
float2( 0.0, 0.0),
|
||||
|
|
@ -44,10 +46,11 @@ float GetEdgeWeight(float2 uv0, in sampler2D prepassBuffer, in float2 targetSize
|
|||
float Depth[9];
|
||||
float3 Normal[9];
|
||||
|
||||
[unroll] //no getting around this, may as well save the annoying warning message
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
float2 uv = uv0 + offsets[i] * PixelSize;
|
||||
float4 gbSample = prepassUncondition( prepassBuffer, uv );
|
||||
float4 gbSample = TORQUE_PREPASS_UNCONDITION( prepassBuffer, uv );
|
||||
Depth[i] = gbSample.a;
|
||||
Normal[i] = gbSample.rgb;
|
||||
}
|
||||
|
|
@ -82,9 +85,9 @@ float GetEdgeWeight(float2 uv0, in sampler2D prepassBuffer, in float2 targetSize
|
|||
return dot(normalResults, float4(1.0, 1.0, 1.0, 1.0)) * 0.25;
|
||||
}
|
||||
|
||||
float4 main( PFXVertToPix IN,
|
||||
uniform sampler2D prepassBuffer :register(S0),
|
||||
uniform float2 targetSize : register(C0) ) : COLOR0
|
||||
uniform float2 targetSize;
|
||||
|
||||
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
||||
{
|
||||
return GetEdgeWeight(IN.uv0, prepassBuffer, targetSize );//rtWidthHeightInvWidthNegHeight.zw);
|
||||
return GetEdgeWeight(IN.uv0, targetSize);//rtWidthHeightInvWidthNegHeight.zw);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue