<<

First Person BIM Revit® and CryEngine 3

Jeffrey A. Pinheiro, LEED AP www.BIMAfterDark.com

First Person BIM: Revit and CryEngine 3 1

® Revit and CryEngine 3: First Person BIM

Introduction My interest in the overlap of technology and architecture influences every aspect of my life. Virtually interacting with architecture, even before it is constructed, is the next step in architectural visualization, presentation, and technology. I believe that platforms (such as CryEngine 3) are a perfect bridging medium for virtual interaction with architecture. Taking a building information model into a lightweight, highly detailed, and intuitive graphics gaming engine will allow users to interact with their buildings in a very unique way as well as creating a photo‐realistic representation of the building.

Imagine walking into a conference room full of men and women in business attire who are awaiting your pitch for their new office building. Now, imagine after a day full of architects and engineers, just like yourself, presenting PowerPoint's and foam core mounted presentations you hand them an X‐Box (or Playstation) controller. The client now has the ability to interact with what are normally a few strategically placed still renderings or fixed path animations. Furthermore, they can interact using a controller or interface I guarantee a high percentage of them know how to use.

In this e‐Book you will learn how to:

1. Prepare your Revit model for use with 3DS Max 2013 and CryEngine. 2. Properly import your Revit model into 3DS Max 2013. 3. Prepare your 3DS Max model for CryEngine. 4. Applying Materials (Two Options). 5. Export your 3DS Max model. 6. Utilize your model within CryEngine.

The file I will be using for this e‐book is the famous Revit Architecture Sample House. It will most likely be located in your Revit install directory within the "Samples" folder. My file was found here:

First Person BIM: Revit and CryEngine 3 2

"C:\Program Files\Autodesk\Revit 2013\Program\Samples\ rac_basic_sample_project.rvt"

Additionally, I am going to assume you have downloaded, read, and followed the install instructions for both CryEngine and the CryEngine tools for 3D Studio Max 2013 (see "Resources" section at the end of this e‐book for URL's.

Prepare you Revit Model for Use with 3DS Max 2013 and CryEngine Unfortunately, there is no direct exporter from Revit into CryEngine. There is an FBX importer (see "Resources" at the end of this e‐book) that has been tossed around the forums but it only allows single elements from Revit to be imported. For example, if you wanted to import a curtain wall system you would have to export each individual mullion to their own FBX files, import them into CryEngine, and rebuild them inside the engine. That is definitely not a process worth utilizing.

Fortunately, the connection between Revit and 3DS Max has been greatly improved for the 2013 (or later) releases of the software. Whether using the suite workflow options or linking options 3DS Max becomes simply an extension of Revit. The method I will illustrate in this e‐book is the linking method in the assumption that not everyone has the access to Autodesk's Suite Workflow.

Before we can link our Revit file into 3DS Max there are some important things to keep in mind when preparing the Revit file:

Remove as Many Warnings as Possible A warning inside of Revit will usually have something to do with bad modeling practices. Although some of the warning may have no effect on the downstream use of the model some of them will. Try to remove most of the warning before linking into 3DS Max.

Pay Careful Attention to Your Materials When we import the Revit Model into 3DS Max we will be combining the elements by Material. This will help us not only export the model elements for use with CryEngine but make applying materials much more simple. Therefore, understand that whatever material name you give an element (or series of elements) inside of Revit will be its object definition inside of 3DS Max and CryEngine. For example, if all of your walls are Generic 8" walls they will be brought into 3DS Max as a single object called "Default Wall". Additionally, if you want some of those walls to be different materials within CryEngine then they must have a different material within Revit.

Remove Your Topography The terrain tool inside of CryEngine is eons better than the Topography tool inside of Revit. You will not be using any of the building pads, topography, trees, entourage, or split surfaces from your Revit model. I suggest deleting them completely from your Revit model. If you plan on using the Revit model and topography later then create a dedicated 3‐D view for CryEngine/3DS Max and hide all of the topography and site components.

First Person BIM: Revit and CryEngine 3 3

Properly import your Revit model into 3DS Max 2013

1. Launch 3D Studio Max 2013 (or later). 2. Before importing your Revit model set the units of the Max project to Centimeters. Select "Customize" on the tool bar and click "Unit Setup...". (Figure 1) 3. In the "Display Unit Scale" area of the Units Setup dialogue select "Metric" and "Centimeters" in the pull down menu. (Figure 2) Click "OK" to finish.

Figure 1

Figure 2

4. It is now time to import your Revit model. Click the application button (the 3D Studio Max logo to the top left of your screen). Select the arrow to the right of "Import" and select the "Link Revit" option. (Figure 3)

First Person BIM: Revit and CryEngine 3 4

Figure 3

5. The "Manage Links" window will now appear. Click "File..." and browse for your Revit file. Before clicking "Attach this file" navigate to the "Presets" tab. (Figure 4).

Figure 4

First Person BIM: Revit and CryEngine 3 5

6. In the "Named Presets" window select the preset titled "Autodesk Revit ‐ Combine by Revit Material". Now, select the "Modify" button. (Figure 5).

Figure 5

7. Uncheck all of the boxes within the "Objects" area and check all of the boxes in the "Materials" area as shown below. (Figure 6).

First Person BIM: Revit and CryEngine 3 6

Figure 6

8. Click "Save" and return to the "Attach" tab of the "Manage Links" window. Select "Attach this file" (Figure 7).

First Person BIM: Revit and CryEngine 3 7

Figure 7

9. You should now see your Revit model in all four viewports of 3DS Max similar to Figure 8, below.

Figure 8

First Person BIM: Revit and CryEngine 3 8

Prepare your 3DS Max model for CryEngine

The Revit model is now imported into your 3DS Max file. First, save the 3DS Max File. It will make your life and CryEngine's life much easier if you save the 3DS Max file to your specified "Objects" directory inside of the CryEngine folder. For example, I saved mine to this location (I created the folder called "Mastering Tutorial"...

"C:\Users\Jeffrey A. Pinheiro\Desktop\CryEngine_3.4.3.5047\Game\Objects\Mastering Tutorial"

The following section will demonstrate how to take your Revit geometry that is now imported into 3DS Max and prepare it for use within CryEngine.

1. When there is a lot of objects in a scene I like to isolate the geometry I am working with. 3DS Max has an isolate selection object similar to Revit. Select the object you would like to isolate. For this tutorial I am going to use the "Glass" object. (Tip: Press the "H" key to see a list of all active object in a 3DS Max scene and highlight the object(s) you would like to select). Once you have selected the object called "Glass" right lick and select "Isolate Selection (Figure 9).

Figure 9

First Person BIM: Revit and CryEngine 3 9

2. The glass should now be isolated and the only element visible. Select the glass. Hit the "Modify" tab on the "Command Panel" (See Figure 10 below). Now, pull down the "Modifier List" and select "Edit Poly". (Figure 10).

Figure 10

3. Your glass object is now an Editable Poly. This is important because we need to select the faces of the object and assign them a Material ID. Activate the "Polygon" option in the "Selection" panel (Figure 11).

First Person BIM: Revit and CryEngine 3 10

Figure 11

4. Now, hit "Ctrl + A" on your keyboard to select all of the faces in view. Navigate to the "Polygon: Material IDs" section within the Command Bar to the right. Type a "1" in the "Set ID:" textbox (Figure 12).

Figure 12

5. Deselect the Polygon option you selected during Step 3. Now the Glass object should be selected instead of its polygons. Right click the object and navigate to the "Clone" command. (Figure 13).

First Person BIM: Revit and CryEngine 3 11

Figure 13

6. Select the "Copy" option in the "Object" area (Figure 14). You can rename the new object if you like. I named the new object "Glass ‐ Proxy" because it will represent the physics proxy object within CryEngine. A physics proxy is the geometry used for collision detection in a video .

Figure 14

First Person BIM: Revit and CryEngine 3 12

7. Finally, repeat steps 3 and 4 with the new "Glass ‐ Proxy" object with the exception of setting it's material ID to "2" (Figure 15).

Figure 15

Well, that was fun, huh? I'm sorry to inform you that this must be done for every single object you plan to import into CryEngine (which would most likely be the whole building)! For the sample file we are using you would have to repeat the aforementioned 7 steps 50 times! The very first time I took on the task of importing a Revit model into CryEngine I repeated those 7 steps 63 times. Fortunately for you, I taught myself how to create a MaxScript.

In the following location you can download a MaxScript that will perform the previous 7 steps for you. Additionally, if you select all of the objects in your scene and run the MaxScript it will perform the last 7 steps for each object. You're welcome. https://docs.google.com/folder/d/0B22tb0XxveQ8RE1kRlF2N3hrSEU/edit

Applying Materials (Two Options)

We now have two objects, "Glass" and "Glass ‐ Proxy", that we turned into Editable Poly's. We also assigned the polygon faces of "Glass" with a Material ID of "1" and the polygon faces of "Glass ‐ Proxy" with a Material ID of "2". The last step before exporting is applying a materials to the two objects.

1. Select the two glass objects. Press "M" on the keyboard to open the Material Editor. In the Material Editor we are going to the "Modes" toolbar and select "Compact Material Editor..." (Figure 16).

Figure 16

First Person BIM: Revit and CryEngine 3 13

2. Now, select one of the grey spheres in the materials bin and change its name to something like "CryEngine Material". Press the button with the word "Standard" and a Material/Map browser will appear (Figure 17). Select "Multi/Sub‐Object" and click "OK".|

Figure 17

3. Select the button that reads "Set Number" (Figure 18). Set the number of sub‐materials to "2". (Figure 19).

First Person BIM: Revit and CryEngine 3 14

Figure 18

Figure 19

4. Name the first sub‐materials "Material" and the second "Proxy". Select the Sub‐Material button for your first Sub‐Material. (Figure 20). Select "Standard" in the browser and press "OK".

First Person BIM: Revit and CryEngine 3 15

Figure 20

5. Under the "Shader Basic Parameters" menu select the drop‐down that reads "Blinn" and select "CryTek Shader" (Figure 21). Again, the CryTek shader will only be there if you have installed the CryEngine tools. I have provided links and information on how to install the tools at the end of the e‐book.

Figure 21

First Person BIM: Revit and CryEngine 3 16

6. Return to the Material by pressing the "Go to Parent" button. (Figure 22). Repeat steps 4 and 5 for the "Proxy" sub‐material but before returning to the parent material check the "Physicalize" box under "Crytek Shader Basic Parameters" and set it to "Physical Proxy (NoDraw)" (Figure 23).

Figure 22

Figure 23

7. Finally, apply this material to all of the object you have previous converted to editable polys and prepared for export. If you plan on solely using CryEngine to manage the materials of your model then this step is very simple. Select all of your object in the scene and hit the "Assign Material to Selection" button (Figure 24). Because we set the material IDs of the original and clone objects to "1" and "2" the original object will be the object to handle the material in CryEngine and the cloned object will be its physics proxy. If you wish to control the materials through 3DS Max I added a link to the "Resources" section at the end of this e‐book.

First Person BIM: Revit and CryEngine 3 17

Figure 24

Export your 3DS Max model

The final step you must take before moving out of 3DS Max and into CryEngine is exporting your model elements to a "*.cfg" file (CryEngine Geometry).

1. Select the object you would like to export and it's cloned proxy. For example, select the "Glass" and the "Glass ‐ Proxy" objects. Find the Utilities tab on the Command Bar and click "More". (Figure 25). Select the "CryENGINE3 Exporter".

Figure 25

2. In the "Geometry Export" area click the "Add Selected" button (Figure 26). Check the box that says "Custom Filename:" and the browse button. It is very important to make sure you save your geometry in the same ...Game\Objects\... folder as your 3DS Max File.

First Person BIM: Revit and CryEngine 3 18

Figure 26

3. Finally, click "Export Nodes" (Figure 27).

Figure 27

Repeat steps 1 to 3 for each of the building elements you wish to import. Unfortunately, I have yet to create or discover a way to do this with MaxScript. Feel free to email me if you can figure it out!

First Person BIM: Revit and CryEngine 3 19

Utilize your model within CryEngine

Our geometry is finally inside of CryEngine and read y to be used! Open up CryEngine and Login to your account. Start a new and create some land (again, refer to the "Resources"). Navigate to the RollupBar on the right hand side of your CryEngine Editor (Figure 28). Select the "Brush" tool (Figure 28). If you do not see the folder you created in the ...\Game\Objects\... location hit the "Reload" button on the bottom of the RollupBar (Figure 28). If you expand your folder you should see all of the geometry you exported from 3DS Max (Figure 29).

Figure 28 Figure 29

First Person BIM: Revit and CryEngine 3 20

Drag and drop the objects into your scene and begin building your house piece by piece (Figure 30). If the objects do not import to scale then simply scaled them up by a factor of "31". To do this select the object in CryEngine, press the number "3" on your keyboard and type in the scale factor in the bottom left of your screen for the X, Y, and Z coordinates. I have no idea why 31 happens to be the number but it has been the correct number for three projects so far. I would venture to say it has something to do with a conversion from feet to meters.

Figure 30

It may seem a bit crazy to rebuild the model within CryEngine and there must be a better way! Fortunately, through complex multi/sub‐materials and utilizing other aspects of the CryEngine Exporter tool within 3DS Max you can bring in the model all at once and still be able to control it's appearance. Unfortunately, the time it takes to set up those materials, sub‐materials, and exports exceeds the time it takes to simply move the geometry and re‐align it in CryEngine.

After aligning my geometry and adding some rudimentary CryEngine materials I now have a fully interactive and photorealistic virtual building (with some awesome vegetation). (Figures 31 & 32)

First Person BIM: Revit and CryEngine 3 21

Figure 31

Figure 32

First Person BIM: Revit and CryEngine 3 22

Resources

Here are the list of resources I mentioned throughout this e‐book that will help you along the way. If you have followed this e‐book I hope you don't stop here. Take what you have learned and expand on it. The possibilities are endless...

The Revit Kid.com! My website with lots of information, tutorials, and updates...

http://www.TheRevitKid.com/

Register and Download CryEngine 3 Free SDK: Scroll down to the bottom of the page for sample assets as well...

http://www.crydev.net/dm_eds/download_detail.php?id=4

How to Install the CryEngine Tools into 3DS Max This page talks about installing the 3DS Max Tools as well as creating materials inside of 3DS Max and linking them to CryEngine (with a really helpful sample file).

http://freesdk.crydev.net/display/SDKDOC3/3ds+Max

CryDev.Net Forums This is the official developers community for CryEngine. When you register to download the SDK you become a member of this forum. USE THE FORUM. It is absolutely priceless.

http://www.crydev.net/

Cyber Game Arts Tutorials This is just one of the many YouTube playlists with CryEngine 3 tutorials. Start here and search around. You will most likely find what you are looking for out there somewhere.

http://www.youtube.com/playlist?list=PLFD00C571688BB20D