Unwanted "fisheye" effect

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
radical-dev
Posts: 45
Joined: Thu Apr 24, 2008 7:54 pm
Location: Wickede, Germany

Unwanted "fisheye" effect

Post by radical-dev »

Hi all,

i'm working on a game where i want a camera system like in "Sins of a solar empire". But in my settings must be something wrong and i don't get it.

First a picture of what i get:

Image

As you can see, planets on the border of the screen aree looking like pills :)

Here some code:

/* Setting up the camera */

Code: Select all

 
    m_CameraNode = m_SceneManager->addCameraSceneNode(0, vector3df(0,0,0.0f), vector3df(0,0,200.0f));
    m_CameraNode->setFOV(degToRad(90.0f));
    m_CameraNode->setNearValue(2.0f);
    m_CameraNode->setFarValue(2000.0f);
    m_CameraNode->setAspectRatio(CGameManager::GetAspectRatio()); //where aspect ratio = screen width / screen height
 
/* And the draw routine */

Code: Select all

 
    m_VideoDriver->beginScene(true, true, SColor(255,0,0,0));
    m_VideoDriver->draw3DLine(m_Ray.start, m_Ray.end, SColor(255,255,255,255));
        m_SceneManager->drawAll();
        m_GUIEnv->drawAll();
    m_VideoDriver->endScene();
 
The planets are at Y = 20.0f and have a radius of 1.0f. What am i doing wrong?

Thx in advance!

radical-dev
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Unwanted "fisheye" effect

Post by hendu »

Your FOV is too large, which is causing the fish-eye effect.
radical-dev
Posts: 45
Joined: Thu Apr 24, 2008 7:54 pm
Location: Wickede, Germany

Re: Unwanted "fisheye" effect

Post by radical-dev »

Hi hendu,

thx for your reply. I've done this before - at degToRad(30.0f) all went good - despite of scene node picking. Changing the fov screws it out.

Again some code:

Code: Select all

 
    m_Ray = m_SceneManager->getSceneCollisionManager()->getRayFromScreenCoordinates(m_RenderDevice->getCursorControl()->getPosition(), m_CameraNode);
    m_CurrentNode = m_SceneManager->getSceneCollisionManager()->getSceneNodeFromRayBB(m_Ray, 100, false, 0); // 100 ist the selectable ID
 
As far as i'm near to the nodes, all runs like a charm. But if i zoom out (move the camera away at z), the ray doesn't touch the nodes. At a distance from CameraPos = 0,0,-12.5f to scene node = 0,0,20.0f the nodes aren't longer selectable. If CameraPos is closer (> 12.5f) the picking is OK.

What am i missing? :D

Thx!

radical-dev
Post Reply