A random sentence for a random mind.

An Ideal Remedy for 3ds2unr

For questions and discussion about UnrealEd, UnrealScript, and other aspects of Unreal Engine design.

Moderators: Semfry, zYnthetic, ividyon

User avatar Gustavo6046
Skaarj Scout Skaarj Scout
Posts: 20
Joined: 09 Apr 2016, 14:35
Location: Porto Alegre, Rio Grande do Sul, Brazil
Contact:

Subject: Re: An Ideal Remedy for 3ds2unr

Post Posted: 12 Apr 2016, 23:14

Oh homie, thanks for all this. But unfortunately I simply can't keep up. I resign. I have other projects and busy stuff to do. I don't comprehend a single crap from all this information. All I wanted to do was to be capable of doing Unreal models from .obj and I decided to help, but I hope you're in to finish this project soon.

Remember, I'm much better doing my own models in Blender!
This is the 700th member!

Half-veteran modeller. Sucker at gaming. Quite nice at coding. O.K. at texturing. Good at mapping in general.

What else do you need? :)

User avatar Gustavo6046
Skaarj Scout Skaarj Scout
Posts: 20
Joined: 09 Apr 2016, 14:35
Location: Porto Alegre, Rio Grande do Sul, Brazil
Contact:

Subject: Re: An Ideal Remedy for 3ds2unr

Post Posted: 17 Apr 2016, 16:17

Sorry for the double-post / bump, but... I CAN parse .obj file into a list of objects in Python if you want. Then it'll be easy to convert that data into aniv file :)

As for the rest (UV coordinates, vertex animation, etc.), I'm thinking about.

EDIT: Oh, and to add some information, the .obj parser is almost finished, all that remains is UV coordinates.

The animation will be done with only a folder "commandLineOption1" and the files "commandLineOption2_FrameNumber" (e.g. "Lorrobasanti_00001", "Lorrobasanti_00002" files inside "LorrobasantiAnim" folder, etc.), since the animations in a Unreal model are simply ranges that determine the frames that will be the animation. Yes, animations doesn't contain frames -- a model does. It contains these frames and THEN assign them to animations.

This way, we won't need to autogenerate a .uc file. This program is not to be used by noobs that want to create annoying crap, for example some guys that made a Monster Hunt level and put a lot of BlockAll's, dickies, BSP errors and such. (Monster Hunt is the gametype where the most mappers are actually crappers!) Without a template we discourage people that don't make something decent or even understandable. We avoid crap. We assure quality of output.

The parser I made outputs one AnimationFrame object per file, which itself contains a list of Polygons, which are a list of Vertice objects (just X, Y and Z coordinates plus a bunch of functions) and in the future a list of texture vertexes/coordinates as well).

Also, are normal vertexes used in Unreal models? By "normal" I don't mean the standard (geometry) vertex, but THE normal or something like that... Understand me?
This is the 700th member!

Half-veteran modeller. Sucker at gaming. Quite nice at coding. O.K. at texturing. Good at mapping in general.

What else do you need? :)

User avatar Gustavo6046
Skaarj Scout Skaarj Scout
Posts: 20
Joined: 09 Apr 2016, 14:35
Location: Porto Alegre, Rio Grande do Sul, Brazil
Contact:

Subject: Re: An Ideal Remedy for 3ds2unr

Post Posted: 19 Apr 2016, 18:03

Last bump. Please reply!

I finished the parser! Now it supports texture coordinates -- and all you have to do to export Unreal models is to write the exporter! In Python :D
This is the 700th member!

Half-veteran modeller. Sucker at gaming. Quite nice at coding. O.K. at texturing. Good at mapping in general.

What else do you need? :)

User avatar Jet v4.3.5
Skaarj Elder Skaarj Elder
Posts: 1239
Joined: 24 Dec 2007, 17:40
Contact:

Subject: Re: An Ideal Remedy for 3ds2unr

Post Posted: 20 Apr 2016, 14:47

Gustavo6046 wrote:Last bump. Please reply!

I finished the parser! Now it supports texture coordinates -- and all you have to do to export Unreal models is to write the exporter! In Python :D


I didn't go through all of the code, but that looks like a good piece of work. You're right, the only thing left is the exporter from what I can see. That will take some binary data manipulation, as I've pointed out.

I'm not going to be able to go through the Python code myself, and make those changes. I have a lot of notes on the .3d formats as they are defined in the original 3ds2unr code written in C++. I also have my own prototypes and notes for the application I intend to write in C++, considerations for the warts and organization of that language very much included. I just need the time to write it, and I've been spending most of my time on schoolwork these past few weeks.

