LIGHT BAKING WITH IRAY Martin-Karl Lefranois May 2017 LIGHT BAKING - - PowerPoint PPT Presentation

light baking with iray
SMART_READER_LITE
LIVE PREVIEW

LIGHT BAKING WITH IRAY Martin-Karl Lefranois May 2017 LIGHT BAKING - - PowerPoint PPT Presentation

LIGHT BAKING WITH IRAY Martin-Karl Lefranois May 2017 LIGHT BAKING What is it? Computing and storing the information of complex lighting to be used in a real time environment. Freezing lights information and storing the data that paint how


slide-1
SLIDE 1

Martin-Karl Lefrançois May 2017

LIGHT BAKING WITH IRAY

slide-2
SLIDE 2

2

LIGHT BAKING

Computing and storing the information of complex lighting to be used in a real time environment. Freezing lights information and storing the data that paint how the light rays bounce around static geometry. Caching pre-calculated lighting information in textures or per-vertex or some other form to recreate the lighting in real time.

What is it?

slide-3
SLIDE 3

3

IRRADIANCE

The act of irradiating; emission of rays of light. That which irradiates or is irradiated. The radiant power received by unit area of surface (physics) Source: Wiktionary

What is Irradiance

slide-4
SLIDE 4

4

IRRADIANCE

Irradiance is a measurement of solar power and is defined as the rate at which solar energy falls onto a surface.

Intensity of Light

"irradiance" and "intensity of light" are the same

slide-5
SLIDE 5

5

TOOLS FOR MEASURING IRRADIANCE

Light meter / Exposure Meter An instrument that measures the intensity of the light reflected from or falling on a subject Calculates the optimum exposure depending

  • n the film speed.

Measuring light intensity

slide-6
SLIDE 6

6

LIGHT METER / LUX METER

Lux meter for measuring illuminances. It is equal to one lumen per square meter.

Measuring Brightness

slide-7
SLIDE 7

7

DIFFUSE LIGHTING

Lambert's cosine law in its reversed form (Lambertian reflection) implies that the apparent brightness of a Lambertian surface is proportional to the cosine of the angle between the surface normal and the direction of the incident light.

Lambertian reflectance

Eθ = E i cos(θ)

Cosine Law:

slide-8
SLIDE 8

8

LIGHTS

for (i = 0; i < n_lights; ++i) result += lightContribution(L[i], N) * diffuse_color; Color lightContribution(light& L, vec3 normal) { return L.color * dot(L.direction, normal); // -shadow, -AO, … }

Diffuse lighting

slide-9
SLIDE 9

9

LIGHTS

Color all_lights(0,0,0) for (i = 0; i < n_lights; ++i) all_lights += lightContribution(L[i], N); result += all_lights * diffuse_color

Total contributions

Lci(Ldi i N)

i

slide-10
SLIDE 10

10

LIGHTS

Environment High Dynamic Range Image (HDRi) Sun & Sky Implicit Lights Point, spot, .. Area: sphere, rectangle, .. Emissive Objects Geometry emitting some energy

Various sources of energy

slide-11
SLIDE 11

11

IRAY PHOTOREAL

Iray Photoreal Path tracer Physically based MDL (Material Definition Language) Define the properties of the material Absorption, reflectivity Emissivity

Implementing Light Baking

slide-12
SLIDE 12

12

LIGHT BAKING

Gathering lighting effect from ray tracer to realtime

  • Emission from the Sun & Sky and
  • ther HDRi
  • Lights and area lights
  • Bouncing light (Global illumination)
  • Shadows and ambient occlusion
  • LPE compatible
  • Using MDL

Adding all incoming light to a light map (texture)

slide-13
SLIDE 13

13

LIGHT PROBES

Sampling the Hemisphere

Sampling the hemisphere for all light contribution defined by a point and a normal

Lci(Ldi i N)

i

slide-14
SLIDE 14

14

LIGHT BAKING

Irradiance probes are used to render the irradiance at certain locations in the scene. Orientation of the camera is irrelevant

Irradiance Probes (capturing elements)

slide-15
SLIDE 15

15

LIGHT BAKING

Applying on Object

Use light probes and place them on the surface of the

  • bject
slide-16
SLIDE 16

16

LIGHT BAKING

Sampling the object in 3D space for each texel.

Sampling the object

slide-17
SLIDE 17

17

LIGHT BAKING

For each texel, add a light probe

Irradiance Probes

slide-18
SLIDE 18

18

LIGHT BAKING

Rasterizing all triangles in the UV domain

  • Output position and normal

Finding 3D position of each texel

Position Normal

slide-19
SLIDE 19

19

UV BAKING

Vertex: gl_Position = vec4(texCoord, 1) * 2.0 - 1.0; Fragment: fColor1 = vec4(varWorldPos, 1.0); fColor2 = vec4(varNormal, 1.0);

GLSL for UV baking

Position Normal

slide-20
SLIDE 20

20

LIGHT BAKING

Extract all points and normals Construct a list of irradiance probes Render

Convert to Irradiance Probes

Lp = {{p0,n0}, {p1,n1}, {p2,n2},…}

slide-21
SLIDE 21

21

LIGHT BAKING

Render using ‘iray' No tonemapper RGB floating point to receive the irradiance values Use values to put in an image at the earlier extracted positions

Render

slide-22
SLIDE 22

22

LIGHT BAKING

Different resolutions

slide-23
SLIDE 23

23

LIGHT BAKING

Result on Object

Without and with light map texture

slide-24
SLIDE 24

24

LIGHTING

vec4 cc = color; if (has_texture) { // Ajdusting the texture to linear space cc = pow(texture(tex, varTexCoord0.xy), vec4(2.2)); } fragcolor = cc * texture(lbk_tex, varTexCoord1.xy);

GLSL Fragment for lighting

slide-25
SLIDE 25

25

LIGHT BAKING ISSUES

Seam and borders

Fixed by enlarging the contour

slide-26
SLIDE 26

26

LIGHT BAKING

Missing Texels

slide-27
SLIDE 27

27

LIGHT BAKING

Removing some noise with Median Blur

slide-28
SLIDE 28

28

LIGHT BAKING

512x512, 100 iterations 1,4 seconds 18 million rays/seconds

Speed

slide-29
SLIDE 29

29

DEMO

Iray and Live

Iray 2000 iterations Live @60Hz

slide-30
SLIDE 30

30

EXTRA

Light Path Expression One light map per group of lights L.*’light_group1’I : Path from a light source to the irradiance point, bounce n-times and touch one of the light which is part of group1. Avoid objects to be part of the lighting contribution: L.*[^’obj1’]I : Any path that goes from any light to the irradiance point, but not touching the object obj1.

LPE

slide-31
SLIDE 31

31

GLOSSINESS

Compute the incoming light from dependent direction. Store the value with the incoming direction and use it for glossy light reflection.

Angle dependent illumination

slide-32
SLIDE 32

32

NEXT

Multisampling to cover the entire area of the texel A radius to the light probe could be better

Enhancement

slide-33
SLIDE 33

33

QUESTIONS?

slide-34
SLIDE 34

THANKS !