2014-12-07 13:10:22 -05:00
|
|
|
uniform samplerCube probe;
|
|
|
|
|
|
|
|
vec3 SpecularIBL(vec3 normal, vec3 V, float roughness)
|
|
|
|
{
|
|
|
|
vec3 sampleDirection = reflect(-V, normal);
|
|
|
|
sampleDirection = (InverseViewMatrix * vec4(sampleDirection, 0.)).xyz;
|
|
|
|
|
|
|
|
// Assume 8 level of lod (ie 256x256 texture)
|
|
|
|
float lodval = 8. * (1. - roughness);
|
2014-12-08 19:33:58 -05:00
|
|
|
return max(textureLod(probe, sampleDirection, lodval).rgb, vec3(0.));
|
2014-12-07 13:10:22 -05:00
|
|
|
}
|