aboutsummaryrefslogtreecommitdiff
path: root/Assets/Shaders/Sphere.glsl
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2025-08-22 12:24:05 +0200
committerhachem <im@hachem.wtf>2025-08-22 12:24:05 +0200
commit0d819f2b9a71e862bce8799c6b0c1304e62219b3 (patch)
treea3011c8f5b04c98de5a8a24bc2b4ded312de958e /Assets/Shaders/Sphere.glsl
parentc20a400e620154f0c334fe0a37d547625b6ee65b (diff)
[add]: add HDRI
Diffstat (limited to 'Assets/Shaders/Sphere.glsl')
-rw-r--r--Assets/Shaders/Sphere.glsl7
1 files changed, 6 insertions, 1 deletions
diff --git a/Assets/Shaders/Sphere.glsl b/Assets/Shaders/Sphere.glsl
index 23e8f54..9f620f7 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,14 @@ void main()
vec3 viewDir = normalize(u_CameraPos - v_WorldPos);
vec3 reflectDir = reflect(-lightDir, normal);
+ // HDRI lighting
+ vec3 hdriLight = texture(u_HDRIEnvironment, normal).rgb;
+ float hdriIntensity = 0.3; // Adjust this for HDRI lighting strength
+
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;