ficool2 / HammerPlusPlus-Issue-Tracker

Bug and feature request tracker for Hammer++
37 stars 1 forks source link

[Feature Request] Voronoi rendering for env_cubemap boundaries #329

Open deathride58 opened 2 years ago

deathride58 commented 2 years ago

So! The title here is one that either immediately makes sense, or simply doesn't.

Cubemaps are fairly tedious to actually get right in maps with more complicated layouts, as it's very easy to end up with issues where objects end up displaying cubemaps from nearby rooms instead of the room that an object's actually sitting in. With the way cubemaps work ingame (whichever cubemap an entity's closest to is the cubemap it'll use), it seems like cubemap placement would be a very simple thing on paper. However, the editor provides no assistance in displaying where the boundaries of an env_cubemap actually are; if you want to get your map's cubemaps right, you have to do quite a bit of guesswork, and regularly test your map's cubemaps ingame.

However, math nerds have already figured out a really good way of solving the problem of "If you have a set of points, how do you show which point any arbitrary position would be closest to? How do you show the boundaries between these points?" Voronoi diagrams. These are fairly straight-forward! Admittedly I don't have any code examples on-hand to point to, but I know that there have quite a few successful implementations of 3D voronoi diagrams over the years.

An ideal implementation of this would likely take the form of a button that toggles displaying transparent voronoi polyhedra in the 3D views, using the positions of all env_cubemaps as points, with 2D views optionally showing a slice of the diagram computed for the 3D views, using the currently selected object to determine where that slice is. This would allow the editor to display more or less the exact boundaries of each env_cubemap present on the map!

With that massive wall-of-text out of the way, here's a mockup of how all this wacky nerd stuff would ideally end up looking in action! (this is a very lazy mockup, but I believe it gets the point across!) hammervoronoicubemapmockup