-1

render preview

Hi, I am making an application which can make camera rotate around the model, I have successfully imported the obj format model
But I meet the problem when rotate the camera, the model will disappear as you can see

gl.Perspective(180, (double)Width / (double)Height, 100, 50000f);

The key code for rotating camera:

Calculate the center point of the model    
currentX = Math.Sin(angle) * radius;
currentZ = Math.Cos(angle) * radius;

gl.LookAt(currentX,0,currentZ,
          centerPoint.X, centerPoint.Y, centerPoint.Z,
          0, 1, 0
);

2 Answers2

0

Check if the model is not closer than the near clipping plane. Check also the face culling: if your camera is inside the mesh, you are looking at the back faces of the polygons, which probably are not rendered.

  • I have added mouse wheel movement which can control the camera, so even if the camera inside the model, I still can find it out. The biggest problem is that model always be `cut` by camera far panel(or near panel?). I hope I can make it like 3dsmax – Yin Xiaoguang Nov 13 '19 at 10:23
0

Try modifying the near clipping plane to be much closer to the camera, and also lower the FoV angle. Try this:

gl.Perspective(90, (double)Width/(double)Height, 0.01f, 100.0f);  
John
  • 181
  • 9