Patch - Fix release and debug config - V11.2.1
This commit is contained in:
53
src/hlsl/skybox.ps
Normal file
53
src/hlsl/skybox.ps
Normal file
@@ -0,0 +1,53 @@
|
||||
/////////////
|
||||
// GLOBALS //
|
||||
/////////////
|
||||
Texture2D shaderTexture : register(t0);
|
||||
SamplerState SampleType : register(s0);
|
||||
cbuffer SkyboxBuffer
|
||||
{
|
||||
float4 ambientColor;
|
||||
float4 diffuseColor;
|
||||
float3 lightDirection;
|
||||
float intensity;
|
||||
};
|
||||
|
||||
cbuffer SkyboxColorBuffer
|
||||
{
|
||||
float4 sunColor;
|
||||
};
|
||||
|
||||
//////////////
|
||||
// TYPEDEFS //
|
||||
//////////////
|
||||
struct PixelInputType
|
||||
{
|
||||
float4 position : SV_POSITION;
|
||||
float2 tex : TEXCOORD0;
|
||||
float3 normal : NORMAL;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Pixel Shader
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
float4 SkyboxPixelShader(PixelInputType input) : SV_TARGET
|
||||
{
|
||||
// Inverser les coordonn<EFBFBD>es de texture pour compenser les normales invers<EFBFBD>es
|
||||
float2 invertedTexCoord = float2(1.0 - input.tex.x, 1.0 - input.tex.y);
|
||||
|
||||
// <EFBFBD>chantillonner la texture avec les coordonn<EFBFBD>es invers<EFBFBD>es
|
||||
float4 textureColor = shaderTexture.Sample(SampleType, invertedTexCoord);
|
||||
|
||||
// Pour une skybox, l'<27>clairage devrait <EFBFBD>tre plus simple - on ignore l'orientation des normales
|
||||
// et on applique une luminosit<EFBFBD> uniforme ou un gradient bas<EFBFBD> sur la position (hauteur)
|
||||
|
||||
// Calculer un facteur de luminosit<EFBFBD> uniforme <EFBFBD> appliquer
|
||||
float lightFactor = saturate(intensity);
|
||||
|
||||
// Combiner la couleur ambiante et diffuse pour l'<27>clairage de la skybox
|
||||
float4 lightColor = ambientColor + (diffuseColor * lightFactor);
|
||||
|
||||
// Appliquer la couleur de l'<27>clairage <EFBFBD> la texture
|
||||
float4 finalColor = saturate(lightColor) * textureColor;
|
||||
|
||||
return finalColor;
|
||||
}
|
||||
Reference in New Issue
Block a user