Home Technical Talk

Blurred Cube Map by a texture

polycounter lvl 18
Offline / Send Message
kodde polycounter lvl 18
Hey guys,

I created this thread for us to discuss blurring cube maps by a texture. I got this idea from EarthQuake who mentioned this in another thread. I found this to be very interesting to grasp and learn so here we go.

I'll start with a test case in Maya viewport, using a CGFX shader I have been tinkering a bit with today. This shader selects what Mip Map level to be used by sampling a "roughness" texture.

[ame]http://www.youtube.com/watch?v=zO76loR_vbQ[/ame]

I'm curious what your opinions on this are. When do you modulate this? In a similar fashion as how you reason when defining specular gloss/roughness level or is this something totally different? My spontaneous thought is they would be the same.

Replies

  • PhilipK
    Options
    Offline / Send Message
    PhilipK polycounter lvl 10
    I think this is very interesting. At the previous company I worked for we had a similar setup, where every object could use an RGB map for specular (green chan), glossiness (red chan) and additional map (could for example be cubemap mask in blue chan). The glossiness also controlled (if you wanted to) which mip step to use from the cubemap.
    I think it's really interesting to see the result you can achieve using the same cubemap but varying the gloss over it.

    I think you can pretty much always rely on you wanting the cubemap roughness to be the same as the specular roughness most (all?) of the time. So having one map to control that would work imo.
  • kodde
    Options
    Offline / Send Message
    kodde polycounter lvl 18
    I've just been messing about with combining this with full lighting solution. Even just having a uniform value to set what cube mip level to use seems lovely, especially with a well tweaked cube map from CubeMapGen. Loving this so far.
  • EarthQuake
    Options
    Offline / Send Message
    Generally, you would use the gloss map to derive your standard specular "glossiness" as well, and you would have a parameter to scale the % it affects the spec in relation to the IBL.

    Someone asked in the other thread for a game that uses this, Darkest of days is a game that i've worked on(and am allowed to talk about =P) that uses IBL for its base lighting system. DoD actually uses HDR cube maps as well, but only had a material set-able glossiness setting. The newest version of marmoset has proper per pixel gloss now.

    3 Point Shader is something else to look at to get an idea of how this works, there are a lot more values exposed here, so much more room to experiment and get a good idea of how it all works. You can also load a ambient and reflection cube separately, and blur them separately too. Spiting the ambient and reflection into two separate maps allows you to do more advanced effects.

    Generally, for film and games, most IBL systems will be based off of Debevec's work.

    http://ict.debevec.org/~debevec/Research/LS/
    http://gl.ict.usc.edu/skyprobes/

    GPU gems:

    http://http.developer.nvidia.com/GPUGems/gpugems_ch19.html

    IBL has been around for quite some time, I dont have a list of games that use it off the top of my head, but it is quite common these days, and becoming even more common.
  • divi
    Options
    Offline / Send Message
    divi polycounter lvl 12
    was experimenting with something similar in udk, but i used several blurred and downsized cubemap version because using lower mip-map levels of a cubemap directly in udk had the faces blurred but the seams between the sides sharp and that was really very visible.

    maybe there's a setting somewhere that solves that problem in udk.

    examples looks very nice and i'd absolutely prefer using that instead of normal specular - even on rougher surfaces.
  • EarthQuake
    Options
    Offline / Send Message
    Divi: what are you using to generate your cube maps? ATI cubemapgen for instance does proper blurring of mips.
  • eld
    Options
    Offline / Send Message
    eld polycounter lvl 18
    We used that at grin, where the shader would just mip down the cube depending on the glossiness or when the lack of a glossinessmap the specular map.

    It can be used for really great effect, to simulate glossiness values with a cube.
  • cman2k
    Options
    Offline / Send Message
    cman2k polycounter lvl 17
    quoting my post from the other thread:
    cman2k wrote: »
    I'm working on a game that is doing it, but we won't be out for a long while...

    I can confirm it's definitely a sweet methodology though. and it let's you make badass metals! :D

    In my shaders for this system the "gloss" is referred to as "roughness". It's stored in the alpha channel of our full-color specular maps.

    It's used to do several things including:
    controlling the cubemap mip-map levels (ie; "blurriness" of the cubemap)
    controlling the exponent of the specular (we still use specular to reflect dynamic lighting)
    mask a detail normal/specular (ie; "rough" areas can optionally get a detail normal that "smooth" areas won't get).

    I think DICE used a system like this in BFBC2? check out this awesome whitepaper on their [url=http://www.slideshare.net/repii/frostbite-rendering-architecture-and-realtime-procedural-shading-texturing-techniques-presentation?from=ss_embed
    ]frostbite rendering system[/url]. (page 51)

    As EQ said it's more physically correct than the standard cubemap/specular methods. I have spoken with several people who have compared it to mental ray's shader setup in terms of functions and controls.

    And yeah, to re-inforce what's been said here, using ATI cubemapgen for this is pretty much absolutely necessary unless you have some engine-specific method for blurring your cube-mips (or generating several cubemaps at lower resolutions).

    Read more about how to do this on the polycount wiki page for diffusely convolved cubemaps!
  • divi
    Options
    Offline / Send Message
    divi polycounter lvl 12
    EarthQuake wrote: »
    Divi: what are you using to generate your cube maps? ATI cubemapgen for instance does proper blurring of mips.


    yeah, that. was just referring to cubemaps generated and downressed in udk having the seams. when exporting them and importing them again it's okay
  • dralex789
    Options
    Offline / Send Message
    dralex789 polycounter lvl 7
    divi wrote: »
    yeah, that. was just referring to cubemaps generated and downressed in udk having the seams. when exporting them and importing them again it's okay

    How do you re-import them with their own pre made mips? I though the UDK could only handle texture formats that couldn't carry mips. It doesn't like DDS files to my knowledge.
Sign In or Register to comment.