For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

[WIP|Help] Wavefront to Unreal Mesh (except in C++)

Questions and tools for modelling.
Post Reply
User avatar
Gustavo6046(BR)
OldUnreal Member
Posts: 9
Joined: Tue Sep 27, 2016 6:08 pm
Location: Porto Alegre, Brazil
Contact:

[WIP|Help] Wavefront to Unreal Mesh (except in C++)

Post by Gustavo6046(BR) »

Hello all guys!

And yes, it seems this forums is just going to get way more active... I beter take care of how much I say regularly. :P

I am working in a converter from Wavefront .obj files into .3d files in C++ (since Python doesn't seems to work very well with Unreal's format using the byte manipulation at the vertex formula).

I've read very carefully Paul Borke's thing a million times, and this is probably the 093875825973825892385923975th try I do at such a converter! *breath* But since this is in C++ and it allows for better manipulation of bytes, it seems I'm closer at the point.

It is going nice. Right now it's crashing because of some weird problem converting some (rather usual) face into an Unreal Poly struct. But I managed to get pretty far, and it imports the .obj files (seemingly succesfully), one after another, each a frame! ;D

Also, it'll probably give me a distorted mesh once it... "works". >_
Last edited by Gustavo6046(BR) on Tue Sep 27, 2016 9:41 pm, edited 1 time in total.
User avatar
Kajgue
Global Moderator
Posts: 757
Joined: Mon Oct 17, 2005 2:36 pm

Re: [WIP|Help] Wavefront to Unreal Mesh (except in C++)

Post by Kajgue »

I've made a few threads accross some forums like here and ut99.org about importing a skeletal animated mesh that has been exported as a .PSK/.PSA file from Blender 2.72.

A friend of mine tried to import the .psk/.psa file through the .UCC commandlet, although the end result just looked like a wedge/diamond looking thing instead of having any resemblance to the original model.

Might you also happen to have much knowledge about importing .psk/.psa files from Blender into Unreal successfully?

Thanks in advance!
AKA - ( T : S : B ) Ice-Lizard
Image
User avatar
Gustavo6046(BR)
OldUnreal Member
Posts: 9
Joined: Tue Sep 27, 2016 6:08 pm
Location: Porto Alegre, Brazil
Contact:

Re: [WIP|Help] Wavefront to Unreal Mesh (except in C++)

Post by Gustavo6046(BR) »

I've made a few threads accross some forums like here and ut99.org about importing a skeletal animated mesh that has been exported as a .PSK/.PSA file from Blender 2.72.

A friend of mine tried to import the .psk/.psa file through the .UCC commandlet, although the end result just looked like a wedge/diamond looking thing instead of having any resemblance to the original model.

Might you also happen to have much knowledge about importing .psk/.psa files from Blender into Unreal successfully?

Thanks in advance!
Sorry, I never really tried to import PSK/PSA's from Blender's default exporter (specially since I know they're skeletal (not really the style I'm looking for) and probably for Unreal Engine 2!). I'd rather help :(

But thanks for consideration!
User avatar
Kajgue
Global Moderator
Posts: 757
Joined: Mon Oct 17, 2005 2:36 pm

Re: [WIP|Help] Wavefront to Unreal Mesh (except in C++)

Post by Kajgue »

As far as I know, .PSK/.PSA is compatible with Unreal 227 and UT, but ah.

Thanks anyway though :)
AKA - ( T : S : B ) Ice-Lizard
Image
User avatar
[]KAOS[]Casey
OldUnreal Member
Posts: 4497
Joined: Sun Aug 07, 2011 4:22 am
Location: over there

Re: [WIP|Help] Wavefront to Unreal Mesh (except in C++)

Post by []KAOS[]Casey »

.PSK/.PSA is compatible with Unreal 227 and UT
yep
User avatar
Gustavo6046(BR)
OldUnreal Member
Posts: 9
Joined: Tue Sep 27, 2016 6:08 pm
Location: Porto Alegre, Brazil
Contact:

Re: [WIP|Help] Wavefront to Unreal Mesh (except in C++)

Post by Gustavo6046(BR) »

Ok so now I'm gonna post the source code for the sake of it!
main.cpp

Code: Select all

#include 
#include 
#include 
#include 
#include 

#include "mesh.hpp"
#include "export.cpp"
#include "ssplit.cpp"

using std::cout;
using std::cin;
using std::vector;
using std::string;
using std::pair;
using std::ifstream;
using std::stringstream;
using std::strcmp;

struct stats
{
    unsigned int parsedlines;
    unsigned int parsedverts;
    unsigned int parseduvs;
    unsigned int parsedfaces;
    unsigned int totallines;
};

bool parseObjLine(string line, mesh* out, stats* out_stats)
{
    face newface;
    vector curd;
    vector pieces;
    string cur = "";

    // Split lines with space delimiter
    for ( unsigned int i = 0; i < line.size(); i++ )
    {
        if ( line[i] == ' ' )
        {
            pieces.push_back(cur);
            cur = "";
        }

        else
            cur += line[i];
    }

    if ( cur != "" )
        pieces.push_back(cur);

    // Check if vertex; if so, append to mesh vertex list
    if ( line.find("v ") == 0 )
    {
        if ( pieces.size() < 4 )
            return false;

        for ( unsigned int i = 0; i < 3; i++ )
            curd.push_back(strtod(pieces[i + 1].c_str(), 0));

        out->vertices.push_back(curd);

        out_stats->parsedverts++;
        return true;
    }

    // Check if texture UV vertex too
    else if ( line.find("vt") == 0 )
    {
        if ( pieces.size() < 3 )
            return false;

        for ( unsigned int i = 0; i < 2; i++ )
            curd.push_back(strtod(pieces[i + 1].c_str(), 0));

        out->uv.push_back(curd);

        out_stats->parseduvs++;
        return true;
    }

    //...and for faces
    else if ( line.find("f") == 0 )
    {
        if ( pieces.size() < 4 )
            return false;

        vector< vector > indexes;
        vector indexlist;
        string curr = "";

        for ( unsigned int i = 1; i < pieces.size(); i++ )
        {
            indexlist.clear();
            curr = "";

            for ( unsigned int j = 0; j < pieces[i].size(); j++ )
            {
                if ( pieces[i][j] == '/' )
                {
                    indexlist.push_back(curr);
                    curr = "";
                }

                else
                    curr += pieces[i][j];
            }

            if ( curr != "" )
            {
                indexlist.push_back(curr);
            }

            vector new_index;

            new_index.push_back(atoi(indexlist[0].c_str()));
            new_index.push_back(atoi(indexlist[1].c_str()));

            indexes.push_back(new_index);
        }

        for ( int i = 0; i < 3; i++ )
        {
            newface.vertices[i] = indexes[i][0];
            newface.uv[i] = indexes[i][1];
        }

        out->faces.push_back(newface);

        out_stats->parsedfaces++;
        return true;
    }

    return false;
}

int main(int argc, char* argv[])
{
    anim animation;
    mesh model;
    stats statistic;

    // Title :3
    cerr  1 && strcmp(argv[1], "-txt") == 0 )
        {
            cerr
Last edited by Gustavo6046(BR) on Thu Sep 29, 2016 3:52 pm, edited 1 time in total.
Post Reply

Return to “Modelling”