Last active
June 13, 2023 11:28
-
-
Save codeanticode/020cc4f25acc820acefce6774cd4893e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uniform samplerCube cubemap; | |
uniform float aperture; | |
varying vec4 vertTexCoord; | |
const float PI = 3.1415926535897932384626433832795; | |
const float DEG_TO_RAD = PI/180; | |
void main() { | |
vec2 thetaphi = ((vertTexCoord.xy * 2.0) - vec2(1.0)) * vec2(PI, PI/2); | |
vec3 rayDirection = vec3(cos(thetaphi.x), tan(aperture* DEG_TO_RAD)*thetaphi.y, sin(thetaphi.x)); | |
vec3 color = vec3(textureCube(cubemap, rayDirection)); | |
gl_FragColor = vec4(color, 1.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment