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.
#[WGSL] How do I get screen dimensions or aspect ratio in a fragment shader?
3 messages · Page 1 of 1 (latest)
You will need to pass it in as a uniform
If you haven't used uniforms yet then this https://sotrh.github.io/learn-wgpu/beginner/tutorial6-uniforms/#a-perspective-camera has a basic example for a 3d camera
Learn Wgpu