26 lines
616 B
GLSL
26 lines
616 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 R = refract(I, normalize(interpNormal), ratio);
|
|
|
|
vec3 r = reflect(normalize(-fragPos), normalize(interpNormal));
|
|
|
|
|
|
vec4 reflectionColor = texture( tex_map, r );
|
|
vec4 refractionColor = texture( tex_map, R );
|
|
|
|
|
|
|
|
gl_FragColor = vec4(mix( reflectionColor,refractionColor,0 ).rgba);
|
|
} |