mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-26 06:20:24 +00:00
22 lines
No EOL
475 B
GLSL
22 lines
No EOL
475 B
GLSL
#version 330 core
|
|
out vec4 FragColor;
|
|
in vec3 localPos;
|
|
|
|
uniform sampler2D equirectangularMap;
|
|
|
|
const vec2 invAtan = vec2(0.1591, 0.3183);
|
|
vec2 SampleSphericalMap(vec3 v)
|
|
{
|
|
vec2 uv = vec2(atan(v.z, v.x), asin(v.y));
|
|
uv *= invAtan;
|
|
uv += 0.5;
|
|
return uv;
|
|
}
|
|
|
|
void main()
|
|
{
|
|
vec2 uv = SampleSphericalMap(normalize(localPos)); // make sure to normalize localPos
|
|
vec3 color = texture(equirectangularMap, uv).rgb;
|
|
|
|
FragColor = vec4(color, 1.0);
|
|
} |