Last active
August 1, 2023 06:42
-
-
Save otanodesignco/215689f96c2efd9436d8e8b96326d9a2 to your computer and use it in GitHub Desktop.
Calculate the screen space uv to map a texture over the mesh regardless of the mesh position or orientation
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
/* Fragment shader | |
// | |
// Screen space | |
// | |
*/ | |
uniform vec2 uResolution; // screen width and height | |
void main() | |
{ | |
vec2 uv = gl_FragCoord.xy / uResolution; // screen space uv to map textures to the full shape of the model regardless of position | |
gl_FragColor = vec4( uv, 0.8, 1.0 ); // display uv | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment