Tool release for physically based rendering

Started by
7 comments, last by sensate 9 years, 4 months ago

I've recently released an image based lighting baker for physically based rendering to generate preconvonvolved specular cube maps (computed against a user specified brdf) using the seperable method proposed by Epic during Siggraph 2013.

The tool also bakes out the BRDF LUT, and a diffuse irradiance environment map. Cubemaps are saved as both MDR and HDR.

You can find the tool at:
https://github.com/derkreature/IBLBaker

There are also a number of walkthrough and example videos at:
http://www.derkreature.com/

I have also supplied 2 Maya example scenes to test the cubemap outputs using Viewport 2.0 and cgfx.
[media]https://vimeo.com/110805546[/media]

Please contact me through my github account if you find any bugs, have questions or have any suggestions. The code is based on some of my older framework code. You'll have to hold your nose around some of the more horrible bits.

Hopefully some of you find this useful.

If there is any interest, I'd consider writing an article on this.

I thought I'd throw in another quick demo of this tech applied to character rendering. (Still proof of concept really):

[media]https://vimeo.com/100285383[/media]

Advertisement

If there is any interest, I'd consider writing an article on this.

I was going to make a similar tool since I need it for my engine.
I would still prefer to make my own tool for the challenge of it.
Why not cover the math in more detail, along with how to fit other BRDF’s into it?
Also to cover would be how exactly to use the cubemap and look-up texture.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Thanks for sharing!


If there is any interest, I'd consider writing an article on this.
Consider me interested! :)

- Jason Astle-Adams


I was going to make a similar tool since I need it for my engine.
I would still prefer to make my own tool for the challenge of it.

This is indeed fun stuff to work on.

The main driver for this release was to have an "end to end" example of the pipeline presented by Epic and Siggraph.

I realize that this code may not be 100% correct.

I'm somewhat hoping on community interaction to make the tool more relevant and further my own understanding.


Why not cover the math in more detail, along with how to fit other BRDF’s into it?

Absolutely. This would be a good exercise for me in any case.

There would be quite a lot to cover.

I have a number of other demos/projects in flight at the moment.

I'll try to have something drafted by the new year.


Also to cover would be how exactly to use the cubemap and look-up texture.

This is something I can go into deeper in the future.

For the moment, I have supplied CgFx viewport 2.0 shaders for Maya that use the LUT, and MDR cubemaps.

They can be found in the maya directory in the IBLBaker root.

There are also example scenes provided that demonstrate various use cases.


Thanks for sharing!

No problem! I'm hoping to do more of this sort of thing in the future for some other techniques:).


Consider me interested!

I'll start putting together some notes. smile.png.

I'm also cleaning up the render API layer (It is based on my framework code from a long, long time ago) and adding support for GL 4.5 and OSX.

Pardon my ignorance on the topic, but can you give a quick rundown on how this would be applied to real time games? Specifically dynamic lighting? I'm a bit confused on whether this is generating static cubemaps to use with the model in a static lighting environment, or if it's precomputing as much information as possible to be used in epic's lighting calculations.

Thanks in advance.

Pardon my ignorance on the topic, but can you give a quick rundown on how this would be applied to real time games? Specifically dynamic lighting? I'm a bit confused on whether this is generating static cubemaps to use with the model in a static lighting environment, or if it's precomputing as much information as possible to be used in epic's lighting calculations.

Thanks in advance.


I would suggest reading the Epic slides and course notes for a more detailed overview:
http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf

And for some pretty pictures:

http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_slides.pdf

The supplied code can be used to generate static maps or in realtime to dynamically generate maps (you would render the scene to the source cubemap (optimally, invalidated by some cache key) ) and run the convolution stage on the source cubemap to generate the specular roughness and diffuse irradiance cubemaps. A more optimal (but slightly less accurate) approach for diffuse would be to use spherical harmonics.
Dynamic generation of the specular preconvolved cubemap for dynamic lighting works very will when paired with http://seblagarde.wordpress.com/2012/09/29/image-based-lighting-approaches-and-parallax-corrected-cubemap/

An example of convolution for dynamic lighting can be found in a very old demo I did for an older presentation.

(the PBR implementation was my first attempt and is incorrect):
[media]https://vimeo.com/81872845[/media]

IBLBaker currently projects a sphere with the lighting environment represented as a HDR image to the source cubemap that is then importance sampled.
A more complete implementation would render the virtual scene to the source cubemap. The code that youneed to do this is already in the project.
The provided code will work for both static and dynamic cases.

The other alternative to preconvolution is to generate the source environment cubemap and importance sample per pixel for a given number of samples using the full brdf.

(This is mentioned in the Epic slides).
An example of this importance sampling approach can be found in Substance Designer:
http://www.allegorithmic.com/products/substance-painter

It can also be found in the GPU Gems article:

http://http.developer.nvidia.com/GPUGems3/gpugems3_ch20.html

Marmoset also take this approach:

http://www.marmoset.co/

However, I think their "skyshop" tool for Unity has pre-convolution functionality.

The supplied code can be used to generate static maps or in realtime to dynamically generate maps (you would render the scene to the source cubemap (optimally, invalidated by some cache key) ) and run the convolution stage on the source cubemap to generate the specular roughness and diffuse irradiance cubemaps. A more optimal (but slightly less accurate) approach for diffuse would be to use spherical harmonics.

This was the bit I was missing when I first looked at it. The description kind of reads like it's a cubemap generation tool. I thought to myself "well, this is great until the surrounding environment changes". I see now it's meant not only to be a standalone tool, but also an example of how to implement these methods. That's excellent, thanks for this =) I will have to look through the code.


This was the bit I was missing when I first looked at it. The description kind of reads like it's a cubemap generation tool. I thought to myself "well, this is great until the surrounding environment changes". I see now it's meant not only to be a standalone tool, but also an example of how to implement these methods. That's excellent, thanks for this =) I will have to look through the code.

Yeah, I should probably overhaul the home site and the description to better communicate this.

Thanks for pointing this out!

If you are looking for just a baker, this guy is doing some amazing work:

https://github.com/dariomanesku/cmft

This topic is closed to new replies.

Advertisement