You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the problem or limitation you are having in your project
While porting my Godot 3 project to Godot 4.2.2 my lights on sliding doors stopped working. The light texture is a sprite sheet animated via the same AnimationPlayer that animates the door sprite.
I can not use additive sprites, as they don't interact with CanvasModulate like lights do.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
In Godot 3 we could use dynamic textures for 2D lights very easily:
-AtlasTextures animated via AnimationPlayer
-AnimatedTextures
-ViewportTextures
Having at least the Atlas- and ViewportTextures back would allow us to easily do the same effects we could do in Godot 3, without resorting to crude hacks like below.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
As far as I understand 2D lights now use a single AtlasTexture to allow for single pass rendering. When setting a new/different texture/region on a PointLight2D this texture should be updated. This of course may reduce performance but as long as the texture is not touched it will work like now and the performance cost only occurs on update.
If this enhancement will not be used often, can it be worked around with a few lines of script?
More or less.
To get it working in my project I had to essentially simulate the deprecated AnimatedTexture, meaning I had to split my sprite sheet into individual files and then use the following code:
@onready var light: PointLight2D = $PointLight2D
@export var frames: Array[Texture] = []
@export var frame: int = 0 : set = _set_frame
func _set_frame(index: int):
if light and index < frames.size() and index > -1:
remove_child(light)
light.texture = frames[index]
add_child(light)
frame = index
Removing the light from the scene tree and adding it back seems to force the update of the 'global' light texture, so the mechanics to update the texture are already there.
But I think there clearly is a demand for this feature as seen here, here and here.
Is there a reason why this should be core and not an add-on in the asset library?
As it is a change to the PointLight2D class it can only be done in core.
The text was updated successfully, but these errors were encountered:
Describe the project you are working on
A 2D sci-fi pixel art sidescroller
Describe the problem or limitation you are having in your project
While porting my Godot 3 project to Godot 4.2.2 my lights on sliding doors stopped working. The light texture is a sprite sheet animated via the same AnimationPlayer that animates the door sprite.
![door](https://private-user-images.githubusercontent.com/11878694/335670445-d51319fb-1739-426a-9d4f-bb9134182e48.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MTIzMzksIm5iZiI6MTczOTYxMjAzOSwicGF0aCI6Ii8xMTg3ODY5NC8zMzU2NzA0NDUtZDUxMzE5ZmItMTczOS00MjZhLTlkNGYtYmI5MTM0MTgyZTQ4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDA5MzM1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTY1NTExZGJiNDEzOTYyMDEyZDgxZTIxYjcwOTYwOWVmNThlY2FiYzA3ZDhhMTU1MDEwNzljM2JhYTAxNzYyMjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.mam_Pecxqi0iCMTpN-6tD1TcmOWp82wBo3eRDTpZL58)
I can not use additive sprites, as they don't interact with CanvasModulate like lights do.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
In Godot 3 we could use dynamic textures for 2D lights very easily:
-AtlasTextures animated via AnimationPlayer
-AnimatedTextures
-ViewportTextures
Having at least the Atlas- and ViewportTextures back would allow us to easily do the same effects we could do in Godot 3, without resorting to crude hacks like below.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
As far as I understand 2D lights now use a single AtlasTexture to allow for single pass rendering. When setting a new/different texture/region on a PointLight2D this texture should be updated. This of course may reduce performance but as long as the texture is not touched it will work like now and the performance cost only occurs on update.
If this enhancement will not be used often, can it be worked around with a few lines of script?
More or less.
To get it working in my project I had to essentially simulate the deprecated AnimatedTexture, meaning I had to split my sprite sheet into individual files and then use the following code:
Removing the light from the scene tree and adding it back seems to force the update of the 'global' light texture, so the mechanics to update the texture are already there.
But I think there clearly is a demand for this feature as seen here, here and here.
Is there a reason why this should be core and not an add-on in the asset library?
As it is a change to the PointLight2D class it can only be done in core.
The text was updated successfully, but these errors were encountered: