PDA

View Full Version : Rendering in a thread: support for SoDraggers, VolumeViz?


JeffI
10-08-2008, 06:04 PM
Hi,

I want to add an Open Inventor window to an existing application to add a "3D display" of a 3D volume. My requirements are:
- Windows application
- using VolumeViz for volume rendering
- need to render the window in a thread so that I don't slow down my existing app.
- would like to use SoDraggers for control

What I've done so far:
- Modified the "MT_Render" (OIV7.1\src\Inventor\MultiThread\examples) to contain my scene graph.

My scene renders - the demo just keeps calling a GLRenderAction in the thread.

*However*, I'm seeing many issues....

1) The SoVolumeRender won't render if the material before it is semi-transparent. I'm guessing I need to make sure the GLRenderAction also renders semi-transparent stuff.
2) Draggers won't show up in the scene unless I call SoXt::init(); at the start of the application. Then, I somehow need to get mouse events to the dragger. ideas?
3) SoVolumeClippingGroup seems to be clipping my volume in a strange way. I can supply a picture, but it differs dramatically from the scene rendered in a normal way.

Any ideas?

JeffI
10-08-2008, 06:51 PM
On #3: I found a work-around for #3. Seems that by backing my camera up so that the view frustrum doesn't cut into the clip volume, I can work around issue. Note that I'm using SoVolumeClippingGroup's clipOutside flag set to false.

mikeheck
10-09-2008, 02:32 AM
Hi Jeff,

What you're trying to do should be possible, although this example may not be the ideal starting point.

0) Are you sure you don't want a viewer class, e.g. SoWinExaminerViewer, so your users can move the camera around?
Wow, I'd forgotten how much code this example needs just to avoid using a viewer class. :-) I believe this example was written with a vis-sim type application in mind (constantly changing scene). In fact for most data visualization apps, constantly re-rendering the scene graph like this is a waste of CPU and GPU cycles. It's usually better to do what the viewer classes do and only re-render when the scene graph changes. If you really don't want a viewer, then the next step would be to create an instance of SoSceneManager (the class the viewer uses to detect changes and re-render).

1) Volume rendering. I'm not sure why this is a problem. So the volume is rendered correctly if the material is opaque and what? doesn't render at all if the material is translucent? Just for curiosity, why do you want a translucent material preceding the volume?

2) Draggers. Right, draggers depend on events being passed through the scenegraph by an SoHandleEventAction. SoSceneManager (and thus the viewers) does this for you.

3) Volume clipping. This is a known problem that is unfortunately not fixed in OIV 7.2. For reasons yet unknown, the bounding box of the volume is not set correctly when volume clipping is active. A (relatively) simple work-around is create an invisible/unpickable cube that surrounds the volume.

Are you working in C++ or .NET?
What are you using for the user interface?

Regards,
Mike

JeffI
10-10-2008, 03:42 PM
Hi Chris,

Thanks for your reply.

We are using:
- C++
- built the UI in MFC.

We need to isolate Open Inventor to one threaded window so that it doesn't slow down the application which is running at 30fps.

0) I'd like to use the ExaminerViewer. And, I did use this in my original demo. However, I need to do rendering in a thread. So, I'm looking for suggestions on how to move interaction and rendering to background threads. What do you suggest?

1) The short answer is that I built my application from one of the examples provided. So, no problem, I see a solution.

2) I'll take a look at SoSceneManager.

3) No problem. I'll do that.

Thanks again.
Jeff

mikeheck
10-15-2008, 03:10 PM
Hi Jeff,

Good news - bug #2318 (incorrect volume bounding box when using SoVolumeClippingGroup with clipOutside set to false) has been fixed and the fix will be included in the 7.2 release.
Hurray for squeaky wheels. ;)

Regards,
-Mike