Page 1 of 2

Is Irrlicht can cut overlapped objects?

Posted: Fri Oct 17, 2008 4:32 pm
by Chmel_Tolstiy
I'm interesting in: is irrlicht not render objects that overlapped by some objects when we see from camera. I mean is there some kind of algorithm done? For example, we should stay flag that object (or it's boundary box) is not transparent, so during rendering engine skips objects that collide by this object.

Thanks.

Posted: Fri Oct 17, 2008 5:07 pm
by night_hawk
Search for Occlusion culling.

Posted: Mon Oct 20, 2008 10:37 am
by Chmel_Tolstiy
search in forum or in google?

Posted: Mon Oct 20, 2008 10:39 am
by JP
There are two irrlicht projects implementing Occlusion Culling so you should be able to find them, one is further developed than the other, i think they're fairly usable...

Posted: Mon Oct 20, 2008 11:22 am
by rogerborg
Chmel_Tolstiy wrote:search in forum or in google?
Yes, it's vitally important that you choose the right one, because the other leads to Certain Doom.

Posted: Mon Oct 20, 2008 7:11 pm
by Minnek
It's true, I'm currently having 100 health drained because I picked the Doom one. (kudos for being able to dereference this poorly-made reference.)

In seriousness, I'm looking into occlusion culling as well. If I find any definitive information through personal research, I'll either post it here or PM you - whichever seems like the better option at the time.

Posted: Mon Oct 20, 2008 9:40 pm
by Halifax
JP wrote:There are two irrlicht projects implementing Occlusion Culling so you should be able to find them, one is further developed than the other, i think they're fairly usable...
Yes, I think you are referring to myself and Nadro's project. Or Nadro's and someone else's project, but it doesn't matter.

At any rate I would just like to say that Nadro's is definitely more useful, and further developed. He has a great base to start on. At any rate, you need to make use, of his wrapper around occlusion queries, and implement some more advanced algorithms if you want to yield any real results with occlusion queries. They cause great overhead, and thus aren't very useful unless you use a clever algorithm, as presented in GPU Gems 2 (available online), or you introduce occlusion culling frame lag.

My general thought was that a better solution, if you don't need fully precise and accurate occlusion culling results, would be to render into a 256x256 (or user configurable) render target, and use the occlusion queries on that. The chance of becoming fill-rate limited is decreased, and the drawing time is decreased as well.

Also another one I was thinking off was making use of the octree. Basically, you would, for all visible nodes, find how many objects are in it. The nodes would also be weighted by how close they are to the near clipping plane and bounding box size, as well. But anyways, you would project the specific octree node bounding box onto the scene to retrieve a roundabout number of how many fragments are occupied by it. That would be factored into the weight equation as well. Then after gathering the weights, you would gather a small subset of the nodes that are believed to be heavy occluders, and only use occlusion queries on those nodes.

I have never gotten around to implementing the algorithm, and I doubt I ever will, but I was just throwing ideas around for you to work with. The best recommendation I would have for you is to use Nadro's occlusion query implementation, and the GPU Gems 2 algorithm.

Posted: Tue Oct 21, 2008 9:57 am
by Chmel_Tolstiy
Is Nardo project included 1.4.2 realese ? I still don't download it. I use 1.4.1. Or I should use his patch for update source (I'm not good in svn) ?

Posted: Tue Oct 21, 2008 9:39 pm
by Halifax
Chmel_Tolstiy wrote:Is Nardo project included 1.4.2 realese ? I still don't download it. I use 1.4.1. Or I should use his patch for update source (I'm not good in svn) ?
No it wasn't included in 1.4.2, but you should still update to 1.4.2 anyways. And yes, his project must be applied as a patch, or you could manually type everything in.

Posted: Tue Oct 28, 2008 2:55 pm
by Chmel_Tolstiy
I have a big troubles with patch. I tryed TortoiseSVN and patch.exe for update code. But always got errors like "patch seems outdate". I tryed "update to revison 1498" and the same result. I tryed patching code of 1.4.2 realese - and the same result. May be some one can mail to me patched code of needed files and then I update my code to 1655 revision.

Thanks. email: naxart@gmail.com

Posted: Tue Oct 28, 2008 4:32 pm
by Chmel_Tolstiy
Chmel_Tolstiy wrote:I have a big troubles with patch. I tryed TortoiseSVN and patch.exe for update code. But always got errors like "patch seems outdate". I tryed "update to revison 1498" and the same result. I tryed patching code of 1.4.2 realese - and the same result. May be some one can mail to me patched code of needed files and then I update my code to 1655 revision.

Thanks. email: naxart@gmail.com
Or may be anyone can send to me patch for 1655 Revision. Thanks.

Posted: Mon Nov 10, 2008 11:37 am
by Chmel_Tolstiy
I have one more question. May be who better know Nardo's project can help me. Nardo's code likes this

Code: Select all

Query[current]->Issue( D3DISSUE_BEGIN );
				{
					for(int scurrent = 0; scurrent < QueryMesh[current]->getMeshBufferCount(); scurrent++)
						drawMeshBuffer(QueryMesh[current]->getMeshBuffer(scurrent));
				}
(function void CD3D9Driver::runAllQueries())
Is after this call zbuffer changed ? and if yes can I stay some flags for buffer don't change? I want to make a 3d-tree for boundboxes and at first test on it, and only when I get leafs of my tree I want to change z-buffer.

Thanks.

Posted: Mon Nov 10, 2008 6:52 pm
by Halifax
That doesn't show whether the z-buffer is enabled or not. Look for something like:

Code: Select all

d3dDevice->SetRenderState(D3DRS_ZENABLE, TRUE);
or something like that. Or you can look for the Irrlicht equivalent.

Posted: Tue Nov 11, 2008 2:06 pm
by Chmel_Tolstiy
Thanks for your help. I'm trying to use this.

Posted: Fri Nov 21, 2008 10:56 am
by Chmel_Tolstiy
I'm trying to use:
pID3DDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); - when I want just to test for visibility of BBox;
pID3DDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE); - when I want to change zbuffer. Is it correct? I read documentation, and as I understood, it's right. But it does not work correctly.

D3DRS_ZENABLE stated to TRUE.

It culls objects, that really visible. :(