diff options
| author | hachem <im@hachem.wtf> | 2025-08-22 12:24:05 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2025-08-22 12:24:05 +0200 |
| commit | 2c8002d30f291cba832a5750212009d48238c308 (patch) | |
| tree | 4aafc468441b3e32c267040830b8e0b5af859faf /assets/shaders/sphere.glsl | |
| parent | b9de06951631d9969c52c6ed95de17a6d8aad121 (diff) | |
feat: add HDRI
Diffstat (limited to 'assets/shaders/sphere.glsl')
| -rw-r--r-- | assets/shaders/sphere.glsl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/assets/shaders/sphere.glsl b/assets/shaders/sphere.glsl index 23e8f54..2d1a46e 100644 --- a/assets/shaders/sphere.glsl +++ b/assets/shaders/sphere.glsl @@ -33,6 +33,7 @@ uniform vec3 u_CameraPos; uniform int u_IsSelected; uniform vec3 u_OutlineColor; uniform float u_OutlineWidth; +uniform samplerCube u_HDRIEnvironment; out vec4 o_FragColor; @@ -43,10 +44,13 @@ void main() vec3 viewDir = normalize(u_CameraPos - v_WorldPos); vec3 reflectDir = reflect(-lightDir, normal); + vec3 hdriLight = texture(u_HDRIEnvironment, normal).rgb; + float hdriIntensity = 0.3; + float diff = max(dot(normal, lightDir), 0.0); float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32.0); - vec3 diffuse = u_Color * diff; + vec3 diffuse = u_Color * (diff + hdriIntensity * hdriLight); vec3 specular = vec3(u_Specular) * spec; vec3 emission = u_Color * u_Emission; |
