New skyboxrenderer + moved meshrenderer inside engine and out from main to clean that up
This commit is contained in:
26
Assets/source/Skybox.frag.hlsl
Normal file
26
Assets/source/Skybox.frag.hlsl
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "RootConstants.hlsl"
|
||||
|
||||
float4 main(float3 ViewDir : TEXCOORD0) : SV_Target0
|
||||
{
|
||||
float3 dir = normalize(ViewDir);
|
||||
|
||||
// Simple Procedural Gradient Skybox Colors
|
||||
float3 skyZenithColor = float3(0.05f, 0.15f, 0.45f); // Deep blue top
|
||||
float3 skyHorizonColor = float3(0.4f, 0.6f, 0.9f); // Light blue horizon
|
||||
float3 groundColor = float3(0.1f, 0.1f, 0.15f); // Dark ground
|
||||
|
||||
float t = dir.z; // -1 to 1 based on vertical alignment
|
||||
|
||||
float3 finalColor = groundColor;
|
||||
|
||||
if (t > 0.0f) {
|
||||
// Blend from horizon to zenith
|
||||
finalColor = lerp(skyHorizonColor, skyZenithColor, t);
|
||||
} else {
|
||||
// Ground - quick blend from horizon to ground
|
||||
finalColor = lerp(skyHorizonColor, groundColor, saturate(-t * 2.0f));
|
||||
}
|
||||
|
||||
// Combine with overall ambient lighting scale
|
||||
return float4(finalColor, 1.0f);
|
||||
}
|
||||
Reference in New Issue
Block a user