Draw distance for easyCam

Hi everyone,

This might be a super simple one…

I am dynamically setting easyCam’s distance over time while drawing a mesh. Is there anyway I can turn off the draw buffer? After about 30 seconds the draw distance doesn’t render the mesh.

I did try this with no results.

//disable zbuffer
ofDisableDepthTest();

Thank you.

.

Hmm, are you setting the far clip of you ofEasyCam at all? Can’t remember what the default is.

I know you’re not interested in depth testing, but it might be worth a shot doing camera.setFarClip() to something further away than your mesh.

Best,
Andreas

yes, the depth buffer and the near/far clip planes are different things you don’t need to have depth testing to have clip planes, which are always used. as @hahakid says try setting the far clip plane of the camera further away. you can query it and set it with getFarClip() and setFarClip()

Oh and something I learned the hard way, don’t be tempted to set your near clip really really low and then forget about it (and if you set it to 0 ofCamera will compute a value for you). As the z-buffer is non-linear you could end up seeing strange results if you set it to 0.0000001 or whatever, even if you far clip is sensible. 0.1 should be all good unless you’re working in 1 unit = 1 meter scale, then you can go a bit lower.

http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html

1 Like

Outstanding!

Thank you so much @hahakid and @arturo.

Hi everyone,

I decided to continue this old conversation because my question is also related to distance and easyCam. Must be super simple too.

I’m setting my easyCam this way:

cam.setNearClip(0.1);
cam.setFarClip(200000);
cam.setDistance(5000);

I’m drawing a mesh on screen. The thing is even if I set the farClip to a really huge number, there is going to be a moment when the mesh is going to be clipped and disappear from the screen.

The same application is going to be running open for the public to interact with it.
I’d like to know if there is a way to set a minimum an a maximum zoom for the camera in order to always have my image on screen, like a “safe margin”, cause I’m sure when random people start playing with the camera the image is gonna get lost in space.

Is there such a thing I can do?

Thanks for your help in advance.

Hi,

I’m not sure if I’m doing it in the right way but I just managed to lock the screen to the range I want like this:

 float distance  = cam.getDistance();
    
    cout << distance << endl;
    
    
    if (distance <= 10){
        cam.setDistance(10);
    }
    
    if (distance >= 6000){
        cam.setDistance(6000);
    }

It’s not perfect, since if you force the zoom too fast over the limit you gonna see the mesh going really small and then scaling back to the setDistance position, but doing a weird jump.

Cheers
GC

1 Like