Please use english language
It is currently 26 Feb 2020, 09:56

All times are UTC





Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: 18 Jun 2013, 00:56 
Offline

Joined: 12 Jun 2013, 07:19
Posts: 66
Hi Boris, some dumb question about adaptation math, hope you don't mind.

Code:
float4   Adaptation=tex2D(_s4, 0.5);


Where does the "texs4" texture come from? How was it calculated?

I am particularly interested in its value range.

Well, I am just trying to have a intuitive understanding of the effect of Adaptation+Tonemap. I have been trying to sort it out in Excel (yeah, amatuer programmer), but I can't be sure without knowing the exact range and value of grayAdaptation...
Image
https://docs.google.com/file/d/0B6n1gHpFbLcRemhnbGpYZlBENE0/edit?usp=sharing


Top
 Profile  
 
Tomoko
PostPosted: 18 Jun 2013, 05:09 
Offline

Joined: 12 Jun 2013, 07:19
Posts: 66
Code:
float4   Adaptation=tex2D(_s4, 0.5);
float   grayadaptation=max(max(Adaptation.x, Adaptation.y), Adaptation.z);


is grayadaptation the max or average luminance of the whole screen?

I am reading Reinhard's paper (http://www.cs.utah.edu/~reinhard/cdrom/tonemap.pdf) on the tone mapping. Managed to figure out his math (formula 4). Yours looks similar but a lot more complicated I couldn't quite understand but saw similar results in mapping.

Sorry if any of my saying sounds nonsense, just learning and couldn't find proper resource.


Top
 Profile  
 
PostPosted: 18 Jun 2013, 11:46 
Offline
*blah-blah-blah maniac*
User avatar

Joined: 27 Dec 2011, 08:53
Posts: 14816
Location: Russia
Quote:
Where does the "texs4" texture come from? How was it calculated?

It's mine texture and it's computed from screen image. It's not average intensity, but something middle between average and max, to make it properly working i experimented with scenes when fire is in dark rooms and sky partially visible in the hole of dark room.
Quote:
I am particularly interested in its value range.

From 0 to intensity of screen pixels, which are hdr 16 bit.
AdaptationSensitivity - curve between sampling of max and middle values result=lerp(average, maximal, AdaptationSensitivity);
AdaptationMin/Max - simply clamping result result=max(result, AdaptationMin); result=min(result, AdaptationMax);

_________________
i5-4690k, 16Gb RAM, GTX 1060 6Gb, X-Fi Titanium, Win7 x128
I am INFP, not the brutal, godamnit.


Top
 Profile  
 
PostPosted: 18 Jun 2013, 12:31 
Offline

Joined: 12 Jun 2013, 07:19
Posts: 66
Thanks for the clarification. I experimented a bit and found it's not max luminance as well.

Sorry if I ask for too much :)

Is it possible to sample the max luminance of the screen after applying all HDR lighting and color tweak (bloom, curves, DOF etc.)?

Because if you have the max luma, it's easy to use Reinhard's formula to compress the exactly whole HDR range to LDR without over compressing or losing anything (and it's automatic, no number tweaks needed). If the sun power or some lights are ridiculously strong you can just cap the max luma at some reasonable point.

After all the purpose of adaptation and tone mapping is to compress HDR range exactly to 0..1 range without losing any information if possible (contrast loss is inevitable thought). If you know the exact max HDR luminance of current image, and proper compression formula, would it be much easier?


Top
 Profile  
 
PostPosted: 18 Jun 2013, 12:37 
Offline

Joined: 12 Jun 2013, 07:19
Posts: 66
Quote:
AdaptationSensitivity - curve between sampling of max and middle values result=lerp(average, maximal, AdaptationSensitivity);


hmm... does that mean if I set AdaptationSensitivity to 1.0, the grayadaptation would be the maximum luminance of the current image? And set to 0.0 for average luminace?


Top
 Profile  
 
PostPosted: 18 Jun 2013, 13:04 
Offline
*blah-blah-blah maniac*
User avatar

Joined: 27 Dec 2011, 08:53
Posts: 14816
Location: Russia
I don't see any sense in using max intensity value, because only single pixel can be extremely bright and ruin tonemapping.
Quote:
If the sun power or some lights are ridiculously strong you can just cap the max luma at some reasonable point.

No, i said in previous message, hard to balance adaptation to human perception, most game developers read those docs and making same code, but what is the result? Shit.
But the most important is that everybody write unrealistic computations and at same time trying to implement exactly the same code which described insome docs, it's rediculous. Less important is the fact that skyrim source data is ldr and docs describe hdr tonemapping techniques for real images, so result will never be realistic, it simply can't.
Quote:
to compress HDR range exactly to 0..1 range without losing any information

This can't be realistic looking. result=color/(1.0+color); - already compress to 0..1 range without loosing information, but what you have visually?
Quote:
does that mean if I set AdaptationSensitivity to 1.0, the grayadaptation would be the maximum luminance of the current image?

No, downsampling process of screen to small adaptation texture consist from many stages and first of them use average computation, but max-average interpolation applied closer to the end, when image small enough. This guarantee minimal "noise" from small spots in image. Don't remember, but guess 16*16 pixels of screen is that stage when AdaptationSensitivity applied.

_________________
i5-4690k, 16Gb RAM, GTX 1060 6Gb, X-Fi Titanium, Win7 x128
I am INFP, not the brutal, godamnit.


Top
 Profile  
 
PostPosted: 18 Jun 2013, 13:11 
Offline

Joined: 12 Jun 2013, 07:19
Posts: 66
Quote:
No, i said in previous message, hard to balance adaptation to human perception, most game developers read those docs and making same code, but what is the result? Shit.


How do you know what i am doing now lol? As you said, what i got is: shit...

I guess the reason is in real life the max luma is capped by natural law and camera sensitivity, but in game, individual pixel can be insanely bright, this trolls math.


Top
 Profile  
 
PostPosted: 18 Jun 2013, 13:39 
Offline

Joined: 12 Jun 2013, 07:19
Posts: 66
Another one: so the adaptation sampling was done before bloom color was applied? does the way bloom was calculated have an unpredictable interference on the tone mapping curve?


Top
 Profile  
 
PostPosted: 18 Jun 2013, 14:01 
Offline
*blah-blah-blah maniac*
User avatar

Joined: 27 Dec 2011, 08:53
Posts: 14816
Location: Russia
Adaptation computed before bloom. Bloom is just an artifact of lenz, read about airy discs.
Quote:
does the way bloom was calculated have an unpredictable interference on the tone mapping curve?

Why? Bloom amount is very low compared to image.

_________________
i5-4690k, 16Gb RAM, GTX 1060 6Gb, X-Fi Titanium, Win7 x128
I am INFP, not the brutal, godamnit.


Top
 Profile  
 
PostPosted: 19 Jun 2013, 03:00 
Offline

Joined: 12 Jun 2013, 07:19
Posts: 66
Boris you are a crazily brilliant genius! I can't even imagine how you designed those math for tone mapping, the more I look at them the more I am overwhelmed with awesomeness.

Is there anyway I can output the grayadaptation value to the screen?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group