-
-
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
Can I use part of a sprite as the light texture? #95507
Comments
What about AtlasTexture? |
I tried this, but for some reason unknown to me the lights don't show up when I use an AtlasTexture. |
This is a limitation that will be enforced, see: Keeping this open to track this specific case and so it can be documented |
So currently I can't clip part of a sprite to a Light2D texture, right? |
Correct. It probably won't change in future either. A workaround could be to create an adapter resource like @tool
class MyAdapter
extends Texture2D
static var _cache: Dictionary # store textures using weakref()
@export var source: AtlasTexture
@export var some_way_to_select_subimage
var _tex: Texture2D
func _draw(...):
if not _tex:
_tex = _create_or_load_from_cache(
source, some_way_to_select_subimage)
_tex.draw(...)
# and the other required Texture2D virtual methods
... |
Then I think my project is ready for like a thousand png files. |
In terms of memory usage, it'll be the same as using a single large PNG file anyway. File size on disk will also nearly be the same - the only difference is that lossless compression will be a bit less efficient, and there will be more PNG headers. Either way, I expect the difference to be pretty small (less than a MB compared to a single large atlas). |
I'm not really worried about the file size, it's just that having too many files makes it hard to organize the project. Too many small files sometimes make it hard to find the files for my light node. |
I really want light textures to use partial sprites. Take this stall for example, the lantern can illuminate the player, but the shop sign can't, they have different |
Discussion opened: godotengine/godot-proposals#10487
Yes, atlas support needs dedicated support in each node. This can add a lot of maintenace burden, so it was only implemented in places where it's really needed (e.g. to save on memory). |
Tested versions
4.3rc2
System information
MacOS Monterey 12.7.5
Issue description
Sorry, I know this isn't the right place, but I've asked around and no one has given me a definitive answer.
When I try to add light textures to my light nodes, I find that light textures are a bit different from Sprite2D textures that can be cut from large sprites.
Currently, I create separate files for each light texture, but this is a bit inconvenient because I have too many light textures and if I create a file for each texture, there will be a lot of files.
My question is, am I doing something wrong or is it really only possible to generate separate texture files for each light node?
Steps to reproduce
N/A
Minimal reproduction project (MRP)
N/A
The text was updated successfully, but these errors were encountered: