Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make shader's main function receive normalised co-ordinates #73

Open
TodePond opened this issue Jan 18, 2025 · 2 comments
Open

make shader's main function receive normalised co-ordinates #73

TodePond opened this issue Jan 18, 2025 · 2 comments
Labels

Comments

@TodePond
Copy link
Collaborator

currently, the second argument gives a positions that's screensize specific. i think it would be more accessible if it passed through 0.0 to 1.0 coordinates of the screen instead

@TristanCacqueray
Copy link
Collaborator

Note that it is that way to be compatible with shadertoy, but it's true that it is annoying to do the conversion manually. Perhaps we could have a default template to take care of this:

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    // Normalized pixel coordinates (from 0 to 1)
    vec2 uv = fragCoord/iResolution.xy;

    // Pixel color
    vec3 col = uv.xyx;

    // Output to screen
    fragColor = vec4(col,1.0);
}

@TodePond
Copy link
Collaborator Author

im not so familiar with the shadertoy community, but im looking at whats currently stopping me from messing with it. i guess i would kinda like uv to be a globally accessible variable? i dunno

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants