c++ - Rotate direction in another hemisphere -


as part of monte carlo path tracing, generate directions in hemisphere this.

double theta = acos(1 - 2 * uniformrandom01()); double phi = 2 * m_pi * uniformrandom01(); vec direction(cos(theta) * cos(phi), sin(theta) * cos(phi), sin(phi));  

however, these directions generated in hemisphere center vector (0,1,0).

now, have intersection point normal. how can rotate generated direction in order put in hemiphere centered @ intersection point's normal ?

example of hemispheres picture http://www.scratchapixel.com/lessons/3d-basic-rendering/global-illumination-path-tracing

for example, hemisphere of generated direction bottom one. want put direction in hemisphere 2 ou 3 bounces hemispheres.

tell me if not clear,

thank you


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -