#[WGSL] How do I get screen dimensions or aspect ratio in a fragment shader?

3 messages · Page 1 of 1 (latest)

supple jolt
#

Hello, I don't know if this is the right place to post this, but I'm trying to make a simple ray marcher in Rust and it works, except that it assumes the screen has an aspect ratio of 1:1 so the sphere turns into an ellipsoid. On GLSL ray marchers, I see that people correct for this using the screens dimensions, but I don't know how to get the screen dimensions or aspect ratio in a fragment shader with WGSL.

plucky flume
#

You will need to pass it in as a uniform