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 ) Surface L V r n Kr, Kg, Kb Ks, q Propiedades del cuerpo
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
Gourard shading I r1, I g1, I b1 I r2, I g2, I b2 I r3, I g3, I b3 Ir pixel = (I r1.A 1 +I r2.A 2 +I r3.A 3 )/A n 1, n 2, n 3 A1A1 A3A3 A2A
Modelo de iluminación simple Flat shadingGourard shading
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 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 Complexity? O(n * m) n = number of objects, m = number of pixels
Ray Tracing Secondary rays (shadows, reflection, refraction) reflection refraction
Sombras
Povray
Ray Tracing Povray
Radiosity
Radiosity 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 Estrategias posibles
Discrete Radiosity Equation A i A j discrete representation iterative solution costly geometric/visibility calculations Discretize the scene into n patches, over which the radiosity is constant form factor reflectivity j=1 jijiii BFEB n
Calculating the Form Factor F ij F ij = 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 i patch j
Calculating the Form Factor F ij F ij = fraction of light energy leaving patch j that arrives at patch i patch i patch j i j r F ij = V ij dA j dA i cos i cos j π r2π r2 1 AiAi AiAi AjAj
Stages in a Radiosity Solution Form Factor Calculation Solve the Radiosity Matrix Input Geometry Visualization (Rendering) Reflectance Properties Camera Position & Orientation Radiosity Solution Radiosity Image ~ 0% < 10% > 90% Calculation & storage of n 2 form factors Why so costly?
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 A i A j