Specification on Roblox OBJ File Format Implementation

Hey all!

I’m no Blender Guru, so naturally I was messing around with creating .obj files using just a plain text editor. However, I’m running into some strange behavior with faces being rendered in the wrong direction. OBJ files support optional vertex normals. In the screenshot below I’ve created 3 different .obj files with a few different approaches to the optional vertex normals in the raw file data which are being rendered in MeshParts. The cubes at the top of the picture below have the DoubleSided property set to true, while the lower ones, false.

The red cubes DO NOT include any explicit declaration of vertex normals. Roblox actually seems to handle this solution the closest to correct in the case of the DoubleSided == true cube. However, I would like to find a solution which allows me to not need the DoubleSided property set to true.

The green cubes DO include explicit declarations of vertex normals. In this approach I have the vertex normals set to what I expected would make the faces face outwards (The unit normal is a vector directed away from the center of the cube; for example, the top surface face has unit normals of (0,1,0) ). However, this appears to have the opposite effect as all the faces render facing inwards.

The blue cubes also DO include explicit declarations of vertex normals. I attempted to fix the inverted faces of the green cubes by inverting all the vertex normals (For example, the top surface face has unit normals of (0,-1,0) ). Still, though, this does not yield the intended result.

I was wondering if anyone has any ideas why I don’t seem to be able to make a cube with faces facing the intended direction.

Some additional info:

  • In my .obj files I create each face of the cube using 4 vertex polygon. (This differs from .obj files created by exporting from Roblox Studio - it always creates 3 vertex polygon). Could Roblox be implemented to only handle 3 vertex polygon?
  • According to the Wikipedia page for the .obj file format, it follows “a right-hand coordinate system,” I remember seeing a page talking about Roblox’s coordinate system in the developer wiki years ago, but can’t seem to locate it now… Could this odd behavior be the result of mismatching coordinate systems?

Overall, if anyone has any additional information about the ways Roblox implements .obj files or some additional approaches I could try I would appreciate it. I’m willing to share any of the files mentioned as well if that would help.

Thanks,
–East98

1 Like

This might be helpful to you. Roblox Mesh Format