Skip to content

Commit

Permalink
Revert PBR shader to ps_2_a (#5004)
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackYps committed Jun 1, 2023
1 parent 8ee9dc9 commit 6512b0a
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions effects/mesh.fx
Original file line number Diff line number Diff line change
Expand Up @@ -9217,10 +9217,13 @@ float3 PBR_PS(
float3 v = normalize(vertex.viewDirection);
float3 reflection = reflect(-v, n);

// We can't use texCUBElod so we need to use a workaround
float lod = roughness * 10;
float3 env_reflection = texCUBElod(environmentSampler, float4(reflection, lod));
float scale = exp2(lod);
float3 env_reflection = texCUBEgrad(environmentSampler, reflection, float3(scale/256, 0, 0), float3(0, scale/256, 0));
// This should be convolved into a proper irradiance map, but we will settle for lod 5 for now
float3 env_irradiance = texCUBElod(environmentSampler, float4(n, 5));
scale = exp2(5);
float3 env_irradiance = texCUBEgrad(environmentSampler, n, float3(scale/256, 0, 0), float3(0, scale/256, 0));

float2 envBRDFlookuptexture = tex2D(anisotropicSampler, float2(dot(n, v), 1 - roughness)).rg;
// We don't have good ao textures to counteract fresnel highlights showing in unplausible places,
Expand Down Expand Up @@ -9674,7 +9677,7 @@ technique PBR_UEF
RasterizerState(Rasterizer_Cull_CW)

VertexShader = compile vs_1_1 NormalMappedVS();
PixelShader = compile ps_3_0 PBR_UEF_PS(true, true, false, 0, 0);
PixelShader = compile ps_2_a PBR_UEF_PS(true, true, false, 0, 0);
}
}

Expand All @@ -9698,7 +9701,7 @@ technique PBR_UEF_Navy
RasterizerState(Rasterizer_Cull_CW)

VertexShader = compile vs_1_1 NormalMappedVS();
PixelShader = compile ps_3_0 PBR_UEF_PS(true, true, false, 0, 0);
PixelShader = compile ps_2_a PBR_UEF_PS(true, true, false, 0, 0);
}
}

Expand All @@ -9718,7 +9721,7 @@ technique PBR_Aeon
RasterizerState( Rasterizer_Cull_CW )

VertexShader = compile vs_1_1 NormalMappedVS();
PixelShader = compile ps_3_0 PBR_AeonPS(true);
PixelShader = compile ps_2_a PBR_AeonPS(true);
}
}

Expand All @@ -9740,7 +9743,7 @@ technique PBR_Aeon_Navy
RasterizerState( Rasterizer_Cull_CW )

VertexShader = compile vs_1_1 NormalMappedVS();
PixelShader = compile ps_3_0 PBR_AeonPS(true);
PixelShader = compile ps_2_a PBR_AeonPS(true);
}
}

Expand All @@ -9760,7 +9763,7 @@ technique PBR_AeonCZAR
RasterizerState( Rasterizer_Cull_CW )

VertexShader = compile vs_1_1 NormalMappedVS();
PixelShader = compile ps_3_0 PBR_AeonCZARPS(true);
PixelShader = compile ps_2_a PBR_AeonCZARPS(true);
}
}

Expand All @@ -9780,7 +9783,7 @@ technique PBR_Cybran
RasterizerState( Rasterizer_Cull_CW )

VertexShader = compile vs_1_1 NormalMappedVS();
PixelShader = compile ps_3_0 PBR_CybranPS(true);
PixelShader = compile ps_2_a PBR_CybranPS(true);
}
}

Expand All @@ -9802,7 +9805,7 @@ technique PBR_Cybran_Navy
RasterizerState( Rasterizer_Cull_CW )

VertexShader = compile vs_1_1 NormalMappedVS();
PixelShader = compile ps_3_0 PBR_CybranPS(true);
PixelShader = compile ps_2_a PBR_CybranPS(true);
}
}

Expand All @@ -9824,7 +9827,7 @@ technique PBR_Seraphim
RasterizerState( Rasterizer_Cull_CW )

VertexShader = compile vs_1_1 UnitFalloffVS();
PixelShader = compile ps_3_0 PBR_SeraphimPS(true);
PixelShader = compile ps_2_a PBR_SeraphimPS(true);
}
}

