According to: https://www.cs.virginia.edu/~jdl/importance.doc
For a specular sample: (page 4 of the document) $$pdf(\theta_{i}) = \frac{n+1}{2\pi} \cos^n(a)$$
And this is how you choose an incoming direction according to a specular sample of the BRDF (page 4 of the document): $$ \vec{w_{i}} = (\alpha, \phi) = (\arccos(\varepsilon_{1}^{ \frac{1}{n+1} }), \ \ 2\pi\varepsilon_{2})$$
But according to the figure on page 4, a specular sample has a BRDF favoring a direction which is highly dependent on the incoming ray, but the $ \phi $ angle is decided by uniformly sampling a circle, disregarding completely the incoming direction, which to me makes no sense
Shouldn't the $ \phi $ angle favor the specular direction, which is dependent on the incoming ray? Why we're not using at all the incoming ray to calculate the sampled direction which is supposedly sampling the brdf?
No matter where I look for it, I haven't seen an implementation using a BRDF which takes into account the incoming direction, which makes me think I've misunderstood the theory behind it
Lastly, assuming a standard backward path tracer, is this pseudocode the right way of computing the results?
color = float3(1,1,1)
ray = getRayFromCamera()
for NUM_BOUNCES:
primitive = world.intersect(ray)
// assuming primitive is non null, I'm omitting the code where we sample a background
albedo = primitive.albedo
// computeOutGoingRay will return a Ray and a PDF
outgoingRay, pdf = primitive.material.computeOutGoingRay(ray, normal, etc..)
// of the incoming radiance, how much is scattered along the new direction?
brdf = primitive.brdf(outgoingRay, ray)
color = (color * albedo * brdf) / pdf
// assigning the new ray to keep our backward recursion
ray = outGoingRay