branchsbox/explicit-shading-apicancel
7 Commits over 0 Days - ∞cph!
PS_InitFinalCombiner( PS_INPUT ) -> PS_InitFinalCombiner() so it works without COMMON_PS_INPUT_DEFINED - this is just for default values anyway
PS_CommonTransformNormal should be wrapped in COMMON_PS_INPUT_DEFINED too
Material shading API can be used without common PixelInput
Internals rewritten to remove reliance on a commonly defined PixelInput
instead every function just takes what it needs.
The only public methods you may have been using were changed like so:
```diff
- float3 TransformNormal( const PixelInput i, float3 vNormalTs )
+ float3 TransformNormal( float3 vNormalTs, float3 vGeometricNormalWs, float3 vTangentUWs, float3 vTangentVWs )
- float3 NormalWorldToTangent( PS_INPUT i, float3 vNormalWs )
+ float3 NormalWorldToTangent( float3 vNormalWs, float3 vGeometricNormalWs, float3 vTangentUWs, float3 vTangentVWs )
```
Material::From( PixelInput ... ), ShadingModelStandard::Shade( PixelInput ... )
stil exist but are wrapped in ifdef COMMON_PS_INPUT_DEFINED, so only work
with the common PixelInput include.
Material::Init() added to initialize a Material with default values
Geometric normals are now distinctive from normals in Material too, this
is important for the lighting model: https://files.facepunch.com/matt/1b1711b1/beforeafter.png
And a lot of tool vis modes were fixed too.
Material.AmbientOcclusion float3 -> float
ShaderGraph fixes
Fix
Material.AmbientOcclusion float3 -> float
PS_InitFinalCombiner( PS_INPUT ) -> PS_InitFinalCombiner() so it works without COMMON_PS_INPUT_DEFINED - this is just for default values anyway
PS_CommonTransformNormal should be wrapped in COMMON_PS_INPUT_DEFINED too
Material shading API can be used without common PixelInput
Internals rewritten to remove reliance on a commonly defined PixelInput
instead every function just takes what it needs.
The only public methods you may have been using were changed like so:
```diff
- float3 TransformNormal( const PixelInput i, float3 vNormalTs )
+ float3 TransformNormal( float3 vNormalTs, float3 vGeometricNormalWs, float3 vTangentUWs, float3 vTangentVWs )
- float3 NormalWorldToTangent( PS_INPUT i, float3 vNormalWs )
+ float3 NormalWorldToTangent( float3 vNormalWs, float3 vGeometricNormalWs, float3 vTangentUWs, float3 vTangentVWs )
```
Material::From( PixelInput ... ), ShadingModelStandard::Shade( PixelInput ... )
stil exist but are wrapped in ifdef COMMON_PS_INPUT_DEFINED, so only work
with the common PixelInput include.
Material::Init() added to initialize a Material with default values
Geometric normals are now distinctive from normals in Material too, this
is important for the lighting model: https://files.facepunch.com/matt/1b1711b1/beforeafter.png
And a lot of tool vis modes were fixed too.
Light fixes
Can use Material and shading without PixelInput
Lights don't accept PixelInput - explicitly pass positions / lightmap uvs
These should be g_vHighPrecisionLightingOffsetWs instead of g_vCameraPositionWs
float4 DoAtmospherics( PixelInput i, float4 vColor, bool bAdditiveBlending = false ) -> float4 DoAtmospherics( float3 vInputColor, float3 vPositionWs, float2 vPositionSs, bool bAdditiveBlending = false )
ShadingModel is never going to be an interface like this
TransformNormal, NormalWorldToTangent accept explicit parameters instead of PixelInput
PS_InitFinalCombiner( PS_INPUT ) -> PS_InitFinalCombiner() so it works without COMMON_PS_INPUT_DEFINED - this is just for default values anyway
Delete DryEraseMarker from common ps code
PS_CommonTransformNormal should be wrapped in COMMON_PS_INPUT_DEFINED too
Wrap Material funcs that interact with assumed common PixelInput with COMMON_PS_INPUT_DEFINED
Lights don't accept PixelInput - explicitly pass positions / lightmap uvs