mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-27 08:09:31 +00:00
Updating BaseGame to work with PBR, and a PBR example module
This commit is contained in:
parent
e83ec69292
commit
cedbd387d9
98 changed files with 6762 additions and 2889 deletions
|
|
@ -4,17 +4,6 @@
|
|||
|
||||
// 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:
|
||||
|
|
@ -27,7 +16,8 @@ inline void autogenUncondition_bde4cbab(in float4 bufferSample, out float3 light
|
|||
struct ConnectData
|
||||
{
|
||||
float4 vpos : SV_Position;
|
||||
float4 screenspacePos : TEXCOORD0;
|
||||
float3 wsNormal : TEXCOORD0;
|
||||
float3 wsPosition : TEXCOORD1;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -42,10 +32,17 @@ struct Fragout
|
|||
//-----------------------------------------------------------------------------
|
||||
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)
|
||||
uniform float3 eyePosWorld : register(C17),
|
||||
uniform float4 inLightPos[3] : register(C1),
|
||||
uniform float4 inLightInvRadiusSq : register(C4),
|
||||
uniform float4 inLightColor[4] : register(C5),
|
||||
uniform float4 inLightSpotDir[3] : register(C9),
|
||||
uniform float4 inLightSpotAngle : register(C12),
|
||||
uniform float4 inLightSpotFalloff : register(C13),
|
||||
uniform float smoothness : register(C14),
|
||||
uniform float metalness : register(C15),
|
||||
uniform float4 ambient : register(C18),
|
||||
uniform float visibility : register(C16)
|
||||
)
|
||||
{
|
||||
Fragout OUT;
|
||||
|
|
@ -56,15 +53,13 @@ Fragout main( ConnectData IN,
|
|||
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);
|
||||
IN.wsNormal = normalize( half3( IN.wsNormal ) );
|
||||
float3 wsView = normalize( eyePosWorld - IN.wsPosition );
|
||||
float4 rtShading; float4 specular;
|
||||
compute4Lights( wsView, IN.wsPosition, IN.wsNormal, float4( 1, 1, 1, 1 ),
|
||||
inLightPos, inLightInvRadiusSq, inLightColor, inLightSpotDir, inLightSpotAngle, inLightSpotFalloff, smoothness, metalness, OUT.col,
|
||||
rtShading, specular );
|
||||
OUT.col *= float4( rtShading.rgb + ambient.rgb, 1 );
|
||||
|
||||
// Visibility
|
||||
fizzle( IN.vpos.xy, visibility );
|
||||
|
|
|
|||
|
|
@ -4,17 +4,6 @@
|
|||
|
||||
// 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:
|
||||
|
|
@ -38,7 +27,8 @@ struct VertData
|
|||
struct ConnectData
|
||||
{
|
||||
float4 hpos : SV_Position;
|
||||
float4 screenspacePos : TEXCOORD0;
|
||||
float3 wsNormal : TEXCOORD0;
|
||||
float3 outWsPosition : TEXCOORD1;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -46,7 +36,8 @@ struct ConnectData
|
|||
// Main
|
||||
//-----------------------------------------------------------------------------
|
||||
ConnectData main( VertData IN,
|
||||
uniform float4x4 modelview : register(C0)
|
||||
uniform float4x4 modelview : register(C0),
|
||||
uniform float4x4 objTrans : register(C4)
|
||||
)
|
||||
{
|
||||
ConnectData OUT;
|
||||
|
|
@ -57,7 +48,8 @@ ConnectData main( VertData IN,
|
|||
// Diffuse Color
|
||||
|
||||
// Deferred RT Lighting
|
||||
OUT.screenspacePos = OUT.hpos;
|
||||
OUT.wsNormal = mul( objTrans, float4( normalize( IN.normal ), 0.0 ) ).xyz;
|
||||
OUT.outWsPosition = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz;
|
||||
|
||||
// Visibility
|
||||
|
||||
|
|
|
|||
|
|
@ -1,25 +1,3 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// 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
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue