Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VisualShader editor input screen_uv preview uses visual position of node in editor rather than a sample area #84311

Closed
TZer0 opened this issue Nov 1, 2023 · 2 comments · Fixed by #84348

Comments

@TZer0
Copy link

TZer0 commented Nov 1, 2023

Godot version

v4.1.2.stable.mono.official [399c9dc], v4.2.beta4.mono.official [93cdacb]

System information

Godot v4.2.beta4.mono - Windows 10.0.22621 - GLES3 (Compatibility) - NVIDIA GeForce RTX 3060 Laptop GPU (NVIDIA; 31.0.15.3713) - AMD Ryzen 5 5600H with Radeon Graphics (12 Threads)

Issue description

Use the output section as positional reference:
image
image

Rather than using a sample range (0 to 1 in both x and y directions) such as for uv, screen_uv uses the visual position of the node in the editor. This has no effect on the shader in-game, but makes it more difficult to make a shader as this forces you to swap between uv while building a shader and screen_uv while testing it ingame.

Steps to reproduce

  1. Create new VisualShader.
  2. Add a new input, set the type to be screen_uv, enable preview.
  3. Drag the node around and observe that it changes colour.
    Drag it to the top left and it starts going dark, drag it to the right to make it red, drag it to the bottom right to make it yellow and finally drag it to the bottom left to make it green.

Minimal reproduction project

Reproduction is trivial, visual of bug has been provided.

@jsjtxietian
Copy link
Contributor

jsjtxietian commented Nov 2, 2023

Confirmed.

The current behaviour is strange though, I think it's ok to align the behaviour with uv.
cc @Chaosus Is it a good practice to hack some logic in VisualShaderNodeInput::generate_code when generating preview code? Tested locally it worked, can make a pr if it's ok to you.

@Chaosus
Copy link
Member

Chaosus commented Nov 2, 2023

Is it a good practice to hack some logic in VisualShaderNodeInput::generate_code when generating preview code? Tested locally it worked, can make a pr if it's ok to you.

Yes, why not? If it's lead to better results... It's not a critical part of the engine, after all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants