Mesh Combiner

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Re: Mesh Combiner

Post by Lonesome Ducky »

There are countless minecraft clones out there, I'll bet there are at least a few open source ones that you could look at
Kuzy
Posts: 21
Joined: Fri Feb 18, 2011 10:30 am

Problem on 64-bit machines

Post by Kuzy »

Does anyone have the actual source of the mesh combiner. The newest link is dead...

My mesh combiner crashes on some 64bit-machines while it runs without any problem on any x86 machine.
Does anyone have a clue why?

Thanks in advance
Kuzy
RdR
Competition winner
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm
Contact:

Re: Problem on 64-bit machines

Post by RdR »

Kuzy wrote:Does anyone have the actual source of the mesh combiner. The newest link is dead...
You can find it on the IrrExt project
http://irrext.svn.sourceforge.net/viewv ... hCombiner/
Kuzy
Posts: 21
Joined: Fri Feb 18, 2011 10:30 am

Re: Mesh Combiner

Post by Kuzy »

Thanks RdR.
Kuzy
Posts: 21
Joined: Fri Feb 18, 2011 10:30 am

Re: Mesh Combiner

Post by Kuzy »

My problem with 64bit machines was caused by memory leaks and is now solved with the actual version.
pepeshka
Posts: 29
Joined: Wed Jul 02, 2008 8:42 pm

Re: Mesh Combiner

Post by pepeshka »

Hey Ducky,

I've noticed my memory usage shoots up when using the mesh combiner, even with meshes that have a lot of repeated textures. It looks like the project is saving copies of the same texture over and over in the bottom of PackTextures():

Code: Select all

irr::core::stringc textureName = "PackedTexture";
        newTexture = driver->addTexture(textureName, packedImage);
        newTexture->regenerateMipMapLevels();
        textureName += globalPackedTextureCount;
        globalPackedTextureCount++;
        return newTexture;
That's adding a new texture each time with a unique name if I'm not mistaken. Wouldn't it be better to give each packed texture a unique name (based on the textures that went into making it), then retrieve any that have already been saved:

Code: Select all

irr::core::stringc textureName = "PT";
        for (int i = 0; i < textures.size(); i++)
        {
                irr::io::SNamedPath s = textures[i]->getName();
                textureName += textures[i]->getName();
        }
        newTexture = driver->getTexture(textureName);
        if (newTexture == NULL)
        {
                newTexture = driver->addTexture(textureName, packedImage);
        }
I've done this in my project and my memory usage is now just a tad over what it would be without the combiner at all, which is really killer. Do you see any downside to this?
Supanova
Posts: 6
Joined: Sun Jun 10, 2012 5:46 pm

Re: Mesh Combiner

Post by Supanova »

First off Ducky, this is a great piece of kit, hat off to you my son :D.

The issue we have, is I'm sure something we have done wrong..

We are currently converting an old 2d game, and it's kicking and screaming all the way...

Bit of background... The host sends the client individual tiles, and [6][6] array of how they are orientated. Currently the client takes these individual tiles, shoves them into the 6x6 mesh and lets your combiner take over. Each individual tiles has it's own texture, which are not always the same.

The issue comes with lighting. I've tried normalizing the normals, and rotating the individual tiles every which way on all 3 axis, but it has no effect. In fact the screenie below has the tiles out of alignment....

A perfect example of this is shown below

What can we do to prevent this?

Image
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Re: Mesh Combiner

Post by shadowslair »

Don`t normalize normals of planar surfaces like the tiles you use, and for better results don`t use per-vertex lighting.
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
Supanova
Posts: 6
Joined: Sun Jun 10, 2012 5:46 pm

Re: Mesh Combiner

Post by Supanova »

I'm afraid I've tried your suggestions, but had no positive outcome.

I did find one other post with what appears to be the same problem, however their solution is somewhat vague....


http://irrlicht.sourceforge.net/forum/v ... =1&t=44177

Perhaps someone can explain the solution better?
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Mesh Combiner

Post by mongoose7 »

He may have been animating his cubes. Anyway, he was using cubes, not planes. It is probably best to create your own planes - I see that that is what I have done:

Code: Select all

static IMesh *createPlaneMesh(float size)
{
    SMeshBuffer *buffer = new SMeshBuffer();
 
    // Create indices
    const u16 u[6] = { 0,2,1,  0,3,2 };
 
    buffer->Indices.set_used(6);
 
    for (u32 i=0; i<6; ++i)
        buffer->Indices[i] = u[i];
 
 
    // Create vertices
    video::SColor clr(255,255,255,255);
 
    buffer->Vertices.reallocate(4);
 
    buffer->Vertices.push_back(video::S3DVertex(0,0,0,
        0, 0,-1, clr, 0.0, 1.0));
    buffer->Vertices.push_back(video::S3DVertex(1,0,0,
        0, 0,-1, clr, 1.0, 1.0));
    buffer->Vertices.push_back(video::S3DVertex(1,1,0,
        0, 0,-1, clr, 1.0, 0.0));
    buffer->Vertices.push_back(video::S3DVertex(0,1,0,
        0, 0,-1, clr, 0.0, 0.0));
 
    // Recalculate bounding box
    buffer->BoundingBox.reset(0,0,0);
 
    for (u32 i=0; i<4; ++i)
    {
        buffer->Vertices[i].Pos -= core::vector3df(0.5f, 0.5f, 0.0f);
        buffer->Vertices[i].Pos *= size;
        buffer->BoundingBox.addInternalPoint(buffer->Vertices[i].Pos);
    }
 
    SMesh* mesh = new SMesh;
    mesh->addMeshBuffer(buffer);
    buffer->drop();
 
    mesh->recalculateBoundingBox();
    return mesh;
}
sievi1
Posts: 1
Joined: Sat Nov 17, 2012 10:26 am

Re: Mesh Combiner

Post by sievi1 »

Im new to irrlicht and have just got the mesh combiner to work. however i was wondering if there is any way to delete a part of the newly created mesh. lets say that i combine 10 cubes into one mesh but want to delete the central cube. is that possible?
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: Mesh Combiner

Post by serengeor »

sievi1 wrote:Im new to irrlicht and have just got the mesh combiner to work. however i was wondering if there is any way to delete a part of the newly created mesh. lets say that i combine 10 cubes into one mesh but want to delete the central cube. is that possible?
Welcome minecraft cloner.
It is possible, if you make it possible :)
Working on game: Marrbles (Currently stopped).
REDDemon
Developer
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Re: Mesh Combiner

Post by REDDemon »

lol why no one makes terraria clones ? i'm only terraria fan here? XD.
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
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: Mesh Combiner

Post by ACE247 »

Hey I liked terraria! :)
But that was quite a long time ago
JimmyRobo
Posts: 5
Joined: Sat Nov 17, 2012 3:28 pm

Re: Mesh Combiner

Post by JimmyRobo »

sievi1 wrote:Im new to irrlicht and have just got the mesh combiner to work. however i was wondering if there is any way to delete a part of the newly created mesh. lets say that i combine 10 cubes into one mesh but want to delete the central cube. is that possible?
Easy (but slow) way: delete the combined mesh and generate a new one from your world data. If you "chunk" your world (which is how I believe most minecraft style engines work) then you can just detect a chunk-change, destroy it and regenerate it. If its too slow, reduce chunk size or actually remove it from the combined mesh (which should be easy if you have only same-sized cubes. The advantage of chunking is that you can have massively large worlds by only have meshes generated for the visible part you're in.
Post Reply