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,44 +21,44 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog final pixel shader V2.00
|
||||
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../shaderModel.hlsl"
|
||||
#include "../shaderModelAutoGen.hlsl"
|
||||
#include "../torque.hlsl"
|
||||
|
||||
uniform sampler2D prepassTex : register(S0);
|
||||
uniform sampler2D depthBuffer : register(S1);
|
||||
uniform sampler2D frontBuffer : register(S2);
|
||||
uniform sampler2D density : register(S3);
|
||||
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(depthBuffer, 1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(frontBuffer, 2);
|
||||
TORQUE_UNIFORM_SAMPLER2D(density, 3);
|
||||
|
||||
uniform float3 ambientColor;
|
||||
uniform float accumTime;
|
||||
uniform float4 fogColor;
|
||||
uniform float4 modspeed;//xy speed layer 1, zw speed layer 2
|
||||
uniform float2 viewpoint;
|
||||
uniform float2 texscale;
|
||||
uniform float fogDensity;
|
||||
uniform float preBias;
|
||||
uniform float textured;
|
||||
uniform float modstrength;
|
||||
uniform float4 modspeed;//xy speed layer 1, zw speed layer 2
|
||||
uniform float2 viewpoint;
|
||||
uniform float2 texscale;
|
||||
uniform float3 ambientColor;
|
||||
uniform float numtiles;
|
||||
uniform float fadesize;
|
||||
uniform float2 PixelSize;
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 hpos : TORQUE_POSITION;
|
||||
float4 htpos : TEXCOORD0;
|
||||
float2 uv0 : TEXCOORD1;
|
||||
};
|
||||
|
||||
float4 main( ConnectData IN ) : COLOR0
|
||||
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 = prepassUncondition( prepassTex, uvscreen).w * preBias;
|
||||
float depth = tex2D(depthBuffer,uvscreen).r;
|
||||
float front = tex2D(frontBuffer,uvscreen).r;
|
||||
float obj_test = TORQUE_PREPASS_UNCONDITION(prepassTex, uvscreen).w * preBias;
|
||||
float depth = TORQUE_TEX2D(depthBuffer, uvscreen).r;
|
||||
float front = TORQUE_TEX2D(frontBuffer, uvscreen).r;
|
||||
|
||||
if (depth <= front)
|
||||
return float4(0,0,0,0);
|
||||
|
|
@ -73,8 +73,8 @@ float4 main( ConnectData IN ) : COLOR0
|
|||
{
|
||||
float2 offset = viewpoint + ((-0.5 + (texscale * uvscreen)) * numtiles);
|
||||
|
||||
float2 mod1 = tex2D(density,(offset + (modspeed.xy*accumTime))).rg;
|
||||
float2 mod2= tex2D(density,(offset + (modspeed.zw*accumTime))).rg;
|
||||
float2 mod1 = TORQUE_TEX2D(density, (offset + (modspeed.xy*accumTime))).rg;
|
||||
float2 mod2 = TORQUE_TEX2D(density, (offset + (modspeed.zw*accumTime))).rg;
|
||||
diff = (mod2.r + mod1.r) * modstrength;
|
||||
col *= (2.0 - ((mod1.g + mod2.g) * fadesize))/2.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,14 +21,15 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog prepass pixel shader V1.00
|
||||
#include "../shaderModel.hlsl"
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 hpos : TORQUE_POSITION;
|
||||
float4 pos : TEXCOORD0;
|
||||
};
|
||||
|
||||
float4 main( ConnectData IN ) : COLOR0
|
||||
float4 main( ConnectData IN ) : TORQUE_TARGET0
|
||||
{
|
||||
float OUT;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,11 +22,12 @@
|
|||
|
||||
// Volumetric Fog prepass vertex shader V1.00
|
||||
|
||||
#include "shaders/common/hlslstructs.h"
|
||||
#include "../shaderModel.hlsl"
|
||||
#include "../hlslStructs.hlsl"
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 hpos : TORQUE_POSITION;
|
||||
float4 pos : TEXCOORD0;
|
||||
};
|
||||
|
||||
|
|
@ -35,12 +36,9 @@ uniform float4x4 modelView;
|
|||
ConnectData main( VertexIn_P IN)
|
||||
{
|
||||
ConnectData OUT;
|
||||
|
||||
float4 inPos = IN.pos;
|
||||
inPos.w = 1.0;
|
||||
|
||||
OUT.hpos = mul( modelView, inPos );
|
||||
OUT.pos = OUT.hpos;
|
||||
OUT.hpos = mul(modelView, float4(IN.pos, 1.0));
|
||||
OUT.pos = OUT.hpos;
|
||||
|
||||
return OUT;
|
||||
return OUT;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,17 +20,19 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog Reflection pixel shader V1.00
|
||||
#include "../shaderModel.hlsl"
|
||||
uniform float4 fogColor;
|
||||
uniform float fogDensity;
|
||||
uniform float reflStrength;
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 hpos : TORQUE_POSITION;
|
||||
float4 pos : TEXCOORD0;
|
||||
};
|
||||
|
||||
float4 main( ConnectData IN ) : COLOR0
|
||||
float4 main( ConnectData IN ) : TORQUE_TARGET0
|
||||
{
|
||||
return float4(fogColor.rgb,saturate(fogDensity*reflStrength));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,24 +22,25 @@
|
|||
|
||||
// Volumetric Fog final vertex shader V1.00
|
||||
|
||||
#include "shaders/common/hlslstructs.h"
|
||||
#include "../shaderModel.hlsl"
|
||||
#include "../hlslStructs.hlsl"
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 hpos : TORQUE_POSITION;
|
||||
float4 htpos : TEXCOORD0;
|
||||
float2 uv0 : TEXCOORD1;
|
||||
};
|
||||
|
||||
uniform float4x4 modelView;
|
||||
|
||||
ConnectData main( VertexIn_PNT IN)
|
||||
ConnectData main( VertexIn_PNTT IN)
|
||||
{
|
||||
ConnectData OUT;
|
||||
ConnectData OUT;
|
||||
|
||||
OUT.hpos = mul(modelView, IN.pos);
|
||||
OUT.hpos = mul(modelView, float4(IN.pos,1.0));
|
||||
OUT.htpos = OUT.hpos;
|
||||
OUT.uv0 = IN.uv0;
|
||||
|
||||
return OUT;
|
||||
return OUT;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue