Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 24 Mar 2006
Offline Last Active May 20 2015 09:21 AM

Posts I've Made

In Topic: Tool release for physically based rendering

21 November 2014 - 10:00 PM

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


In Topic: Tool release for physically based rendering

21 November 2014 - 03:20 PM

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!

In Topic: Tool release for physically based rendering

21 November 2014 - 12:46 PM

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:


And for some pretty pictures:

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): 
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:

It can also be found in the GPU Gems article:


Marmoset also take this approach:


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

In Topic: Proper C++ header file?

20 November 2014 - 07:57 PM


I would also suggest to replace







#pragma once


it's simpler and you don't need the #endif at the end smile.png


The only problem with it is that it is not part of the C/C++ standard, so while it is supported by major compilers, it can't be guaranteed to always work.




I thought that I should extend this a little.

Compiler support for this is wide.



However, I'm yet to see someone screw up #ifndef INCLUDED_#

(Aside from me, just then). tongue.png.


Maybe I'm just being old and crotchety and indicating to people to get off of my lawn. 

For me, I prefer #ifndef/#define.

I prefer not to see "#pragma" in my code unless it is inline adding a library (which I prefer it wouldn't (still guilty of this myslef)), or disabling particularly annoying Microsoft compile warnings.

I started with Visual Studio 5.0, and #pragma meant "hear be dragons" to me.


I think that preference on this may fit under "religious/other".



In Topic: Proper C++ header file?

20 November 2014 - 03:59 PM

Some general thoughts and ramblings.

Ramblings are inlined in comments. :).


// You are only using string.
// You should only include string.
// Judiciously including only what you use will improve compile times.
// This is so important that people have written tools to ensure that a
// code base adheres to this:
// https://code.google.com/p/include-what-you-use/wiki/WhyIWYU
#include <string>

// Style guides, totally worth reading up on.
// Seeing as you are just starting out, choose a different one for every project.
// Adhere to it. Learn what you don't like about it:
// http://google-styleguide.googlecode.com/svn/trunk/cppguide.html
// http://udn.epicgames.com/Three/CodingStandard.html
// http://wiki.ros.org/CppStyleGuide
// Many more by googling "c++ style guide" + some company name.
class TileMap
    // Declare the default constructor. Even though a default is provided, it is
    // a really, really good habit to get into.

    // Declare the copy constructor. It will save you later.
    // I would also (maybe) suggest looking into the concept of "non copyable".
    TileMap(const TileMap& from);
    TileMap(const std::string& name, const std::string& location);

    // Declare the default destructor. Even though a default is provided, it is a 
    // life saving habit to get into.

    // Again, one is provided, but quite honestly, this is a another life saving habit
    // to get into when you are just starting out.
    TileMap&            operator=(const TileMap &);

    // Const references for input when setting a value.
    void                setName(const std::string& inName);

    // I assume that "loc" is location. 
    // A longer variable name will help you later when you have other stuff to think about.
    void                setLocation(const std::string& inLocation);

    // Accessors usually are const. I tend to loathe using get on the "gettor".
    // Returning a const ref here is also faster. 
    // I also suggest reading up on return value optimization...
    // http://en.wikipedia.org/wiki/Return_value_optimization
    // If you are aiming for well performing code I would recommend doing away with
    // the use of std::string all together and using const char*.
    // Supplying a const char* in the "create" function should also lead you onto
    // topics such as "copy on write", which is something totally worth reading about:
    // (But not until you know why you shouldn't have a function 
    //  operator in a class declaration :) ).
    // http://en.wikipedia.org/wiki/Copy-on-write 
    // Now I'm rambling, so I will stop.
    const std::string&  name() const;
    const std::string&  location() const;

    // You should probably consider marking your members with a character 
    // that indicates the variable is a member. 
    // Some naming models become very elaborate at the expense of readability.
    // I prefer underscores, others prefer m, some specs prefer extended information
    // for pointers. I.e., if _name were a pointer, the variable would be _pName or mpName.
    std::string         _name; // or mName
    std::string         _loc; // or mLoc