godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.14k stars 93 forks source link

Add Viewport properties to disable directional and positional shadows separately #8127

Open m4rr5 opened 12 months ago

m4rr5 commented 12 months ago

Describe the project you are working on

A 3D racing simulator with support for triple screen and VR where the in-car view also features working mirrors.

Describe the problem or limitation you are having in your project

Rear-view mirrors in the cars need to render the world behind you, but to keep their rendering cost as low as possible, they typically disable a lot of the more expensive rendering features. Shadows are a big part of that, so the ability to disable (not just positional) shadows would make a big difference in performance.

A different use-case is an overhead map view showing the track and cars around you.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

A property on the viewport to “enable shadows”, on by default, that can be turned off.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Depending on the proposed viewport property value, we can simply skip the shadow rendering pass for that specific viewport. There apparently already is a switch that disables applying shadows. This new property can be added to that logic.

If this enhancement will not be used often, can it be worked around with a few lines of script?

I am not aware of any way to do this.

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

This is not something that can be worked around, making it impossible to move to an add-on.

BastiaanOlij commented 12 months ago

This has my vote and I might find a moment to implement this. Shouldn't be very hard. I can think of a number of game genres where this is common, race sims and flight sims being the obvious ones, but I can see turning shadows off when a topdown camera is used for a minimap, or when rendering a separate viewport for an inset enemy cam, etc.

Calinou commented 12 months ago

This also makes me wonder whether ReflectionProbe should have separate properties for directional and positional shadows. Right now, both are enabled at the same time if you tick Enable Shadows. However, directional shadows usually have a greater visual impact than positional shadows, especially within a reflection.

WrobotGames commented 11 months ago

This suggestion is fairly similar to #3773 (The same as this one but with reflectionprobes instead of viewports)