If you do some research into binary, and a touch of C or C++, you might be able to construct an understanding that will then allow you to write from Python the binary .3d formats as I'll be doing in my application. That would be interesting, and a good illustration of how it might done in the more general sense.
Image
ModDb Portfolio
"Bear," she cried. "I love you. Pull my head off."

User avatar Gustavo6046
Skaarj Scout Skaarj Scout
Posts: 20
Joined: 09 Apr 2016, 14:35
Location: Porto Alegre, Rio Grande do Sul, Brazil
Contact:

Subject: Re: An Ideal Remedy for 3ds2unr

Post Posted: 20 Apr 2016, 15:23

Jet v4.3.5 wrote:
Gustavo6046 wrote:Last bump. Please reply!

I finished the parser! Now it supports texture coordinates -- and all you have to do to export Unreal models is to write the exporter! In Python :D


I didn't go through all of the code, but that looks like a good piece of work. You're right, the only thing left is the exporter from what I can see. That will take some binary data manipulation, as I've pointed out.

I'm not going to be able to go through the Python code myself, and make those changes. I have a lot of notes on the .3d formats as they are defined in the original 3ds2unr code written in C++. I also have my own prototypes and notes for the application I intend to write in C++, considerations for the warts and organization of that language very much included. I just need the time to write it, and I've been spending most of my time on schoolwork these past few weeks.

If you do some research into binary, and a touch of C or C++, you might be able to construct an understanding that will then allow you to write from Python the binary .3d formats as I'll be doing in my application. That would be interesting, and a good illustration of how it might done in the more general sense.


That's why I did a exporter decorator.

All you have to do is the following for a example exporter:

Code: Select all

from exportercommons import model_output


def export(frames):
    # function that returns the string that should be written to the file.

def register_exporter():
    return model_output(export, True) # or False in case of non-binary


Where "frames" is a list of frames (duh) and the classes for it are:

Code: Select all

AnimFrame -> contains variables "polygons" (list of Polygon's) and "frame_index" (thanks Captain Obvious! :D).

Polygon    -> contains variables "texture_coordinates" (a size-two list of texture coordinates, first part is U and second part is V; floats that are NOT converted from the numbers stored in the "vt" part of the .obj file) and "vertices" (tuple of Vertex'es of any size) and the int "index" (normally the index of the polygon in the frame).

Vertex      -> contains variables "x", "y" and "z", along with many vectorial functions.


It doesn't support multiple files, but there must be a workaround!

EDIT: I found a workaround:

Two exporters instead of one! One for anivfile and other for data file. :)

EDIT 2: I finished the aniv-file exporter:

Code: Select all

from exportercommons import model_output
from sys import getsizeof


def export(frames):
    number_of_vertices = 0

    measureframe = frames[0]

    for polygon in measureframe.polygons:
        for vertex in polygon.vertices:
            number_of_vertices += 1

    export_string = "{}{}".format(len(frames), number_of_vertices * getsizeof(number_of_vertices))
    frame_number = 0

    for frame in frames:
        for poly in frame.polygons:
            for vertex in poly.vertices:
                export_string += str(
                    (vertex.x * 8.0) & 0x7ff | ((vertex.y * 8.0) & 0x7ff) << 11 | ((vertex.z * 4.0) & 0x3ff) << 22)

        frame_number += 1

    return export_string


def register_exporter():
    return model_output(export, True)



I am not sure as for the datafile one :/
EDIT 3: Noooo! I'm not writing the aniv file correctly!
This is the 700th member!

Half-veteran modeller. Sucker at gaming. Quite nice at coding. O.K. at texturing. Good at mapping in general.

What else do you need? :)

User avatar Gustavo6046
Skaarj Scout Skaarj Scout
Posts: 20
Joined: 09 Apr 2016, 14:35
Location: Porto Alegre, Rio Grande do Sul, Brazil
Contact:

Subject: Re: An Ideal Remedy for 3ds2unr

Post Posted: 21 Apr 2016, 17:50

I did end up with a working aniv file exporter :)

HOWEVER, I can't seem to convert the polygonal texture coordinates from Wavefront models to Unreal meshes' vertex-based texture coordinates! (for data file exporter)
This is the 700th member!

Half-veteran modeller. Sucker at gaming. Quite nice at coding. O.K. at texturing. Good at mapping in general.

What else do you need? :)

User avatar Jet v4.3.5
Skaarj Elder Skaarj Elder
Posts: 1239
Joined: 24 Dec 2007, 17:40
Contact:

Subject: Re: An Ideal Remedy for 3ds2unr

Post Posted: 21 Apr 2016, 18:00

Gustavo6046 wrote:I did end up with a working aniv file exporter :)

HOWEVER, I can't seem to convert the polygonal texture coordinates from Wavefront models to Unreal meshes' vertex-based texture coordinates! (for data file exporter)


On a square UV texture in OBJ, the origin is on the bottom left of the UV grid. U goes from left-to-right, and V goes from bottom-to-top. Without wrapping around, each goes from 0.0 to 1.0.

In the Unreal formats, the origin is on the top left of the grid. U goes from left-to-right, and V goes from top-to-bottom. Unreal explicitly limits the U and V values to a byte, so the range is 0 to 255. This also means you can't use UVs that go off the grid.

On that last point, a useful feature for any converter would be to auto-adjust the UV coordinates so that they sit on the UV grid.
Image
ModDb Portfolio
"Bear," she cried. "I love you. Pull my head off."

User avatar Gustavo6046
Skaarj Scout Skaarj Scout
Posts: 20
Joined: 09 Apr 2016, 14:35
Location: Porto Alegre, Rio Grande do Sul, Brazil
Contact:

Subject: Re: An Ideal Remedy for 3ds2unr

Post Posted: 21 Apr 2016, 18:22

Thanks for the prompt reply, Jet!

Now the problem is that in Wavefront models, the texture coordinates are per polygon, while in Unreal format, they are by vertex, and I don't understand texture coordinate per vertex!

EDIT: Nevermind, I'll keep the exporter for the parser only for aniv file. I will instead write a Blender addon (!) that writes to two .3d files since it has much more data :P

But Blender can't give per-vertex UV data too! :(
Last edited by Gustavo6046 on 21 Apr 2016, 22:56, edited 1 time in total.
This is the 700th member!

Half-veteran modeller. Sucker at gaming. Quite nice at coding. O.K. at texturing. Good at mapping in general.

What else do you need? :)

User avatar Jet v4.3.5
Skaarj Elder Skaarj Elder
Posts: 1239
Joined: 24 Dec 2007, 17:40
Contact:

Subject: Re: An Ideal Remedy for 3ds2unr

Post Posted: 21 Apr 2016, 22:56

Gustavo6046 wrote:Thanks for the prompt reply, Jet!

Now the problem is that in Wavefront models, the texture coordinates are per polygon, while in Unreal format, they are by vertex, and I don't understand texture coordinate per vertex!

EDIT: Nevermind, I'll keep the exporter for the parser only for aniv file. I will instead write a Blender addon (!) that writes to two .3d files since it has much more data :P


That's good, I'm glad you're doing what you're doing. I should mention that, while I didn't make it clear before, this thread is chiefly intended for discussion and progress tracking of my own version of the converter. If you're doing your own work, I encourage you to make a thread of your own to keep things clean and separated.

Ideally this thread should consist of discussion of features and behavior, demonstrations of where I'm at or what I'm testing, definitely feedback if people are so inclined, and hopefully some functional build releases for people to use (and test). What it shouldn't be is a mishmash of the above, plus code postings and discussion of another version of the tool not produced under similar conditions (C++ vs. Python for instance). I only have so much time to work on my own code, and I can't collaborate at the moment on a project with such a different scope and parameters.
Image
ModDb Portfolio
"Bear," she cried. "I love you. Pull my head off."

User avatar Gustavo6046
Skaarj Scout Skaarj Scout
Posts: 20
Joined: 09 Apr 2016, 14:35
Location: Porto Alegre, Rio Grande do Sul, Brazil
Contact:

Subject: Re: An Ideal Remedy for 3ds2unr

Post Posted: 21 Apr 2016, 22:57

Jet v4.3.5 wrote:This thread is chiefly intended for discussion and progress tracking of my own version of the converter. If you're doing your own work, I encourage you to make a thread of your own to keep things clean and separated.

Ideally this thread should consist of discussion of features and behavior, demonstrations of where I'm at or what I'm testing, definitely feedback if people are so inclined, and hopefully some functional build releases for people to use (and test). What it shouldn't be is a mishmash of the above, plus code postings and discussion of another version of the tool not produced under similar conditions (C++ vs. Python for instance). I only have so much time to work on my own code, and I can't collaborate at the moment on a project with such a different scope and parameters.


OK, I'll continue my project in a separate thread! :)
This is the 700th member!

Half-veteran modeller. Sucker at gaming. Quite nice at coding. O.K. at texturing. Good at mapping in general.