Expand All @@ -9848,7 +9851,7 @@ technique PBR_Seraphim_Navy
RasterizerState( Rasterizer_Cull_CW )

VertexShader = compile vs_1_1 UnitFalloffVS();
PixelShader = compile ps_3_0 PBR_SeraphimPS(true);
PixelShader = compile ps_2_a PBR_SeraphimPS(true);
}
}

Expand All @@ -9870,7 +9873,7 @@ technique PBR_PhaseShield
RasterizerState( Rasterizer_Cull_CW )

VertexShader = compile vs_1_1 NormalMappedVS();
PixelShader = compile ps_3_0 PBR_UEF_PS(true, true, false, 0, 0);
PixelShader = compile ps_2_a PBR_UEF_PS(true, true, false, 0, 0);
}
pass P1
{
Expand Down Expand Up @@ -9899,7 +9902,7 @@ technique PBR_AeonPhaseShield
RasterizerState( Rasterizer_Cull_CW )

VertexShader = compile vs_1_1 NormalMappedVS();
PixelShader = compile ps_3_0 PBR_AeonPS(true);
PixelShader = compile ps_2_a PBR_AeonPS(true);
}
pass P1
{
Expand Down Expand Up @@ -9928,7 +9931,7 @@ technique PBR_CybranPhaseShield
RasterizerState( Rasterizer_Cull_CW )

VertexShader = compile vs_1_1 NormalMappedVS();
PixelShader = compile ps_3_0 PBR_CybranPS(true);
PixelShader = compile ps_2_a PBR_CybranPS(true);
}
pass P1
{
Expand Down Expand Up @@ -9958,7 +9961,7 @@ technique PBR_SeraphimPersonalShield
RasterizerState( Rasterizer_Cull_CW )

VertexShader = compile vs_1_1 UnitFalloffVS();
PixelShader = compile ps_3_0 PBR_SeraphimPS(true);
PixelShader = compile ps_2_a PBR_SeraphimPS(true);
}
pass P1
{
Expand Down Expand Up @@ -9988,7 +9991,7 @@ technique PBR_UEFBuild
RasterizerState( Rasterizer_Cull_CW )

VertexShader = compile vs_1_1 NormalMappedVS();
PixelShader = compile ps_3_0 PBR_UEFBuildPS(true);
PixelShader = compile ps_2_a PBR_UEFBuildPS(true);
}
pass P1
{
Expand Down Expand Up @@ -10016,15 +10019,15 @@ technique PBR_AeonBuild
AlphaState( AlphaBlend_Disable_Write_RGB )

VertexShader = compile vs_1_1 AeonBuildVS(0.0);
PixelShader = compile ps_3_0 PBR_AeonBuildPS(true);
PixelShader = compile ps_2_a PBR_AeonBuildPS(true);
}
pass P1
{
AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
RasterizerState( Rasterizer_Cull_CW )

VertexShader = compile vs_1_1 AeonBuildVS(0);
PixelShader = compile ps_3_0 PBR_AeonBuildOverlayPS();
PixelShader = compile ps_2_a PBR_AeonBuildOverlayPS();
}
}

Expand All @@ -10044,7 +10047,7 @@ technique PBR_AeonBuildPuddle
RasterizerState( Rasterizer_Cull_CW )

VertexShader = compile vs_1_1 NormalMappedVS();
PixelShader = compile ps_3_0 PBR_AeonBuildPuddlePS(true);
PixelShader = compile ps_2_a PBR_AeonBuildPuddlePS(true);
}
}

Expand All @@ -10065,7 +10068,7 @@ technique PBR_CybranBuild
RasterizerState( Rasterizer_Cull_CW )

VertexShader = compile vs_1_1 NormalMappedVS();
PixelShader = compile ps_3_0 PBR_CybranBuildPS(true);
PixelShader = compile ps_2_a PBR_CybranBuildPS(true);
}
pass P1
{
Expand Down Expand Up @@ -10095,6 +10098,6 @@ technique PBR_SeraphimBuild
RasterizerState( Rasterizer_Cull_CW )

VertexShader = compile vs_1_1 SeraphimBuildVS();
PixelShader = compile ps_3_0 PBR_SeraphimBuildPS(true);
PixelShader = compile ps_2_a PBR_SeraphimBuildPS(true);
}
}

0 comments on commit 6512b0a

Please sign in to comment.