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

  • OtisInf
  • Topic Author
More
8 years 1 month ago #1 by OtisInf What's the format of 'mousecoords' in v2.0? was created 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.

  • OtisInf
  • Topic Author
More
8 years 1 month 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.

  • crosire
More
8 years 1 month ago - 8 years 1 month 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: 8 years 1 month ago by crosire.

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

  • OtisInf
  • Topic Author
More
8 years 1 month 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.

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.