Very nice to see this kind of addition to the effect section. Functions as advertised
And just me being and feeling lazy, I did this to reduce the amount of code needed per variable;
Helper Function;
Code: Select all
// Time and Location separation for ENBSeries by Phinix
float3 DNSrSsEIFactor(float WthrTime, float3 EXTSunrise, float3 EXTDay, float3 EXTSunset, float3 EXTNight, float3 INTSunrise, float3 INTDay, float3 INTSunset, float3 INTNight)
{
///////////////////////////////////////////////////////////////////////////////////
/// This assumes Skyrim standard climate values for sunrise/sunset time/duration.
/// To calibrate properly, leave DetectorOldVersion=false in enbseries.ini and set
/// the following values under the [TIMEOFDAY] section:
///
/// Enable=true
/// DawnDuration=4.5
/// SunriseTime=7.75
/// DayTime=13.0
/// SunsetTime=18.25
/// DuskDuration=4.5
/// NightTime=1.0
///////////////////////////////////////////////////////////////////////////////////
float Int = (1-EInteriorFactor);
float NDDet = 0; /// Night/day detector, no interpolation.
float IsSunrSuns = 0; /// Set to 1 if currently sunrise or sunset.
float SunrDet = 0; /// Sunrise detector.
float SunrFade = 0; /// Sunrise in/out detector (0 is fade-in, 1 is fade-out).
float SunsDet = 0; /// Sunset detector.
float SunsFade = 0; /// Sunset in/out detector (0 is fade-in, 1 is fade-out).
if (WthrTime >= 5.5 && WthrTime <= 10) SunrDet = 1; /// Calculate if currently sunrise.
if (WthrTime >= 16 && WthrTime <= 20.5) SunsDet = 1; /// Calculate if currently sunset.
if (WthrTime > 7.75 && WthrTime <= 10) SunrFade = 1; /// Calculate if sunrise is fading out.
if (WthrTime > 18.25 && WthrTime <= 20.5) SunsFade = 1; /// Calculate if sunset is fading out.
if (WthrTime >= 10 && WthrTime <= 16) NDDet = 1; /// Calculate if currently full day.
if (SunrDet == 1 || SunsDet == 1) IsSunrSuns = 1; /// Calculate if currently sunrise/sunset.
float SunrFactor = lerp((0.4444 * WthrTime) - 2.4444, (0.4 * WthrTime) - 3, SunrFade); /// Sunrise fade factor.
float SunsFactor = lerp((0.4444 * WthrTime) - 7.1111, (0.4444 * WthrTime) - 8.1111, SunsFade); /// Sunset fade factor.
return lerp( lerp( lerp( INTNight, INTDay, NDDet ), lerp( EXTNight, EXTDay, NDDet ), Int ), lerp( lerp( lerp( lerp( INTNight, INTSunrise, SunrFactor), lerp( INTSunrise, INTDay, SunrFactor), SunrFade), lerp( lerp( EXTNight, EXTSunrise, SunrFactor), lerp( EXTSunrise, EXTDay, SunrFactor), SunrFade), Int), lerp( lerp( lerp( INTDay, INTSunset, SunsFactor), lerp( INTSunset, INTNight, SunsFactor), SunsFade), lerp( lerp( EXTDay, EXTSunset, SunsFactor), lerp( EXTSunset, EXTNight, SunsFactor), SunsFade), Int), SunsDet), IsSunrSuns);
}
New per Variable Implementation;
Code: Select all
float fVariable = DNSrSsEIFactor(WeatherAndTime.w, EXTSunrise, EXTDay, EXTSunset, EXTNight, INTSunrise, INTDay, INTSunset, INTNight); // WeatherAndTime is included because it's not present in the enbbloom.fx file
Instead of original implementation;
Code: Select all
float ECCGamma = lerp( lerp( lerp( ECCGIN, ECCGID, pnd ), lerp( ECCGN, ECCGD, pnd ), pi ), lerp( lerp( lerp( lerp( ECCGIN, ECCGISR, psrf), lerp( ECCGISR, ECCGID, psrf), psrd), lerp( lerp( ECCGN, ECCGSR, psrf), lerp( ECCGSR, ECCGD, psrf), psrd), pi), lerp( lerp( lerp( ECCGID, ECCGISS, pssf), lerp( ECCGISS, ECCGIN, pssf), pssd), lerp( lerp( ECCGD, ECCGSS, pssf), lerp( ECCGSS, ECCGN, pssf), pssd), pi), pss), psrss);
Phinix;
I'm wondering if it would be ok if I included this code snippet into a future revision of
Modular Shader Library I have created, with full credits to you and a link here for users wanting more info about this particular code snippet?
EDIT;
And just because.
If you are using ELE - Lite you can use this to introduce a fake Dungeon Factor to alter Dungeons separately from the other "regular" interiors
Helper Function;
Code: Select all
// Time and Location separation for ENBSeries by Phinix, using "Hack" value to allow Dungeon separated control values.
// Only functional if using ELE - Lite or ELE - Interior Lighting!
float3 DNSrSsEIDFactor(float inReg, float WthrTime, float3 EXTSunrise, float3 EXTDay, float3 EXTSunset, float3 EXTNight, float3 INTSunrise, float3 INTDay, float3 INTSunset, float3 INTNight, float3 DUNSunrise, float3 DUNDay, float3 DUNSunset, float3 DUNNight)
{
///////////////////////////////////////////////////////////////////////////////////
/// This assumes Skyrim standard climate values for sunrise/sunset time/duration.
/// To calibrate properly, leave DetectorOldVersion=false in enbseries.ini and set
/// the following values under the [TIMEOFDAY] section:
///
/// Enable=true
/// DawnDuration=4.5
/// SunriseTime=7.75
/// DayTime=13.0
/// SunsetTime=18.25
/// DuskDuration=4.5
/// NightTime=1.0
///////////////////////////////////////////////////////////////////////////////////
/// Hack value used in Dungeon specific factor function
float dunHackVal=0;
if(inReg==1.000001) dunHackVal=1;
float Int = (1-EInteriorFactor);
float NDDet = 0; /// Night/day detector, no interpolation.
float IsSunrSuns = 0; /// Set to 1 if currently sunrise or sunset.
float SunrDet = 0; /// Sunrise detector.
float SunrFade = 0; /// Sunrise in/out detector (0 is fade-in, 1 is fade-out).
float SunsDet = 0; /// Sunset detector.
float SunsFade = 0; /// Sunset in/out detector (0 is fade-in, 1 is fade-out).
if (WthrTime >= 5.5 && WthrTime <= 10) SunrDet = 1; /// Calculate if currently sunrise.
if (WthrTime >= 16 && WthrTime <= 20.5) SunsDet = 1; /// Calculate if currently sunset.
if (WthrTime > 7.75 && WthrTime <= 10) SunrFade = 1; /// Calculate if sunrise is fading out.
if (WthrTime > 18.25 && WthrTime <= 20.5) SunsFade = 1; /// Calculate if sunset is fading out.
if (WthrTime >= 10 && WthrTime <= 16) NDDet = 1; /// Calculate if currently full day.
if (SunrDet == 1 || SunsDet == 1) IsSunrSuns = 1; /// Calculate if currently sunrise/sunset.
float SunrFactor = lerp((0.4444 * WthrTime) - 2.4444, (0.4 * WthrTime) - 3, SunrFade); /// Sunrise fade factor.
float SunsFactor = lerp((0.4444 * WthrTime) - 7.1111, (0.4444 * WthrTime) - 8.1111, SunsFade); /// Sunset fade factor.
return lerp( lerp(lerp(lerp(INTNight, INTDay, NDDet), lerp(EXTNight, EXTDay, NDDet), Int), lerp(DUNNight, DUNDay, NDDet), dunHackVal), lerp( lerp(lerp(lerp(lerp(INTNight, INTSunrise, SunrFactor), lerp(INTSunrise, INTDay, SunrFactor), SunrFade), lerp(lerp(EXTNight, EXTSunrise, SunrFactor), lerp(EXTSunrise, EXTDay, SunrFactor), SunrFade), Int), lerp(DUNSunrise, DUNDay, NDDet), dunHackVal), lerp(lerp(lerp(lerp(INTDay, INTSunset, SunsFactor), lerp(INTSunset, INTNight, SunsFactor), SunsFade), lerp(lerp(EXTDay, EXTSunset, SunsFactor), lerp(EXTSunset, EXTNight, SunsFactor), SunsFade), Int), lerp(DUNSunset, DUNNight, NDDet), dunHackVal), SunsDet), IsSunrSuns);
}
New per Variable Implementation;
Code: Select all
float fVariablefloat = DNSrSsEIDFactor(_c3.z, WeatherAndTime.w, EXTSunrise, EXTDay, EXTSunset, EXTNight, INTSunrise, INTDay, INTSunset, INTNight, DUNSunrise, DUNDay, DUNSunset, DUNNight); // WeatherAndTime is included because it's not present in the enbbloom.fx file