Real-Time Rendering : Dynamo to Unity


#1

I find real-time walkthroughs helpful at the concept development stage of a project. However, I don’t want to waste time preparing meshes for materials assignment at each iteration. The workflow from Dynamo to Unity seems to provide a reasonable solution. Exported meshes can have colliders, UV texture coordinates, normals and materials automatically assigned on import to the game engine – making for quick turnaround of design options.


The images are rendered with Realtime Lighting only – Mixed Lighting (baked global illumination) was avoided – in order to speed up turnaround. Unity’s automation of UV mapping provides good results in terms of scaling and minimizing distortion but seam positions are arbitrarily placed. However, the latter is not a major issue when texture patterns are relatively small in scale and consistent throughout – as are those for a lot of building materials.

The above is obviously just one of many options for achieving the desired result. I’d be interested to know how others have found the workflow from, say, Dynamo -> Unreal Engine 4 / Autodesk Stingray, or Dynamo -> Revit -> Enscape. It’s been a while since I played around with Revit’s materials editor but I found it real clunky and limited in comparison to games engine equivalents.


#2

Hi @RitchieJ,

Did you already find how to export from revit to Unity with Dynamo or do you want to know if somebody find a way to do it ?
If you know how to export which package do you use ?
I know several plugins to export to unity but no similar node.


#3

@Alban_de_Chasteigner I’m simply using the ‘Mesh.ExportMeshes’ node in the MeshToolkit package to interface with the games engine directly from Dynamo and am not using Revit as part of the pipeline.


#4

Could be great to see you actually outline the workflow on here. Traditionally, the “share” category involves people breaking down their workflow. Don’t get me wrong, the images are nice, but without some more substance, it is a bit misleading coming into this post.


#5

Thanks for posting this. Just last week a friend was recommending I check out Unity so this is timely indeed. Would you say Unity is easy to work with? And if I am understanding the post correctly, you are only exporting different meshes from Dynamo? Not like structural members or different family types?


#6

@John_Pierson I’m filing it under the ‘Works in Progress’ rather than the ‘small tutorials’ sub-category in ‘Share’ – as the prime intention is to get feedback on alternate and possibly better real-time strategies!

Regarding workflow, the Dynamo side comprises basic familiarity with the MeshToolkit package as noted in a previous reply. The rest is Unity oriented so don’t know if this forum is the correct place for that. However, I’d be happy to answer specific questions anyone might have.


#7

@PerfectArchCo ‘Unity easy to work with?’ Like Revit, it’s ‘easy’ but the learning curve’s steepness and length is entirely dependent on what you want to achieve. Yes, only exporting meshes - it’s relatively simple to send them to the game engine and get a walkthrough up and running quickly.

Rendering quality is proportional to the time you’re willing to invest. There’re plenty of good tutorials on Unity’s site – suggest you have a look at these to get a feel for the challenge.


#8

I won’t speak for everyone, but I would love to see whatever input you have on the topic. If Dynamo is in the workflow than I would argue that this is the right forum too… :slight_smile:


#9

As an alternative to the mesh toolkit, you can directly export the visible scene in dynamo to stl, which is supported by probably all of the gaming engines:
DynamoSandbox_2018-03-20_09-44-13

The only caveat with it is that everything comes out as one single object.


#10

@JacobSmall Well, I don’t want to rub salt in Autodesk’s ‘Stingray’ wound – they arrived rather late to the game engine party with that one – had the temerity to charge for it – and left rather early!
So I’ll keep it brief to allow for follow-up questions if anyone should be interested.

Dynamo:-

  1. Decide which elements for export will share a common material.
  2. Convert each unique grouping to a single object using the appropriate nodes, for example:-
    Surface (List) -> PolySurface.ByJoinedSurfaces -> Dynamo.Mesh.ByGeometry = one Mesh
    Surface (List) -> Dynamo.Mesh.ByGeometry (List) -> Python Mesh.Boolean Script = one Mesh
    (currently, the standard Mesh.Boolean node only takes two input meshes)
    NB: It is not a strict requirement to combine elements as above but it makes for far easier management of export/import and materials assignment, as well as providing better overall rendering performance, especially in the case of complex forms with a high poly-count.
  3. Create a sub-folder in Unity’s Asset directory and export the meshes using the appropriate path

Unity:-

  1. Select the imported files and in the Inspector/Model window ensure that Read/Write Enabled, Optimize Mesh, Generate Colliders, Generate Lightmap UVs and Normals -> Calculate are checked. In the Inspector/Materials window Import Materials can be unchecked as there are none accompanying the Dynamo exports.
  2. Place the objects in the Scene as required and assign appropriate materials.
  3. Create a C# script to copy the secondary UVs to the primary UVs slot and assign this script to each object.
  4. Hit ‘Play’ to set up the materials. Exit ‘Play’, revise materials and repeat until satisfied.
  5. Then the real fun begins with playing around with Realtime Lighting, Procedural Skyboxes, the Post-Processing Stack and so forth to achieve the required quality for the project in hand.

NB: The above is simply a quick overview and is not intended to be a comprehensive tutorial. Those familiar with Unity should have no trouble following it – the C# script is very basic to implement – and those who have not used the app will have to spend time on the general interface before using the workflow.


#11

@Dimitar_Venkov STL files are not directly supported by major games apps such as Unity, Unreal Engine or CryEngine– they would need to be converted first. The ProBuilder plugin for Unity does allow for export of STL files but I’m not sure if import is still supported after its recent integration with the main app – I can’t find that option in the editor.


#12

Would people use Unity as an alternative to REVIT’s rendering because it’s better or because the real-time lighting effects are useful? To me the advantage of the Unity engine is that it seems easier to get the high-quality results I’m looking for. But I can’t say I’m particularly good at 3D viz.


#13

@PerfectArchCo I personally favour Unity as I find it far more flexible with regard to the lighting, materials and rendering setup in general. Furthermore, I’m only interested in real-time output for rapid turnaround and don’t need features such as accurate ray-tracing which is still largely confined to an offline production mode.

If budget is not an issue and Revit, rather than Dynamo, is your primary production tool then it’s probably worth focussing on plugins/apps such as Enscape and Lumion to get good results quickly.


#14

@RitchieJ - do you have any experience with similar workflows around 3DS Max / Max Interactive?


#15

@JacobSmall I haven’t used 3DS Max in years. Whilst it’s a great package it’s superfluous to my needs. I tend to use Unity throughout a project’s development, taking it from conceptual blocking-out to final design. All materials assignment is done within that package, together with Allegorithmic’s Substance Designer on occasion. I only rely on an external app for modelling and precise UV mapping, when required. Blender fits the bill here on non-Dynamo projects. Unity’s ProBuilder plugin is a viable built-in modelling and UV tool when the geometry is not too complex.

Regarding Max Interactive, once again I’d opt for interfacing with VR directly from Unity when the hardware is sufficiently mainstream to entice me to take the plunge. When 4k res screens and wireless headsets are standard, I’m in. I don’t mind the ‘screen-door’ effect for conceptual work but it’s not particularly alluring in a presentation context.