Jump to content

  • Log In with Google      Sign In   
  • Create Account


Gamma Correction & Environment Maps


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 lipsryme   Members   -  Reputation: 986

Like
0Likes
Like

Posted 12 May 2013 - 06:21 AM

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...?

 



Sponsor:

#2 kauna   Crossbones+   -  Reputation: 2159

Like
1Likes
Like

Posted 12 May 2013 - 10:23 AM

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!



#3 lipsryme   Members   -  Reputation: 986

Like
0Likes
Like

Posted 12 May 2013 - 11:05 AM

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, 12 May 2013 - 11:24 AM.


#4 kauna   Crossbones+   -  Reputation: 2159

Like
0Likes
Like

Posted 12 May 2013 - 04:30 PM

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!



#5 lipsryme   Members   -  Reputation: 986

Like
0Likes
Like

Posted 12 May 2013 - 04:31 PM

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, 12 May 2013 - 05:03 PM.


#6 InvalidPointer   Members   -  Reputation: 1368

Like
0Likes
Like

Posted 13 May 2013 - 11:09 AM

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.


clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS