Skip to content

Add octant visualization to GridMap#118583

Open
YeldhamDev wants to merge 1 commit into
godotengine:masterfrom
YeldhamDev:gridmap_show_octants
Open

Add octant visualization to GridMap#118583
YeldhamDev wants to merge 1 commit into
godotengine:masterfrom
YeldhamDev:gridmap_show_octants

Conversation

@YeldhamDev
Copy link
Copy Markdown
Member

Salvaging of #105333, with some modifications. Such as:

  • Property quantity shrunk to just debug_show_octants and debug_octant_color.
  • Modified updating method to not rely on processing.

Copy link
Copy Markdown
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally, it works as expected. Code looks good to me.

Some feedback:

  • Lines use an opaque material, which means they cast shadows and their opacity can't be reduced:
Image
  • This works at runtime, even in projects exported in release mode.
    • I suggest putting the code inside the new methods behind #ifdef DEBUG_ENABLED to ensure the binary size of release export templates isn't impacted as much by this PR. The methods would still exist and be exposed to scripting, but would be no-op in release export templates.

@YeldhamDev YeldhamDev force-pushed the gridmap_show_octants branch 4 times, most recently from c370141 to 4721ffe Compare April 16, 2026 00:49
@YeldhamDev YeldhamDev force-pushed the gridmap_show_octants branch from 4721ffe to 157b16f Compare April 16, 2026 00:57
@YeldhamDev
Copy link
Copy Markdown
Member Author

@Calinou Changes made.

@Repiteo Repiteo modified the milestones: 4.x, 4.8 Apr 16, 2026
Copy link
Copy Markdown
Contributor

@BastiaanOlij BastiaanOlij left a comment

Choose a reason for hiding this comment

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

LGTM, cool feature,

I can see how you can use this to optimise the scene, for instance in @Nodragem sample scene you can see that we have two additional octants with only one or two pieces in it:

Image

Just moving everything over 1 cell would help here.

Seeing it visualised I do wonder if octant is the right term here, we're basically just dividing the gridmap up in sectors. That also lead to wondering if it makes sense for these to be cubes, I can see a scenario with multiple floors where you would want each sector to not be so high. Anyway, that's a discussion totally separate from this PR.

@Nodragem
Copy link
Copy Markdown
Contributor

I totally agree with being able to use boxes rather than cubes ! 😊

Copy link
Copy Markdown
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Works great now 🙂

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.

6 participants