Welcome, Guest.
Username: Password: Remember me

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

What's the format of 'mousecoords' in v2.0? 8 months 3 weeks ago #1

  • OtisInf
  • OtisInf's Avatar
  • Offline
  • Posts: 123
  • Thank you received: 51
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!
The administrator has disabled public write access.

What's the format of 'mousecoords' in v2.0? 8 months 3 weeks ago #2

  • OtisInf
  • OtisInf's Avatar
  • Offline
  • Posts: 123
  • Thank you received: 51
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.
The administrator has disabled public write access.

What's the format of 'mousecoords' in v2.0? 8 months 3 weeks ago #3

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2453
  • Thank you received: 1393
They are stored in screen coordinates. The following is faster:
float2 focusPoint = MouseCoords * ReShade::PixelSize;
Cheers, crosire =)
Last Edit: 8 months 3 weeks ago by crosire.
The administrator has disabled public write access.

What's the format of 'mousecoords' in v2.0? 8 months 3 weeks ago #4

  • OtisInf
  • OtisInf's Avatar
  • Offline
  • Posts: 123
  • Thank you received: 51
Thanks!

I've another question regarding key uniforms. Will start a new thread.
The administrator has disabled public write access.