2014-12-07 13:10:22 -05:00
|
|
|
uniform samplerCube probe;
|
|
|
|
|
|
|
|
vec3 SpecularIBL(vec3 normal, vec3 V, float roughness)
|
|
|
|
{
|
|
|
|
vec3 sampleDirection = reflect(-V, normal);
|
2017-12-25 01:00:10 -05:00
|
|
|
sampleDirection = (u_inverse_view_matrix * vec4(sampleDirection, 0.)).xyz;
|
2014-12-07 13:10:22 -05:00
|
|
|
|
|
|
|
// Assume 8 level of lod (ie 256x256 texture)
|
2015-01-15 13:52:48 -05:00
|
|
|
float lodval = 7. * (1. - roughness);
|
|
|
|
return clamp(textureLod(probe, sampleDirection, lodval).rgb, 0., 1.);
|
2014-12-09 21:02:36 -05:00
|
|
|
}
|