GRK-Projekt/grafika_projekt/shaders/bubble.frag
2022-01-02 17:29:41 +01:00

30 lines
795 B
GLSL

#version 430 compatibility
in vec3 fragPos;
in vec3 interpNormal;
in float v_fresnel;
uniform vec3 cameraPos;
in vec3 incident;
uniform samplerCube bubble;
layout (binding = 0) uniform samplerCube tex_map;
void main()
{
float ratio = 1.33 / 1.00;
vec3 I = normalize(fragPos - cameraPos);
vec3 Refract = refract(I, normalize(interpNormal), ratio);
vec3 R = reflect(I, normalize(interpNormal));
vec3 flip = reflect(normalize(-fragPos), normalize(interpNormal));
vec4 flipColor = texture( tex_map, flip );
vec4 refractionColor = texture( tex_map, Refract );
vec4 reflectionColor = texture( tex_map, R );
//vec4 color = vec4(mix(flipColor,reflectionColor,0).rgb,1.0);
gl_FragColor = vec4(mix( flipColor,refractionColor,0).rgb,1.0);
}