-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Add a way to use a mathematically defined PointLight2D texture #3444
Comments
Would godotengine/godot#53234 work (using radial gradients)? |
To a large extent, yes. It looks like it would make PointLight2D a lot easier to work with. |
See also #723 (which is only for 3D). |
Goost has |
A while ago I was working on a plugin for exactly this kind of thing. The idea was to replicate Unity's Point and Freeform lights. I did make some decent progress on both of those. Screen.Recording.2020-11-20.at.6.54.14.PM.movThis shader solution worked great for sprites, but for Light2D you have to use an extra viewport which is rather cumbersome especially since they are/were buggy. So I never really got it quite fleshed out. I also experimented with a core "PointLightTexture" which did the same thing in C++. This could be super handy for generating static textures in editor, but animating these kinds of textures on the CPU is very slow. It can be fast enough for small pixel art at least. Perhaps a more elegant shader solution could be implemented in core somehow. |
This is now implemented by GradientTexture2D (which supports linear and radial gradients), closing. GradientTexture2D will be available in 4.0 and 3.5. |
Describe the project you are working on
A 2D drag and drop building game.
Describe the problem or limitation you are having in your project
I find it a bit clunky tweaking the light shape, switching back and forth between editing and re-importing importing images.
If the image textures cover a large area, they can be cumbersome as they get in the way of re-arranging other sprites as well.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Being able to define a light with an image offers a lot of flexibility, but there are usually simple radial shapes you want for lights that can easily be mathematically defined and tweaked with a couple of parameters. This way the effect can be seen in real-time in the editor as you adjust the parameters.
I would like to instead of adding a texture, select a predefined mathematical function and tweak it's parameters. I'm focused here on PointLight2D as I work in 2D, I don't know how lights work in 3D or weather this is applicable there as well.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Hopefully it can be accomplished with the same PointLight2D node, and selecting, say 'Gaussian' instead of Texture from the drop-down menu.
Some useful presets might be:
For each of these, the following could apply:
energy
property.If this enhancement will not be used often, can it be worked around with a few lines of script?
These shapes can be created easily enough with image textures. But with a slower workflow, relying on other image editing software, and doesn't allow real-time feedback on the effect of changes.
Is there a reason why this should be core and not an add-on in the asset library?
I'm not sure. I suppose a node type could be created that generates the textures from the parameters on the fly? The large textures would still get in the way in the editor, and I suspect it could be done more efficiently in core, but I'm no expert. In any case, I think a lot of people would enjoy having this out of the box.
The text was updated successfully, but these errors were encountered: