200 likes | 859 Views
Propiedades del cuerpo. Kr, Kg, Kb Ks, q. Surface. Modelo de iluminación “simple”. R = I a .Kr + Σ I i .((1-Ks).Kr. L i .n + Ks. ( V.r i ) q ) G = I a .Kg + Σ I i .((1-Ks).Kg. L i .n + Ks. ( V.r i ) q ) B = I a .Kb + Σ I i .((1-Ks).Kb. L i .n + Ks. ( V.r i ) q ). L. r. n.
E N D
Propiedades del cuerpo Kr, Kg, Kb Ks, q Surface Modelo de iluminación “simple” R = Ia.Kr + ΣIi.((1-Ks).Kr. Li.n + Ks. (V.ri)q) G = Ia.Kg + Σ Ii.((1-Ks).Kg. Li.n + Ks. (V.ri)q) B = Ia.Kb + Σ Ii.((1-Ks).Kb. Li.n + Ks. (V.ri)q) L r n V
Z buffer • Ademas del frame buffer (R, G, B) • Almacenar la distancia a la cámara (z-buffer) • Pixel es pintado solo si el nuevo z es más alto que el valor en el z-buffer value
n1 , n2 , n3 Ir1 , Ig1 , Ib1 Ir2 , Ig2 , Ib2 Ir3 , Ig3 , Ib3 3 A1 A2 Irpixel= (Ir1.A1+Ir2.A2+Ir3.A3)/A A3 2 1 Gourard shading
Gourard shading Flat shading Modelo de iluminación simple
Que falta tener en cuenta? • Sombras • Transparencias • Reflexiones • Refracciones • Fuentes no puntuales • Iluminación proveniente de otros objetos
Ray Casting For every pixel Construct a ray from the eye For every object in the scene Find intersection with the ray Keep if closest
Ray Casting • Complexity? • O(n * m) • n = number of objects, • m = number of pixels For every pixel Construct a ray from the eye For every object in the scene Find intersection with the ray Keep if closest Shade depending on light and normal vector
Ray Tracing • Secondary rays (shadows, reflection, refraction) reflection refraction
Povray www.povray.org
Ray Tracing Povray
Radiosity Estrategias posibles • Radiosity • Independiente de donde miro la escena • Computar la matriz de Radiosity y resolver el sistema de ecuaciones • Monte-Carlo Ray-tracing • Enviar toneladas de rayos indirectos
Discrete Radiosity Equation Discretize the scene into n patches, over which the radiosity is constant reflectivity n A å = + r B E F B j i i i ij j j=1 form factor • discrete representation • iterative solution • costly geometric/visibility calculations A i
Calculating the Form Factor Fij • Fij = fraction of light energy leaving patch j that arrives at patch i • Takes account of both: • geometry (size, orientation & position) • visibility (are there any occluders?) patch j patch j patch j patch i patch i patch i
patch j j r i cos i cos j 1 Fij = ∫ ∫ Vij dAj dAi πr2 Ai patch i Ai Aj Calculating the Form Factor Fij • Fij = fraction of light energy leaving patch j that arrives at patch i
Stages in a Radiosity Solution Why so costly? Input Geometry Form FactorCalculation > 90% Calculation & storage of n2 form factors Reflectance Properties Solve theRadiosity Matrix < 10% Radiosity Solution Camera Position & Orientation Visualization(Rendering) ~ 0% Radiosity Image
A j A i Form Factor from Ray Casting • Cast n rays between the two patches • n is typically between 4 and 32 • Compute visibility • Integrate the point-to-point form factor • Permits the computation of the patch-to-patch form factor, as opposed to point-to-patch