0

I'm creating a surface using elevation data and texturing it with orthoimagery to render terrain in Matlab. I'd like to be able to render the view from the perspective of a small UAV flying around. However, when I move the camera too close to the surface, it disappears. Note that I have set the projection to perspective, and I am manually setting the camera position, target, and view angle. Does anyone know what causes this and how to fix it?

Edit: As I've been playing with things, it seems like it has problems when part of the surface lies behind the camera. Either things start getting distorted and rendered weird, or the entire surface just disappears. Is there an easy way get around this?

Edit 2: I ran across this example of moving the camera through a scene. However, it looks like it uses patches instead of a surface. I also found this function to convert surface data to patch data. However, it does not seem like you can map textures onto patches like you can onto surfaces. Any thoughts? I suppose I could break the terrain up into a grid of small surfaces for rendering purposes.

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Brandon
  • 1,747
  • 17
  • 15
  • What renderer are you using (zbuffer or painters)? Does switching to the other make a difference? – tmpearce May 17 '12 at 01:50
  • @tmpearce Didn't think to check that. I was using the OpenGL renderer. It turns out that the problem does not happen with the zbuffer renderer. The painters renderer doesn't work because it doesn't support RGB CData. If you throw that up as an answer, I'd be happy to accept it. I wonder why the OpenGL renderer has issues with it though... Doesn't seem like it should. – Brandon May 17 '12 at 02:22
  • 1
    @Brandon: OpenGL itself has clipping planes, it sounds like MatLab isn't resetting them or moving the model inside the clipping region. See [FAQ 10.060 here](http://www.opengl.org/archives/resources/faq/technical/clipping.htm#0060). – Ben Voigt May 17 '12 at 05:25
  • @BenVoigt Clipping planes don't seem to explain it though, because the entire surface disappears even if the camera is looking toward the horizon. With OpenGL, the part of the surface between the near and far clipping planes should still be visible even if other parts of the surface are getting clipped. In fact, I've written c++ code before that used OpenGL to do the same thing I'm trying to do in Matlab. It even crossed my mind to try wrapping it in mex functions or doing some socket communication or something. I think there's just some wierd issues with the way Matlab uses OpenGL. – Brandon May 17 '12 at 18:51

0 Answers0