Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Kuba Cupisz &
Tobias Alexander Franke
Progressive Lightmapper: An introduction to lightmapping
in Unity
Unity Technologies
Progressive Lightmapper:
An introduction to
lightmapping in Unity
Who are we?
Kuba
Cupisz
Tobias Alexander
Franke
The problem with
Lightmapping...
press
wait…
Milliseconds
Progressive updates View prioritization
Today’s menu
• Optimizing content for the Progressive Lightmapper
• i.e. “What can you do to make baking faster”
• A sneak...
Part 1: Optimizing
baking in the
Progressive
Lightmapper
Global
Illumination:
Gambling with
photons until
you think you
have won
Lightmapping at a glance
An overview of the parameters
• Direct Samples
• Number of rays shot towards light sources
• Indirect Samples
• Number of ...
An overview of the parameters
An overview of the parameters
An overview of the parameters
Understanding texels
• Pixels in lightmap
• Mapped to units of space
• Texel count is proportional to resolution^2
• Each ...
1 Texel per Unit 2 Texels per Unit 5 Texels per Unit
You don’t need to bake texels if you
don’t put them into the lightmap!
Keep a low texel count
• Do not waste (a lot of) texels on these:
• Surfaces with low variation
• Surfaces which receive i...
Albedo Baked Lightmap Shaded
Scale objects with low variation
• Scale “unimportant” objects to
reduce texel count
• Good targets:
• Small objects
• Obj...
Light Modes
• Subtractive
• Baked direct and indirect
• Shadowmask
• Save additional lightmap information to composite rea...
Shadowmask/Subtractive Baked Indirect
Remove small/low-influence
objects entirely
Remove small/low-influence
objects entirely
Probe lighting
• Use probes for small or thin objects, and for
small-ish objects that would use too many texels
• Fences
•...
(not)Lightmapping LODs
• Marking all LODs in an LOD Group as lightmap static
• Each renderer gets lightmap texels
• Slow b...
(not)Lightmapping LODs - projection
• Marking only LOD0 in an LOD Group as lightmap static
• Only renderers in LOD0 get li...
(not)Lightmapping LODs - projection
Matching UVs
(not)Lightmapping LODs - projection
27.5k/13.7k/6.9k triangles
(not)Lightmapping LODs - projection
Same distance
(not)Lightmapping LODs - projection
Actual usage in game
(not)Lightmapping LODs - projection
• Will be released as scripts soon
• Copy lightmap scale/offset and lightmap index
• F...
Filtering
• Post process to filter out noise by applying a “blur”
• Two variants
• Gaussian
• Edge-Aware A-Trous
• Used to...
400 Samples Gauss Filter A-Trous Filter 400K Samples
400 Samples Gauss Filter A-Trous Filter 400K Samples
An overview of the parameters
• Lightmap Padding
• Space between UV islands
• Lightmap Size
• Max atlas width/height
Part 2: The GPU baking
backend
Speedup
AMD RadeonRays
• OpenCL based
• Cross platform
• Vendor agnostic
• Wavefront compute based
• Small simple kernels
• Quite ...
Part 3: The Future
The Future
• C# Raytracing API
• Support for multiple GPUs
• in one desktop
• laptop (with internal GPU + eGPUs)
• Feature...
Take-away
• Minimize texel count for faster baking
• Use probes wherever possible, but most importantly for small objects
...
Thank you!
Q&A
Progressive Lightmapper: An Introduction to Lightmapping in Unity
You’ve finished this document.
Download and read it offline.
Upcoming SlideShare
What to Upload to SlideShare
Next
Upcoming SlideShare
What to Upload to SlideShare
Next
Download to read offline and view in fullscreen.

Share

Progressive Lightmapper: An Introduction to Lightmapping in Unity

Download to read offline

