Weird problem (culling?)

Hi there,

I’ve been playing a bit with adding boxes and selecting them, this works pretty good now.

But somehow, the boxes don’t always show up when I expect them to show up. For example: I place a box in the center of the screen. I then move the camera a bit, using the strafe-actions ( basically moving along the x,y plane since I want a birdview-view). Then, when I moved the camera a bit to the left, the box starts dissappearing (like culling was ment to be I guess) but it should NOT cull. It’s still way within the frustum.

I have three screenshots which show excactly what I mean:

The objects actually dissapear when I try to focus on them with the camera.

Hope anyone can explain what i’m doing wrong :slight_smile:

// edit.

I noticed the testPicking shows the same weird thing! If you move the camera to the right of the nerdy person with green jacket, everything dissapears. Hopefully this example makes my problem more clear

Ok, investigating. Just to be clear, which bounding volumes are you using? Boxes or spheres?

found the problem and fixing. Quick question, in your test, are you mixing bounding volume types? I.e. spheres and boxes?

If so, don’t. They don’t merge well, causing in accuracies. The problem with the picking is the model sets bounding volumes to spheres, while we were using boxes. I’ll fix that right now.

Thanks, I believe I used a boundingBox for the scene (root) and boundingSpheres for my two objects.

Right, currently we don’t support multiple bounding types. Only use one type per application.

This seemed to fix most of my problems. Occasionally the objects within my frustum do disappear, but not extensive.

Hmmm, well it never should dissappear, so if you can get it to happen consistently, let us know.

Also, please try getting the latest from cvs as there have been some corrections to bounds in the last few days.

Yeah, I check in every day to get the latest release. And I must say: things are really improving! Great job on that.

Also, I noticed that as soon as I move out of the world bound (the big sphere around all of the objects), everything disappears, I will investigate this a bit more, and try to take some screenshots.

I think I might know what’s happening there. If you have two major nodes, say scene and root. Scene contains all the 3D geometry, and root contains the text and stuff, make sure root is set to always display. (setForceView(true)). Because the text doesn’t have a bounding, it only displays if scene displays. This is a strange quirk that needs to have a solution.

That explains it. But what if I want to keep showing my objects within the frustum when my camera is out of the world bounding? As it is now ( if i’m right) the scene stops displaying whenever my camera is out of the world bounding.

Forgive me for asking these questions, still learning to work with these kind of things.

Are you saying you are just moving the location of the camera out of the main scene bounding and it culls the objects… even though the bounding is within the camera frustum?

That shouldn’t happen. See TestScenegraph for an example. The entire bounding is within view of the camera. But the camera is outside of the bounding.

Yeah, that’s excactly what I mean. But I’m afraid I made a small mistake, so I’m gonna check everything twice again.

Below are the screenshots. In each screenshot I moved the camera a bit backward. The last screenshot does not show the text, but you explained that earlier on ( not changed yet :slight_smile: )


As you can see, the planet in the middle dissapears even before it’s out my frustum.

hmmm very stange. Renanse any ideas?

EDIT: Just an observation, In that second pic, the sphere rendered looks wrong. Like it’s missing vertices, etc.

You mean the world sphere, that’s right. I believe that’s where frustrum ends I guess.

But more important, I know what goes wrong:

In my test application I use an altered camera direction:

  • new Vector3f(0.0f, 2.0f, -1.0f);

    this goed WRONG - see screenshots.

    But when I use the standard direction
  • new Vector3f(0.0f, 0.0f, -1.0f);

    it works damn good :slight_smile:

    Hope this informations is a but more usefull

Ah, ok, you must set your camera to be in a right handed coordinate system. This means, the left, up and dir must be at right angles to each other facing in the relative correct position. Otherwise all sorts of stuff gets messed up. In fact, I’m suprised you weren’t having other problems.

Well, I tried everything, but my camera just won’t response the way I want (probably because I dont get the right-handed method…). The mouse coordinates I use right now let me move across the x and y axes

However, I view the scene from above, viewing down the z-axes, while I want to see it in a 45 degrees way ( or something like that ) and still be moving over the x,y axes. How can I ever pass this to the camera?

if you have a coordinate system in the following way:



| / -Z

| /

| /

|/_______> +x

which is default.

you would define left (-1,0,0), up(0,1,0), dir(0,0,-1)

Now, if you wanted to look say 45 degrees down, left would not change, but up and dir would. So you’d do the following:

left(-1,0,0), up(0,0.5f,-0.5f), dir(0,-0.5f, -0.5f)

does that help at all.

Basically, you have to do a little vector math to point the camera. It’s not terribly difficult, but getting that initial set up is a little bit of a pain. I may provide some utility methods in Camera at a future date to help out.

Thanks for the (again) fast reply. I solved it on a strange way. Did the initialise, then altered the camera ( using the routine used in KeyLookDownAction ) and a final update. This works fine for the time being and let’s me change the camera whenever I want.

I must confess that this little problem is the hardest I ever had :stuck_out_tongue:

It’s one of those things that takes awhile to understand properly, but just keep asking questions if you don’t understand something, and we’ll do our best to help you out.