I thought I had my head around Marschner’s 2003 paper but am now ready to ask for help. I’ve seen the other thread mentioning it in this forum but unfortunately it doesn’t answer my question.
So any input from someone who has done this would be most welcome.
(When calculating Ntt)
Basically I’m confused-ish by the formula used to calculate eta’ (the adjusted index of refraction) I’m using the formula
eta’ = sqrt(eta^2 - sin^2(theta_d))/cos(theta_d)
where theta_d is the difference between the incident and reflected rays (light and eye vectors)
Along the lines of the implementation in GPU gems 2, I’m using sin(theta_eye) and sin(theta_light) as input parameters - which range from -pi/2 to pi/2.
I’m taking asin(theta_light) and asin(theta_eye) and using those angles as inputs to my lookup table generation functions.
This means my lookup tables are all indexed -1 to 1.
Anyway, back to my problem. Plot that function (for eta’) over the range -pi/2 to pi/2 and you can see it skyrockets around pi/2 as cos(theta_d) approaches zero.
This causes several problems, in partuicular I get three roots for the cubic eqn, which is apparently not possible for Ntt.
So, questions: Am I right to be using -pi/2 - pi/2 as a range for theta_d? I’ve tried using values slightly inside this range but am still getting huge values for eta’.
Best way to solve the cubic? I’m using a the numerical recipes/GSL cubic root finding algorithm - this required rearranging the cubic so that it was of the form
x^3 + ax^2 + bx + c
i.e I divided the whole lot by (8pc/PI^3).
Any other experiences with this paper?