steamworks-vr-api icon indicating copy to clipboard operation
steamworks-vr-api copied to clipboard

No way to query relative size of a screen pixel

Open dghost opened this issue 10 years ago • 2 comments

Currently, the IHmd object does not have any method of determining what the size of a pixel on the screen relative to the size of a pixel in the render target. For a 3D scene it is largely irrelevant, but for certain effects (line sizes, fonts, particles) it is useful to be able to scale them so that they are guaranteed to be visible when displayed on the HMD regardless of what resolution it is rendering at.

It would be nice if the IHmd API could be extended to provide this information.

dghost avatar Mar 16 '14 02:03 dghost

That's a continuously variable value. Assuming you're using GetRecommendedRenderTargetSize() then at the lens axis it should be 1:1, but as you move away from the axis it will start to change to 1:N where 1 screen pixel covers N framebuffer pixels. But in fact you should be able work it out by using the ratio between the input and the results of ComputeDistortion()

jherico avatar Mar 26 '14 00:03 jherico

You're conflating screen resolution with render target resolution. As you point out, you can make a reasonable enough guess about the relative size of a pixel in the pre-distortion render targets and the post-distortion render targets, but that doesn't give any indication of how the native resolution of the display compares to the pre-distortion render target.

Some items, particularly fonts and screen-space effects that are intended to be single-pixel in size, would need additional scaling to ensure that they are still large enough to be visible on the screen.

dghost avatar Mar 26 '14 05:03 dghost