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

Use Vertex-Lighting for far objects #8128

Closed
ywmaa opened this issue Oct 15, 2023 · 2 comments
Closed

Use Vertex-Lighting for far objects #8128

ywmaa opened this issue Oct 15, 2023 · 2 comments

Comments

@ywmaa
Copy link

ywmaa commented Oct 15, 2023

Describe the project you are working on

Working on reimplementing vertex-lighting in Godot 4

Describe the problem or limitation you are having in your project

Nothing really, but an idea.
As I understand vertex-lighting enhances performance, but it is kinda low quality lighting.

So why can't we use it for far objects, along with auto Lod ?

I am no expert so I don't know if the performance gains is worth it for PC platforms, but I guess it will be worth it for mobile games that target High-End so they can use pixel-lighting for near objects and vertex-lighting for far objects.

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

Add options for each mesh "Use Vertex-Lighting when far from camera, Far Distance Value for Vertex-Lighting"

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

The Engine will switch to vertex lighting if after the check the mesh distance to camera is bigger than "Far Distance Value for Vertex-Lighting"

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

You will have to do it for each mesh, and do distance calculation to camera.

I guess not convenient.

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

Improving engine performance out of the box.

@Calinou
Copy link
Member

Calinou commented Oct 15, 2023

This can already be achieved using visibility ranges and a custom material: https://docs.godotengine.org/en/latest/tutorials/3d/visibility_ranges.html#use-simpler-materials-at-a-distance-to-improve-performance

However, vertex shading needs to be reimplemented first.

Also, remember that performance won't improve much when doing this, as distant materials only occupy a small portion of the screen. The performance impact of per-pixel shading is more noticeable when the material takes up a lot of the screen (which is why it's a good idea to use vertex shading for shaded particles).

@ywmaa
Copy link
Author

ywmaa commented Oct 20, 2023

For me this answer is what I needed so closing this issue.

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

No branches or pull requests

3 participants