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

Implement automatic LOD (Level of Detail) #44468

Merged
merged 1 commit into from
Dec 18, 2020

Conversation

reduz
Copy link
Member

@reduz reduz commented Dec 17, 2020

-Happens on import by default for all models
-Just works (tm)
-Biasing can be later adjusted per node or per viewport (as well as globally)
lod1

@Zireael07
Copy link
Contributor

Vulkan-only or can it be ported to 3.x?

@Calinou
Copy link
Member

Calinou commented Dec 17, 2020

Vulkan-only or can it be ported to 3.x?

I believe this approach is Vulkan-only or would require major compatibility-breaking changes to be backported to 3.2.x. It relies on the new 3D import system which was rewritten to make this kind of post-import processing easier.

In 3.2.x, you can use the godot-lod add-on.

(p_normal.x > 0) ? -half_extents.x : half_extents.x,
(p_normal.y > 0) ? -half_extents.y : half_extents.y,
(p_normal.z > 0) ? -half_extents.z : half_extents.z) +
(p_normal.x > 0) ? half_extents.x : -half_extents.x,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a bugfix? is this worth backporting?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I am not sure if this function exists in 3.x, (I have the feeling I added it recently but I may be wrong) but if it does probably should be.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does exist in 3.2, but backporting this would break compatibility.

editor/editor_node.cpp Outdated Show resolved Hide resolved
@fire
Copy link
Member

fire commented Dec 17, 2020

Can you expose the pixel area of the lod array anywhere as info?

Nevermind:

void RendererViewport::viewport_set_lod_threshold(RID p_viewport, float p_pixels); It is in pixels.

editor/plugins/node_3d_editor_plugin.cpp Outdated Show resolved Hide resolved
scene/main/scene_tree.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@JFonS JFonS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the meshoptimizer code was re-formatted, which makes it hard to track what actually changed. Other than that and the couple of typos mentioned by Clay, everything looks OK.

@akien-mga
Copy link
Member

Looks like the meshoptimizer code was re-formatted, which makes it hard to track what actually changed.

Nice catch, I had overlooked this. I'll fix it as I guess it's not @reduz's forte to prevent automatic formatting (and revert it when wrong).

@akien-mga akien-mga force-pushed the implement-lod branch 2 times, most recently from c8f3bf8 to 56b554a Compare December 18, 2020 14:00
Copy link
Contributor

@Logharaa Logharaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All "threshold" words are perfectly written 😛

@reduz
Copy link
Member Author

reduz commented Dec 18, 2020

@akien-mga ah I pushed a fix on my own with the fixed meshoptimizer

-Happens on import by default for all models
-Just works (tm)
-Biasing can be later adjusted per node or per viewport (as well as globally)
-Disabled AABB.get_support test because its broken
@akien-mga akien-mga merged commit 7ad29ed into godotengine:master Dec 18, 2020
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

10 participants