summaryrefslogtreecommitdiff
path: root/data/shaders/pbr-frag.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'data/shaders/pbr-frag.glsl')
-rw-r--r--data/shaders/pbr-frag.glsl5
1 files changed, 4 insertions, 1 deletions
diff --git a/data/shaders/pbr-frag.glsl b/data/shaders/pbr-frag.glsl
index a211096..0986840 100644
--- a/data/shaders/pbr-frag.glsl
+++ b/data/shaders/pbr-frag.glsl
@@ -66,6 +66,9 @@ const float GAMMA = 2.2;
vec4 texture(sampler2D tex, vec2 coord) {
return texture2D(tex, coord);
}
+vec4 texture(samplerCube tex, vec3 coord) {
+ return textureCube(tex, coord);
+}
#endif
float posDot(vec3 v1, vec3 v2) {
@@ -364,7 +367,7 @@ void main(void) {
//
// TODO: Use fancy PBR equations instead of these basic ones.
float fresnel = pow(1.0 - clamp(dot(viewDirection, normal), 0.0, 1.0), 5);
- vec3 ambientDiffuse = textureCube(skybox, normal).rgb;
+ vec3 ambientDiffuse = texture(skybox, normal).rgb;
vec3 ambientSpecular = textureLod(skybox, reflection, roughness * 7.0).rgb;
color += (ambientDiffuse * albedo + ambientSpecular * fresnel) * ambientOcclusion;
// Apply Reinhard tone mapping to convert our high dynamic range