DevilsDagger's LUTs
- matsilagi
- Topic Author
- Offline
- Posts: 292
4 years 21 hours ago - 4 years 21 hours ago #1 by matsilagi
Could someone port this? (or its LUTs to the ReShade format)
This is how the LUT looks like:
And this is how its code look like:
Unfortunately, i don't know all of the infos, but the most important (color) ones are there, the only problem is that the LUTs produce weird colors, so they may be on a different format or formula.
This is how the LUT looks like:
And this is how its code look like:
#version 330
uniform float seed;
uniform float vhs_scale;
uniform float lut_scale;
uniform float lut2_scale;
uniform float exposure;
uniform vec3 cam_position;
uniform vec3 light_dir;
uniform mat3 aspect_view_proj;
uniform mat4 view_proj_matrix;
uniform sampler2D tex_diffuse;
uniform sampler2D tex_diffuse2;
uniform sampler2D tex_lut;
uniform sampler2D tex_lut2;
varying vec2 vert_uv0;
varying vec2 vert_view_pos;
varying vec3 vert_view_dir;
void main( )
{
vec2 vuv = vert_uv0.xy + vhs_scale * 0.003 * vec2( pow( 1.0 - ( abs( seed - vert_uv0.y )), seed * 144.0 ), 0.0 );
vec4 result0 = texture( tex_diffuse, vuv ) * vec4( 1.0, 0.0, 0.0, 1.0 );
result0 += texture( tex_diffuse, vuv + vhs_scale * vec2( 0.002, 0.0 )) * vec4( 0.0, 1.0, 0.0, 1.0 );
result0 += texture( tex_diffuse, vuv + vhs_scale * vec2(-0.002, 0.0 ) ) * vec4( 0.0, 0.0, 1.0, 1.0 );
//result0 *= result0;
// result0.rgb *= 1.0 - clamp(( length( wpos - cam_position )) * 0.02, 0.0, 1.0 );
// result0.rgb *= mix( vec3( 1.0 ), vec3( 0.0, 0.0, 0.4 ), min( 1.0, length( wpos - cam_position ) * 0.1 ));
float r = sin( seed * 63.3 + dot(vert_uv0.xy ,vec2(12.9898,78.233))) * 43758.5453;
vec3 noise = vec3( fract( r * 0.111 ), fract( r * 12.0 ), fract( r * 0.01 ));
// result0 = texture( tex_diffuse, vert_uv0.xy );
result0.rgb += vhs_scale * ( noise * 0.02 - 0.01 );
result0 *= 2.0;
result0.a = 1.0;
float quantpow = 1.1;
float sat = 1.0 - min( result0.r, min( result0.g, result0.b )) / max( 0.001, max( result0.r, max( result0.g, result0.b )));
quantpow -= sat * 0.9;
result0.rgb = pow( result0.rgb, vec3( quantpow ));
vec3 quant = vec3( 19.0 );
result0.rgb = floor( result0.rgb * quant ) / quant;
result0.rgb = pow( result0.rgb, vec3( 1.0 / quantpow ));
// LUT TEST
vec3 lut_in = clamp( result0.rgb, vec3( 0.0 ), vec3( 1.0 ));
float lut_tex_size = textureSize( tex_lut, 0 ).x;
float lut_b = lut_in.b * 15.0;
float lut_b_sub = fract( lut_b );
lut_b -= lut_b_sub;
vec2 lut_rg = lut_in.rg * 15.0 / vec2( lut_tex_size, 256.0 );
//lut_rg.g = 0.0;
lut_rg.g += lut_b * 16.0 / 256.0;
lut_rg += vec2( 0.5 / lut_tex_size, 0.5 / 256.0 );
lut_rg.g = 1.0 - lut_rg.g;
vec3 lut_rgb = mix( textureLod( tex_lut, lut_rg, 0 ), textureLod( tex_lut, lut_rg - vec2( 0.0, 16.0 / 256.0 ), 0 ), lut_b_sub ).rgb;
vec3 lut2_rgb = mix( textureLod( tex_lut2, lut_rg, 0 ), textureLod( tex_lut2, lut_rg - vec2( 0.0, 16.0 / 256.0 ), 0 ), lut_b_sub ).rgb;
result0.rgb = mix( mix( result0.rgb, lut_rgb, lut_scale ), lut2_rgb, lut2_scale );
result0.a = 1.0;
// result0.rgb = wpos;
// result0 = 1.0 * texture( tex_diffuse, vuv );
// result0.rgb = qpos / 16.0;
gl_FragColor = result0 * exposure;
}
Unfortunately, i don't know all of the infos, but the most important (color) ones are there, the only problem is that the LUTs produce weird colors, so they may be on a different format or formula.
Please Log in or Create an account to join the conversation.
- TreyM
- Offline
- Posts: 137
4 years 18 hours ago #2 by TreyM
I'm pretty sure that LUT is just oriented vertically instead of horizontally. You can try to rearrange the squares beside each other in photoshop to reorient the LUT horizontally. Rearrange them in the order they are now where top to bottom becomes left to right.
Please Log in or Create an account to join the conversation.
- matsilagi
- Topic Author
- Offline
- Posts: 292
4 years 18 hours ago #3 by matsilagi
Thats literally The first thing i did, thats why i said in my post that it produces weird colors, The channels or something on the LUT is distributed differently
Please Log in or Create an account to join the conversation.
- TreyM
- Offline
- Posts: 137
4 years 16 hours ago #4 by TreyM
You didn't rotate them did you? Just rearranged them right?
Please Log in or Create an account to join the conversation.
- crosire
- Offline
- Posts: 3665
4 years 12 hours ago - 4 years 4 hours ago #5 by crosire Rotate each square 90° to the right and then rearrange them horizontally.
The following user(s) said Thank You: matsilagi
Please Log in or Create an account to join the conversation.
- matsilagi
- Topic Author
- Offline
- Posts: 292
4 years 5 hours ago #6 by matsilagi
They just needed to be rearranged, not rotated, silly me, yesterday i only rotated them and it got the colors all wrong.
Thanks a lot everyone!
Thanks a lot everyone!
Please Log in or Create an account to join the conversation.