shaders/first.frag
author František Kučera <franta-hg@frantovo.cz>
Wed, 29 Nov 2023 01:27:05 +0100
branchv_0
changeset 4 9aba96f0b001
parent 2 3faef2f5128e
permissions -rw-r--r--
fragment shader: add grayscale() function

#version 330 core

uniform  sampler2D  uTexture;
in       vec2       vTextureXY;
out      vec3       fColor;

vec3 grayscale(vec3 original) {
	const vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);
	float luminance = dot(original, luminanceWeighting);
	return vec3(luminance);
}

void main(){
	fColor = texture(uTexture, vTextureXY).rgb;
	// fColor = grayscale(fColor);
	// fColor *= vec3(0.8, 1., 0.2);
}