Update Waveform Output
Updates: * Added IRE text on 20% increments * Added waveform lines that work * Scaled waveform to a subsection of the surface
This commit is contained in:
@@ -8,6 +8,11 @@ uniform vec2 ove_resolution;
|
||||
uniform vec2 ove_viewport;
|
||||
uniform vec3 luma_coeffs;
|
||||
|
||||
uniform float waveform_scale;
|
||||
uniform vec2 waveform_dims;
|
||||
uniform vec4 waveform_region;
|
||||
uniform vec4 waveform_uv;
|
||||
|
||||
in vec2 ove_texcoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
@@ -19,8 +24,8 @@ void main(void) {
|
||||
// based on how granular the increment is set. For example, it can be
|
||||
// challenging to spot 8 bit combing with an increment of 1. / 2.^8 - 1.
|
||||
float increment = 1.0 / (pow(2, 10) - 1.0);
|
||||
float maxb = ove_texcoord.y + increment;
|
||||
float minb = ove_texcoord.y - increment;
|
||||
float maxb = waveform_dims.y + increment;
|
||||
float minb = waveform_dims.y - increment;
|
||||
|
||||
// Intensity would make sense to also expose via the UI, as a density
|
||||
// slider allows you to peek past certain values or reveal very low
|
||||
@@ -29,29 +34,38 @@ void main(void) {
|
||||
// emission output strength.
|
||||
float intensity = 0.10;
|
||||
|
||||
int y_lim = int(ove_resolution.y);
|
||||
int y_lim = int(waveform_dims.y);
|
||||
|
||||
vec3 cur_col = vec3(0.0);
|
||||
vec3 cur_lum = vec3(0.0);
|
||||
for (int i = 0; i < y_lim; i++) {
|
||||
cur_col = texture2D(
|
||||
ove_maintex,
|
||||
vec2(ove_texcoord.x, float(i) / float(ove_resolution.y))
|
||||
).rgb;
|
||||
|
||||
col += step(vec3(ove_texcoord.y - increment), cur_col) *
|
||||
step(cur_col, vec3(ove_texcoord.y + increment)) * intensity;
|
||||
if (
|
||||
(gl_FragCoord.x >= waveform_region.x) &&
|
||||
(gl_FragCoord.y >= waveform_region.y) &&
|
||||
(gl_FragCoord.x < waveform_region.z) &&
|
||||
(gl_FragCoord.y < waveform_region.w)
|
||||
) {
|
||||
// col = vec3(0.5, 0.5, 0.0);
|
||||
// int start = int(waveform_region.y);
|
||||
int stop = int(waveform_dims.y);
|
||||
float ratio = 0.0;
|
||||
float waveform_x = (ove_texcoord.x - waveform_uv.x) / waveform_scale;
|
||||
float waveform_y = (ove_texcoord.y - waveform_uv.y) / waveform_scale;
|
||||
for (int i = 0; i < waveform_dims.y; i++) {
|
||||
ratio = float(i) / float(waveform_dims.y);
|
||||
cur_col = texture2D(
|
||||
ove_maintex,
|
||||
vec2(waveform_x, ratio)
|
||||
).rgb;
|
||||
|
||||
// TODO: Implement proper luma / luminance based values.
|
||||
// This is simply taking the luminance weights derived from the
|
||||
// OCIO configuration or the RGB to XYZ matrix and multiplying
|
||||
// the above step approach by the luminance weights.
|
||||
// EG:
|
||||
cur_lum = vec3(dot(cur_col, luma_coeffs));
|
||||
col += step(vec3(waveform_y - increment), cur_col) *
|
||||
step(cur_col, vec3(waveform_y + increment)) * intensity;
|
||||
|
||||
col += step(vec3(ove_texcoord.y - increment), cur_lum) *
|
||||
step(cur_lum, vec3(ove_texcoord.y + increment)) * intensity;
|
||||
cur_lum = vec3(dot(cur_col, luma_coeffs));
|
||||
|
||||
col += step(vec3(waveform_y - increment), cur_lum) *
|
||||
step(cur_lum, vec3(waveform_y + increment)) * intensity;
|
||||
}
|
||||
}
|
||||
|
||||
gl_FragColor = vec4(col, 1.0);
|
||||
|
||||
Reference in New Issue
Block a user