{"id":1357,"date":"2016-04-13T05:02:02","date_gmt":"2016-04-13T05:02:02","guid":{"rendered":"http:\/\/www.migenius.com\/?p=1357"},"modified":"2016-04-13T05:02:41","modified_gmt":"2016-04-13T05:02:41","slug":"realityserver-4-4","status":"publish","type":"post","link":"https:\/\/www.migenius.com\/articles\/realityserver-4-4","title":{"rendered":"RealityServer 4.4 with Iray 2016.0"},"content":{"rendered":"

We have just released RealityServer 4.4 which includes the new NVIDIA Iray 2016.0<\/a>. We will periodically release updated versions as new improvements and Iray updates become available. We’ll cover some of the highlights of this release here but users are strongly encouraged to read both the RealityServer release notes (relnotes.txt) and the Iray releases notes (neurayrelnotes.pdf) provided with the release. Let’s take a look at those new features, some of which many of our users have been asking about for some time.<\/p>\n

<\/p>\n

Lens Distortions<\/h3>\n

Iray 2016.0 introduces a new concept of lens distortions<\/a>. This functionality allows for several interesting effects, including simulating the lenses\u00a0of very specific cameras (extremely useful for photomontage). However the option of most interest to RealityServer customers is likely to be the ability to render spherical images using these distortions. This allows you to create panoramic imagery with a single render. Previously several of our customers have used the workaround of rendering six 90 degree field of view images and creating a cube map. While this works it can sometimes result in visible seams. Rendering with a spherical lens distortion gives perfect results. To activate you just need to set the mip_lens_distortion_type<\/em> attribute on your scenes camera to “spherical”. \u00a0You’ll want to render with an aspect ratio of 2:1 for best results.<\/p>\n

\"Spherical

Spherical panorama rendered with RealityServer 4.4<\/p><\/div>\n

Mesh Generation Command<\/h3>\n

A new command, generate_mesh<\/a> has been added to the RealityServer JSON-RPC web services API. Previously, the only way to get geometry into RealityServer was to have it on your servers filesystem and load it with one of the available importers (e.g., OBJ or .mi). Now you can feed mesh data to RealityServer directly through web services. This allows you to build logic outside RealityServer to generate geometry (for example if you have an application that generates a room shape based on an outline) and then pass it in dynamically. There is a very wide range of potential uses for this command and while customers have always been able to build server-side C++ plugins to expose this functionality we are now pleased to include it as an out of the box feature.<\/p>\n

Using this new feature you can now create scenes without every loading geometry from disk. The image to the right was created using a server-side JavaScript command that calls the new generate_box<\/em> command (described below) which in turn uses the new generate_mesh<\/em> command to make the actual geometry. The script also assigns materials, creates a light, setups the camera and a clipping plane to cut out the front wall. All of this is then exposed as a single command to the client which can just call something similar to generate_room<\/em> with the parameters for the size of the room and the table.<\/p>\n

Note: You may need to increase the size\u00a0http_post_body_limit<\/em> setting in your realityserver.conf<\/em> configuration if you plan to pass large amounts of data to this command. If you have extremely large datasets it may still be more efficient to put them into .mi or OBJ format and get them to the servers filesystem.<\/p>\n<\/div><\/div>

\"Procedural<\/a><\/p>\n

Room made entirely with generate_mesh (click to zoom)<\/p>\n<\/div>\n<\/div><\/div><\/div>\n

Geometry Generators<\/h3>\n

One of the great things about having the new generate_mesh command is that in addition to being able to be called through the web services API, it can also be directly called from the server-side JavaScript API. What this lets you do is quickly author geometry generating scripts in JavaScript which run on the server-side and expose parameterised commands to the web services API. If you have to create procedural or parametric geometry this can greatly reduce the amount of data you need to send down the wire since you can just send the parameters to the command and let it do the work on the server. We’ve included two simple generators in the javascript_services<\/em> directory of your installation, generate_box<\/a> and generate_extrusion<\/a>. Full JavaScript source code is provided, so you can use these as an guide for your own.<\/p>\n

\r\n\/\/# name = generate_cylinder\r\n\/\/# description = Creates an extruded solid from a closed 2D polygon.\r\n\/\/# argument_descriptions = [ { "name": "name", "type" : "String", "description" : "The name of the object to create." } ]\r\n\/\/# argument_descriptions = [ { "name": "radius", "type" : "Float32", "default": 1.0, "description" : "Radius of the cylinder." } ]\r\n\/\/# argument_descriptions = [ { "name": "height", "type" : "Float32", "default": 0.0, "description" : "Height of the cylinder." } ]\r\n\/\/# argument_descriptions = [ { "name": "sides", "type" : "Sint32", "default": 16, "description" : "Number of sides to give the cylinder." } ]\r\n\/\/# return_type = void\r\n\r\n\/\/ this is the structure for our mesh\r\nvar mesh = {\r\n "vectors" : {\r\n "points" : [],\r\n "normals" : []\r\n },\r\n "vertices" : [],\r\n "polygons" : []\r\n};\r\n\r\n\/\/ keep separate arrays for top and bottom polygons\r\nvar bottom = [];\r\nvar top = [];\r\n\r\nfor (var i = 0; i &lt; sides; i++) {\r\n var r = i \/ sides * Math.PI * 2.0; \/\/ radians for our angle\r\n var c = Math.cos(r) * radius; \/\/ the x component\r\n var s = Math.sin(r) * radius; \/\/ the y component\r\n var b = { x: c, y: s, z: 0.0 }; \/\/ bottom vertex\r\n var t = { x: c, y: s, z: height }; \/\/ top vertex\r\n var n = { x: c, y: s, z: 0.0 }; \/\/ normal vector\r\n var nl = Math.sqrt((n.x*n.x) + (n.y*n.y) + (n.z*n.z)); \/\/ normal length\r\n n.x = n.x \/ nl; n.y = n.y \/ nl; n.z = n.z \/ nl; \/\/ normalize the normal\r\n mesh.vectors.points[i] = b; \/\/ bottom ring for side polygons\r\n mesh.vectors.points[i+sides] = t; \/\/ top ring for side polygons\r\n mesh.vectors.points[i+(sides*2)] = t; \/\/ top cap\r\n mesh.vectors.points[i+(sides*3)] = b; \/\/ bottom cap\r\n mesh.vectors.normals[i] = n; \/\/ side normals\r\n mesh.vertices[i] = { v: i, n: i }; \/\/ bottom ring vertex\r\n mesh.vertices[i+sides] = { v: i+sides, n: i }; \/\/ top ring vertex\r\n mesh.vertices[i+(sides*2)] = { v: i+(sides*2), n: sides }; \/\/ bottom cap vertex\r\n mesh.vertices[i+(sides*3)] = { v: i+(sides*3), n: sides+1 }; \/\/ bottom cap vertex\r\n mesh.polygons.push([(i+1) % sides, i, i+sides, ((i+1) % sides) + sides]); \/\/ side polygon\r\n bottom.push(i+(sides*2)); \/\/ bottom polygon\r\n top.push(i+(sides*3)); \/\/ top polygon\r\n}\r\n\r\nmesh.vectors.normals.push({ x:0.0, y:0.0, z:-1.0 }) \/\/ bottom normal\r\nmesh.vectors.normals.push({ x:0.0, y:0.0, z:1.0 }) \/\/ top normal\r\n\r\nmesh.polygons.push(bottom); \/\/ add the bottom polygon\r\nmesh.polygons.push(top); \/\/ add the top polygon\r\n\r\n\/\/ pass the mesh along to the appropriate command\r\nNRS_Commands.generate_mesh({name: name, mesh: mesh});\r\n<\/pre>\n<\/div><\/div>
\"Cylinder\"<\/p>\n

Cylinder generator script (Radius 3.5)<\/p>\n<\/div>\n

\"Procedural<\/p>\n

Cylinder from generator script (Radius 0.25)<\/p>\n<\/div>\n<\/div><\/div><\/div>\n

Numerical Renders<\/h3>\n

RealityServer has for some time included the Iray irradiance probes feature which lets you render an image containing irradiance (the amount of light arriving at a particular point) information for specific locations in the scene. While this all works well, the vast majority of the time when using this feature, rather than getting back an image your would ideally like to get back the actual values. We have now introduced a new special file format for the render command<\/a> called “array”. When you specify this format, instead of returning binary image data the render command modifies its return type and sends back an array of values.\u00a0 Irradiance probe renders are very quick,\u00a0\u00a0so you can potentially setup many reading planes in your scene and compute them all at once.<\/p>\n

\n

The format of these values will depend in your selection for canvas_pixel_type<\/em>, however to get back monochromatic irradiance values, you can specify “Float32” as your canvas_pixel_type. You will then get back a simple array of numbers.\u00a0This new functionality makes it especially straight forward to build cloud based lighting analysis tools using RealityServer. To the right is a simple plot of a grid of irradiance probes and their resulting irradiance values. This type of material can now be produced programmatically without resorting to re-reading image data or performing conversions. You get the numbers you need right out of the render call and you can code whatever data visualisation you like.<\/p>\n<\/div><\/div>

\"Irradiance<\/p>\n

Irradiance plot from numerical rendering<\/p>\n<\/div>\n

 <\/p>\n<\/div><\/div><\/div>\n

More on the Way<\/h3>\n

This initial release contains many bugfixes and improvements both in Iray and RealityServer itself. In particular several enhancements have been made to Iray memory handling which could help you if you were one of those who found yourself frequently running out of GPU memory or encountering other strange GPU related issues. Speed and quality enhancements have also been made in several places, however these can be quite scene specific so you may not notice this on all scenes. We also added a remove_render_context<\/a> command which can be useful if you need to programmatically release a render context you created. We are working on many other great enhancements for RealityServer 4.4 which we will roll out in incremental releases. We hope you find these new features useful, but as always be sure to contact us<\/a> if you have any ideas or questions.<\/p>\n","protected":false},"excerpt":{"rendered":"

We have just released RealityServer 4.4 which includes the new NVIDIA Iray 2016.0. We will periodically release updated versions as new improvements and Iray updates become available. We’ll cover some of the highlights of this release here but users are strongly encouraged to read both the RealityServer release notes (relnotes.txt) and the Iray releases notes […]<\/p>\n","protected":false},"author":2,"featured_media":1362,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"spay_email":"","jetpack_publicize_message":"RealityServer 4.4 with Iray 2016.0 now released","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[15],"tags":[16,14],"jetpack_featured_media_url":"https:\/\/www.migenius.com\/migenius\/wp-content\/uploads\/2016\/04\/realityserver-4-4-feature.jpg","_links":{"self":[{"href":"https:\/\/www.migenius.com\/wp-json\/wp\/v2\/posts\/1357"}],"collection":[{"href":"https:\/\/www.migenius.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.migenius.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.migenius.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.migenius.com\/wp-json\/wp\/v2\/comments?post=1357"}],"version-history":[{"count":21,"href":"https:\/\/www.migenius.com\/wp-json\/wp\/v2\/posts\/1357\/revisions"}],"predecessor-version":[{"id":1388,"href":"https:\/\/www.migenius.com\/wp-json\/wp\/v2\/posts\/1357\/revisions\/1388"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.migenius.com\/wp-json\/wp\/v2\/media\/1362"}],"wp:attachment":[{"href":"https:\/\/www.migenius.com\/wp-json\/wp\/v2\/media?parent=1357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.migenius.com\/wp-json\/wp\/v2\/categories?post=1357"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.migenius.com\/wp-json\/wp\/v2\/tags?post=1357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}