Modelo de iluminacin simple R Ia Kr Ii




















- Slides: 20
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) Propiedades del cuerpo Kr, Kg, Kb Ks, q V r n Surface L
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 n 1 , n 2 , n 3 Ir 1 , Ig 1 , Ib 1 Ir 2 , Ig 2 , Ib 2 Ir 3 , Ig 3 , Ib 3 3 A 2 A 1 A 3 Irpixel= (Ir 1. A 1+Ir 2. A 2+Ir 3. A 3)/A 1 2
Modelo de iluminación simple Flat shading Gourard 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 Complexity? O(n * m) n = number of objects m = number of pixels Find intersection with the ray Keep if closest Shade depending on light and normal vector
Ray Tracing Secondary rays (shadows, reflection, refraction) reflection refraction
Sombras
Povray www. povray. org
Ray Tracing Povray
Radiosity
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 B i = E i + r i å Fij B j Aj j=1 form factor Ai • discrete representation • iterative solution • costly geometric/visibility calculations
Calculating the Form Factor 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 i
Calculating the Form Factor Fij = fraction of light energy leaving patch j that arrives at patch i patch j j i Fij = 1 Ai patch i r cos i cos j ∫ ∫ Vij d. Ai 2 πr Ai Aj
Stages in a Radiosity Solution Input Geometry Reflectance Properties Form Factor Calculation > 90% Solve the Radiosity Matrix < 10% Radiosity Solution Camera Position & Orientation Visualization (Rendering) Radiosity Image ~ 0% Why so costly? Calculation & storage of n 2 form factors
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 Ai Aj