Page 8 of 9

Re: Mesh Combiner

Posted: Tue Oct 04, 2011 3:03 am
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

Problem on 64-bit machines

Posted: Tue Feb 14, 2012 10:13 am
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

Re: Problem on 64-bit machines

Posted: Tue Feb 14, 2012 2:45 pm
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/

Re: Mesh Combiner

Posted: Tue Feb 14, 2012 3:18 pm
by Kuzy
Thanks RdR.

Re: Mesh Combiner

Posted: Tue Feb 21, 2012 8:12 am
by Kuzy
My problem with 64bit machines was caused by memory leaks and is now solved with the actual version.

Re: Mesh Combiner

Posted: Mon Feb 27, 2012 8:18 pm
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?

Re: Mesh Combiner

Posted: Sat Jul 14, 2012 4:42 pm
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

Re: Mesh Combiner

Posted: Sun Jul 15, 2012 8:21 am
by shadowslair
Don`t normalize normals of planar surfaces like the tiles you use, and for better results don`t use per-vertex lighting.

Re: Mesh Combiner

Posted: Sun Jul 15, 2012 10:26 pm
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?

Re: Mesh Combiner

Posted: Mon Jul 16, 2012 12:28 pm
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;
}

Re: Mesh Combiner

Posted: Sun Nov 18, 2012 6:45 pm
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?

Re: Mesh Combiner

Posted: Sun Nov 18, 2012 8:15 pm
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 :)

Re: Mesh Combiner

Posted: Sun Nov 18, 2012 8:53 pm
by REDDemon
lol why no one makes terraria clones ? i'm only terraria fan here? XD.

Re: Mesh Combiner

Posted: Sun Nov 18, 2012 9:03 pm
by ACE247
Hey I liked terraria! :)
But that was quite a long time ago

Re: Mesh Combiner

Posted: Mon Nov 19, 2012 12:49 am
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.