Some Question to Shaders (Visual seems easier)
Asked Answered
S

4

0

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?

Subatomic answered 6/10, 2021 at 14:40 Comment(0)
C
0

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.

Chesser answered 6/10, 2021 at 15:5 Comment(0)
L
0

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
Leadership answered 6/10, 2021 at 16:23 Comment(0)
A
0

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.

Alluvion answered 6/10, 2021 at 17:48 Comment(0)
S
0

This fits my needs. Thank you!!!

Subatomic answered 6/10, 2021 at 17:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.