Note that there are some explanatory texts on larger screens.

plurals
  1. POPerformance: Offline surface for hit testing vs Triangle Intersection
    primarykey
    data
    text
    <p>First, a disclaimer. I'm well aware of the std answer for X vs Y - "it depends". However, I'm working on a very general purpose product, and I'm trying to figure out "it depends on what". I'm also not really able to test the wide variety of hardware, so try-and-see is an imperfect measure at best.</p> <p>I've been doing some googling, and I've found very little reference to using an offline render target/surface for hittesting. I'm not sure of the nomenclature, what I'm talking about though is using very simple shaders to render a geometry ID (for example) to a buffer, then reading the pixel value under the mouse to see what geometry is directly under the mouse pointer. </p> <p>I have however, found 101 different tutorials on doing triangle intersection, a la D3DXIntersect &amp; DirectX sample "Pick".</p> <p>I'm a little curious on this - I would have thought using HW was the standard method. By all rights, it should be many orders of magnitude faster, and should scale far better.</p> <p>I'm relatively new to graphics programming, so here are my assumptions, for you to disabuse.</p> <p>1) A simple shader that does geometry transform &amp; writes a Node + UV value should be nearly free.</p> <p>2) The main cost in the HW pick method would be the buffer fetch, when getting the rendered surface back off the GPU for the CPU to read over. I have no idea how costly this is. us? ms? seconds? minutes?</p> <p>3) This may be obvious, but I am assuming that Triangle Intersection (D3DXIntersect) is only possible on the CPU.</p> <p>4) A possible cost people want to avoid is the cost of the extra render target(s) (zbuffer+surface). I'm a'guessing about 10 megs for 1024x1280 (std screen size?). This is acceptable to me, although if I could render a smaller surface (trade accuracy for memory) I would do so (is that possible?).</p> <p>This all leads to a few thoughts.</p> <p>1) For very simple scenes, triangle intersection may be faster. Quite what is simple/complex is hard to guess at this point. I'm looking at possible 100s of tris to 10000s. Probably not much more than that.</p> <p>2) The HW buffer needs to be rendered regardless of whether or not its used (in my case). However, it can be reused without cost (ie, click-drag, where mouse tracks across a static scene)</p> <p>2a) Possibly, triangle intersection may be preferable if my scene updates every frame, or if I have limited mouse interaction.</p> <p>Now I've finished writing, I see a similar question has been asked: (<a href="https://stackoverflow.com/questions/18270747/3d-graphics-picking-what-is-the-best-approach-for-this-scenario">3D Graphics Picking - What is the best approach for this scenario</a>). My problem with this is (a) why would you need to re-render your picking surface for click-drag as your scene hasn't actually changed, and (b) wouldn't it <em>still</em> be faster than triangle intersection?</p> <p>I welcome thoughts, criticism, and any manner of side-tracking :-)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload