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
Discontinuous texture in ParallaxBackground if the texture has to be drawn more than twice on screen #27160
Comments
Your project upload did not complete, so it's a bit hard to do anything for this issue without more details. |
@alexzheng Pretty bump, check above comment. |
I think this is sort-of by design, since ParallaxLayer's Mirroring shows things at most twice. See #15359. |
I kinda work around this by setting This "bug" is also very prominent when you zoom out big time with camera.
Should it repeat more than twice then? Something like |
Also here's my hacky workaround snippet: func _update_size():
for canvas_idx in get_child_count():
var canvas_layer = get_child(canvas_idx)
if not canvas_layer is CanvasLayer:
continue
for idx in canvas_layer.get_child_count():
var layer_node = canvas_layer.get_child(idx)
if not layer_node is ParallaxLayer:
continue
var canvas = layer_node.get_node('canvas')
var tex_size = canvas.texture.get_size()
var vp_size = viewport.size
var vp_scale = viewport.canvas_transform.get_scale()
var q = vp_size / tex_size
q = q / vp_scale
q = q.ceil()
var x = q.x * tex_size.x
var y = q.y * tex_size.y
var new_size = Vector2(x, y)
new_size *= 2 # just to be sure it covers all
# Update mirroring
var mirroring = layer_node.motion_mirroring
if mirroring.x > 0.0:
mirroring.x = new_size.x
if mirroring.y > 0.0:
mirroring.y = new_size.y
layer_node.motion_mirroring = mirroring
# Update canvas size
var canvas_size
if canvas is TextureRect:
canvas_size = canvas.rect_size
elif canvas is Sprite:
canvas_size = canvas.region_rect.size
if mirroring.x > 0.0:
canvas_size.x = new_size.x
if mirroring.y > 0.0:
canvas_size.y = new_size.y
if canvas is TextureRect:
canvas.rect_size = canvas_size
elif canvas is Sprite:
canvas.region_rect.size = canvas_size
|
Still valid in 2ba96f0 |
workaround might work but having mirror_count is something that I think should get added, don't think it will be hard to implement it. |
Godot version:
3.1
OS/device including version:
Issue description:
if the width of the texture is smaller than the width of the device, there is a short gap between the textures.
Steps to reproduce:
Minimal reproduction project:
Uploading ParallaxBug.zip…
The text was updated successfully, but these errors were encountered: