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

All times are UTC





Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: 16 Jan 2014, 15:06 
Offline
*sensei*

Joined: 28 Jul 2013, 23:26
Posts: 372
Does anyone know if there is a technique to downsample scene to a 1x1 texture to use for proper average luminosity calculation for use in tonemapping and adaptation? -- yes, from within pixel shader.

Running it in pixel shader just gets me average luminosity of the pixel or texture, which returns weird results.. example; only certain parts of the trees will become darker when looking at the sun, instead of the entire tree, or ground will stay too bright.

I'm looking for ways to improve tonemapping and adaptation, but limitation in getting accurate scene averages is holding a bit back.... unless I misunderstand something. As far as I understand it requires some changes to deliver a downsampled texture, which cannot be done through pixel shader alone.

Thank you kindly.


Top
 Profile  
 
Tomoko
PostPosted: 16 Jan 2014, 15:19 
Offline
*blah-blah-blah maniac*
User avatar

Joined: 27 Dec 2011, 08:53
Posts: 14816
Location: Russia
Average is not the best while working with hdr data, small bright spot will make average level too high. I tweaked math of adaptation blending to game vanilla weathers (without post processing) to make adaptation natural to human eye, so when fire in the darkness, it not affect everything negatively, but sky do. The less you bother with this, the less pain with tweaking other things. I always start tweaking from setting sun intensity and adaptation limits, then lights. Or take as base values standart ldr look of the game lighting, make it the same, but modify everything else, but again adaptation is one of the first (perfect adaptation is when sun looks properly as human see it, but darkness in games is different, so upper limit of adaptation matter the most).
Well, enough that blah-blah-blah mr freeman, to make adaptation computation draw pixel in corner of screen or line, it's very simple actually and was done many times, ask f.e. gta4 users or search already made shaders which reading data of entire screen and write to edge/corner.

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


Top
 Profile  
 
PostPosted: 16 Jan 2014, 16:40 
Offline
*sensei*

Joined: 28 Jul 2013, 23:26
Posts: 372
Hey Boris,
So if I understand well using tex2D(_s4, IN.txcoord0.xy) alone will already give me proper results in calculating different methods of tonemapping or adaptation? I currently add _s2 and _s4 together.

Example;

float3 Adaptation = tex2D(_s4, IN.txcoord0.xy);
float3 LumCoeff = {0.299, 0.587, 0.114};
float AvgLumin = dot(Adaptation, LumCoeff);

This should already compute to accurate average luminosity of scene and not of pixel? I don't know which math behind in your adaptation.

Currently picking between Reinhard method 4 (http://www.cs.utah.edu/~reinhard/cdrom/tonemap.pdf -- page 3) and Filmic from John Hable ( http://www.slideshare.net/ozlael/hable- ... r-lighting -- slide 142)


Top
 Profile  
 
PostPosted: 16 Jan 2014, 16:51 
Offline
*blah-blah-blah maniac*
User avatar

Joined: 27 Dec 2011, 08:53
Posts: 14816
Location: Russia
_s4 sampler in enbeffect.fx is screen brightness, but not average as i wrote in previous post, you may use it. Limitations of my adaptation are in enbeffect.fx file. You can visualize values of adaptation in side of the screen or in meter of any type, line, circle, digits.

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


Top
 Profile  
 
PostPosted: 16 Jan 2014, 17:06 
Offline
*sensei*

Joined: 28 Jul 2013, 23:26
Posts: 372
Sounds perfect to me. I'll have a play with it and drop Skyrim adaptation out of the mix since its just bad.

Havent opened the original enbeffect.fx file in a while, I see now you take _s4 and use max of it to obtain max white point. Or at least that's how I see it. I'll toy a bit with code and see how that works out for me.

Tanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

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