Skip to content
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

Projected light texture #451

Closed
Janders1800 opened this issue Feb 7, 2020 · 8 comments · Fixed by godotengine/godot#37887
Closed

Projected light texture #451

Janders1800 opened this issue Feb 7, 2020 · 8 comments · Fixed by godotengine/godot#37887
Milestone

Comments

@Janders1800
Copy link

Describe the project you are working on:
General purpose

Describe the problem or limitation you are having in your project:
Total dependency on shadows to do any light details

Describe how this feature / enhancement will help you overcome this problem or limitation:
This feature will allow to fake a lot of shadow and shadow-tint effects.

Show a mock up screenshots/video or a flow diagram explaining how your proposal will work:
The first image it comes to mind is HL2 flashlight
119-2

But there are a lot of uses for this feature
iehfiueniubg

Controls could be added to the Light property, something like this.
PT

Describe implementation detail for your proposal (in code), if possible:
Not my field.

If this enhancement will not be used often, can it be worked around with a few lines of script?:
Don't think so, also it needs to be performant.

Is there a reason why this should be core and not an add-on in the asset library?:
Again, performance.

@clayjohn
Copy link
Member

clayjohn commented Feb 7, 2020

This is planned for 4.0. I'm not sure if it has been implemented in the Vulkan branch yet. But it is planned for sure. :)

@Calinou
Copy link
Member

Calinou commented Feb 7, 2020

Note that the projector can only be represented in a single texture for SpotLight. In OmniLight, one would have to use a CubeMap resource instead.

@Janders1800
Copy link
Author

It could also be added to Directional lights, just put the texture on repeat and add a max range to draw.

@Two-Tone
Copy link

Two-Tone commented Feb 8, 2020

This is planned for 4.0. I'm not sure if it has been implemented in the Vulkan branch yet. But it is planned for sure. :)

This is great, but it's also good for this proposal to exist so that there is a way to check when it gets added.

@clayjohn
Copy link
Member

clayjohn commented Feb 8, 2020

@Two-Tone that's why I left it open. :)

@bojidar-bg
Copy link

Note that for some cases, an orthographic projection is wanted, for example the shadow under the ball in a Neverball-like game is not something which should scale with distance. It is used as an indicator straight below the ball, helping the player realize where exactly they are, and thus cannot be made by just enabling DirectionalLight shadows when the sun is at an angle. It could be part of DirectionalLight, however.

@Janders1800
Copy link
Author

In a game like Neverball the shadow is a decal texture, I don't thing it has something to do with the light direction.

@Calinou
Copy link
Member

Calinou commented Mar 9, 2020

I wonder if projected light textures can be used to "bake" shadows for real-time lights. This would effectively allow you to have lights that cast shadows for static objects, but with the same performance as lights without shadows (which can be very fast with Vulkan and clustered rendering). Baked shadows also have the potential to use much higher-quality filtering (with penumbra simulation), as you only need to compute the shadow texture once. These lights would also still be able to accurately light dynamic objects and cast shadows on them. Another upside is that you can change the light's color and energy in real-time (unlike baked lights).

Many games like Trackmania² seem to be doing something like this for static lights, but I can't find much literature about it.

If this is viable, we could have a way to bake a projector texture for OmniLights and SpotLights directly from the editor. It might be doable as a plugin, but it would likely be slower to bake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants