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

Default Viewport texture repeat mode changed in 4.0 #73373

Closed
allenwp opened this issue Feb 15, 2023 · 4 comments
Closed

Default Viewport texture repeat mode changed in 4.0 #73373

allenwp opened this issue Feb 15, 2023 · 4 comments

Comments

@allenwp
Copy link
Contributor

allenwp commented Feb 15, 2023

Godot version

v4.0.rc2.official [d2699dc]

System information

Windows 10, NVIDIA, Forward+, Mobile, and Compatibilty

Issue description

I am posting this because I am not sure if it is an intentional change in Godot 4.0 or if it is a possible "regression".

In Godot 3, the texture repeat of a Viewport texture is set to "not repeat" (clamp). In Godot 4, the texture repeat of a SubViewport texture is set to "repeat".

image

This issue is simply resolved by changing the texture repeat mode in a shader:

uniform sampler2D viewport_texture: repeat_disable;

Or, if you are using a StandardMaterial3D material, you can change the repeat mode to "Off" under "Sampling" (this changes the texture_repeat property).

The new default repeat texture mode of Godot 4 becomes problematic if your UVs of a mesh are set to the full 0 to 1 range. In this case, the repeated edge can be seen bleeding through. With the texture repeat mode set to "no repeat", this specific use case has no problems, so this change may be seen as a regression in Godot 4 for this use case.

It seems there was no way to change the repeat mode in Godot 3.5, so now that there are ways to easily change this, it might not be a problem that the default has changed from "no repeat" to "repeat".

Steps to reproduce

  1. Create a SubViewport with a camera
  2. Create a mesh instance with a material that uses the SubViewport's texture
  3. Note that the texture repeats in Godot 4.0 RC2 but does not repeat in Godot 3.5

Minimal reproduction project

ViewportTextureRepeat.zip

allenwp added a commit to allenwp/GodotMirror that referenced this issue Feb 15, 2023
…revent texture repeat bleeding into the edges. This is to address a change in the default repeat mode in Godot 4 RC2: godotengine/godot#73373
@clayjohn
Copy link
Member

Repeat mode is now set on the shader instead of on the texture itself. When using ShaderMaterials, you can set the repeat hint as you have done. When using StandardMaterial3D, you can adjust the texture_repeat property and set it to false

@allenwp
Copy link
Contributor Author

allenwp commented Feb 15, 2023

Repeat mode is now set on the shader instead of on the texture itself. When using ShaderMaterials, you can set the repeat hint as you have done. When using StandardMaterial3D, you can adjust the texture_repeat property and set it to false

Thanks @clayjohn! I did not know about this property. I have updated my original post to reference this.

@Calinou
Copy link
Member

Calinou commented Feb 15, 2023

This is done by design indeed. I don't think we should make a special case for ViewportTextures compared to regular textures.

@allenwp
Copy link
Contributor Author

allenwp commented Feb 15, 2023

Actually, now that I know that StandardMaterial3D does have a property to change this, I understand that the important thing here is that StandardMaterial3D defaults to "repeat".

In Godot 3, the SpacialMaterial defaults to repeat.
In Godot 4, the StandardMaterial3D defaults to repeat.

So, in this way, there is no change in the defaults. Only a change in where this texture property is set.

I am closing this issue because I understand why things appear different at first glance.

@allenwp allenwp closed this as completed Feb 15, 2023
@Calinou Calinou closed this as not planned Won't fix, can't repro, duplicate, stale Feb 15, 2023
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

3 participants