Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image-Based Lighting #7051

Closed
5 of 8 tasks
bagnell opened this issue Sep 19, 2018 · 7 comments
Closed
5 of 8 tasks

Image-Based Lighting #7051

bagnell opened this issue Sep 19, 2018 · 7 comments

Comments

@bagnell
Copy link
Contributor

bagnell commented Sep 19, 2018

Roadmap for implementing IBL:

  • Decide on format: RGBE, LogLUV, RGBM
  • Decide on format container: KTX2, KTX, DDS
  • Collaborate with glTF community on storage, e.g., EXT_lights_image_based extension KhronosGroup/glTF#1377
  • Load diffuse and specular environment maps plus convoluted mip maps
  • Prototype with WebGL2 (requires textureLod in fragment shader)
  • Pack specular environment map and convolutions into a texture atlas using octahedral projection.
  • Use spherical harmonics for the diffuse irradiance map
  • Update default procedural IBL
@bagnell
Copy link
Contributor Author

bagnell commented Sep 19, 2018

For RGBM and octahedral projection, see: http://webglinsights.github.io/downloads/WebGL-Insights-Chapter-16.pdf

For spherical harmonics, see: http://graphics.stanford.edu/papers/envmap/envmap.pdf

@bagnell
Copy link
Contributor Author

bagnell commented Sep 19, 2018

@OmarShehata
Copy link
Contributor

This is a nice explanation of actually computing the coefficients for spherical harmonics: https://computergraphics.stackexchange.com/a/5001

And an example from Babylon of getting these coefficients from a cubemap: https://github.com/BabylonJS/Babylon.js/blob/master/src/Tools/HDR/babylon.cubemapToSphericalPolynomial.ts#L94

@TimvanScherpenzeel
Copy link

TimvanScherpenzeel commented Oct 9, 2018

Filament has a tool called cmgen that is able to create environment maps and generate the precomputed spherical harmonics. It recently also added the ability for octahedral projected maps.

I've also been looking into Bash wrapping this tool in order to output all the necessary assets for IBL here.

@OmarShehata
Copy link
Contributor

Oh, this is great @TimvanScherpenzeel ! Thanks for pointing that out. It'll be pretty useful to compare my implementation to theirs. I know I had some issues with artifacts from linear sampling and had to add a 2 pixel border to get around that, so I'm curious if they had to do the same thing.

Additionally, this might be useful to mention in the glTF lights extension (KhronosGroup/glTF#1377). It's still a draft, and you can see they have this note in the spherical harmonics section:

*(this section needs more about how the coefficients are used as well as a brief blurb about what SH are)*
*(also, we should probably just put some shader code in here for using the coefficients)*

So that might be a nice resource to mention there.

@OmarShehata
Copy link
Contributor

Sample model we can use when implementing the glTF loading part:

KhronosGroup/glTF-Sample-Models#201

@pjcozzi pjcozzi changed the title Image-base Lighting Image-Based Lighting Jan 5, 2019
@OmarShehata
Copy link
Contributor

This was implemented in #7172.

The only remaining thing is using the glTF extension for defining the IBL parameters, which has an issue here: #7252

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants