I'm trying to importance sample the Cook Torrance BRDF for my path tracer but I'm not sure about the part where you have to change the sample from one coordinate frame to another.
This resource states that
the strategy is to importance sample the distribution term to get a microfacet normal, and then transform everything from all vectors relative to the normal to relative to the origin.
This blog doesn't mention any coordinate frame change.
This answer uses one with the
TransformToWorld function but doesn't explain why.
I'm left confused as to when we need to change the coordinates of the sampled direction and more importantly, why it has to be done.
This article from GPU Gems even writes about a "specular coordinate frame":
Here, and are the spherical coordinates of the sample direction in a coordinate frame where the specular direction is the z-axis
What is this specular coordinate frame? Where does it come from? Is it different from the coordinate frame handled by the
TransformToWorld function of this answer? Is it specific to the Phong BRDF?
Why do we need such a coordinate change?