What’s New in RealityServer 5.1 Update 173

We recently released RealityServer 5.1 build 2017.173. This is mainly an incremental and bug fix release but adds some cool features some customers have been waiting for, including multiple UV sets, materials and holes for the generate_mesh command, updated AssImp plugin, a new Smart Batch command and render loop improvements.

Mesh Generator Improvements

The generate_mesh command is extremely useful when you want to programmatically create geometry in your application. For example when creating walls for a floor plan which someone has designed in your software. However what if you want to have each wall use a different material, with different texture coordinates and have holes in the wall mesh for the windows. Previously you would need to generate separate meshes for this and manually create the holes within the polygons.

With this update you can now have multiple UV coordinates for your meshes, simply by providing an array of coordinates instead of a single set. You can also add a material index to each polygon which allows the same mesh to have polygons with different materials. This can be much more efficient than defining separate meshes.

 

Example Image

Example with Multiple Holes, Materials and UVs

Finally polygons can also now define holes which are automatically cut from the polygon and are tessellated for you. This is great when you need to make room for a window or cut a hole in the ceiling for a light fitting for example. You can find a simple example set of commands using the new features here. This will create the same image as shown above and shows all of the new features.

Smart Batch

Quite often when building a RealityServer application you want to execute a bunch of commands in sequence but you need to use the results of one command as input to another later in the sequence. Previously you only had two choices for this, either do multiple round trips to the server or write a server-side V8 command to encapsulate the operation. This release adds a third option, the new smart_batch command. With Smart Batch you can do things like this:

{"jsonrpc": "2.0", "method": "smart_batch", "params": {
    "environment" : {
      "scene_file": "scenes/meyemII.mi",
      "resolution" : { "x" : 384, "y": 384},
      "iterations" : 50
    },
    "commands" : [
      {
        "name" : "create_uuid",
        "id" : "uuid"
      },
      {
        "name" : "import_scene",
        "params" : {
          "filename" : "${scene_file}",
          "scene_name" : "${uuid}"
        },
        "id" : "scene"
      },
      {
        "name" : "instance_get_item",
        "params" : {
          "instance_name" : "${scene.camera_instance}"
        },
        "id" : "camera"
      },
      {
        "name" : "camera_set_resolution",
        "params" : {
          "camera_name" : "${camera}",
          "resolution" : "${resolution}"
        }
      },
      {
        "name" : "element_set_attribute",
        "params" : {
          "element_name" : "${scene.options}",
          "attribute_name" : "progressive_rendering_max_samples",
          "attribute_value" : "${iterations}",
          "attribute_type" : "Sint32",
          "create" : true
        }
      }
    ]
}, "id": 1}

If you have ever used a templating language in JavaScript such as Handlebars or Underscore you will get the idea. You have a starting environment where you can specify variables for use in replacements later on, but the real magic happens when you add an id to the sub-commands. This causes their results to get added to the environment so you can access them in future commands. The final environment is also returned by the command at the end.

You’ll notice you can also use dot notation to access members of the variables during replacement. It’s also clever enough to work out when you want to replace your string with a full object or other type. One powerful use case for this new command is creating templated snippits in your application code which you can easily just change the environment on and resend. We have already been using this command heavily on our own applications.

While you could use the multiple round trips or V8 command options, there are many use cases where a Smart Batch would be preferable. If you need branching, loops and other advanced functionality then you will still need to do a V8 command but for many things a Smart Batch will do the job better. One final thing to note, you should not use smart_batch with commands that return binaries such as the render commands. For more details, refer to the RealityServer Features section under Getting Started in the RealityServer Document Center.

AssImp 4.1.0

The fantastic AssImp project recently released their 4.1.0 update. We have incorporated this into our importer/exporter plugin so we inherit the new features such as 3MF export and glTF 2 support for import and export. There are also plenty of bug fixes in the new release, check out the projects release notes for more details.

Render Loop Improvements

The default and simple render loop handlers now allow you to change the renderer between Iray Photoreal and Iray Interactive on the fly, without restarting the render loop. All you have to do is set the renderer parameter with render_loop_set_parameter just like any other parameter. A new update_scene parameter has also been added so you can inform the render loop if you change the camera instance or options used in a scene, previously these were not picked up and caused issues.

Iray Version Bump

Upgraded to Iray 2017.1.2, build 296300.3713 which contains mainly bug fixes, including a fix for a performance regression for certain simple scenes with uniform lighting. Checkout the neurayrelnotes.pdf file in your RealityServer installation for more details.

Introspection of Structures and Enums

The internal API of RealityServer has built in and user definable Structures and Enums (defined with IStructure_decl and IEnum_decl). We have now added a new command type_get_declaration to allow introspection of these types. This is helpful when building user interfaces that might need to understand how these types are defined. For example the built in Approx structure attribute used to define tessellation.

Aways Read the Release Notes!

There are several other fixes both in RealityServer and Iray so always read the full release notes and Iray release notes.

Articles