Implemented a bbox renderer using etna and added it to shadowmap sample#46
Open
JackOfBlades232 wants to merge 1 commit intomsu-graphics-group:integrate_etna_frameworkfrom
Open
Conversation
… (currently not the most efficient, uses memory mapped buffer for boxes)
Mrkol
requested changes
Mar 19, 2024
| {1.f, 1.f, 0.f, 1.f}, | ||
| {1.f, 0.f, 1.f, 1.f}, | ||
| {0.f, 1.f, 1.f, 1.f}, | ||
| {1.f, 1.f, 1.f, 1.f} |
Collaborator
There was a problem hiding this comment.
Зачем? Захардкодь это прямо в шейдер и делай рендеринг просто на N линий, высчитывая координаты из индекса вершины
| 4, 7 | ||
| }; | ||
|
|
||
| BboxRenderer::BboxRenderer(CreateInfo info) : m_drawInstanced(info.drawInstanced), m_extent(info.extent) |
Collaborator
There was a problem hiding this comment.
зачем пользователю может понадобится включать или выключать drawInstanced? ему, кажется, должно быть без разницы, главное чтобы боксы рисовались
| vk::Image targetImage, vk::ImageView targetImageView, | ||
| const etna::Image &depthImage, const LiteMath::float4x4 &mViewProj) | ||
| { | ||
| etna::RenderTargetState renderTargets(cmdBuff, |
Collaborator
There was a problem hiding this comment.
Зачем фигачить пасс прямо внтури этого класса? Пусть пользователь сам зовёт этот метод уже внутри пасса, проще класс будет, никаких размеров и форматов знать не нужно будет
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added the BboxRenderer class, which can handle rendering of a buffer of bounding boxes in wireframe mode, similarly to QuadRenderer, and added it to the shadowmap sample. I also added shaders for bbox rendering which are used in the class internally.
The class can be constructed with providing necessary info (attachment formats and framebuffer extent), and it also comes with an option whether to draw the boxes instanced in one draw call (which requires the boxes to be loaded as a buffer), or as separate draw calls (which requires no additional gpu buffer).
The SetBoxes method takes in an array or vector of LiteMath's bounding boxes (in world space coords), converts them to instance matrices for a simple 1x1x1 box and stores them in the class for drawing. If drawInstanced is true, it also loads the matrices to the GPU (currently, this is done inefficiently with a mapped buffer, didn't want to use vk_utils or do the staging buffer myself, will be fixed once etna has utilities for staging buffers).
The RecordCommands method adds all the necessary commands to a provided command buffer, similarly to QuadRenderer.