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 node "UV Panning" don't work properly in 2D #74310

Open
ElHuman0 opened this issue Mar 3, 2023 · 2 comments
Open

VisualShader node "UV Panning" don't work properly in 2D #74310

ElHuman0 opened this issue Mar 3, 2023 · 2 comments

Comments

@ElHuman0
Copy link

ElHuman0 commented Mar 3, 2023

Godot version

4.0 stable

System information

Fedora 37, Intel integrated grafics with mesa drivers using Vulkan

Issue description

When I try to make a texture pan using the Visual Shader built-in node called UV Panning it wont pan properly, this only happens when using a 2DSprite, I tried the same but in a 3d object and it worked properly

This is in 2D:

Screencast.from.2023-03-03.17-02-36.webm

But in 3D:
Screencast from 2023-03-03 17-04-51.webm

Steps to reproduce

  1. Create a new project
  2. Add a 2D scene
  3. Add a Sprite 2D node
  4. Add a VisualShader to the Sprite2D
  5. Inside the Shader Editor add a 2DTexture
  6. Add the UV Panning node and connect it to the UV socket in the 2DTexture node

Minimal reproduction project

UVPanning.zip

@clayjohn
Copy link
Member

clayjohn commented Mar 3, 2023

This is a difference in the default repeat mode for textures in 2D and in 3D. In 3D textures default to "repeat_enabled" which means that the texture will repeat if the UV goes outside the 0-1 range. In 2D, textures default to "repeat_disabled" meaning that the texture does not repeat if the UV goes outside the 0-1 range. I don't think this difference is well documented. It should likely be documented in both the shader reference, and the class reference for BaseMaterial3D, CanvasitemMaterial, and the relevant visual shader nodes (UVFunc, and Texture2D at the very least)

In your 2D project you need to enable repeat if you want the texture to repeat when the UV goes outside the 0-1 range.

@ElHuman0
Copy link
Author

ElHuman0 commented Mar 3, 2023

Thanks! Do you know how can i enable the repeat mode? i found a option in CanvasItem>Texture but it doesn't change anything

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

No branches or pull requests

2 participants