In 2018.1 we removed the preview label from the Progressive Lightmapper – we’ve made memory improvements, optimizations, and have had customers battle test it. We are now also working on a GPU accelerated version of the lightmapper. In this session, Tobias and Kuba will provide an intro to the basics of lightmapping and address of the most common issues that users struggle with and how to solve them. They will also provide an update on the future roadmap for lightmapping in Unity.
Tobias Alexander Franke & Kuba Cupisz (Unity Technologies)

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Progressive Lightmapper: An Introduction to Lightmapping in Unity

  1. 1. Kuba Cupisz & Tobias Alexander Franke Progressive Lightmapper: An introduction to lightmapping in Unity Unity Technologies
  2. 2. Progressive Lightmapper: An introduction to lightmapping in Unity
  3. 3. Who are we? Kuba Cupisz Tobias Alexander Franke
  4. 4. The problem with Lightmapping... press wait…
  5. 5. Milliseconds
  6. 6. Progressive updates View prioritization
  7. 7. Today’s menu • Optimizing content for the Progressive Lightmapper • i.e. “What can you do to make baking faster” • A sneak peak into the GPU backend for the Progressive Lightmapper • i.e. “What we are doing to make baking faster” • Future developments • i.e. “What we have in store to make baking more convenient”
  8. 8. Part 1: Optimizing baking in the Progressive Lightmapper
  9. 9. Global Illumination: Gambling with photons until you think you have won
  10. 10. Lightmapping at a glance
  11. 11. An overview of the parameters • Direct Samples • Number of rays shot towards light sources • Indirect Samples • Number of paths shot in the upper hemisphere • Bounces • Number of times a ray is allowed to bounce of another surface
  12. 12. An overview of the parameters
  13. 13. An overview of the parameters
  14. 14. An overview of the parameters
  15. 15. Understanding texels • Pixels in lightmap • Mapped to units of space • Texel count is proportional to resolution^2 • Each texel spawns: • n direct rays towards k lights • m indirect rays * j bounces • one direct ray per bounce towards k lights • Texels are the amount of work to do • Texels are the amount of work to
  16. 16. 1 Texel per Unit 2 Texels per Unit 5 Texels per Unit
  17. 17. You don’t need to bake texels if you don’t put them into the lightmap!
  18. 18. Keep a low texel count • Do not waste (a lot of) texels on these: • Surfaces with low variation • Surfaces which receive indirect bounce light only • Small objects • Thin objects • Surfaces hidden from the player
  19. 19. Albedo Baked Lightmap Shaded
  20. 20. Scale objects with low variation • Scale “unimportant” objects to reduce texel count • Good targets: • Small objects • Objects which receive almost uniform lighting • e.g. the wall in the back Can be represented with few texels Needs many texels, otherwise shadow will be blurry
  21. 21. Light Modes • Subtractive • Baked direct and indirect • Shadowmask • Save additional lightmap information to composite realtime and baked shadows correctly • Indirect only • Baked indirect only • Realtime direct light and shadows
  22. 22. Shadowmask/Subtractive Baked Indirect
  23. 23. Remove small/low-influence objects entirely
  24. 24. Remove small/low-influence objects entirely
  25. 25. Probe lighting • Use probes for small or thin objects, and for small-ish objects that would use too many texels • Fences • Wires • Tubes • Trees • “Decoration” • … • Quick to compute, fairly low lookup cost
  26. 26. (not)Lightmapping LODs • Marking all LODs in an LOD Group as lightmap static • Each renderer gets lightmap texels • Slow bakes • Lower LODs need to be processed one by one • Not enough work to saturate the hardware • Raytracer’s acceleration structure needs to be changed • Can be slow
  27. 27. (not)Lightmapping LODs - projection • Marking only LOD0 in an LOD Group as lightmap static • Only renderers in LOD0 get lightmap texels • Lower LODs reuse those texels • UVs need to match between LOD levels • Same UV island outline, simpler topology inside • Bakes are fast again • All renderers processed in one go • Raytracer’s acceleration structure is static
  28. 28. (not)Lightmapping LODs - projection Matching UVs
  29. 29. (not)Lightmapping LODs - projection 27.5k/13.7k/6.9k triangles
  30. 30. (not)Lightmapping LODs - projection Same distance
  31. 31. (not)Lightmapping LODs - projection Actual usage in game
  32. 32. (not)Lightmapping LODs - projection • Will be released as scripts soon • Copy lightmap scale/offset and lightmap index • From LOD0 to lower LODs • Fully built-in in one of the coming releases
  33. 33. Filtering • Post process to filter out noise by applying a “blur” • Two variants • Gaussian • Edge-Aware A-Trous • Used to fix small amounts of noise • How NOT to optimize • Lower sample count to bake fast • Counter noise with more filtering
  34. 34. 400 Samples Gauss Filter A-Trous Filter 400K Samples
  35. 35. 400 Samples Gauss Filter A-Trous Filter 400K Samples
  36. 36. An overview of the parameters • Lightmap Padding • Space between UV islands • Lightmap Size • Max atlas width/height
  37. 37. Part 2: The GPU baking backend
  38. 38. Speedup
  39. 39. AMD RadeonRays • OpenCL based • Cross platform • Vendor agnostic • Wavefront compute based • Small simple kernels • Quite a lot of them • Can fall back to CPU
  40. 40. Part 3: The Future
  41. 41. The Future • C# Raytracing API • Support for multiple GPUs • in one desktop • laptop (with internal GPU + eGPUs) • Features • MIS • Better probe handling
  42. 42. Take-away • Minimize texel count for faster baking • Use probes wherever possible, but most importantly for small objects • Scale objects in lightmaps if they have low lighting variation • Use appropriate light modes • Try to avoid baking high-frequency details • Indirect light is usually very blurry/low-frequency, no need for many texels • GPU Lightmapper • Future development
  43. 43. Thank you!
  44. 44. Q&A
  • DuoShen

    Aug. 19, 2021
  • chipchipknight

    Aug. 8, 2021
  • HugoCordeiro7

    Mar. 18, 2020

In 2018.1 we removed the preview label from the Progressive Lightmapper – we’ve made memory improvements, optimizations, and have had customers battle test it. We are now also working on a GPU accelerated version of the lightmapper. In this session, Tobias and Kuba will provide an intro to the basics of lightmapping and address of the most common issues that users struggle with and how to solve them. They will also provide an update on the future roadmap for lightmapping in Unity. Tobias Alexander Franke & Kuba Cupisz (Unity Technologies)

Views

Total views

6,017

On Slideshare

0

From embeds

0

Number of embeds

0

Actions

Downloads

65

Shares

0

Comments

0

Likes

3

×