Creating a Project Comparing the Editors
Total Page:16
File Type:pdf, Size:1020Kb
This guide provides an overview of the CRYENGINE V interface from the standpoint of a Unity user. It covers the basic differences between Unity and CRYENGINE V and discusses how to port existing Creating a Project assets to CRYENGINE V from Unity. Comparing the Editors Editors Side by Side Focus is made on using CRYENGINE V's C# support as this will be most similar and appropriate for Glossary Unity users, however much of the content in this guide also applies to C++ projects as well. Project Structure Importing your Meshes Converting Textures and Materials Substance Painter Exports Creating Materials Importing an Animated Character Importing into CRYENGINE V Importing the Animations Setting up Blendspaces Translating a Unity Blend Tree From Mecanim to Mannequin Developing User Interfaces Localization Porting C# Scripted Components From GameObjects to Entities In Unity, the Inspector Tab is used to edit selected assets in your project. In CRYENGINE V, Porting Unity's FixedUpdate the Properties Panel exposes properties of selected objects, while larger editing tasks are undertaken in Adding a Component the Perspective Window. Creating and Destroying Entities Destroying Entities Creating a Project Physics (Rigidbody to PhysicsEntity) CRYENGINE and Unity have similar concepts when considering a project. However, there are some Raytracing/Raycast subtle differences that you need to be aware of. From Prefabs to Schematyc Creating a Project In Unity you can run the game inside the Editor and then produce a build when you want to run the game Comparing the Editors standalone. In CRYENGINE the Editor (called the Sandbox Editor) is more of a lightweight wrapper Editors Side by Side around your game - this means that you can run your game in standalone mode during development. Glossary Project Structure Importing your Meshes Converting Textures and Materials Substance Painter Exports Creating Materials Importing an Animated Character Importing into CRYENGINE V Importing the Animations Setting up Blendspaces Translating a Unity Blend Tree From Mecanim to Mannequin Developing User Interfaces Localization Comparing the Editors Porting C# Scripted Components In CRYENGINE the Sandbox Editor (the equivalent to Unity’s editor) is already running a version of your From GameObjects to Entities game - this is started as soon as you load your level in CRYENGINE. However, it’s quite easy to use this Porting Unity's FixedUpdate in a similar way to the Scene/Game views in Unity. Using the Switch to Game-button (highlighted in Adding a Component orange below), CRYENGINE sends callbacks to your code to start/stop gameplay. This disables the Creating and Destroying additional widgets and free-roam camera that are enforced in the editing mode. CRYENGINE also has Entities the additional feature of being able to preview/debug physics simulation (without starting the game logic) Destroying Entities by using the buttons highlighted in purple below. Physics (Rigidbody to PhysicsEntity) Raytracing/Raycast From Prefabs to Schematyc Editors Side by Side Below are images of the Unity Editor (left-hand image) and the CRYENGINE Sandbox Editor (right-hand image). Each is color-coded to show what each section is used for. As in Unity, the Sandbox Editor is fully customizable by dragging and dropping tabs into different parts of the Sandbox Editor window. Confidential. © 2009-2015 Crytek GmbH. All Rights Reserved. Page 1 of 39 In Unity, game objects can have multiple Components that are displayed in the Inspector (right-hand panel of the Unity Editor). Similarly, CRYENGINE has the Properties Panel that provides the same functionality of being able to add and remove Components from entities, as well as being able to modify their properties. Glossary Unity CRYENGINE V Editor Sandbox Editor Component Component GameObject Entity Prefab Schematyc Entity Hierarchy Panel Level Explorer Inspector Properties Panel Project Browser Asset Browser Scene Level Scene View Perspective Static Mesh Brush Skinned Mesh Character Material Material Particle Effect Particle Effect UI Scaleform Mecanim Mannequin Blend Tree Blendspace Rigidbody/Character Controller Entity Physics Project Structure As with Unity projects, CRYENGINE projects exist in their own directory. Additionally, CRYENGINE projects have a project file that defines certain properties of the project. You can double click on this file to load the Sandbox Editor, or right click it for additional options. CRYENGINE is very liberal about how you structure your project, however there are general conventions that are commonly followed as illustrated in the image below. By default the C# code for the templates is located in the Code folder. A solution for this code can be generated by right-clicking on the Game.cryproject file and selecting Generate Solution. The solution file will be in the Code folder and can be opened with Visual Studio 2017 providing the CRYENGINE extension is installed. It's also possible to have C# scripts in the Assets folder. These will show up in the Asset Browser of the Sandbox Editor and can be opened from there. Confidential. © 2009-2015 Crytek GmbH. All Rights Reserved. Page 2 of 39 Importing your Meshes CRYENGINE uses its own file format, Crytek Geometry Format (CGF) for reading meshes. There are two main methods used to convert your meshes into this format: 1. The FBX importer can be used to drag and drop your FBX files directly from Unity into your CRYENGINE project. 2. If you are a 3DS Max user, the provided plugin can be used to export a CGF directly from 3DS Max. Option 1: Using the FBX Importer The FBX Importer allows FBX, DXF, DAE, OBJ and 3DS Max files to be dropped directly into your project’ s Asset folder and produces a usable CGF file. For more information about this system see here. Option 2: Using the 3DS Max Plugin Once you have a mesh that is ready to export from 3DS Max, then create a ‘dummy’ from the panel on the right hand side of 3DS Max (as shown below). Place it where you would like the pivot point of your mesh to be and name the dummy what you would like your mesh to be exported as. Quick Tip: If you already have your pivot point set on your mesh press Shift+A, then click your mesh to quickly align the dummy object. Next open the Schematyc View from the icon shown below and link the mesh to the dummy using the link tool - this will make the mesh a child of the dummy node. As for physics in CRYENGINE, then you can create a proxy mesh for collisions. This is defined by the shape and the material that is applied to the proxy that you create. For more information about this system see here. In the example used here a simple proxy has been created - it has been made a child of the mesh (not a dummy), assigned the correct material ID and checked the links in schematyc view. Below is the final setup (the red box being the Proxy Mesh for collisions). Confidential. © 2009-2015 Crytek GmbH. All Rights Reserved. Page 3 of 39 Now that we have everything setup, we can use the CRYENGINE Exporter to export the geometry. In the Exporter tick “Export File Per Node” to create a different CGF file for each file in the export list. If you have changed the normal of the mesh, then also tick “Custom Normals” and if you aren’t using them re member to untick “Vertex Colours”. Finally, after exporting navigate to where your 3DS Max file is on the file system and you will find that the CGF file has been created. Converting Textures and Materials CRYENGINE comes with a Resource Compiler (RC) tool that is used to appropriately compress textures for their given use. One common use of this compiler is through a tool integrated into Photoshop that simply gets your textures CRYENGINE ready. Note: CRYENGINE uses a Spec/Gloss workflow. If you are using a Metal/Spec workflow then you will need to convert or re-create your metalness map. A good resource in regard to best practices for doing this can be found here. For each map then CRYENGINE looks for different file name endings to determine the type of map it is. File Name File Ending Map Type YourTextureName_diff _diff Diffuse YourTextureName_ddna _ddna Normal map, Gloss in Alpha YourTextureName_spec _spec Specular YourTextureName_displ _displ Displacement When saving textures out of Photoshop as a CryTif with the correct file extension, then the RC should bring up the correct settings as seen below. On this screen you have the option for setting the resolution and how things are compressed. If you don’t see your preset, then press the "list all presets" button to make them appear in the list. Confidential. © 2009-2015 Crytek GmbH. All Rights Reserved. Page 4 of 39 Substance Painter Exports Substance Painter provides you with the ability to combine textures before the export - so it’s easier to run through the RC. Saving out as a PSD file type gives you the ability to load up the PSD and Save out CryTifs efficiently. Creating Materials You can create materials in 3DS Max or directly in CRYENGINE. A quick way to make materials is to just duplicate an existing material in Windows Explorer. Materials work just like Multi-Materials in 3DS Max. For each different Material ID you need a corresponding material. After you have taken your textures from Unity (and ran them through the RC in Photoshop to create your CryTifs), you can combine them to create your materials. Importing an Animated Character Exporting from Maya Before you start - your skinned mesh must be skinned with Dual Quaternions (DQ's) and not Classic Linear. CRYENGINE works with DQ's, so even if you skin in classic linear, CRYENGINE will treat it as a DQ when it's imported (your skin won’t deform the way you see it in Maya).