Sign in to follow this  

PBR (EnvMap Prefiltering and Shader optimization)

Recommended Posts



I have some questions regarding PBR in general and filtering.


So i am using the lighting equation.


L - light dir(directional light)

N - surface normal.

H - Half Vec.

Lc - Light color(1/PI factor in this).

V - View vec

R = 2 * (V.N) * N - V


Runtime shader(Pseudo code).


Lo = (diffuse + directSpecular) * NoL * lightColor + IndirectSpecular;

directSpecular = GGX_NDF(roughness,NoH) * (Fresnel * G);

IndirectSpecular = EnvBRDF(specularColor.roughness,NOV) * EnvMap.sample(R,roughnessBias);




I want to prefilter Environment maps using GGX distribution and optimize my shader, but i have some confusion in my understanding.


1>Prefilter envmap using N = V = R,

     So my understanding is N = texel location to cube center(0.0), ( I need help understanding this mapping).

2>I am using the EnvBRDF approximate analytical solution just like here(


Also if u read to end part of the blog, UE4 uses Blinn NDF on mobile(approximated using R and L),

GGX distribution is really nice( would rather drop the geometry term than GGX), Can GGX be approximated using R and L ?


He also mentions he multiplies the EnvBRDF with the NDF(direct specular), i am not able to understand the basis of this.or is it only a good approximate for directional lights?

(Fresnel *G) =  EnvBRDF(specularColor,roughness,NOV) ?


In doing so the following things happen in UE4 mobile shader.

1>No need to compute half vector.(Can GGX be represented using Reflection/View vector instead of halfvector?)

2>F and G , need not be computed for direct specular(since they come from EnvBRDF).









Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this