Easiest way to draw multiple AABBs?

Started by
2 comments, last by QQemka 5 years, 10 months ago

Hello there. What is the easiest way to draw aabbs for my scene? I already have all the maths implemented but showing it on screen is not so trivial. Having a dedicated shader just for aabbs seems like overkill, or is it the standard way? Is it possible to code shader in a way that i'd just send the min/max point instead of setting up one template cube and passing the xyz scales and location?

Advertisement

You could do it in the vertex shader, by setting inputlayout and vertexbuffer to NULL and using SV_VertexID to know which vertex you need to calculate. You would probably need to use 6 sides * 2 triangles * 3 vertices = 36 vertices for your draw call, and if you use a static const float3[] to hold all 36 vertices of a unity cube in your vertex shader, all you need to do is scale and position them :)

 

.:vinterberg:.

I just did it the standard way ;)

This topic is closed to new replies.

Advertisement