Hi guys,
Been doing some HDR technique research recently and came across an interesting "Uncharted 2" dev technical analysis...
http://www.cg.tuwien.ac.at/~ginko/Hable ... ghting.pdf
...which then put me onto finding the code(s) for different HDR techniques, including the (apparently) best version being "Filmic Tone Mapping"...
http://filmicgames.com/archives/75
To me this looks very interesting and would like to know if F.T.M. can be implemented as a post processing option within ENB (for Skyrim in particular). I'm having a week off for "battery recharging" from Skyrim / ENB modding, but would still love to hear from anyone about this.
PS. Apart from very basic .ini / .fx code adjusting, I know nothing about ENB / HLSL / any other coding.
"Filmic Tone mapping" HDR possible in (Skyrim) ENB?
- Author
- Message
-
Offline
- Posts: 16
- Joined: 08 Aug 2013, 13:04
-
Offline
- *sensei*
- Posts: 391
- Joined: 03 Oct 2012, 06:12
- Location: Ottawa, Canada
Re: "Filmic Tone mapping" HDR possible in (Skyrim) ENB?
It's possible to have filmic tonemap. Those papers show the basics, you could just transform the math accordingly.
Or better to try some of the newer ENBs on Nexus. To my knowledge, Skylight ENB and Serenity ENB both use filmic tonemapping. I've been using filmic tonemap for a long time, ever since I was dissatisfied with Reinhard math.
Or better to try some of the newer ENBs on Nexus. To my knowledge, Skylight ENB and Serenity ENB both use filmic tonemapping. I've been using filmic tonemap for a long time, ever since I was dissatisfied with Reinhard math.
Last edited by ZeroKing on 25 Feb 2014, 20:32, edited 2 times in total.
-
Offline
- *blah-blah-blah maniac*
- Posts: 530
- Joined: 30 Jan 2012, 13:18
Re: "Filmic Tone mapping" HDR possible in (Skyrim) ENB?
Of course it's possible and it's already done, for GTA IV by icelaglace and for GTA SA by myself. Skyrim idk but since this blog is open, I'm pretty sure someone already found it. Pass me your enbeffect.fx file, I'll implement it for you. Note that the default values give a super dark image so I'll add an exposure control value aswell to brighten up the image again without damaging the color curve.
-
Offline
- Posts: 16
- Joined: 08 Aug 2013, 13:04
Re: "Filmic Tone mapping" HDR possible in (Skyrim) ENB?
@ ZeroKing:
Thank you for your reply, but even "transforming the math" sounds considerably beyond my knowledge and skill level (I'm always open to learning, but I'm equally aware of "biting off more than I can chew"). I've just now had a quick look at the enbeffect.fx files from the two ENB presets you mentioned, and although I can see "toe" and "shoulder" type settings, I'm unsure about the actual settings' values - as in if they're "standard" F.T.M values or modified to suit the presets. Page 137 of the Uncharted 2 PDF I linked states what I assume to be the standard F.T.M. values, but I don't know how the information on this page translates to ENB code (again, I'm more into lighting than engine coding).
@ Marty:
Thank you also for your reply, and for the good info too.
I actually use the standard enbeffect.fx file that Boris issues with each official ENB version (I'm currently using 0.250) but with a small adjustment which JawZ kindly advised me on within this thread...
viewtopic.php?f=7&t=2282
...so in an ideal world I'd love to have the standard enbeffect.fx which allows game post processing, uses p.p. method no.2, allows ENB bloom with game p.p. along with bloom contrast settings (also as JawZ linked to), while having this filmic tone mapping! But if you're willing to provide an original enbeffect.fx with F.T.M. added to it (or instructions if better / easier) then I'd be eternally grateful. If you feel it'll need the extra exposure control then I'll trust your word on that.
I did try to mimic F.T.M. via modifying a standard grey-scale enbpalette.bmp file, along with many other experimental tone mapping curves, but I'm confusing myself more than helping myself, hence I feel the enbeffect.fx file is where the attention should be placed.
I know I may sound a bit strict in my train of thought, but I'm trying to fully understand every process as best I can, and within reason, so I have peace of mind within the files that I'm working with, and the methods that I use so that I actually learn and not accidentally "stumble" across solutions.
Thank you both again.
Thank you for your reply, but even "transforming the math" sounds considerably beyond my knowledge and skill level (I'm always open to learning, but I'm equally aware of "biting off more than I can chew"). I've just now had a quick look at the enbeffect.fx files from the two ENB presets you mentioned, and although I can see "toe" and "shoulder" type settings, I'm unsure about the actual settings' values - as in if they're "standard" F.T.M values or modified to suit the presets. Page 137 of the Uncharted 2 PDF I linked states what I assume to be the standard F.T.M. values, but I don't know how the information on this page translates to ENB code (again, I'm more into lighting than engine coding).
@ Marty:
Thank you also for your reply, and for the good info too.
I actually use the standard enbeffect.fx file that Boris issues with each official ENB version (I'm currently using 0.250) but with a small adjustment which JawZ kindly advised me on within this thread...
viewtopic.php?f=7&t=2282
...so in an ideal world I'd love to have the standard enbeffect.fx which allows game post processing, uses p.p. method no.2, allows ENB bloom with game p.p. along with bloom contrast settings (also as JawZ linked to), while having this filmic tone mapping! But if you're willing to provide an original enbeffect.fx with F.T.M. added to it (or instructions if better / easier) then I'd be eternally grateful. If you feel it'll need the extra exposure control then I'll trust your word on that.
I did try to mimic F.T.M. via modifying a standard grey-scale enbpalette.bmp file, along with many other experimental tone mapping curves, but I'm confusing myself more than helping myself, hence I feel the enbeffect.fx file is where the attention should be placed.
I know I may sound a bit strict in my train of thought, but I'm trying to fully understand every process as best I can, and within reason, so I have peace of mind within the files that I'm working with, and the methods that I use so that I actually learn and not accidentally "stumble" across solutions.
Thank you both again.
-
Offline
- *sensei*
- Posts: 372
- Joined: 28 Jul 2013, 23:26
Re: "Filmic Tone mapping" HDR possible in (Skyrim) ENB?
Hi LargeStyle
Here you go:
Add your own GUI elements... see my ENB on Nexus for the min/max values you need on those elements or just shamelessly copy the whole thing over the ones from Serenity are the "official" values for the GUI min/max.. enjoy
[THIS APPLIES TO LARGESTYLE] Feel free to take the whole enbeffect.fx file for your own purposes, or if its for a release, feel free to use it if you add credits... it has all the control you can wish for except for Luma sharpen and SMAA.
Here you go:
Code: Select all
//Filmic Tonemapping DNI plugged into Adaptation (adapt_max is max of ENB adaptation (_s4), which I clamp somewhere)
float A = lerp( lerp( ShoulderStrengthN, ShoulderStrengthD, ENightDayFactor ), ShoulderStrengthI, EInteriorFactor );
float B = lerp( lerp( LinearStrengthN, LinearStrengthD, ENightDayFactor ), LinearStrengthI, EInteriorFactor );
float C = lerp( lerp( LinearAngleN, LinearAngleD, ENightDayFactor ), LinearAngleI, EInteriorFactor );
float D = lerp( lerp( ToeStrengthN, ToeStrengthD, ENightDayFactor ), ToeStrengthI, EInteriorFactor );
float E = lerp( lerp( ToeNumeratorN, ToeNumeratorD, ENightDayFactor ), ToeNumeratorI, EInteriorFactor );
float F = lerp( lerp( ToeDenominatorN, ToeDenominatorD, ENightDayFactor ), ToeDenominatorI, EInteriorFactor );
float W = lerp( lerp( LinearWhiteN, LinearWhiteD, ENightDayFactor ), LinearWhiteI, EInteriorFactor );
float3 Q = color.xyz;
float3 numerator = ((Q*(A*Q+C*B)+D*E)/(Q*(A*Q+B)+D*F)) - E/F;
float3 denominator = ((W*(A*W+C*B)+D*E)/(W*(A*W+B)+D*F)) - E/F;
color.xyz = numerator / denominator;
color.xyz = max( color.xyz, _c6.xyz );
[THIS APPLIES TO LARGESTYLE] Feel free to take the whole enbeffect.fx file for your own purposes, or if its for a release, feel free to use it if you add credits... it has all the control you can wish for except for Luma sharpen and SMAA.
Last edited by prod80 on 16 May 2014, 00:09, edited 2 times in total.
-
Offline
- Posts: 16
- Joined: 08 Aug 2013, 13:04
Re: "Filmic Tone mapping" HDR possible in (Skyrim) ENB?
Hey Prod80 - good to hear from you again. Has been a while since my Nexus banning / leaving (:
Thank you for the code, and I'll look into how to implement it but at a glance I wouldn't know where exactly to place it within the enbeffect.fx. I'll study your file from your ENB (was easy to find as in Hot Files - congrats) as see how I go - but I ain't holding my breath. Thanks also for the permission for the file use (with credits) - I'll put in into my current (unreleased) ENB and see how I go with my tweaking.
I'll also give Serenity ENB a play - looks good chap. Was surprised to see you do a non-CoT ENB preset, but welcome it nonetheless (no offense to CoT).
Thank you for the code, and I'll look into how to implement it but at a glance I wouldn't know where exactly to place it within the enbeffect.fx. I'll study your file from your ENB (was easy to find as in Hot Files - congrats) as see how I go - but I ain't holding my breath. Thanks also for the permission for the file use (with credits) - I'll put in into my current (unreleased) ENB and see how I go with my tweaking.
I'll also give Serenity ENB a play - looks good chap. Was surprised to see you do a non-CoT ENB preset, but welcome it nonetheless (no offense to CoT).
-
Offline
- *sensei*
- Posts: 372
- Joined: 28 Jul 2013, 23:26
Re: "Filmic Tone mapping" HDR possible in (Skyrim) ENB?
Nexus banned you? How lame... afaik you always helped a lot of people... o well.
The way to implement tone mapping depends on the effect you try and create... in any case the most logical order in enbeffect.fx would be
Apply Game Colorcorrection -> Bloom -> Tonemapping <-> Adaptation (either adaptation before or after tonemapping) -> Color corrections -> Any after effects
But as you can see my fx file has a different order...
Apply Game Colorcorrection -> Bloom -> Color corrections -> Tonemapping hooked into adaptation -> After effects -> Vibrance -> Noise...
It's all up to you, but in any case Tonemapping should follow Bloom, and Bloom should be ran before any color corrections for best effects... But you can code around anything, really. It's a Pixel Shader, so you simply adjust 1 pixel on the screen/texture. In which order is entirely up to you. There's a workaround code possible for any weirdness you encounter on the way. It's just about most efficient path to get to the same goal, but my file is not very efficient (though it does perform quite well)... there are optimalizations planned somewhere in the near future.
PS. Reinhard math is well, needs a lot of extra's to look well.. but basically if you take Reinhard and apply intensity and a curve after it like
...it will work ok-ish.
But anyway, Reinhard isnt made to run over RGB, works a lot better when using color spaces like HSL or HCY instead.
The way to implement tone mapping depends on the effect you try and create... in any case the most logical order in enbeffect.fx would be
Apply Game Colorcorrection -> Bloom -> Tonemapping <-> Adaptation (either adaptation before or after tonemapping) -> Color corrections -> Any after effects
But as you can see my fx file has a different order...
Apply Game Colorcorrection -> Bloom -> Color corrections -> Tonemapping hooked into adaptation -> After effects -> Vibrance -> Noise...
It's all up to you, but in any case Tonemapping should follow Bloom, and Bloom should be ran before any color corrections for best effects... But you can code around anything, really. It's a Pixel Shader, so you simply adjust 1 pixel on the screen/texture. In which order is entirely up to you. There's a workaround code possible for any weirdness you encounter on the way. It's just about most efficient path to get to the same goal, but my file is not very efficient (though it does perform quite well)... there are optimalizations planned somewhere in the near future.
PS. Reinhard math is well, needs a lot of extra's to look well.. but basically if you take Reinhard and apply intensity and a curve after it like
Code: Select all
color.xyz *= intensity;
color.xyz = color.xyz / (color.xyz + tonemapcurve);
color.xyz = pow(color.xyz, contrastcurve);
But anyway, Reinhard isnt made to run over RGB, works a lot better when using color spaces like HSL or HCY instead.
-
Offline
- Posts: 16
- Joined: 08 Aug 2013, 13:04
Re: "Filmic Tone mapping" HDR possible in (Skyrim) ENB?
Yeah, the Nexus staff had / have a lot to learn about treating people right. In some degree of fairness, I also asked to have my account terminated due to being too angry with some idiots on the forums, but ultimately they banned me. I have other means of acquiring downloads so I don't really care. I even then had Zenimaxs legal department on my case for uploading my "Lighting Test Area" cell that I made onto Mediafire (which got taken down without any appropriate communication to myself). Seems I just get shat on when just trying to help others...Nexus banned you? How lame... afaik you always helped a lot of people... o well.
Thanks for your help with enbeffect stuff - although some of it went well over my head. I've just placed your enbeffect.fx into my Skyrim, and g-damn you have a ton of stuff to change! Think I might stick with this file from now on - but I'm wondering one thing...
The "RGB Balance" sections - what are the values in your Serenity ENB based on (personal taste or pre-defined formula)? Or, perhaps more the point, which values would I need to recreate this "Filmic Tone Mapping"?
As you probably recall, I'm way more experienced working with basic RGB / values in Creation Kit itself, and I have a rather good handle on the theory behind that side of things, but when adding an enbeffect.fx as complicated (in a good way) as yours then I'm all confused again and ideally need to take things one step at a time (i.e. add just F.T.M. to otherwise standard Skyrim, then start with compensatory tweaking).
-
Offline
- *sensei*
- Posts: 372
- Joined: 28 Jul 2013, 23:26
Re: "Filmic Tone mapping" HDR possible in (Skyrim) ENB?
add the enbeffect.fx.ini file from Serenity which can be found in the enbseries folder... needs to be in enbseries folder... should give you good base values for that pixel shader (rgb will be correct for Skyrim for that pixel shader), unless you also use color adjustment from effect.txt, but there's no need for any color adjustment in effect.txt with this enbeffect.fx file.
Cant see why they'll put a legal department because of a lighting test area on Mediafire? wtf... this world is mad.
Here's more or less a description of all settings, given some are redundant functions, like I said; not optimized fully. Also some GUI elements min/max values are out of range.... eg. Saturation should have range 0 - 1.0 not 16.0 but that's I think the only one severely out of range. Filmic min/max should be correct according to the creator.
Another minor mistake (hardly has an effect) is that the gray value is on wrong standard (damn... why do I always forget to change it)
float grayValue(float3 gv)
{
return dot( gv, float3(0.25,0.65,0.1) );
}
Should be:
float grayValue(float3 gv)
{
return dot( gv, float3(0.2125,0.7154,0.0721) );
}
Cant see why they'll put a legal department because of a lighting test area on Mediafire? wtf... this world is mad.
Here's more or less a description of all settings, given some are redundant functions, like I said; not optimized fully. Also some GUI elements min/max values are out of range.... eg. Saturation should have range 0 - 1.0 not 16.0 but that's I think the only one severely out of range. Filmic min/max should be correct according to the creator.
Another minor mistake (hardly has an effect) is that the gray value is on wrong standard (damn... why do I always forget to change it)
float grayValue(float3 gv)
{
return dot( gv, float3(0.25,0.65,0.1) );
}
Should be:
float grayValue(float3 gv)
{
return dot( gv, float3(0.2125,0.7154,0.0721) );
}
- Attachments
-
- enbeffect.fx_readme.txt
- read me for the fx file
- (6.16 KiB) Downloaded 400 times
-
Offline
- Posts: 16
- Joined: 08 Aug 2013, 13:04
Re: "Filmic Tone mapping" HDR possible in (Skyrim) ENB?
Thanks again Prod, your help is appreciated - however I'm having a "low mood" day today and not exactly brimming with motivation and confidence, so I'll have a look at all this later. I'll update this thread if / when I carry on with this...