Rbx2Source v2.0

I’ve been working on this for about a month now, and I’ve been posting some teaser screenshots on the “What are you working on currently?” thread. I’m pleased to say that its finally finished, and its now available to download from it’s github repository: https://github.com/CloneTrooper1019/Rbx2Source

What is Rbx2Source?


Rbx2Source is a tool that assembles real geometry rigs of ROBLOX assets, and compiles them into the Source engine. I built a reflection system that takes .rbxmx files, and emulates them in C# so that I can take the appearance of a character, extract the mesh assets being used, compute how object space is applied to the rig assembly, and then bake the meshes into an assembly of polygons and bones.

The system is completely dynamic, and it’ll accept almost everything that you throw at it. In the case of the program though, I chose to target user avatars, as well as hats and gears in the catalog. It also supports the direct import of ROBLOX animations, transparency, reflectance, parts that use BrickColors instead of mesh textures, VertexColor3, and more!

The interface looks a bit like this:

It takes around 5-10 seconds on average for a character to be assembled, depending on your internet speeds. Assets are pre-cached using their version id, so it doesn’t have to download assets from ROBLOX more than once.

Once compiled, you can view the character model in Valve’s Half-Life Model Viewer, to see how everything turned out.

You can also tinker with the animations from there, and see how they blend together.

Some screenshots of hats & gears.

Whats the point of this?


Well, I suppose one reason was because I wanted to beat myself up as a ragdoll in Garry’s Mod.

But I think one of the primary uses for this would be ROBLOX machinimas and video making, using Source Filmmaker.
I put together this small example a few days ago:

Here’s something pretty cool I found recently that uses Rbx2Source and Source Filmmaker:

It’s also pretty good for making thumbnail renders. I used Source Filmmaker to make The Stalker: Reborn’s thumbnails:

Anyhow, yeah I hope you guys enjoy!

40 Likes

oh god that intro

This program is absolutely incredible. I hope people will be making some awesome things with it!

2 Likes

about time it was fixed. thanks again clone

For anyone who might be curious about ROBLOX’s mesh format, heres some specifications me and my friend were able to come up with:

Header

All mesh files start with a header indicating what version it is.
So far, we’ve isolated 3 versions that exist:

  • version 1.00
  • version 1.01
  • version 2.00

General notes about the mesh format

  • The texture coordinate uses Vector3, but the Z axis is always set to 0, since its technically a Vector2.

version 1.00

This format is stored in ASCII, and there are 3 lines present in this file.

  • The 1st line is the version header, as mentioned earlier.
  • The 2nd line is a number indicating how many polygons are in the mesh.
  • The 3rd line is a series of Vector3 strings encapsulated by brackets. For every polygon, you should expect 3 sets of 3 Vector3 pairs listed in the following order to define a polygon:
  • Vertex
  • Surface Normal
  • Texture Coordinate
  • Notes:
  • With version 1.00, you are expected to scale the mesh down by 0.5 after parsing.
  • The texture coordinate’s Y axis is flipped, so you need to read it as 1 - Y.

version 1.01

  • This version is identical to version 1.00, except you don’t need to scale the mesh down by 0.5 after parsing.

version 2.00

The primary difference between this version and the other versions, is that this format uses binary instead of ASCII. This significantly compresses the file size. In addition, it offers support to recycle vertices being used by multiple polygons.

The format uses two number types primarily:

  • UInt32
  • float

Both number types are stored as 4-bytes using Little Endian.

  • The file starts with a 17 byte header.
  • The first 12 bytes being the “version 2.00” text, and the last 5 always being some stub data (0A 0C 00 24 0C) that isn’t necessary to read the mesh.
  • The next 4 bytes represent a UInt32, being the number of vertices to read
  • The next 4 bytes represent a UInt32, being the number of polygons to build.
  • From there, there are numVertices * 36 bytes to read.
  • Each set of 36 bytes gets split into 3 sets of 12 bytes.
  • The sets of 12 bytes represent XYZ coordinates, so you read them 4 bytes at a time and convert them to floats.
  • The 3 sets define’s a vertice’s location, surface normal, and texture coordinate.
  • You should then store this data in an array somewhere for later.
  • Finally, there will be numPolygons * 3 bytes to read, as UInt32 values.
  • For every 3 int values, use those values as 0-based indexes to fetch a vertice data set, and then use those 3 data sets to form a polygon.

are you planning on making this rbx2fbx?

2 Likes

we’ll see about that

1 Like

What about rbx2source for linux users??

1 Like

I know I’m six years late, but how would I import custom made avatars from studio?

1 Like

Is it just me or is it being treated like a virus by Windows Defender?

1 Like

Most exe programs do. Just click “more info” when it blocks it from running, and press “run anyway.”

pretty late but it should be fine, windows defender acts a bit out of touch sometimes, just run a virus scan if you’re that worried
(happened to me as I was about to use it for something)

1 Like