texture movement (shader)
Asked Answered
A

2

0

does anyone know how to make this shader code to make a movement on the texture more optimized so that it can be changed during the game without sudden cuts

shader_type canvas_item;
uniform vec2 dir = vec2(0.1,-0.0);
uniform float speed = 2.0f;

void fragment(){
	vec4 color = texture(TEXTURE, UV + (dir* TIME * speed));
	COLOR = color;
	
}
Abbotsun answered 15/7, 2023 at 11:24 Comment(0)
S
0

Abbotsun so that it can be changed during the game without sudden cuts

I suspect that's possibly more up to the script from which you update the uniform input values and how you go about updating them. You haven't shown that code yet at all.

Silicic answered 15/7, 2023 at 13:41 Comment(0)
A
0

Silicic

gravar-2023-07-15-16-21-52-207.mp4
347kB

I saw that the texture speed was equal to the player's velocity.x divided by 1000

Abbotsun answered 15/7, 2023 at 14:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.