hole appear beetween polygon
hole appear beetween polygon
Hello everyone,
A problem appear when i try to render two surface (with two polygon) : some hole appear beetween polygon (just one pixel, and we see the background color).
Depend of the position of the camera, it appears everywhere beetwen two surface (screenshot => http://hpics.li/5517e48)
I think it is a problem of finite numerical precision limit, but i am not sure,
do you know this problem and how I can solve that ?
Thanks a lot
jerome
A problem appear when i try to render two surface (with two polygon) : some hole appear beetween polygon (just one pixel, and we see the background color).
Depend of the position of the camera, it appears everywhere beetwen two surface (screenshot => http://hpics.li/5517e48)
I think it is a problem of finite numerical precision limit, but i am not sure,
do you know this problem and how I can solve that ?
Thanks a lot
jerome
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: hole appear beetween polygon
Depends on how you create the polygons, which are the exact locations, what drivers you use, etc. Maybe show the full code?
Re: hole appear beetween polygon
ok, I made some test with examples of irricht and itis works,
I think that it's a problem of surface recovery.
I am looking to rewrite my code
thanks
jerome
I think that it's a problem of surface recovery.
I am looking to rewrite my code
thanks
jerome
Re: hole appear beetween polygon
outdated video drivers have this problem. If you draw 2 triangles across 4 points (says a quad) with a single draw call its ok, but if you draw the two triangles in 2 separate draw call (using the same exact vertices, and also with the same transform/view matrix) in certain video cards you will see holes on the edge.
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Re: hole appear beetween polygon
well,
finaly, i'am not able to solve my problem, so i wrote a small (and dirty ) code to illustrate.
And to be sure that we speak about the same thing, I upload a video of the result : http://youtu.be/61d3VSXc-bw
You can see some white hole appear beetwen surfaces.
I really apreciate if you have a solution
jerome
finaly, i'am not able to solve my problem, so i wrote a small (and dirty ) code to illustrate.
And to be sure that we speak about the same thing, I upload a video of the result : http://youtu.be/61d3VSXc-bw
You can see some white hole appear beetwen surfaces.
I really apreciate if you have a solution
jerome
Code: Select all
#include <irrlicht/irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
class Test
{
public:
static void build(core::array<S3DVertex> &vertices, const vector3df &pos, const vector3df &size)
{
vector3df front[4] = { vector3df(-.5, -.5, .5),
vector3df(.5, -.5, .5),
vector3df(.5, .5, .5),
vector3df(-.5, .5, .5)};
for(char i=0;i<4;i++)
{
vector3df p = front[i] * size + pos;
vertices.push_back(S3DVertex(p,
vector3df(-1,0,0),
SColor(255, 255, 255, 255),
vector2df(0,0)));
}
}
};
void add_surface(ISceneManager* smgr, const vector3df &pos, const vector3df &size)
{
core::array<S3DVertex> vertices;
array<u16> indices;
Test::build(vertices, pos, size);
indices.push_back( 0 );
indices.push_back( 1 );
indices.push_back( 2 );
indices.push_back( 2 );
indices.push_back( 3 );
indices.push_back( 0 );
scene::SMeshBuffer *buf = new scene::SMeshBuffer();
SMesh *mesh = new SMesh();
buf->append(vertices.pointer(), vertices.size(), indices.pointer(), indices.size() );
mesh->addMeshBuffer(buf);
buf->Material.setFlag(video::EMF_LIGHTING, true);
buf->drop();
smgr->addMeshSceneNode(mesh);
}
int main()
{
IrrlichtDevice *device =
createDevice( video::EDT_OPENGL, dimension2d<u32>(640, 480), 16,
false, false, false, 0);
if (!device)
return 1;
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
device->getCursorControl()->setVisible(false);
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
ICameraSceneNode * camera = smgr->addCameraSceneNodeFPS(0, 50, 0.2);
camera->setPosition(vector3df(0, 0, 20));
camera->setTarget(vector3df(0,0,0));
add_surface(smgr, vector3df(0,0,0), vector3df(10,10,10));
add_surface(smgr, vector3df(10,0,0), vector3df(10,20,10));
while(device->run())
{
driver->beginScene(true, true, SColor(255,200,200,200));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
Re: hole appear beetween polygon
Nobody can help me ?
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: hole appear beetween polygon
I have to admit that I cannot see any hole in the video. But as it seems you have to quads which overlap, and which are exactly adjacent to some extent. This can lead to z-buffer fighting and in turn to wrong render orders or other artifacts. This will always occur if you have surfaces which align perfectly, but also overlap for some larger area. You can put a little distance between the surfaces, or use the polygon offset attribute in material (maybe only for Irrlicht 1.8, not sure yet).
Re: hole appear beetween polygon
the only other way to solve the problem is to manually remove edges by overlapping primitives a bit.
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Re: hole appear beetween polygon
I can see it! It's as white as a sheep!hybrid wrote:I have to admit that I cannot see any hole in the video. But as it seems you have to quads which overlap, and which are exactly adjacent to some extent. This can lead to z-buffer fighting and in turn to wrong render orders or other artifacts. This will always occur if you have surfaces which align perfectly, but also overlap for some larger area. You can put a little distance between the surfaces, or use the polygon offset attribute in material (maybe only for Irrlicht 1.8, not sure yet).
ermmmm,,,, what about playing with multisampling?
Re: hole appear beetween polygon
http://i.imgur.com/XIb4P.jpg
I think it is kinda like this. The D3D driver doesn't produce a gap in the face while openGL dirver does from certain angles. The model I'm using might not be accurate thought.
And it seems the coords are cauculated differently, for example in the picture, the opengGL driver seems to have smaller faces, for example, the edges of the leaves and the petals.
I think it is kinda like this. The D3D driver doesn't produce a gap in the face while openGL dirver does from certain angles. The model I'm using might not be accurate thought.
And it seems the coords are cauculated differently, for example in the picture, the opengGL driver seems to have smaller faces, for example, the edges of the leaves and the petals.
Re: hole appear beetween polygon
yes that's a driver bug. I have that bug on my laptop, the same don't happens on other computers I tried.. Also quake 3 levels of IRrlicht demo shows that seams on my pc.. probably is fixed if you update video drivers (i'm not updating because I need old drivers for tests). you can partially hide that artifact by disabling backface culling. (in certain cases the artifact will be visible, and disabling backface culling can increase render time if done for a whole scene).
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me