Replies: 3 comments 4 replies
-
Beware of #216. Current implementation, even with the kd-tree, is not very performant. We might need to take a different approach. An idea is to render the outlines outside of the terrain shader and somehow utilize instancing. This does not imply that your implementation cannot proceed, just make sure that even when many buildings are selected, it still performs reasonably well (i.e. 60+ FPS on a new mid-range GPU). |
Beta Was this translation helpful? Give feedback.
-
I would use 2D AABB from |
Beta Was this translation helpful? Give feedback.
-
I think that having a discussion in a PR over concrete code would be easier. |
Beta Was this translation helpful? Give feedback.
-
I've been prototyping the second part of #36, highlighting buildings with a square.
So far I have a working prototype in Zakru:feature/36, screenshot above, although the shader part has no optimization data structure like the circle markers do, and the size should be made to fit around the building more snugly (it uses circular radius as ½ side length currently). I wanted to open this discussion to talk about reuse of code that already exists for the circle markers.
In terms of engine code, I think what I currently have in the branch is pretty decent. I extracted the
VisibilityFlags
fromCircleMarker
into an independentMarkerVisibility
component, and made all of the code that only handles the visibility (most marker-related systems) use only that. Then I created aMarker
trait so that theupdate_markers
system which updates relevant markers toTerrainMaterial
s can easily be generic over marker types.The shader and intermediate part are what I'd like to talk about. Here is the diff of the current implementation. I opted to quickly just use an array for prototyping before deciding how to reuse the data structures that already exist for circle markers, so there is no optimization at play. I haven't worked with k-d trees before, but optimization data structures like that are something I am personally very interested in learning, so lmk if and how I should approach that.
While writing I figured out I can use the AABB from
Ichnography
to get a more rectangular estimate, although now it looks a little too tight IMO. Opinions?Also please tell me if you'd rather discuss this over a draft PR or something, I just figured this might end up being a lengthy post. Or if I'm being silly and this could just be improved later 😄
Beta Was this translation helpful? Give feedback.
All reactions