Jump to content
  • Advertisement
Sign in to follow this  
lipsryme

Gamma Correction & Environment Maps

This topic is 2037 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was thinking....in my renderer I currently do:

 

- Render Lighting while using linear space fetch for textures

- Then do post processing

- And in the end after tone mapping I convert back to SRGB.

 

But what about environment maps...

Is it correct to do the same but without the last part ?

So basically for env maps:

 

- Render Lighting while using linear space fetch for textures

- Store env map in linear space as HDR.

 

or is it needed to convert them back to SRGB ?

Keeping them linear does make them a bit more contrast heavy / darker of course so I'm asking if that's correct...?

 

Share this post


Link to post
Share on other sites
Advertisement

I think that the environmental maps should be in linear space, since they are used for lighting and all the lighting calculations are done in linear space. 

 

All the texture reads from albedo / diffuse textures should be gamma corrected (unless you somehow happen to have linear space textures). It doesn't matter if the final rendering is used for rendering to back buffer or to a environmental map. 

 

If you are using the correct texture format for each case, then you don't have to worry so much about the gamma correction, ie. RGBA8_SRGB for the back buffer (automatic gamma conversion) and some suitable HDR  format for the environmental map.

 

In my opinion the environmental maps don't need post processing, since the post processing is mostly used for the final rendered frame. If you post-process your env-maps then the parts using the env maps will have double post-processing in the final frame. By post processing I mean tonemapping, bloom effect etc. I guess there might be some post processing effects suitable for the env maps too.  

 

Cheers!

Share this post


Link to post
Share on other sites

So if I render them out in linear space, then filter them using AMD cubemap gen and then read these textures in my shader again, would I need to convert them to linear space when reading again ? I guess they won't be stored in linear space, so I'd need to convert them again to linear when reading. But doesn't that seem kind of doubled ?

 

Sorry if that sounds confusing. What I mean is when I write these environment maps (being in linear space) to my HDD as a *.DDS file, then filter them and read them again in my lighting shader to use, are they already linear or not ? (meaning do I have to convert them to linear space again?). 

Edited by lipsryme

Share this post


Link to post
Share on other sites

If you are using a linear texture format for the render target them and you don't do any format conversions before storing the map to the disk, then reading from them should result in linear output too.

 

The conversion to linear space is done by hardware automatically if you specify the texture format with _SRGB extension. No need to do any conversion manually in the shader. 

 

Of course, when reading the rendered environmental map texture from disk you must not define it to be an sRGB texture. On the other hand, if you are using a floating point texture format for the env maps, you can't specify sRGB as texture format.

 

What kind of filtering you are talking about?

 

Cheers!

Share this post


Link to post
Share on other sites

I'm talking about irradiance map & prefiltered env map for glossy reflections.

I'm gonna try saving it in SRGB, since I'm getting too dark reflections, ambient light...

Edited by lipsryme

Share this post


Link to post
Share on other sites

All lighting information should be in linear space, sRGB is just there as a storage thing. Since most images (including the LDR framebuffer) tend to have pretty limited precision, you can putz around with the stored/retrieved values in such a way that that lack of precision will be less noticeable to the human eye. Basically just remember to un-sRGB whatever you sRGB and pre-sRGB whatever your pipeline will un-sRGB (see also monitor gamma or textures) and you'll be fine.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!