Skybox.hlsl 713 B

12345678910111213141516171819202122232425
  1. #include "Uniforms.hlsl"
  2. #include "Samplers.hlsl"
  3. #include "Transform.hlsl"
  4. void VS(float4 iPos : POSITION,
  5. out float3 oTexCoord : TEXCOORD0,
  6. out float4 oPos : OUTPOSITION)
  7. {
  8. float4x3 modelMatrix = iModelMatrix;
  9. float3 worldPos = GetWorldPos(modelMatrix);
  10. oPos = GetClipPos(worldPos);
  11. oPos.z = oPos.w;
  12. oTexCoord = iPos.xyz;
  13. }
  14. void PS(float3 iTexCoord : TEXCOORD0,
  15. out float4 oColor : OUTCOLOR0)
  16. {
  17. float4 sky = cMatDiffColor * SampleCube(DiffCubeMap, iTexCoord);
  18. #ifdef HDRSCALE
  19. sky = pow(sky + clamp((cAmbientColor.a - 1.0) * 0.1, 0.0, 0.25), max(cAmbientColor.a, 1.0)) * clamp(cAmbientColor.a, 0.0, 1.0);
  20. #endif
  21. oColor = sky;
  22. }