Eye Adaptation
- Deriest
- Topic Author
float4 adaptPass (in float4 pos : SV_Position, in float2 texcoord : TEXCOORD0) : SV_Target
{
float4 Lum = tex2D(samplerBloom4, 0.5);
Lum.w = max(Lum.x, max(Lum.y, Lum.z));
float4 Color = tex2D(samplerColor, texcoord);
Color.w = max(Color.x, max(Color.y, Color.z));
float adaptLum = Lum.w;
float adaptCol = Color.w;
if (adaptCol > adaptLum)
{
float difference = adaptCol / adaptLum;
float3 brightness = pow(color.xyz, difference);
}
if (adaptCol < adaptLum)
{
float difference = adaptLum / adaptCol;
float3 brightness = color.xyz + difference;
}
// color.xyz = lerp(color.xyz, brightness, timer);
color.xyz = lerp(color.xyz, brightness, smoothstep(0, timeleft, timer));
color.w = 1.0;
return color;
}
I want to learn this so if there is anything someone wants to point out to me, feel free to do so.
Please Log in or Create an account to join the conversation.
- crosire
Please Log in or Create an account to join the conversation.
- Deriest
- Topic Author
Please Log in or Create an account to join the conversation.
- crosire
Please Log in or Create an account to join the conversation.
- Deriest
- Topic Author
Please Log in or Create an account to join the conversation.
- Deriest
- Topic Author
Is frametime the number of milliseconds that have passed while compiling the current frame or the number of milliseconds it took for the previous frame?
Is timer counting total milliseconds since game started or since current frame started rendering?
Sorry for these questions if they are dumb but the extent of my programming knowledge is from mods like this which I have only been messing with for under a year.
Please Log in or Create an account to join the conversation.
- crosire
To answer yours, the following timers are currently available in ReShade:
- date | Four component vector containing: year, month (1 - 12), day of month (1 - 32) and time in seconds since midnight
- frametime | Time in milliseconds it took for the previous frame to complete (including post processing)
- timer | Time in milliseconds since game start
- timeleft | Time in milliseconds that is left until the current technique timeout is reached
Please Log in or Create an account to join the conversation.
- Deriest
- Topic Author
Please Log in or Create an account to join the conversation.
- Deriest
- Topic Author
Please Log in or Create an account to join the conversation.
- CryZENx
i wish this feature in reshade aswell
Please Log in or Create an account to join the conversation.
- Deriest
- Topic Author
(1 - timeleft) * adaptSpeed
Please Log in or Create an account to join the conversation.
- crosire
Please Log in or Create an account to join the conversation.
- Deriest
- Topic Author
Please Log in or Create an account to join the conversation.
- DrakePhoenix
Sorry for raising this thread even though it hasn't been posted to for about 4.5 months, but I have a question about this, and I'm hoping Deriest is still around and can answer it, or that someone else might be able to answer it for me...
given the code line:
float4 Lum = tex2D(samplerBloom4, 0.5);
Why is the second parameter for the tex2D function merely 0.5? I thought it required a full texture coordinate, which would be a float2, not a single float value. Does the system assume a coordinate of (0.5, 0.5) if it only receives the one float value?
I'd appreciate clarification on that please.
Thanks,
Drake Phoenix
Please Log in or Create an account to join the conversation.
- Ganossa
Please Log in or Create an account to join the conversation.
- crosire
ReShade supports implicit vector casting from a smaller size vector (in this case a single component one, a scalar) to a bigger size vector (in this case a two component one). It will automatically expand the last value in the vector to the remaining components of the bigger size vector. This means:DrakePhoenix wrote: Why is the second parameter for the tex2D function merely 0.5? I thought it required a full texture coordinate, which would be a float2, not a single float value. Does the system assume a coordinate of (0.5, 0.5) if it only receives the one float value?
float3 val3 = 5; // val3 == float3(5, 5, 5)
float4 val4 = float2(1, 2); // val4 == float4(1, 2, 2, 2)
Please Log in or Create an account to join the conversation.
- DrakePhoenix
I was actually wondering this morning if it worked similar to the way copying from a couple of cells in MS Excel or OpenOffice Calc and then pasting into a selected set of cells that is larger than the original source. In that case it starts over with the first value and repeats through it. So, for example, if you copy 2 cells (1, 2) and paste into 4 cells you would get a result of 1, 2, 1, 2.
So it's good to know not only that it will implicitly cast, but also the manner in which it does so.
Thanks again,
Drake Phoenix
Please Log in or Create an account to join the conversation.
- DrakePhoenix
I'm curious as to how the samplerBloomX samplers work. I know they are based on sampling from texBloomX. And for some reason texBloom1 and texBloom2 are identical. But texBloom3 divides the buffer dimensions by 2, texBloom4 divides by 4, and texBloom5 divides by 8.
Is this basically that you take the buffer texture, and then down-size it to fit into the smaller dimensions (which would lose detail), in order to deliberately blur the texture and then output the blurred texture as the result?
Thanks,
Drake Phoenix
Please Log in or Create an account to join the conversation.
- crosire
That would be a question for Marty, since these originate from his code (ported from ENB) AFAIK.DrakePhoenix wrote: I'm curious as to how the samplerBloomX samplers work. I know they are based on sampling from texBloomX. And for some reason texBloom1 and texBloom2 are identical. But texBloom3 divides the buffer dimensions by 2, texBloom4 divides by 4, and texBloom5 divides by 8.
Please Log in or Create an account to join the conversation.