Hi there,
I need some advice and knowlege about shaders. I want scrolling texture on a Cube-Mesh. The texture should be scaled down (not shown in full size).
The tutorials I found were outdated.
Which functions I need?
Hi there,
I need some advice and knowlege about shaders. I want scrolling texture on a Cube-Mesh. The texture should be scaled down (not shown in full size).
The tutorials I found were outdated.
Which functions I need?
You can achieve scrolling and scaling by manipulating UV coordinates in shader code. Spatial shaders already have uv scale and offset parameters that you can change from script or animate.
You can animate the uv offset via GDScript and a Spatial material, you don't need a custom shader for this.
onready var your_mat = get_node("YourMesh").get_surface_material(0)
func _physics_process(delta):
your_mat.uv1_offset += Vector3(0.25, 0, 0) * delta
To add to @cybereality's example, for scaling you would *=
(edit: on the uv coordinates, esp. in shader) instead of the addition +=
which is used for translation.
This fits my needs. Thank you!!!
© 2022 - 2024 — McMap. All rights reserved.