-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
AtlasTexture does not work with some Objects and Resources #33855
Comments
I get the same issue with Godot 3.2 beta 2 on Windows 10. I created a minimal project: Reproduce by:
|
There is a PR to fix this for CpuParticles2D already. #32496 I guess similar changes need to be made for other nodes. |
I really think that all these problems are due to bad design/implementation of AtlasTexture. For example: #25895. Also it has bugs with progress bar node. |
AFAIK, AnimatedTexture will never support atlases due to how it works, but in exchange it has an excellent performance. Also docs state that it's not supported, so this case is ok. As for others, we should probably find all places where AtlasTextures don't work and either fix this or document that it's impossible (if it's impossible ofc). |
Were do the docs state it is not supported? It only states the textures should be the same size or they will be cropped. |
https://docs.godotengine.org/en/latest/classes/class_animatedtexture.html#description
See the reduz's comment here: https://twitter.com/reduzio/status/1018869909781180427
Which doesn't mean it can be implemented in a better way. Especially without sacrificing performance. |
Ah great, thank you. I'm using stable and the docs in that version, so I do not get anything mixed up - also thanks for the twitter post. |
Wow I just wasted an hour on this. The limitation of AnimatedTexture not being able to use AtlasTexture should be made much clearer in the docs. Right now it's the last sentence in Description. There should be a section labeled Warning or Limitations stating this. |
See godotengine#33855. (cherry picked from commit a7ad7ce)
AtlasTexture certainly doesn't behave as one would expect. I suspect I'm not using it correctly in the way described below, but if that's the case then there should be an error message or the behavior should not be permitted.
|
AtlasTexture is only meant for use in 2D, not 3D. For 3D atlases, see godotengine/godot-proposals#651. |
Godot should support any sort of texture nested into any sort of texture |
I also had problem when trying to use AtlasTexture inside a ShaderMaterial. tool
extends ImageTexture
class_name ImageAtlasTexture
### NOTE: This script is far from being used as part of a plugin
### It basically gets a Texture's Image, uses Image.get_rect() on it and sets is as the image
export var atlas: Texture setget set_atlas
export var region: Rect2 setget set_region
func _init():
update_image()
func set_atlas(val):
atlas = val
if atlas and not atlas.is_connected("changed", self, "update_image"):
var __ = atlas.connect("changed", self, "update_image")
update_image()
emit_changed()
func set_region(val):
region = val
update_image()
emit_changed()
func update_image():
if !atlas: return
if !region.size: return
var p_flags = flags
# Here is where the magic happens
var p_image = atlas.get_data().get_rect(region)
create_from_image(p_image)
flags = p_flags I've tested it and it works with materials, AnimatedTexture and Sprite3D and should work on everything else by the design of it (However I had to reload project for it to work on AnimatedTexture), I may turn this into a plugin. Edit: I made the plugin and it is now in the Asset Library (https://godotengine.org/asset-library/asset/1414) |
This issue seems still present on GPUParticles2D with AtlasTexture in Godot 4.1. |
Godot version:
3.1.1
OS/device including version:
Windows 10
Issue description:
Using the AtlasTexture on some Objects and Ressources does not use the selected region but the whole image. I found this to be the case with AnimatedTexture and CPUParticles2D, but I am prety shure, this is are not the only two cases.
Steps to reproduce:
Note: The AtlasTexture is shown correctly in the Editor
Minimal reproduction project:
The text was updated successfully, but these errors were encountered: