26
Lighting

Phong and Blinn Phong

Embed Size (px)

Citation preview

Page 1: Phong and Blinn Phong

Lighting

Page 2: Phong and Blinn Phong

Agenda

• Modelos de iluminación

• Phong

• Blinn-Phong

• Implementation

• Multiples luces

• Deferred rendering

• Tiled Based rendering

Page 3: Phong and Blinn Phong

Modelos de iluminación

• Phong

• Blinn-Phong

• Lambert

• Oren Nayar

• Cook-Torrance

• Minnaert

Page 4: Phong and Blinn Phong

Phong

Page 5: Phong and Blinn Phong

Phong

Page 6: Phong and Blinn Phong

Specular Power

Page 7: Phong and Blinn Phong

Blinn-Phong

Page 8: Phong and Blinn Phong

Blinn-Phong

Page 9: Phong and Blinn Phong

Diferencia entre modelos

Page 10: Phong and Blinn Phong

Detalles de ImplementaciónPhong Blinn-Phong Approximate curve 4.0 4.2

Page 11: Phong and Blinn Phong

ResultadoPhong Normal Blinn-Phong Blinn-Phong With 4.2

Page 12: Phong and Blinn Phong

Problemas comunes

• WorldInverseTranspose

• Normales no normalizadas

• Directions no normalizadas

• LightColor no normalizadas

Page 13: Phong and Blinn Phong

WorldInverseTranspose

Page 14: Phong and Blinn Phong

Normales no normalizadas

Page 15: Phong and Blinn Phong

Direcciones no normalizadas

Page 16: Phong and Blinn Phong

LightColor no normalizadas

Page 17: Phong and Blinn Phong

Multiples luces

• Bucle en el que se recorren todas las luces y se acumula el resultado.

Page 18: Phong and Blinn Phong

Multiples luces

• Realizar varias pasadas acumulando el resultado mediante Additive.

Page 19: Phong and Blinn Phong

Multiples luces

• Cálculo de nuevas luces que acumulan al resto.

• Varios shaders para 1, 2, 3 y 4 luces.

• Problema con las transiciones entre luces.

Page 20: Phong and Blinn Phong

Deferred Rendering

• For each light

– For each object

• Añadir la contribución de luz al framebuffer

• Shader por tipo de material y por tipo de luz

• Perdida de ciclos de Shaders

– Superficies invisibles / Overdraw

– Triángulos fuera de la influencia de la luz.

– Perdida de tiempo

• Full VertexBuffer, Texture Filtering

Page 21: Phong and Blinn Phong

Deferred Rendering

• For each object

– Almacenar sus propiedades en el G-Buffer

• For each light and lit pixels

– Usar el G-Buffer para calcular la iluminación

– Añadir el resultado al framebuffer

• Número constante de pixeles (Screen Spaces)

• No contempla objetos transparentes.

Page 22: Phong and Blinn Phong

Deferred Rendering

RenderTarget 0 (SurfaceFormat.Color)

Color.R Color.G Color.B Specular Intensity

RenderTarget 1 (SurfaceFormat.Color)

Normal.X Normal.Y Normal.Z Specular Power

RenderTarget 2 (SurfaceFormat.Single)

Depth 32bit

Page 23: Phong and Blinn Phong

Deferred Rendering

Page 24: Phong and Blinn Phong

Tile-based Deferred Shading

• Dividir la pantalla en tiles y determinar que luces afectan a cada tile.

• Se utiliza suele utilizar DirectCompute.

Page 25: Phong and Blinn Phong

Tile-based Deferred Shading

Page 26: Phong and Blinn Phong

Thank you so much

Javier Cantón Ferrero