Jul 1, 2018 - Convoar and Converting OARs

I’ve been working on an OAR file converter. For those of you not in the OpenSimulator community, an OAR file is a region archive format – saving the contents of a region for loading into another region. So it contains all the meshes, textures, scripts, and assets that completely define a region’s contents.

Convoar reads an OAR file and outputs a GLTF scene and image files containing most of the region information. Most specifically, textured mesh representation of all the objects described in the OAR file.

Convoar is evolving. The current version reads an OAR file and outputs either an unoptimized GLTF scene file or a “material reorganized” GLTF scene. The output GLTF is not packed or binary so the output GLTF is a JSON .gltf file, one or more .buf files (containing the vertex information), and an images directory with the texture files for the mesh materials. By default, the output textures are either JPG or PNG format depending if there is any transparency in the texture.

The unoptimized GLTF conversion is a simple conversion of the OAR primitives which creates many, many meshes and is very inefficient for rendering but is good for editing (importing into Blender, for instance).

The “material reorganized” scene has object corresponding to each unique material (texture/color/features) and the meshes have been assigned to each of these material objects. This renders the scene uneditable but this should greatly reduce the number of draw calls needed to render the scene in OpenGL/WebGL.

Future versions of convoar with either contain or have tools to perform other optimizations to the scene and the object therein.

Roadmap-wise, Convoar is a first step in developing code that makes OpenSimulator content displayable in a web browser.

Comments

Feb 14, 2018 - Projects and Versions

Haven’t posted in a while. Well, really, no one reads my little blog so no one has missed my missives.

To catch up:

After doing some work on region simplification (for displaying OpenSimulator regions in a browser), I’ve been trying to create an OAR to other format converter. OAR files are the region archive format of OpenSimulator. The OAR file reading code is in C# (the native language of OpenSimulator ). I started thinking that the best output format would be GLTF since it was new and upcoming. There are conversion toolsets in the Cesium project and it looked like the browser world was moving there.

Well, I ended up writing my own GLTF format exporter and had it more-or-less working with ThreeJS.

Then, the GLTF standards group decided that the world needed a version 2 of the GLTF format. Over many months (and I mean MANY), the standard and then all of the tools in the pipeline converted from GLTFv1 to GLTFv2. Then there was the wait for the GLTF extensions to convert to version 2. As of this writing, I’m not sure all the tools have caught up.

It then occured to me that I could use an existing format conversion library to convert the OAR scene to many different formats. So I found Assimp that reads and writes many different 3D formats. One problem with that choice is that Assimp is a C++ library and, as mentioned above, I was working in C#.

An interface library was required so I found Assimp-net. Well, actually one of the forks of Assimp-net which had been updated recently. But it had been updated to the most recent Microsoft C# framework which, it turned out, was not yet supported by everything.

Sigh. It is frustrating spending time playing with tool versioning when I just wanted to do some 3D object conversion. It feels like I started the day trying to build a house. But, to build that house, I needed a hammer. So I needed to research what hammer options were available. To get the hammer option I needed, I had to then study forging and how to forge the type of hammer I needed. Finally, after weeks of researching hammers and forging and where to dig up the iron oar, I look up and there is still the empty lot where my house should be.

I’m shelving that project to let the tools mature a bit. In the mean time, it’s off to building robots!

Comments

Aug 15, 2017 - BulletSim Upgrade and Fixes

An update to BulletSim has been checked into the OpenSimulator that upgrades BulletSim with version 2.86 of the Bullet physics engine as well as fixing some known problems.

Mantis 8010 (“BulletSim does not always call collision events on collisions”) was caused by BulletSim not doing collision detection on all of the physics engine sub-steps. This meant that fast moving objects (like bullets) could bounce off of a target without reporting any collisions. For those into details, any OpenSimulator physics engine is called every tenth of a second to simulate the next tenth of a second of time. BulletSim internally steps 10 times within that tenth of a second to do a higher resolution physics simulation – a tenth of a second is a long simulation step but that’s the way OpenSimulator does it.

Mantis 8011 (“BulletSim fails to send land_collision messages on some terrain”) was caused by BulletSim computing terrain height differently than the mesh in the physics engine. So, an object on steep terrain could compute as underground to some code while appearing above ground in other code. BulletSim prevents physical objects from going underground by pushing them up when the do. This check would sometimes cause a falling object to float over terrain rather than colliding with the terrain.

The problem in Mantis 7132 (“Collisions stop for no apparent reason on BulletSim”) hasn’t been explicitly fixed. Still looking for that problem.

I found an additional problem that collision_end events don’t happen if the colliding object does an llDie() on its collision. For instance, a target object wouldn’t get a collision_end event for a bullet object that hits the target and does an llDie() on its collision. It looks like the ODE and ubODE physics engines don’t exhibit this problem because of the order that collisions are reported to the simulator. The fix is some code re-organization in SceneObjectPart.cs.

Still in the pipeline is the proper implementation of PhysicsShapeType and then physics engine implementation of raycast.

Comments

Aug 7, 2017 - Bullet Version Upgrade and Build Tasks

Since the Bullet physics engine is distributed with OpenSimulator as a binary, I have to keep my library compatibility kind of old fashioned, That means I can’t use the latest-and-greatest Visual Studio nor the latest-and-greatest version of Linux. I’m building the Linux versions on Ubuntu 14.04 as that has been good with various shared library compatibilities. For Windows, I’m using Visual Studio 2012.

I have to build for both 32 bit and 64 bit Linux systems. Does anyone still use 32 bit?

The upgrade of the Bullet physics engine to v2.86 doesn’t seem to have any problems and I will start the OpenSimulator development branch (“BulletSim2017”) later today. There shouldn’t be any functional difference.

After thinking about the work to be done and talking to people, the major task list is getting longer:

  • Upgrade the underlying Bullet physics engine to version 2.86;
  • Fix the missing collision problem ;
  • CPU performance improvements (people mention high CPU usage with physical objects);
  • generate convex shapes if PhysicsShapeType is set to CONVEX;
  • Raycasting is not done in the physics engine.

Once I’m happy with the upgrade, I’ll create some test cases for collisions and CPU usages to track progress.

Comments

Aug 5, 2017 - Working on BulletSim

I’ve set aside time the next two weeks to work on BulletSim. As some of you might know, I am the original author of the BulletSim physics engine in OpenSimulator. While other projects have taken up most of my attention, there are some tweeks to BulletSim that are needed.

There are three things that I want to address the next weeks:

The first job is getting re-setting up the build environment. I have to use an old version of Visual Studio and an old version of Linux so the compiled C++ code DLL’s and SO’s will work on older versions of the operating systems.

When I start making source changes, I’ll create an OpenSimulator branch for testing.

Stay tuned.

Comments