What's the format of 'mousecoords' in v2.0?

More
4 years 8 months ago #1 by OtisInf
Hi,

in the changelog for 2.0, the following is stated:
Added "mousepoint" source for uniform variables (float2 with mouse cursor coordinates)

which is great, as it can be used e.g. select the auto-focus point based on the mouse coords (combined with a keytoggle through the keyboard uniform variable to enable/disable it quickly). But there's no info (or I couldn't find it!) on the format of mousepoint, i.e. what is the range of the coordinates? If I use the value directly as the focuspoint in the dof, it's not working as expected and if I try to paint a series of pixels around the current mousepoint to see where it is for debugging, I get unexpected results, telling me the values aren't ranging from 0.0 to 1.0 ;)

Is there more info about this uniform somewhere?

Thanks!

Please Log in or Create an account to join the conversation.

More
4 years 8 months ago #2 by OtisInf
Replied by OtisInf on topic What's the format of 'mousecoords' in v2.0?
Never mind. Converting it to 0-1.0 coords is done through:

// reshade.fx
uniform float2 MouseCoords < source = "mousepoint"; >;

// dof.fx::GetCoC
focusPoint = float2(ReShade::MouseCoords.x/BUFFER_WIDTH, ReShade::MouseCoords.y/BUFFER_HEIGHT);

I can now manually set the autofocus point in the DoF using the mouse. Will tweak it a bit so it's switchable through keyboard and will try to display a dot so it's visible what the focus point is, and if everything works as planned I'll send a PR.

Please Log in or Create an account to join the conversation.

More
4 years 8 months ago - 4 years 8 months ago #3 by crosire
Replied by crosire on topic What's the format of 'mousecoords' in v2.0?
They are stored in screen coordinates. The following is faster:
float2 focusPoint = MouseCoords * ReShade::PixelSize;
Last edit: 4 years 8 months ago by crosire.

Please Log in or Create an account to join the conversation.

More
4 years 8 months ago #4 by OtisInf
Replied by OtisInf on topic What's the format of 'mousecoords' in v2.0?
Thanks!

I've another question regarding key uniforms. Will start a new thread.

Please Log in or Create an account to join the conversation.