WebGL PBR工具envTools

664 阅读1分钟

原文:cedricpinson.github.io/ParisWebGL2…

LIGHT [1]

  • Micro geometry image.png

SURFACE ROUGH

image.png

SURFACE PLANE

image.png

APPROXIMATION

image.png

MICROFACET SPECULAR BRDF [1]

image.png

DIFFUSE [2]

image.png

IMAGE BASED LIGHTING

image.png

PREFILTERING ENVIRONMENT

  • Mitsuba [4] for reference
  • Diffuse, Cubemap / SH - cubemapgen [5]
  • Specular, Cubemap - UE4 [6]Frostbite [7]

WEBGL STATS [8]

image.png

CUBEMAP SEAMS

No ARB_seamless_cube_map extension

AMD cubemap gen has code to fixup [5]

image.png

PANORAMA LOD FALLBACK

better alternative Octahedral projection [10] image.png

ENVTOOLS [11]

  • Spherical Harmonics for diffuse
  • Panorama and Cubemap GGX
  • Environment preview
  • Blurred environment background
  • Color encoding (float,rgbe,rgbm,luv)
  • MulitThread / OpenCL**

SAMPLES COUNT

  • Depends on the HDR range
  • Depends on roughness level

OPTIMIZATION

IMPORTANCE SAMPLING [12]

image.png image.png

COLOR ENCODING

  • float image.png
  • rgbm image.png
  • rgbe luv image.png

STORAGE 256

Interleave

sizeformatencoding
1.3Mpanoramaluv
1.6Mpanoramargbm
1.7Mpanoramargbe
7.2Mpanoramafloat
1.1Mcubemapluv
1.4Mcubemaprgbm
1.4Mcubemaprgbe
5.5Mcubemapfloat
Bitplane
sizeformatencoding
---------------------
687Kpanoramaluv
1002Kpanoramargbm
924Kpanoramargbe
6.9Mpanoramafloat
646Kcubemapluv
944Kcubemaprgbm
885Kcubemaprgbe
5.2Mcubemapfloat

RESOURCES

[1] Natty Hoffman, Physics and Math of Shading
[2] Sebastien Lagarde, PI or not to PI in game lighting equation
[3] HDR environment hdri-hub.com
[4] Mitsuba PBR renderer
[5] Sebastien Lagarde, AMD Cubemapgen for PBR
[6] Brian Karis, Epic UE4 shading
[7] Charles de Rousiers & Sébastian Lagarde, Moving Frostbite to PBR
[8] Florian Boesch, WebGL stats
[9] Ignacio Castaño, post about cubemap seams
[10] Jeff Russel, HDR image based lighting on the web
[11] Cedric Pinson, envtools
[12] GPU based importance sampling
[13] Padraic Hennessy, Runtime Environment Map Filtering for Image Based Lighting
[14] Christer Ericson, Converting RGB to LogLuv in a fragment shader
[15] Brian Karis, RGBM color encoding
[16] Sketchfab