Page 1 of 2

.tri 3D model

Posted: Thu Nov 18, 2021 9:30 pm
by JaKeN525
Hello forum! can someone open these files of one model, or help me with this. Please.

https://mega.nz/folder/HXJxHKYZ#Mg1OOoadSTBivTh_naA7LQ

This is one of the parts of the complete car model from the Beetle Crazy Cup/Beetle Buggin'/Käfer Total.

.TRI .NOR .INF .VER

Re: .tri 3D model

Posted: Thu Nov 18, 2021 10:49 pm
by shakotay2
1st part, for the next part I'll need some trick (again :D ):
.
and 2nd part (little bit tired of "tricks" :eek: )
part1.png

Re: .tri 3D model

Posted: Fri Nov 19, 2021 6:31 pm
by dimis9138
shakotay2 wrote: Thu Nov 18, 2021 10:49 pm 1st part, for the next part I'll need some trick (again :D ):
.
and 2nd part (little bit tired of "tricks" :eek: )
part1.png
What is this magic tricks? :D

Re: .tri 3D model

Posted: Fri Nov 19, 2021 6:53 pm
by shakotay2
dimis9138 wrote: Fri Nov 19, 2021 6:31 pmWhat is this magic tricks? :D
It's "trying to understand" the structure of the face indices block and writing some code lines to get proper FIs.
(The "magic" is that I didn't really understand it, but worked. :D )

Re: .tri 3D model

Posted: Sat Nov 20, 2021 12:01 pm
by JaKeN525
thank you very much, I'm going to try

Re: .tri 3D model

Posted: Sat Nov 20, 2021 2:01 pm
by JaKeN525
can you please explain to me how you did it?

Re: .tri 3D model

Posted: Sat Nov 20, 2021 2:03 pm
by JaKeN525
shakotay2 wrote: Fri Nov 19, 2021 6:53 pm
dimis9138 wrote: Fri Nov 19, 2021 6:31 pmWhat is this magic tricks? :D
It's "trying to understand" the structure of the face indices block and writing some code lines to get proper FIs.
(The "magic" is that I didn't really understand it, but worked. :D )
can you please explain to me how you did it?

Re: .tri 3D model

Posted: Sat Nov 20, 2021 5:27 pm
by shakotay2
Collecting vertices and face indices (FIs), as always.
Did you try to get a point cloud? (simple part, using hex2obj, view link in my sig)
.
1_CARRO-ver.png
Details for getting FIs won't help you that much except you're a coder.

Re: .tri 3D model

Posted: Sun Nov 21, 2021 5:43 am
by mariokart64n

Code: Select all

struct fmtINF {
    uint32_t                                                 num_vertices;
    uint32_t                                                 num_triangles;
    float*                                                     vertices;
    float*                                                     tvertices;
    float*                                                     normals;
    uint16_t*                                                 nor_triangles;
    uint16_t*                                                 ver_triangles;
    uint32_t*                                                 unk_triangles;
    bool read (char* &f, size_t &pos, size_t &fsize, std::string &fpath, std::string &fname) {
        bool sucess                                         = false;
        num_vertices                                         = readlong(f, pos);
        num_triangles                                         = readlong(f, pos);
        std::string verFile                                 = fpath + fname + ".ver";
        std::string norFile                                 = fpath + fname + ".nor";
        std::string triFile                                 = fpath + fname + ".tri";
        if (num_vertices > 0) {
            if (f != NULL) {delete[] f; f = NULL; pos = 0;}
            if (openFile(f, fsize, verFile)) {
                vertices                                     = new float [num_vertices * 3];
                tvertices                                     = new float [num_vertices * 2];
                for (int i = 0; i < num_vertices; i++) {
                    vertices[i * 3]                         = readfloat(f, pos);
                    vertices[(i * 3) + 1]                     = readfloat(f, pos);
                    vertices[(i * 3) + 2]                     = readfloat(f, pos);
                    tvertices[i * 2]                         = readfloat(f, pos);
                    tvertices[(i * 2) + 1]                     = readfloat(f, pos);
                    }
                }
            if (f != NULL) {delete[] f; f = NULL; pos = 0;}
            if (openFile(f, fsize, norFile)) {
                normals                                     = new float [num_vertices * 3];
                for (int i = 0; i < num_vertices; i++) {
                    normals[i * 3]                             = readfloat(f, pos);
                    normals[(i * 3) + 1]                     = readfloat(f, pos);
                    normals[(i * 3) + 2]                     = readfloat(f, pos);
                    }
                }
            sucess                                             = (num_vertices > 0) || sucess;
            }
        if (num_triangles > 0) {
            if (f != NULL) {delete[] f; f = NULL; pos = 0;}
            if (openFile(f, fsize, triFile)) {
                nor_triangles                                 = new uint16_t [num_triangles * 3];
                ver_triangles                                 = new uint16_t [num_triangles * 3];
                unk_triangles                                 = new uint32_t [num_triangles];
                for (int i = 0; i < num_triangles; i++) {
                    ver_triangles[i * 3]                     = readshort(f, pos);
                    nor_triangles[i * 3]                     = readshort(f, pos);
                    ver_triangles[(i * 3) + 1]                 = readshort(f, pos);
                    nor_triangles[(i * 3) + 1]                 = readshort(f, pos);
                    ver_triangles[(i * 3) + 2]                 = readshort(f, pos);
                    nor_triangles[(i * 3) + 2]                 = readshort(f, pos);
                    unk_triangles[i]                         = readlong(f, pos);
                    }
                }
            sucess                                             = (num_triangles > 0) || sucess;
            }
        return sucess;
        }
    };
Edit:
Sorry forgot to explain what this is, this is my struct that I wrote in c++

I've included a 7-Zip containing the code::blocks project file which can be used to recompile the project if need be.
Unfortunately it's using some window libraries to handle i/o so it has a dependency on windows.h

The compiled binary should be in the project folder under ./bin/release/*.exe

You can either call it through command line such as <exe> <file.inf>, drag and drop, or simply double click the exe and hope for the best.

The inf and its daughter files are required to be in the same location and a new wavefront obj should be created in the same location.

It should be noted that I didn't understand the indices in the *.tri file so something probably isn't right :\

Re: .tri 3D model

Posted: Sun Nov 21, 2021 2:04 pm
by JaKeN525
mariokart64n wrote: Sun Nov 21, 2021 5:43 am

Code: Select all

struct fmtINF {
    uint32_t                                                 num_vertices;
    uint32_t                                                 num_triangles;
    float*                                                     vertices;
    float*                                                     tvertices;
    float*                                                     normals;
    uint16_t*                                                 nor_triangles;
    uint16_t*                                                 ver_triangles;
    uint32_t*                                                 unk_triangles;
    bool read (char* &f, size_t &pos, size_t &fsize, std::string &fpath, std::string &fname) {
        bool sucess                                         = false;
        num_vertices                                         = readlong(f, pos);
        num_triangles                                         = readlong(f, pos);
        std::string verFile                                 = fpath + fname + ".ver";
        std::string norFile                                 = fpath + fname + ".nor";
        std::string triFile                                 = fpath + fname + ".tri";
        if (num_vertices > 0) {
            if (f != NULL) {delete[] f; f = NULL; pos = 0;}
            if (openFile(f, fsize, verFile)) {
                vertices                                     = new float [num_vertices * 3];
                tvertices                                     = new float [num_vertices * 2];
                for (int i = 0; i < num_vertices; i++) {
                    vertices[i * 3]                         = readfloat(f, pos);
                    vertices[(i * 3) + 1]                     = readfloat(f, pos);
                    vertices[(i * 3) + 2]                     = readfloat(f, pos);
                    tvertices[i * 2]                         = readfloat(f, pos);
                    tvertices[(i * 2) + 1]                     = readfloat(f, pos);
                    }
                }
            if (f != NULL) {delete[] f; f = NULL; pos = 0;}
            if (openFile(f, fsize, norFile)) {
                normals                                     = new float [num_vertices * 3];
                for (int i = 0; i < num_vertices; i++) {
                    normals[i * 3]                             = readfloat(f, pos);
                    normals[(i * 3) + 1]                     = readfloat(f, pos);
                    normals[(i * 3) + 2]                     = readfloat(f, pos);
                    }
                }
            sucess                                             = (num_vertices > 0) || sucess;
            }
        if (num_triangles > 0) {
            if (f != NULL) {delete[] f; f = NULL; pos = 0;}
            if (openFile(f, fsize, triFile)) {
                nor_triangles                                 = new uint16_t [num_triangles * 3];
                ver_triangles                                 = new uint16_t [num_triangles * 3];
                unk_triangles                                 = new uint32_t [num_triangles];
                for (int i = 0; i < num_triangles; i++) {
                    ver_triangles[i * 3]                     = readshort(f, pos);
                    nor_triangles[i * 3]                     = readshort(f, pos);
                    ver_triangles[(i * 3) + 1]                 = readshort(f, pos);
                    nor_triangles[(i * 3) + 1]                 = readshort(f, pos);
                    ver_triangles[(i * 3) + 2]                 = readshort(f, pos);
                    nor_triangles[(i * 3) + 2]                 = readshort(f, pos);
                    unk_triangles[i]                         = readlong(f, pos);
                    }
                }
            sucess                                             = (num_triangles > 0) || sucess;
            }
        return sucess;
        }
    };
Edit:
Sorry forgot to explain what this is, this is my struct that I wrote in c++

I've included a 7-Zip containing the code::blocks project file which can be used to recompile the project if need be.
Unfortunately it's using some window libraries to handle i/o so it has a dependency on windows.h

The compiled binary should be in the project folder under ./bin/release/*.exe

You can either call it through command line such as <exe> <file.inf>, drag and drop, or simply double click the exe and hope for the best.

The inf and its daughter files are required to be in the same location and a new wavefront obj should be created in the same location.

It should be noted that I didn't understand the indices in the *.tri file so something probably isn't right :\
thank you so much, it works. true, not with all models, but the most important opens perfectly!

Re: .tri 3D model

Posted: Fri Nov 26, 2021 10:33 am
by Karpati
I have finished my Beetle Crazy Cup (Beetle Buggin'; Käfer Total) *.INF/VER/TRI loader module and I have released the following programs as web updates:

- 3D Object Converter v8.018 (Windows)
- i3DConverter v4.106 (macOS)
- i3DConverter v2.106 (Linux)

How to get the 3D Object Converter v8.018:
Download the 3D Object Converter from http://3doc.i3dconverter.com and install it or download and use the portable version.
After it just use the Help/Check for updates... function to get the v8.018.

How to get the i3DConverter macOS v4.106:
Download the i3DConverter from http://www.i3dconverter.com and install it.
After it just use the Help/Check for updates... function to get the v4.106.

How to get the i3DConverter Linux v2.106:
Download the i3DConverter from http://www.i3dconverter.com and install it.
After it just use the Help/Check for updates... function to get the v2.106.

Re: .tri 3D model

Posted: Fri Nov 26, 2021 8:26 pm
by JaKeN525
that's cool!
but there are models without .nor files and they don't open. what to do?

these are the files:
https://mega.nz/folder/yeRHQYiD#4IZUNYH7oFASZYlpSLudPg

Re: .tri 3D model

Posted: Sat Nov 27, 2021 12:09 pm
by Karpati
JaKeN525 wrote: Fri Nov 26, 2021 8:26 pm that's cool!
but there are models without .nor files and they don't open. what to do?

these are the files:
https://mega.nz/folder/yeRHQYiD#4IZUNYH7oFASZYlpSLudPg
My program does not use the .nor file, but it checks the .inf file size (8 bytes).
Your sample .inf file has 12 bytes.

Unfortunately I have checked the cars folder's files only, your sample file comes from the track folder.

Mundo64.jpg

Re: .tri 3D model

Posted: Sat Nov 27, 2021 12:10 pm
by Karpati
Here I attached the converted file in Wavefront .obj/mtl formats.

Re: .tri 3D model

Posted: Sat Nov 27, 2021 3:44 pm
by JaKeN525
Karpati wrote: Sat Nov 27, 2021 12:09 pm
JaKeN525 wrote: Fri Nov 26, 2021 8:26 pm that's cool!
but there are models without .nor files and they don't open. what to do?

these are the files:
https://mega.nz/folder/yeRHQYiD#4IZUNYH7oFASZYlpSLudPg
My program does not use the .nor file, but it checks the .inf file size (8 bytes).
Your sample .inf file has 12 bytes.

Unfortunately I have checked the cars folder's files only, your sample file comes from the track folder.


Mundo64.jpg
strange :)
"unrecognized or unsupported file type"
Image