(Mostly) updated verve implementation.

This commit is contained in:
Areloch 2019-03-07 16:23:41 -06:00
parent 775ca57047
commit 87ee749801
538 changed files with 68727 additions and 49 deletions

View file

@ -0,0 +1,94 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// Base Texture
// Diffuse Color
// Deferred Shading: Empty Specular
// Deferred Shading: Mat Info Flags
// Eye Space Depth (Out)
// Visibility
// GBuffer Conditioner
// Deferred Material
struct ConnectData
{
float4 vpos : SV_Position;
float2 texCoord : TEXCOORD0;
float4 wsEyeVec : TEXCOORD1;
float3 gbNormal : TEXCOORD2;
};
struct Fragout
{
float4 col : SV_Target0;
float4 col1 : SV_Target1;
float4 col2 : SV_Target2;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
Fragout main( ConnectData IN,
uniform SamplerState diffuseMap : register(S0),
uniform Texture2D diffuseMapTex : register(T0),
uniform float4 diffuseMaterialColor : register(C0),
uniform float matInfoFlags : register(C1),
uniform float3 vEye : register(C3),
uniform float4 oneOverFarplane : register(C4),
uniform float visibility : register(C2)
)
{
Fragout OUT;
// Vert Position
// Base Texture
float4 diffuseColor = diffuseMapTex.Sample(diffuseMap, IN.texCoord);
OUT.col1 = diffuseColor;
// Diffuse Color
OUT.col1 *= diffuseMaterialColor;
// Deferred Shading: Empty Specular
OUT.col2.g = 1.0;
OUT.col2.ba = 0.0;
// Deferred Shading: Mat Info Flags
OUT.col2.r = matInfoFlags;
// Eye Space Depth (Out)
#ifndef CUBE_SHADOW_MAP
float eyeSpaceDepth = dot(vEye, (IN.wsEyeVec.xyz / IN.wsEyeVec.w));
#else
float eyeSpaceDepth = length( IN.wsEyeVec.xyz / IN.wsEyeVec.w ) * oneOverFarplane.x;
#endif
// Visibility
fizzle( IN.vpos.xy, visibility );
// GBuffer Conditioner
float4 normal_depth = float4(normalize(IN.gbNormal), eyeSpaceDepth);
// output buffer format: GFXFormatR16G16B16A16F
// g-buffer conditioner: float4(normal.X, normal.Y, depth Hi, depth Lo)
float4 _gbConditionedOutput = float4(sqrt(half(2.0/(1.0 - normal_depth.y))) * half2(normal_depth.xz), 0.0, normal_depth.a);
// Encode depth into hi/lo
float2 _tempDepth = frac(normal_depth.a * float2(1.0, 65535.0));
_gbConditionedOutput.zw = _tempDepth.xy - _tempDepth.yy * float2(1.0/65535.0, 0.0);
OUT.col = _gbConditionedOutput;
// Deferred Material
return OUT;
}

View file

@ -0,0 +1,74 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// Base Texture
// Diffuse Color
// Deferred Shading: Empty Specular
// Deferred Shading: Mat Info Flags
// Eye Space Depth (Out)
// Visibility
// GBuffer Conditioner
// Deferred Material
struct VertData
{
float3 position : POSITION;
float3 normal : NORMAL;
float3 T : TANGENT;
float3 B : BINORMAL;
float2 texCoord : TEXCOORD0;
};
struct ConnectData
{
float4 hpos : SV_Position;
float2 out_texCoord : TEXCOORD0;
float4 wsEyeVec : TEXCOORD1;
float3 gbNormal : TEXCOORD2;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
ConnectData main( VertData IN,
uniform float4x4 modelview : register(C0),
uniform float4x4 objTrans : register(C4),
uniform float3 eyePosWorld : register(C12),
uniform float4x4 worldViewOnly : register(C8)
)
{
ConnectData OUT;
// Vert Position
OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
// Base Texture
OUT.out_texCoord = (float2)IN.texCoord;
// Diffuse Color
// Deferred Shading: Empty Specular
// Deferred Shading: Mat Info Flags
// Eye Space Depth (Out)
float3 depthPos = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz;
OUT.wsEyeVec = float4( depthPos.xyz - eyePosWorld, 1 );
// Visibility
// GBuffer Conditioner
OUT.gbNormal = mul(worldViewOnly, float4( normalize(IN.normal), 0.0 ) ).xyz;
// Deferred Material
return OUT;
}

View file

@ -0,0 +1,52 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// Eye Space Depth (Out)
// Visibility
struct ConnectData
{
float4 vpos : SV_Position;
float4 wsEyeVec : TEXCOORD0;
};
struct Fragout
{
float4 col : SV_Target0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
Fragout main( ConnectData IN,
uniform float3 vEye : register(C1),
uniform float4 oneOverFarplane : register(C2),
uniform float visibility : register(C0)
)
{
Fragout OUT;
// Vert Position
// Eye Space Depth (Out)
#ifndef CUBE_SHADOW_MAP
float eyeSpaceDepth = dot(vEye, (IN.wsEyeVec.xyz / IN.wsEyeVec.w));
#else
float eyeSpaceDepth = length( IN.wsEyeVec.xyz / IN.wsEyeVec.w ) * oneOverFarplane.x;
#endif
OUT.col = float4(eyeSpaceDepth.rrr,1);
// Visibility
fizzle( IN.vpos.xy, visibility );
return OUT;
}

View file

@ -0,0 +1,51 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// Eye Space Depth (Out)
// Visibility
struct VertData
{
float3 position : POSITION;
float3 normal : NORMAL;
float3 T : TANGENT;
float3 B : BINORMAL;
float2 texCoord : TEXCOORD0;
};
struct ConnectData
{
float4 hpos : SV_Position;
float4 wsEyeVec : TEXCOORD0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
ConnectData main( VertData IN,
uniform float4x4 modelview : register(C0),
uniform float4x4 objTrans : register(C4),
uniform float3 eyePosWorld : register(C8)
)
{
ConnectData OUT;
// Vert Position
OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
// Eye Space Depth (Out)
float3 depthPos = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz;
OUT.wsEyeVec = float4( depthPos.xyz - eyePosWorld, 1 );
// Visibility
return OUT;
}

View file

@ -0,0 +1,77 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/lighting.hlsl"
//------------------------------------------------------------------------------
// Autogenerated 'Light Buffer Conditioner [RGB]' Uncondition Method
//------------------------------------------------------------------------------
inline void autogenUncondition_bde4cbab(in float4 bufferSample, out float3 lightColor, out float NL_att, out float specular)
{
lightColor = bufferSample.rgb;
NL_att = dot(bufferSample.rgb, float3(0.3576, 0.7152, 0.1192));
specular = bufferSample.a;
}
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// Diffuse Color
// Deferred RT Lighting
// Visibility
// HDR Output
struct ConnectData
{
float4 vpos : SV_Position;
float4 screenspacePos : TEXCOORD0;
};
struct Fragout
{
float4 col : SV_Target0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
Fragout main( ConnectData IN,
uniform float4 diffuseMaterialColor : register(C0),
uniform float4 rtParamslightInfoBuffer : register(C2),
uniform SamplerState lightInfoBuffer : register(S0),
uniform Texture2D lightInfoBufferTex : register(T0),
uniform float visibility : register(C1)
)
{
Fragout OUT;
// Vert Position
// Diffuse Color
OUT.col = diffuseMaterialColor;
// Deferred RT Lighting
float2 uvScene = IN.screenspacePos.xy / IN.screenspacePos.w;
uvScene = ( uvScene + 1.0 ) / 2.0;
uvScene.y = 1.0 - uvScene.y;
uvScene = ( uvScene * rtParamslightInfoBuffer.zw ) + rtParamslightInfoBuffer.xy;
float3 d_lightcolor;
float d_NL_Att;
float d_specular;
lightinfoUncondition(lightInfoBufferTex.Sample(lightInfoBuffer, uvScene), d_lightcolor, d_NL_Att, d_specular);
OUT.col *= float4(d_lightcolor, 1.0);
// Visibility
fizzle( IN.vpos.xy, visibility );
// HDR Output
OUT.col = hdrEncode( OUT.col );
return OUT;
}

View file

@ -0,0 +1,67 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/lighting.hlsl"
//------------------------------------------------------------------------------
// Autogenerated 'Light Buffer Conditioner [RGB]' Uncondition Method
//------------------------------------------------------------------------------
inline void autogenUncondition_bde4cbab(in float4 bufferSample, out float3 lightColor, out float NL_att, out float specular)
{
lightColor = bufferSample.rgb;
NL_att = dot(bufferSample.rgb, float3(0.3576, 0.7152, 0.1192));
specular = bufferSample.a;
}
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// Diffuse Color
// Deferred RT Lighting
// Visibility
// HDR Output
struct VertData
{
float3 position : POSITION;
float3 normal : NORMAL;
float3 T : TANGENT;
float3 B : BINORMAL;
float2 texCoord : TEXCOORD0;
float2 texCoord2 : TEXCOORD1;
};
struct ConnectData
{
float4 hpos : SV_Position;
float4 screenspacePos : TEXCOORD0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
ConnectData main( VertData IN,
uniform float4x4 modelview : register(C0)
)
{
ConnectData OUT;
// Vert Position
OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
// Diffuse Color
// Deferred RT Lighting
OUT.screenspacePos = OUT.hpos;
// Visibility
// HDR Output
return OUT;
}

View file

@ -0,0 +1,54 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// skybox
// Diffuse Color
// Reflect Cube
// HDR Output
struct ConnectData
{
float4 vpos : SV_Position;
float3 reflectVec : TEXCOORD0;
};
struct Fragout
{
float4 col : SV_Target0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
Fragout main( ConnectData IN,
uniform float4 diffuseMaterialColor : register(C0),
uniform SamplerState cubeMap : register(S0),
uniform TextureCube cubeMapTex : register(T0)
)
{
Fragout OUT;
// Vert Position
// skybox
// Diffuse Color
OUT.col = diffuseMaterialColor;
// Reflect Cube
OUT.col *= cubeMapTex.Sample( cubeMap, IN.reflectVec );
// HDR Output
OUT.col = hdrEncode( OUT.col );
return OUT;
}

View file

@ -0,0 +1,58 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// skybox
// Diffuse Color
// Reflect Cube
// HDR Output
struct VertData
{
float3 position : POSITION;
float3 normal : NORMAL;
float2 texCoord : TEXCOORD0;
};
struct ConnectData
{
float4 hpos : SV_Position;
float3 reflectVec : TEXCOORD0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
ConnectData main( VertData IN,
uniform float4x4 modelview : register(C0),
uniform float4x4 objTrans : register(C4),
uniform float3 eyePosWorld : register(C8)
)
{
ConnectData OUT;
// Vert Position
OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
// skybox
// Diffuse Color
// Reflect Cube
float3 cubeVertPos = mul(objTrans, float4(IN.position,1)).xyz;
float3 cubeNormal = ( mul( (objTrans), float4(IN.normal, 0) ) ).xyz;
cubeNormal = bool(length(cubeNormal)) ? normalize(cubeNormal) : cubeNormal;
float3 eyeToVert = cubeVertPos - eyePosWorld;
OUT.reflectVec = reflect(eyeToVert, cubeNormal);
// HDR Output
return OUT;
}

View file

@ -0,0 +1,58 @@
//------------------------------------------------------------------------------
// Autogenerated 'Light Buffer Conditioner [RGB]' Condition Method
//------------------------------------------------------------------------------
inline float4 autogenCondition_bde4cbab(in float3 lightColor, in float NL_att, in float specular, in float4 bufferSample)
{
float4 rgbLightInfoOut = float4(lightColor, 0) * NL_att + float4(bufferSample.rgb, specular);
return rgbLightInfoOut;
}
//------------------------------------------------------------------------------
// Autogenerated 'Light Buffer Conditioner [RGB]' Uncondition Method
//------------------------------------------------------------------------------
inline void autogenUncondition_bde4cbab(in float4 bufferSample, out float3 lightColor, out float NL_att, out float specular)
{
lightColor = bufferSample.rgb;
NL_att = dot(bufferSample.rgb, float3(0.3576, 0.7152, 0.1192));
specular = bufferSample.a;
}
//------------------------------------------------------------------------------
// Autogenerated 'GBuffer Conditioner' Condition Method
//------------------------------------------------------------------------------
inline float4 autogenCondition_55070f7a(in float4 unconditionedOutput)
{
// g-buffer conditioner: float4(normal.X, normal.Y, depth Hi, depth Lo)
float4 _gbConditionedOutput = float4(sqrt(half(2.0/(1.0 - unconditionedOutput.y))) * half2(unconditionedOutput.xz), 0.0, unconditionedOutput.a);
// Encode depth into hi/lo
float2 _tempDepth = frac(unconditionedOutput.a * float2(1.0, 65535.0));
_gbConditionedOutput.zw = _tempDepth.xy - _tempDepth.yy * float2(1.0/65535.0, 0.0);
return _gbConditionedOutput;
}
//------------------------------------------------------------------------------
// Autogenerated 'GBuffer Conditioner' Uncondition Method
//------------------------------------------------------------------------------
inline float4 autogenUncondition_55070f7a(SamplerState deferredSamplerVar, Texture2D deferredTexVar, float2 screenUVVar)
{
// Sampler g-buffer
float4 bufferSample = deferredTexVar.SampleLevel(deferredSamplerVar, screenUVVar,0);
// g-buffer unconditioner: float4(normal.X, normal.Y, depth Hi, depth Lo)
float2 _inpXY = bufferSample.xy;
float _xySQ = dot(_inpXY, _inpXY);
float4 _gbUnconditionedInput = float4( sqrt(half(1.0 - (_xySQ / 4.0))) * _inpXY, -1.0 + (_xySQ / 2.0), bufferSample.a).xzyw;
// Decode depth
_gbUnconditionedInput.w = dot( bufferSample.zw, float2(1.0, 1.0/65535.0));
return _gbUnconditionedInput;
}

View file

@ -0,0 +1,80 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/lighting.hlsl"
//------------------------------------------------------------------------------
// Autogenerated 'Light Buffer Conditioner [RGB]' Uncondition Method
//------------------------------------------------------------------------------
inline void autogenUncondition_bde4cbab(in float4 bufferSample, out float3 lightColor, out float NL_att, out float specular)
{
lightColor = bufferSample.rgb;
NL_att = dot(bufferSample.rgb, float3(0.3576, 0.7152, 0.1192));
specular = bufferSample.a;
}
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// Base Texture
// Deferred RT Lighting
// Visibility
// HDR Output
struct ConnectData
{
float4 vpos : SV_Position;
float2 texCoord : TEXCOORD0;
float4 screenspacePos : TEXCOORD1;
};
struct Fragout
{
float4 col : SV_Target0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
Fragout main( ConnectData IN,
uniform SamplerState diffuseMap : register(S0),
uniform Texture2D diffuseMapTex : register(T0),
uniform float4 rtParamslightInfoBuffer : register(C1),
uniform SamplerState lightInfoBuffer : register(S1),
uniform Texture2D lightInfoBufferTex : register(T1),
uniform float visibility : register(C0)
)
{
Fragout OUT;
// Vert Position
// Base Texture
float4 diffuseColor = diffuseMapTex.Sample(diffuseMap, IN.texCoord);
OUT.col = diffuseColor;
// Deferred RT Lighting
float2 uvScene = IN.screenspacePos.xy / IN.screenspacePos.w;
uvScene = ( uvScene + 1.0 ) / 2.0;
uvScene.y = 1.0 - uvScene.y;
uvScene = ( uvScene * rtParamslightInfoBuffer.zw ) + rtParamslightInfoBuffer.xy;
float3 d_lightcolor;
float d_NL_Att;
float d_specular;
lightinfoUncondition(lightInfoBufferTex.Sample(lightInfoBuffer, uvScene), d_lightcolor, d_NL_Att, d_specular);
OUT.col *= float4(d_lightcolor, 1.0);
// Visibility
fizzle( IN.vpos.xy, visibility );
// HDR Output
OUT.col = hdrEncode( OUT.col );
return OUT;
}

View file

@ -0,0 +1,57 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/lighting.hlsl"
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// Base Texture
// Deferred RT Lighting
// Visibility
// HDR Output
struct VertData
{
float3 position : POSITION;
float3 normal : NORMAL;
float3 T : TANGENT;
float3 B : BINORMAL;
float2 texCoord : TEXCOORD0;
};
struct ConnectData
{
float4 hpos : SV_Position;
float2 out_texCoord : TEXCOORD0;
float4 screenspacePos : TEXCOORD1;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
ConnectData main( VertData IN,
uniform float4x4 modelview : register(C0)
)
{
ConnectData OUT;
// Vert Position
OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
// Base Texture
OUT.out_texCoord = (float2)IN.texCoord;
// Deferred RT Lighting
OUT.screenspacePos = OUT.hpos;
// Visibility
// HDR Output
return OUT;
}

View file

@ -0,0 +1,87 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// Diffuse Color
// Deferred Shading: Empty Specular
// Deferred Shading: Mat Info Flags
// Eye Space Depth (Out)
// Visibility
// GBuffer Conditioner
// Deferred Material
struct ConnectData
{
float4 vpos : SV_Position;
float4 wsEyeVec : TEXCOORD0;
float3 gbNormal : TEXCOORD1;
};
struct Fragout
{
float4 col : SV_Target0;
float4 col1 : SV_Target1;
float4 col2 : SV_Target2;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
Fragout main( ConnectData IN,
uniform float4 diffuseMaterialColor : register(C0),
uniform float matInfoFlags : register(C1),
uniform float3 vEye : register(C3),
uniform float4 oneOverFarplane : register(C4),
uniform float visibility : register(C2)
)
{
Fragout OUT;
// Vert Position
// Diffuse Color
OUT.col1 = float4(1.0,1.0,1.0,1.0);
OUT.col1 = diffuseMaterialColor;
// Deferred Shading: Empty Specular
OUT.col2.g = 1.0;
OUT.col2.ba = 0.0;
// Deferred Shading: Mat Info Flags
OUT.col2.r = matInfoFlags;
// Eye Space Depth (Out)
#ifndef CUBE_SHADOW_MAP
float eyeSpaceDepth = dot(vEye, (IN.wsEyeVec.xyz / IN.wsEyeVec.w));
#else
float eyeSpaceDepth = length( IN.wsEyeVec.xyz / IN.wsEyeVec.w ) * oneOverFarplane.x;
#endif
// Visibility
fizzle( IN.vpos.xy, visibility );
// GBuffer Conditioner
float4 normal_depth = float4(normalize(IN.gbNormal), eyeSpaceDepth);
// output buffer format: GFXFormatR16G16B16A16F
// g-buffer conditioner: float4(normal.X, normal.Y, depth Hi, depth Lo)
float4 _gbConditionedOutput = float4(sqrt(half(2.0/(1.0 - normal_depth.y))) * half2(normal_depth.xz), 0.0, normal_depth.a);
// Encode depth into hi/lo
float2 _tempDepth = frac(normal_depth.a * float2(1.0, 65535.0));
_gbConditionedOutput.zw = _tempDepth.xy - _tempDepth.yy * float2(1.0/65535.0, 0.0);
OUT.col = _gbConditionedOutput;
// Deferred Material
return OUT;
}

View file

@ -0,0 +1,70 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// Diffuse Color
// Deferred Shading: Empty Specular
// Deferred Shading: Mat Info Flags
// Eye Space Depth (Out)
// Visibility
// GBuffer Conditioner
// Deferred Material
struct VertData
{
float3 position : POSITION;
float3 normal : NORMAL;
float3 T : TANGENT;
float3 B : BINORMAL;
float2 texCoord : TEXCOORD0;
float2 texCoord2 : TEXCOORD1;
};
struct ConnectData
{
float4 hpos : SV_Position;
float4 wsEyeVec : TEXCOORD0;
float3 gbNormal : TEXCOORD1;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
ConnectData main( VertData IN,
uniform float4x4 modelview : register(C0),
uniform float4x4 objTrans : register(C4),
uniform float3 eyePosWorld : register(C12),
uniform float4x4 worldViewOnly : register(C8)
)
{
ConnectData OUT;
// Vert Position
OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
// Diffuse Color
// Deferred Shading: Empty Specular
// Deferred Shading: Mat Info Flags
// Eye Space Depth (Out)
float3 depthPos = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz;
OUT.wsEyeVec = float4( depthPos.xyz - eyePosWorld, 1 );
// Visibility
// GBuffer Conditioner
OUT.gbNormal = mul(worldViewOnly, float4( normalize(IN.normal), 0.0 ) ).xyz;
// Deferred Material
return OUT;
}

View file

@ -0,0 +1,47 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Paraboloid Vert Transform
// Visibility
// Depth (Out)
struct ConnectData
{
float4 vpos : SV_Position;
float2 posXY : TEXCOORD0;
float depth : TEXCOORD1;
};
struct Fragout
{
float4 col : SV_Target0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
Fragout main( ConnectData IN,
uniform float visibility : register(C0)
)
{
Fragout OUT;
// Paraboloid Vert Transform
clip( 1.0 - abs(IN.posXY.x) );
// Visibility
fizzle( IN.vpos.xy, visibility );
// Depth (Out)
OUT.col = float4( IN.depth, 0, 0, 1 );
return OUT;
}

View file

@ -0,0 +1,61 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Paraboloid Vert Transform
// Visibility
// Depth (Out)
struct VertData
{
float3 position : POSITION;
float3 normal : NORMAL;
float3 T : TANGENT;
float3 B : BINORMAL;
float2 texCoord : TEXCOORD0;
};
struct ConnectData
{
float4 hpos : SV_Position;
float2 posXY : TEXCOORD0;
float depth : TEXCOORD1;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
ConnectData main( VertData IN,
uniform float2 atlasScale : register(C4),
uniform float4x4 worldViewOnly : register(C0),
uniform float4 lightParams : register(C5),
uniform float2 atlasXOffset : register(C6)
)
{
ConnectData OUT;
// Paraboloid Vert Transform
OUT.hpos = mul(worldViewOnly, float4(IN.position.xyz,1)).xzyw;
float L = length(OUT.hpos.xyz);
OUT.hpos /= L;
OUT.hpos.z = OUT.hpos.z + 1.0;
OUT.hpos.xy /= OUT.hpos.z;
OUT.hpos.z = L / lightParams.x;
OUT.hpos.w = 1.0;
OUT.posXY = OUT.hpos.xy;
OUT.hpos.xy *= atlasScale.xy;
OUT.hpos.xy += atlasXOffset;
// Visibility
// Depth (Out)
OUT.depth = OUT.hpos.z / OUT.hpos.w;
return OUT;
}

View file

@ -0,0 +1,52 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// Eye Space Depth (Out)
// Visibility
struct ConnectData
{
float4 vpos : SV_Position;
float4 wsEyeVec : TEXCOORD0;
};
struct Fragout
{
float4 col : SV_Target0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
Fragout main( ConnectData IN,
uniform float3 vEye : register(C1),
uniform float4 oneOverFarplane : register(C2),
uniform float visibility : register(C0)
)
{
Fragout OUT;
// Vert Position
// Eye Space Depth (Out)
#ifndef CUBE_SHADOW_MAP
float eyeSpaceDepth = dot(vEye, (IN.wsEyeVec.xyz / IN.wsEyeVec.w));
#else
float eyeSpaceDepth = length( IN.wsEyeVec.xyz / IN.wsEyeVec.w ) * oneOverFarplane.x;
#endif
OUT.col = float4(eyeSpaceDepth.rrr,1);
// Visibility
fizzle( IN.vpos.xy, visibility );
return OUT;
}

View file

@ -0,0 +1,51 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// Eye Space Depth (Out)
// Visibility
struct VertData
{
float3 position : POSITION;
float3 normal : NORMAL;
float3 T : TANGENT;
float3 B : BINORMAL;
float2 texCoord : TEXCOORD0;
};
struct ConnectData
{
float4 hpos : SV_Position;
float4 wsEyeVec : TEXCOORD0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
ConnectData main( VertData IN,
uniform float4x4 modelview : register(C0),
uniform float4x4 objTrans : register(C4),
uniform float3 eyePosWorld : register(C8)
)
{
ConnectData OUT;
// Vert Position
OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
// Eye Space Depth (Out)
float3 depthPos = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz;
OUT.wsEyeVec = float4( depthPos.xyz - eyePosWorld, 1 );
// Visibility
return OUT;
}

View file

@ -0,0 +1,69 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// Diffuse Color
// Diffuse Vertex Color
// Visibility
// Fog
// HDR Output
// Forward Shaded Material
// Translucent
struct ConnectData
{
float4 vpos : SV_Position;
float4 vertColor : COLOR;
float3 wsPosition : TEXCOORD0;
};
struct Fragout
{
float4 col : SV_Target0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
Fragout main( ConnectData IN,
uniform float4 diffuseMaterialColor : register(C0),
uniform float visibility : register(C1),
uniform float4 fogColor : register(C2),
uniform float3 eyePosWorld : register(C3),
uniform float3 fogData : register(C4)
)
{
Fragout OUT;
// Vert Position
// Diffuse Color
OUT.col = diffuseMaterialColor;
// Diffuse Vertex Color
OUT.col *= IN.vertColor;
// Visibility
OUT.col.a *= visibility;
// Fog
float fogAmount = saturate( computeSceneFog( eyePosWorld, IN.wsPosition, fogData.r, fogData.g, fogData.b ) );
OUT.col.rgb = lerp( fogColor.rgb, OUT.col.rgb, fogAmount );
// HDR Output
OUT.col = hdrEncode( OUT.col );
// Forward Shaded Material
// Translucent
return OUT;
}

View file

@ -0,0 +1,63 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// Diffuse Color
// Diffuse Vertex Color
// Visibility
// Fog
// HDR Output
// Forward Shaded Material
// Translucent
struct VertData
{
float3 position : POSITION;
float4 diffuse : COLOR;
};
struct ConnectData
{
float4 hpos : SV_Position;
float4 vertColor : COLOR;
float3 outWsPosition : TEXCOORD0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
ConnectData main( VertData IN,
uniform float4x4 modelview : register(C0),
uniform float4x4 objTrans : register(C4)
)
{
ConnectData OUT;
// Vert Position
OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
// Diffuse Color
// Diffuse Vertex Color
OUT.vertColor = IN.diffuse;
// Visibility
// Fog
OUT.outWsPosition = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz;
// HDR Output
// Forward Shaded Material
// Translucent
return OUT;
}

View file

@ -0,0 +1,52 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Paraboloid Vert Transform
// Visibility
// Depth (Out)
// Single Pass Paraboloid
struct ConnectData
{
float4 vpos : SV_Position;
float isBack : TEXCOORD0;
float2 posXY : TEXCOORD1;
float depth : TEXCOORD2;
};
struct Fragout
{
float4 col : SV_Target0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
Fragout main( ConnectData IN,
uniform float visibility : register(C0)
)
{
Fragout OUT;
// Paraboloid Vert Transform
clip( abs( IN.isBack ) - 0.999 );
clip( 1.0 - abs(IN.posXY.x) );
// Visibility
fizzle( IN.vpos.xy, visibility );
// Depth (Out)
OUT.col = float4( IN.depth, 0, 0, 1 );
// Single Pass Paraboloid
return OUT;
}

View file

@ -0,0 +1,67 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Paraboloid Vert Transform
// Visibility
// Depth (Out)
// Single Pass Paraboloid
struct VertData
{
float3 position : POSITION;
float3 normal : NORMAL;
float3 T : TANGENT;
float3 B : BINORMAL;
float2 texCoord : TEXCOORD0;
};
struct ConnectData
{
float4 hpos : SV_Position;
float isBack : TEXCOORD0;
float2 posXY : TEXCOORD1;
float depth : TEXCOORD2;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
ConnectData main( VertData IN,
uniform float2 atlasScale : register(C4),
uniform float4x4 worldViewOnly : register(C0),
uniform float4 lightParams : register(C5)
)
{
ConnectData OUT;
// Paraboloid Vert Transform
OUT.hpos = mul(worldViewOnly, float4(IN.position.xyz,1)).xzyw;
float L = length(OUT.hpos.xyz);
bool isBack = OUT.hpos.z < 0.0;
OUT.isBack = isBack ? -1.0 : 1.0;
if ( isBack ) OUT.hpos.z = -OUT.hpos.z;
OUT.hpos /= L;
OUT.hpos.z = OUT.hpos.z + 1.0;
OUT.hpos.xy /= OUT.hpos.z;
OUT.hpos.z = L / lightParams.x;
OUT.hpos.w = 1.0;
OUT.posXY = OUT.hpos.xy;
OUT.hpos.xy *= atlasScale.xy;
OUT.hpos.x += isBack ? 0.5 : -0.5;
// Visibility
// Depth (Out)
OUT.depth = OUT.hpos.z / OUT.hpos.w;
// Single Pass Paraboloid
return OUT;
}

View file

@ -0,0 +1,84 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/lighting.hlsl"
//------------------------------------------------------------------------------
// Autogenerated 'Light Buffer Conditioner [RGB]' Uncondition Method
//------------------------------------------------------------------------------
inline void autogenUncondition_bde4cbab(in float4 bufferSample, out float3 lightColor, out float NL_att, out float specular)
{
lightColor = bufferSample.rgb;
NL_att = dot(bufferSample.rgb, float3(0.3576, 0.7152, 0.1192));
specular = bufferSample.a;
}
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// Detail
// Diffuse Color
// Deferred RT Lighting
// Visibility
// HDR Output
struct ConnectData
{
float4 vpos : SV_Position;
float2 detCoord : TEXCOORD0;
float4 screenspacePos : TEXCOORD1;
};
struct Fragout
{
float4 col : SV_Target0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
Fragout main( ConnectData IN,
uniform SamplerState detailMap : register(S0),
uniform Texture2D detailMapTex : register(T0),
uniform float4 diffuseMaterialColor : register(C0),
uniform float4 rtParamslightInfoBuffer : register(C2),
uniform SamplerState lightInfoBuffer : register(S1),
uniform Texture2D lightInfoBufferTex : register(T1),
uniform float visibility : register(C1)
)
{
Fragout OUT;
// Vert Position
// Detail
OUT.col = ( detailMapTex.Sample(detailMap, IN.detCoord) * 2.0 ) - 1.0;
// Diffuse Color
OUT.col = diffuseMaterialColor;
// Deferred RT Lighting
float2 uvScene = IN.screenspacePos.xy / IN.screenspacePos.w;
uvScene = ( uvScene + 1.0 ) / 2.0;
uvScene.y = 1.0 - uvScene.y;
uvScene = ( uvScene * rtParamslightInfoBuffer.zw ) + rtParamslightInfoBuffer.xy;
float3 d_lightcolor;
float d_NL_Att;
float d_specular;
lightinfoUncondition(lightInfoBufferTex.Sample(lightInfoBuffer, uvScene), d_lightcolor, d_NL_Att, d_specular);
OUT.col *= float4(d_lightcolor, 1.0);
// Visibility
fizzle( IN.vpos.xy, visibility );
// HDR Output
OUT.col = hdrEncode( OUT.col );
return OUT;
}

View file

@ -0,0 +1,73 @@
//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/lighting.hlsl"
//------------------------------------------------------------------------------
// Autogenerated 'Light Buffer Conditioner [RGB]' Uncondition Method
//------------------------------------------------------------------------------
inline void autogenUncondition_bde4cbab(in float4 bufferSample, out float3 lightColor, out float NL_att, out float specular)
{
lightColor = bufferSample.rgb;
NL_att = dot(bufferSample.rgb, float3(0.3576, 0.7152, 0.1192));
specular = bufferSample.a;
}
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// Detail
// Diffuse Color
// Deferred RT Lighting
// Visibility
// HDR Output
struct VertData
{
float3 position : POSITION;
float3 normal : NORMAL;
float3 T : TANGENT;
float3 B : BINORMAL;
float2 texCoord : TEXCOORD0;
float2 texCoord2 : TEXCOORD1;
};
struct ConnectData
{
float4 hpos : SV_Position;
float2 detCoord : TEXCOORD0;
float4 screenspacePos : TEXCOORD1;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
ConnectData main( VertData IN,
uniform float4x4 modelview : register(C0),
uniform float2 detailScale : register(C4)
)
{
ConnectData OUT;
// Vert Position
OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
// Detail
OUT.detCoord = IN.texCoord * detailScale;
// Diffuse Color
// Deferred RT Lighting
OUT.screenspacePos = OUT.hpos;
// Visibility
// HDR Output
return OUT;
}