<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div>Yes bboxSize and bboxCenter can be directly used as scale and translation for a transformation matrix for a bboxShape with size at 1. </div><div><br></div><div>I also miss the possibility of setting the color of the box.</div><div><br></div><div>
<div>Holger Seelig</div><div>Leipzig, Germany</div><div>holger.seelig@yahoo.de</div><div><br></div><br class="Apple-interchange-newline">

</div>
<div><br><blockquote type="cite"><div>Am 24.03.2023 um 19:15 schrieb Andreas Plesch <andreasplesch@gmail.com>:</div><br class="Apple-interchange-newline"><div><div>Following up, I looked up the bboxDisplay implementation in x_ite, and<br>it does pretty much follow what I outlined, eg. using an additional<br>internal, on demand Shape. Instead of wrapping in a Transform, for<br>scaling it multiplies in a local transform matrix to the model view<br>matrix. it is not strictly part of the scene graph but gets added<br>during render traversal but not picking traversal. The bbox shape is<br>predefined as a white IndexedLineset but presumably could be<br>generalized/made customizable.<br><br>I hope it is possible to avoid special treatment during traversal and<br>just manage as a regular, inert scene graph participant. Let's see.<br><br>Ok, this was helpful. Andreas<br><br>On Fri, Mar 24, 2023 at 12:10 PM Andreas Plesch <andreasplesch@gmail.com> wrote:<br><blockquote type="cite"><br>Please forgive me if I use this message to plan strategies for a<br>possible implementation of bboxDisplay for x3dom. There will be a few<br>questions at the end.<br><br>To start, it is already quite straightforward to generate visual<br>feedback for selection purposes in x3dom. Here are a few examples:<br><br>https://andreasplesch.github.io/Library/Examples/html5/highlight/turnyellow.html<br>https://andreasplesch.github.io/Library/Examples/html5/highlight/withBBox.html<br>https://andreasplesch.github.io/Library/Examples/html5/highlight/outline.html<br><br>Thinking about generalizing to any X3DBoundedObject leads to the<br>following observations.<br><br>In x3dom, only Shapes are collected for rendering during scene<br>traversal. Displaying a bbox for groups etc. breaks this basic<br>pattern.<br><br>Although a custom shader would be most performant, this means it is<br>not really advantageous to expand the shader to include an option for<br>bbox rendering because it is restricted to shapes. Also a bbox needs<br>to be displayed even if the shape is not visible which complicates<br>logic.<br><br>In turn, this means it appears to be necessary to add an internal bbox<br>Shape for each X3DBoundedObject to the scene graph which is managed by<br>the engine. Since the bbox size needs to be updated at each traversal<br>this will add some overhead. I guess if the updates are only performed<br>when the bbox is visible this may be ok but the check is still<br>necessary. Also the bbox shapes need to be created for a lot of<br>objects, perhaps on demand only which could be an optimization. It<br>will be necessary to be careful in cleaning up when a X3DBoundedObject<br>is deleted from the scene graph.<br><br>Finally, I am considering adding an SFNode field to X3DBoundedObject<br>"bboxTemplate" which would be a Shape node or a Grouping node and<br>would let the scene designer customize the kind of bounding box used<br>for the display. By default it would be a green cage or such. It is<br>expected to be of unit size, and scaled internally (by a Transform<br>wrapper) to the actual bbox size. ( Hm, this would probably mean<br>allowing subShapes to Shape nodes as children. It may be possible to<br>deal with bboxes for Shapes as siblings, or in general as siblings,<br>eg. child of parent ).<br><br>By default the size of the displayed bbox would be a tight fit but it<br>would look probably better to make it a little larger. So another<br>custom field could be SFFloat "bboxMargin", zero by default.<br><br>What strategies do FreeWRL, x_ite or castle use to implement<br>bboxDisplay while keeping overhead at a minimum ? Check at each<br>traversal and insert a scaled bbox ? As an option in the shader ?<br><br>Depending on the strategy, would it make sense to support a custom<br>bounding box ?<br><br>A somewhat unrelated question is if a displayed bounding box is<br>eligible to be sensed by Sensors such as a TouchSensor ? Presumably,<br>it should be completely inert and be ignored but I am not sure if this<br>is how the spec. intends to be read. I think in x3dom it should be<br>possible to make sensing eligibility configurable.<br><br>Thanks for any feedback,<br><br>Andreas<br>--<br>Andreas Plesch<br>Waltham, MA 02453<br></blockquote><br><br><br>-- <br>Andreas Plesch<br>Waltham, MA 02453<br><br>_______________________________________________<br>x3d-public mailing list<br>x3d-public@web3d.org<br>http://web3d.org/mailman/listinfo/x3d-public_web3d.org<br></div></div></blockquote></div><br></body></html>