clipping problem
clipping problem
I created a sphere and wrapped it with a map of the earth. I then gave the user the power to control the camera such that it moves around the globe and can zoom in and out.
The problem comes when I try to zoom close enough that the globe takes up more space than the window size. The edges of my globe get clipped off before I can zoom in far enough not to see the clipping. When I get close enough, All I can see is one triangle. For this app, I want to be able to zoom in really close.
I've played with camera->setNear() and ->setFOV() to no avail.
What do you recommend?
The problem comes when I try to zoom close enough that the globe takes up more space than the window size. The edges of my globe get clipped off before I can zoom in far enough not to see the clipping. When I get close enough, All I can see is one triangle. For this app, I want to be able to zoom in really close.
I've played with camera->setNear() and ->setFOV() to no avail.
What do you recommend?
here
camera->setNearValue(number)
player with the numbers
player with the numbers
irrlicht game character project
http://picasaweb.google.com/juliusctw/FinishedArt
http://picasaweb.google.com/juliusctw/FinishedArt
The view will not clip if you are just changing the field of view. It will clip if you move the camera to close to the object. The following testcase works just fine for me with the software, d3d and ogl drivers. It will not work with the old software driver because that driver clips polys that aren't completely on screen.
Press the +/- keys to zoom in and out. You can move around with the normal camera controls, but if you use them and get to close you will see clipping. If you get very close and zoom in/out with +/-, you will see that the sphere is not clipped when you just apply a zoom.
Press the +/- keys to zoom in and out. You can move around with the normal camera controls, but if you use them and get to close you will see clipping. If you get very close and zoom in/out with +/-, you will see that the sphere is not clipped when you just apply a zoom.
Code: Select all
#include <irrlicht.h>
#pragma comment(lib, "Irrlicht.lib")
using namespace irr;
class MyEventReceiver : public IEventReceiver
{
public:
MyEventReceiver(scene::ICameraSceneNode* cam)
: Camera(cam)
{
Camera->grab();
}
virtual ~MyEventReceiver()
{
Camera->drop();
}
virtual bool OnEvent(const SEvent& event)
{
if (event.EventType == EET_KEY_INPUT_EVENT)
{
f32 fov = Camera->getFOV();
switch(event.KeyInput.Key)
{
case irr::KEY_PLUS:
fov -= (core::DEGTORAD * 1.f);
break;
case irr::KEY_MINUS:
fov += (core::DEGTORAD * 1.f);
break;
default:
return false;
}
static const f32 minFOV = core::DEGTORAD * 0.f;
static const f32 maxFOV = core::DEGTORAD * 90.f;
if (minFOV <= fov && fov <= maxFOV)
Camera->setFOV(fov);
return true;
}
return false;
}
private:
scene::ICameraSceneNode* Camera;
};
int main()
{
// ask user for driver
video::E_DRIVER_TYPE driverType = video::EDT_DIRECT3D9;
// create device and exit if creation failed
IrrlichtDevice* device =
createDevice(driverType, core::dimension2d<s32>(800, 600));
if (device == 0)
return 1; // could not create selected driver.
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
scene::ICameraSceneNode* cam = smgr->addCameraSceneNodeMaya();
MyEventReceiver receiver(cam);
device->setEventReceiver(&receiver);
scene::ISceneNode* node = smgr->addSphereSceneNode(10.f, 32);
node->setMaterialTexture(0, driver->getTexture("../../media/stones.jpg"));
node->setMaterialFlag(video::EMF_LIGHTING, false);
u32 now = 0;
while(device->run())
{
if (device->isWindowActive())
{
if (driver->beginScene(true, true, video::SColor(0,100,100,100)))
{
smgr->drawAll();
driver->endScene();
}
}
}
device->drop();
return 0;
}
I get a similar problem with sections of floor in my level. (not the walls though), when I tilt the camera up and down. It displays then doesn't display, then displays again as I tilt the camera.
If i raise the camera further fom the ground it solves the problem, but am about 50ft tall, so is impracticle
Its an .x mesh and happens in DirectX, and OpenGL mode. Ive tried adjusting setNearValue but still happens.
Any ideas?
________
Mercedes-Benz 200 History
If i raise the camera further fom the ground it solves the problem, but am about 50ft tall, so is impracticle
Its an .x mesh and happens in DirectX, and OpenGL mode. Ive tried adjusting setNearValue but still happens.
Any ideas?
________
Mercedes-Benz 200 History
Last edited by roguelike on Tue Feb 22, 2011 10:49 pm, edited 1 time in total.
@rogue Thats a 1.1 bug with the .X file format. Try using the previous version, 1.0. Remember that version only supports text not binary .X files
Alternativly use .3ds format
________
MARIJUANA CARD
Alternativly use .3ds format
________
MARIJUANA CARD