Why camera setting affected by new iv model loaded

Why camera setting affected by new iv model loaded

Post by Wang » Tue, 03 Jun 2003 18:52:55



I'm still working on the f16 simulation program, using TGS Open
Inventor for VC.NET (VC 7.0). I'm also using the IVF.

I noticed that if the iv model itself has a camera, it will affect the
camera used in the program. So I checked all my iv files and manually
deleted all camera settings inside, so that the camera can be fully
controlled by me.

But I still got this problem: my program requires me to load a very
big map file. Before I load it, I set my camera in relation to the f16
to be followed. Focal distance, near distance, far distance were all
ok. But once I load the map.iv, just simply loading it in, everything
is messed up. Even after I deleted all camera related things in the
map.iv, the result is still the same. I can't even see my f16 model
although the camera movement following the f16 dynamic is correct. The
reason I guess is the near or far distance or focal distance was
changed.

How should I modify the map.iv file so that it won't affect my camera
setting? Or, is IVF automatically adjusting the camera setting
according to the size of model? Can I stop it in doing so?

Thanks a lot!!

 
 
 

Why camera setting affected by new iv model loaded

Post by Mike He » Wed, 04 Jun 2003 00:47:14



> I'm still working on the f16 simulation program, using TGS Open
> Inventor for VC.NET (VC 7.0). I'm also using the IVF.

> I noticed that if the iv model itself has a camera, it will affect the
> camera used in the program. So I checked all my iv files and manually
> deleted all camera settings inside, so that the camera can be fully
> controlled by me.

> But I still got this problem: my program requires me to load a very
> big map file. Before I load it, I set my camera in relation to the f16
> to be followed. Focal distance, near distance, far distance were all
> ok. But once I load the map.iv, just simply loading it in, everything
> is messed up. Even after I deleted all camera related things in the
> map.iv, the result is still the same. I can't even see my f16 model
> although the camera movement following the f16 dynamic is correct. The
> reason I guess is the near or far distance or focal distance was
> changed.

> How should I modify the map.iv file so that it won't affect my camera
> setting? Or, is IVF automatically adjusting the camera setting
> according to the size of model? Can I stop it in doing so?

It works like this:
When the viewer's setSceneGraph method is called

  - If the scene graph contains a camera node, the viewer will
    use that camera's settings,

  - Else the viewer will create a camera node and call its
    viewAll() method, which adjusts the camera's view frustum
    to include the entire scene.

It sounds like you want to create your own camera and preset
its fields.  One approach (of several) would be to first create
a simple "placeholder" scene graph and set it into the viewer.
It might look something like this:

    Separator "Root"
      |- Camera "MyCamera"
      |- Separator "Terrain"
      |- Separator "Aircraft"

Then you would load the terrain file, and add that geometry
to the scenegraph using pTerrainSep->addChild().  This will
not change the camera settings.

FYI, you can also contact the consultants at the TGS Hotline

-Mike
 TGS Inc, http://www.tgs.com

 
 
 

Why camera setting affected by new iv model loaded

Post by Wang » Thu, 05 Jun 2003 13:06:57


Quote:> It sounds like you want to create your own camera and preset
> its fields.  One approach (of several) would be to first create
> a simple "placeholder" scene graph and set it into the viewer.
> It might look something like this:

>     Separator "Root"
>       |- Camera "MyCamera"
>       |- Separator "Terrain"
>       |- Separator "Aircraft"

> Then you would load the terrain file, and add that geometry
> to the scenegraph using pTerrainSep->addChild().  This will
> not change the camera settings.

If I understand you right, I think I did the exact thing you
suggested: putting the terrain in a SoSeparator, all along. Because
that's all the example codes showed.

But still, my camera's neardistance and focaldistance (not position or
orientation) are affected by the terrain. I tested several times and
confirmed this: once the very very big terrain is loaded, camera
nearDistance and focalDistance is changed, even though there is no
sign of camera settings in the terrain file. Also it doesn't seem that
the viewAll() is called.

I'd really like to monitor the initialization process, see who
modified the camera. Is there a way, like debugging the program step
by step, to pinpoint the exact location where the camera is modified?

> FYI, you can also contact the consultants at the TGS Hotline


I'll do that. Thanks. I used to keep contact with a Mr Patrick
Barthelemy, but he didn't reply my last email.

Regards, Wang Yu

 
 
 

Why camera setting affected by new iv model loaded

Post by Mike He » Thu, 05 Jun 2003 22:12:32



> If I understand you right, I think I did the exact thing you
> suggested: putting the terrain in a SoSeparator, all along. Because
> that's all the example codes showed.

> But still, my camera's neardistance and focaldistance (not position or
> orientation) are affected by the terrain. I tested several times and
> confirmed this: once the very very big terrain is loaded, camera
> nearDistance and focalDistance is changed, even though there is no
> sign of camera settings in the terrain file. Also it doesn't seem that
> the viewAll() is called.

Sorry, I slightly misunderstood your question.  Yes, this is the
expected default behavior - before each render traversal the
viewer adjusts the near and far planes based on the bounding box
of the entire scene graph.  You can disable this behavior using:

    void SoWinViewer::setAutoClipping( SbBool onOrOff )  

    Sets the auto clipping plane. When auto clipping is ON, the
    camera near and far planes are dynamically adjusted to be as
    tight as possible around the objects being viewed.

-Mike
 TGS Inc, http://www.tgs.com

 
 
 

Why camera setting affected by new iv model loaded

Post by Wang » Fri, 06 Jun 2003 13:46:45


Thank you very much!! This (setAutoClipping) is what I want to know.
It is written in the Mentor p445, but I haven't fully cover the book
yet.

Thanks again for your patient help every time.

 
 
 

1. New MS policy will affect new PC purchases

I am not one who usually post off-topic threads nor do I want to be accused
of M$ bashing, but...

If you are looking to buy a new PC in the future with a Windows OS, you
should know about this new MS policy.

Two parter:  First is an article about their new policy, second is customer
response & analysts suggestions on the "real" reasons for this policy.

Pt 1 - The policy:
http://www.infoworld.com/articles/op/xml/00/05/01/000501opfoster.xml

Pt 2 - Customer initial response:
http://www.infoworld.com/articles/op/xml/00/06/05/000605opfoster.xml

Sorry for the OT post, but this is a very important issue that will affect
all Windows users in the future.

Rob

2. DEM To DXF Conversion Program?

3. Problem: Setting new default camera position

4. PageMaker 7

5. Please explain PS40 RGB to CMYK, matching colors and setting that affect to it

6. No saving warning in modeler !

7. Can Performer load non-standard iv file?

8. Loading IV file in GL Optimizer

9. Certain .iv files fail to load if application linked against pthread library

10. Loading IV file in GL Optimizer

11. Why does this IV file crash ivview?

12. New shape node affects current material, cache problem?