How to repeat a uniform sampler2d texture in godot 4
Asked Answered
T

5

0

Hi,

As imported textures in godot 4 no longer provide the ability for these to be flagged as repeating does any one know how a uniform sampler2d texture can be flagged for the shader as repeating?

Thank you.

Tautologize answered 28/10, 2021 at 21:22 Comment(0)
D
0

Don't know how things are in Godot 4 but isn't tiling a default behavior for textures?

If nothing else works you can always wrap UV coordinates in the shader, or manipulate them in any way needed.

Dallasdalli answered 29/10, 2021 at 15:26 Comment(0)
T
0

Thanks xyz.

When importing textures in godot 4 you can no longer choose for the texture to be set as repeat. You can however set it when assigning the image to a sprite2d for example - there is a property to indicate the texture is repeating. I was wondering if there is something similar to indicate to the shader a uniform sampler2d is repeating.

But anyhow I will do the wrapping within the shader.

Tautologize answered 29/10, 2021 at 20:11 Comment(0)
P
0

It's this line that does it:

uniform sampler2D texture_albedo : hint_albedo,filter_linear_mipmap,repeat_enable;
Paulownia answered 30/10, 2021 at 2:20 Comment(0)
T
0

Thank you very much cybereality.

I was thinking it would be something like this.

Cheers!

Tautologize answered 31/10, 2021 at 23:57 Comment(0)
P
0

Yeah, no problem. I didn't know this either. But I noticed the standard material did repeat by default. So I converted the standard material to a shader material and just looked at the code.

Paulownia answered 1/11, 2021 at 0:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.