3DS group smoothing supported in 1.8?

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
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

3DS group smoothing supported in 1.8?

Post by robmar »

Does anyone know if 3DS smoothing is now supported, or if it can be enabled/added?

It would be really useful if 3DS content could be used, there is so much of it, but without smoothing its really unusable withut conversion to other formats, like obj, where smoothing works.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: 3DS group smoothing supported in 1.8?

Post by hybrid »

No, smoothing groups are neither supported in 3ds nor in .obj files. However, .obj format supports per-vertex normals and thus does not require face duplication. For 3ds files it's largely impossible to avoid face duplication without smoothing groups, hence it's even not easily possible to fix those meshes afterwards in your app. Better convert them with some external tool first.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: 3DS group smoothing supported in 1.8?

Post by robmar »

Convert them? To which format?

With obj if I output without smoothing the tree branches are extruded triangles... turning smoothing on, and they become nice and round....

Ummmm?!!
WWebber
Posts: 16
Joined: Sun Feb 26, 2012 11:24 am

Re: 3DS group smoothing supported in 1.8?

Post by WWebber »

I - for instance - wrote my own 3dsmax importer - supporting of course smoothing groups. But as there were so many other things missing in IrrLicht, I moved now to Unity3D where I can now directly import entire FBX scenes.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: 3DS group smoothing supported in 1.8?

Post by hybrid »

Very helpful comment WWebber. *Of course* you did write it that way and *of course* there's so much missing. But basically because you did not search. The matrix operators you searched for do exist, FBX loader does exist. But hey, if Unity did not reinvent the whell or resembles Wildmagic better, why not use it. After all you're free to do so. Don't know if 3ds or fbx is really a format anyone will ever use for anything else than CAD tools.

@robmar: Not sure what you mean by your descriptions, but sounds as if your meshes have some more problems than just wrong smoothing groups in 3ds... Can you provide screenshots?
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: 3DS group smoothing supported in 1.8?

Post by robmar »

@hybrid: Here´s the link to see the two meshes, one is 3ds, other is obj, from a professional publisher:- http://www.sendspace.com/file/q9gm9k

Only the OBJ version shows smoothing, both models suffer a problem with the mesh on the tires, triangles show through. Why would that happen?

Checking the files it seems the tires have a bump map associated, which Irrlicht doesn´t not manage... and that I can´t see how it could be managed....or is there a way to have sub-mesh bump maps in Irrlicht???

From the MTL file, we see the bump map for the tire´s material:-

newmtl _0_tire
Ka 0 0 0
Kd 0.0988824 0.0988824 0.0988824
Ks 0 0 0
illum 2
Ns 6.06287
map_bump 10-tire.jpg
bump 10-tire.jpg

Can we get Irrlicht to bump map on a per material basis? Would be really good if so!

The smoothing in 3ds in Irrlicht is also an issue as I´m sure the file has it enabled...
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: 3DS group smoothing supported in 1.8?

Post by hybrid »

IIRC, the material needs a '-bm 2' somewhere (or some other number). It's not yet documented anywhere, I guess we need to add some docs about this and the other features supported for each mesh format.
3ds smoothing groups were never supported. There's a patch in our trackers, but it's not easy to integrate as it showed some bugs when I tested it on some meshes.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: 3DS group smoothing supported in 1.8?

Post by robmar »

I´m working through the obj loader, and it isn´t complete at all.

Take a look, I comment the bugs with a standard MTL file load:-

const c8* COBJMeshFileLoader::readTextures(const c8* bufPtr, const c8* const bufEnd, SObjMtl* currMaterial, const io::path& relPath)
{
....
Line 418 onwards:-

Code: Select all

    if ((type==1) && (core::isdigit(textureNameBuf[0])))
    {
        currMaterial->Meshbuffer->Material.MaterialTypeParam=core::fast_atof(textureNameBuf);
// BUG!     bufPtr = goAndCopyNextWord(textureNameBuf, bufPtr, WORD_BUFFER_LENGTH, bufEnd);
// robmar - do not skip, this is the filename!!  skipping here returned a null name!  commented out it loads okay, but more problem related to paths!
    }
    if (clamp)
        currMaterial->Meshbuffer->Material.setFlag(video::EMF_TEXTURE_WRAP, video::ETC_CLAMP);
 
    io::path texname(textureNameBuf);
zzz texname.replace('\\', '/');     ................ The path set should have the / at the end, as with windows, paths use alt slash...
 
    video::ITexture * texture = 0;
    bool newTexture=false;
    if (texname.size())
    {
        io::path texnameWithUserPath( SceneManager->getParameters()->getAttributeAsString(OBJ_TEXTURE_PATH) );
        if ( texnameWithUserPath.size() )
        {
// zzz          texnameWithUserPath += '/';         // Windows uses '/', in any case, add when setting path as required, and not here: robmar
            texnameWithUserPath += texname;
        }
 
this below seems confused!  So, if texname with path file exists, load texture, but if not, and texname exists, set newTexture == true!!??
why should the path working or not affect whether the texture gets makeNormalMapTexture called?
 
        if (FileSystem->existFile(texnameWithUserPath))
            texture = SceneManager->getVideoDriver()->getTexture(texnameWithUserPath);
        else if (FileSystem->existFile(texname))
        {
            newTexture = SceneManager->getVideoDriver()->findTexture(texname) == 0;
            texture = SceneManager->getVideoDriver()->getTexture(texname);
        }
        else
        {
            newTexture = SceneManager->getVideoDriver()->findTexture(relPath + texname) == 0;
            // try to read in the relative path, the .obj is loaded from
            texture = SceneManager->getVideoDriver()->getTexture( relPath + texname );
        }
 
here, depending on paths, makeNormalMapTexture is or is not called! why????
 
    if ( texture )
    {
        if (type==0)
            currMaterial->Meshbuffer->Material.setTexture(0, texture);
        else if (type==1)
        {
            if (newTexture)
                SceneManager->getVideoDriver()->makeNormalMapTexture(texture, bumpiness);
            currMaterial->Meshbuffer->Material.setTexture(1, texture);
            currMaterial->Meshbuffer->Material.MaterialType=video::EMT_PARALLAX_MAP_SOLID;
            currMaterial->Meshbuffer->Material.MaterialTypeParam=0.035f;
        }
 
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: 3DS group smoothing supported in 1.8?

Post by hybrid »

Please do not cross-post unrelated stuff. This thread is about 3ds smoothing!
CuteAlien
Admin
Posts: 9716
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: 3DS group smoothing supported in 1.8?

Post by CuteAlien »

Yeah, thread for those bugs is: http://irrlicht.sourceforge.net/forum/v ... =7&t=48090
(I had already fixed it mostly when I messed up something losing my patch on the way, trying to get my motivation up writing it once more since then - and yes, there's more than one bug, like setting materialtype for textures if texturename starts with a number is just wrong as far as I can see).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: 3DS group smoothing supported in 1.8?

Post by robmar »

Some MTL files do have bump files names starting with 2 digits, so it may be a sort of standard...

I´ve reposted to a bug thread I started. Will take a look at the link you gave.
Post Reply