What else do you need? :)

User avatar Jet v4.3.5
Skaarj Elder Skaarj Elder
Posts: 1239
Joined: 24 Dec 2007, 17:40
Contact:

Subject: Re: An Ideal Remedy for 3ds2unr

Post Posted: 24 Apr 2016, 22:30

It may not look like much, but here's a .obj parsing demonstration:



Any lines with a positive non-zero number in brackets indicates parsed data from the .obj (generally line-by-line).

There are some interesting differences between the simple file above, from Blender, and ones exported by others like Max. For instance, the Object() line near the top is technically only required before you begin defining faces for a particular object, and in the .obj provided by AlCapowned that's exactly what happens. This means I cannot load the Vertices into my model data class immediately because we don't know which model/frame we're loading to. Rather, I'll have to hold onto them in a temporary list until we have specified a model designated in the .obj. It's not too difficult, but it does illustrate a form of inconsistency that might show up and cause problems later.

My next step will be to pump that information into a model internal to the application. Then I'll need to write export code based on 3ds2unr's that works with the model data structures. That's the current scope, but once I get it working, I'll see about getting other features implemented.
Image
ModDb Portfolio
"Bear," she cried. "I love you. Pull my head off."

User avatar Gustavo6046
Skaarj Scout Skaarj Scout
Posts: 20
Joined: 09 Apr 2016, 14:35
Location: Porto Alegre, Rio Grande do Sul, Brazil
Contact:

Subject: Re: An Ideal Remedy for 3ds2unr

Post Posted: 27 Apr 2016, 21:52

Unreal doesn't uses materials, smoothing groups or normals... though you can theoretically convert .mtl to James mesh types plus texture numbers.
This is the 700th member!

Half-veteran modeller. Sucker at gaming. Quite nice at coding. O.K. at texturing. Good at mapping in general.

What else do you need? :)

jammer64
Skaarj Scout Skaarj Scout
Posts: 14
Joined: 05 Jan 2010, 02:38

Subject: Re: An Ideal Remedy for 3ds2unr

Post Posted: 02 May 2016, 23:23

Good luck - I wonder why you're bothering with repairing buggy 3ds2unr (coords convertion still gives me nightmares :D) when there's ActorX around which works much better? :)
Last edited by jammer64 on 03 May 2016, 23:54, edited 1 time in total.

User avatar Jet v4.3.5
Skaarj Elder Skaarj Elder
Posts: 1239
Joined: 24 Dec 2007, 17:40
Contact:

Subject: Re: An Ideal Remedy for 3ds2unr

Post Posted: 03 May 2016, 00:15

jammer64 wrote:Good luck - I wonder why you're bothering with repairing buggy 3ds2unr (coords convertion still gives me nightmares :D) if there's ActorX which works much better? :)


Well the end result isn't going to use straight 3ds2unr code at all. Other than notes on the layout of data in the _d.3d and _a.3d file formats, the early "Townsend" build is being used as a reference and doesn't have a bunch of code I feel needs to be preserved. I'm writing my own code fresh to match my specs and notes on the formats, not copying or appropriating the old implementation from 3ds2unr.

As for ActorX, it seemed like a good tool when I tinkered with it, but I can't keep a 3DS Max installation on my computer just for conversion. It is easy to get it for free legally if you're non-commercial, but I'm still not interested. I primarily use Blender for 3D work, so if I can pop out some .obj files and load them into the converter, knowing how the data's going to be handled as precisely as I can*, then I'll be a happy man. Also, I'm not having a terribly difficult job writing this thing. It's just time consuming.

*I think you can look forward to some pretty clear debug messages if you want to flag them on. That, along with the easily readable .obj files, should make things much more transparent then 3ds2unr ever was. I'll qualify all of this as a MAYBE, but even if some early versions of a converter don't have every feature I've been batting around in my head, I don't think too many of them will be very difficult to implement soon after.
Image
ModDb Portfolio
"Bear," she cried. "I love you. Pull my head off."

User avatar []KAOS[]Casey
Skaarj Berserker Skaarj Berserker
Posts: 425
Joined: 25 Sep 2008, 07:25

Subject: Re: An Ideal Remedy for 3ds2unr

Post Posted: 04 May 2016, 23:28

Just leaving this here, don't know if it's good but it seems like it might be. Some random obscure topic that seems to have been overlooked which may be doing this exact thing.

http://www.oldunreal.com/cgi-bin/yabb2/ ... 1439384432

Previous Next

Who is online

Users browsing this forum: No registered users and 2 guests