-
-
Notifications
You must be signed in to change notification settings - Fork 2
Stages_gStageEditor
To install the gStageEditor package you have to download it from here https://github.com/gRally/gStageEditor/releases
After that, open the Unity3d project and go to Assets ->Import Package ->Custom Package.. and choose the downloaded file :
Make sure to have all the items checked and click Import.
Now you have a new folder called gStageEditor into your Assets folder:
After the installation the first thing to do is to prepare the requisities to define a stage;
To do this, simply go to the gRally menu:
Click on:
- Create layers
- Create default stage data
-
Create temp, stage and layout0 scenes
About the 4th command, at the moment it's not necessary and it will be used when you'll want to add a stage layout, for example to create a reverse path or to extend/cut the stage. When you'll complete the first layout and you're ok with everything, you can add a new layout with that command and redo all the layout configuration steps you'll doing now.
The layers you created are useful to define particular functionalities to the gameobjects set with a specific layer. For example, if you create an object to collide with, you have to select the object, go to the Layers properties and choose "COLLISION"
The default stage data contains some info about the stage, like the latitude, longitude and the default surface library;
The "Create temp, stage and layout0 scenes" creates and populates the 3 basic scenes needed to have a working stage for gRally;
Now you have 3 scenes in the Hierarchy, you just need to add the 3d stuff into these scenes;
- temp scene: First thing to remember is that this scene will not be exported. As default, you'll find here a Main Camera, a Directiona Light and some GameObject needed to place the cameras around the stage;
- stage scene: This is the 'hero' scene, it must contain all the 3d things used as base for all the layouts of the stage, in other words all the elements shared by all the layouts. In this scene you'll place all the 3d meshes about roads, trees, objects, terrains and so on.
- layout0 scene: The stage needs at least one layout (you can add some other layouts from the menu). Every layout contains the path of the layout, the camera info, and all the 3d that is only needed in this specific layout, for example, the marshalls zone at the start of the stage, must be placed here, 'cause in the hypothetical layout1 (reverse of layout0) the marshalls zone will be in another place.
Helping you to understand the whole process, we thought to provide you a FBX file with a simple 1km long stage. This file is downloadable here
Now go to your empty project. Go to the "Assets" folder, select it, right click and select Create, then Folder. Name it "Meshes". Open the "1km.zip" file and extract the FBX inside the "Meshes" folder. Your project should be something like this
Now add the "1km" prefab that you have in the "Meshes" folder inside the "stage" scene. Using drag&drop into the "stage" scene in the Hierarchy panel , it uses the original position of the object you're adding. Otherwise, Unity3d will use the center of the cam view as pivot origin. If this happens, we suggest to put the "1km" gameobject to the world origin.
As you can see in the Hierarchy panel I have 3 gameobjects inside the "stage" scene:
- "1km" is the reference to the FBX file
- "grass001" and "road" are referring to the 2 objects inside that file.
Now you must set two different properties of these geometries to say to gRally that those geometries have physical attributes and they must be used for the simulation.
To do this you have to select the 2 gameobjects "grass001" and "road" .
Then go to the "inspector" panel and look to the top right of this panel.
Here you have : Static and Layer.
Set Static "unchecked" and where there is the property Layer, click on the dropdown menu and select "COLLISION".
For all the other gameobjects that are not related with the simulation, you can enable the Static property.
Now you have to add two physical materials: a grass material and an asphalt one. As you did before with geometries, you add a "Materials" folder. Select the "Assets" folder, right click and select Create, then Folder. Name it "Materials".
After that, you can create there the 2 materials. Select "Materials" folder, right click and select Create, then Material. Name it "grass". Now the material created has the default Unity3d standard material based on the standard shader (it's a PBR shader with a metallic workflow). You need to change it with a gRally physical material.
With the material selected, go to the "inspector".
Just below the name of the material you have a "Shader" property.
Click on the dropdown menu and navigate to "gRally" and select "PhysRoad v2"
Now the material should looks like this
Before adding the textures, a brief explanation of the material properties:
-
Albedo (with Smoothness Map) Put here a texture file with Albedo in the RGB channels and Smoothness in the Alpha channel.
-
Normal map Put here the Normal map. Pay attention that the normal map is set as "normal map" in the texture file properties. To check this, select the normal map file, go to the "inspector" and set the "Texture type" as "Normal Map".
-
(R)Spec-(G)Transparency-(B)AO-(A)WetMap Put here a texture file with these maps as single channels:
- R channel for the Specular Map
- G channel for Transparency
- B channel for Ambient Occlusion
- Alpha channel for the WetMap. Wetmap for us is a map similar to an height map where the "deepest" part of the texture starts to collect more water when it rains. Take care that the deepest pixel are bright.
-
Tiling Main Textures Here you can set the UV tiling multiplier
-
Offset Main Textures Here you can set the UV Offset
-
Tiling Multipliers for far textures Here you can set a different UV map for far main textures reducing the tiling effect.
-
Transition distance (in meters) Here you can set the distance from the camera to start using the multiplied UV tiliing for far textures
-
Transition falloff Here you can set how strong or weak is the transition between the near main textures and the far ones.
-
Mask clip value Here you can set how strong is the clipping of the transparency
-
_GR_displacement Here you can set the vertex displacement. Leave at 0. You'll be able to check the vertex displacement later using the PhysDebug gameobject.
-
Use Groove Tex Here you can choose if you want to use a Groove map.
-
Groove map Put here the Groove map
-
Use Puddles Texture Here you can choose if you want to use a puddles texture map. For every puddles texture file you can set up to 4 different puddles textures using the 4 RGBA channels.
-
Puddles Texture Put here the puddles texture.
-
Puddles Size Here you can set the size of the puddles textures.
-
Physical Texture Put here the Phys texture. This texture define the type of simulated material. Before create your first phys texture, we suggest to create a folder where put all the phys textures to keep organized the project (it will become early really crowded :) ). To do it, right click in the "Assets" folder of your Project window.
Now duplicate (CTRL+D) the sample we provide
and put it inside the folder you created and change its name.
Now, put into the phys material.
Assign the material to the geometry.
To do this you can drag&drop the material over the mesh.
The Phys Texture Editor will list only assigned phys materials.
Now we want to change the sample phyx texture and assign the "grass" material properties.
Go to the gRally menu and select as below:
It will be open a new window with the phys texture editor.
The buttons are quite self-explaining, so just few words on it. Prev and Next is used to navigate trough the Phys materials assigned to the scenes objects. Next to Next button there is the number of material you're modifying and its name. The "opacity" controls the phys texture opacity over the Albedo. The dropdown on the right is used to define which material (and its grip properties) are painted on the phys texture.
The painting works like this: The image is divided by 16 columns and 16 rows. So we have 256 cells and every cell has a kind of coordinate (column by row number) and it could be painted with a unique grip value. In this way you can create grip variations inside the physical texture.
In our example we want to create a grass phys texture with all the cells that share one kind of grass material grip value.
To do this, press the All X and All Y buttons.
Go to the dropdown menu (where you see "tarmac max grip" ) and select "grass med grip".
Then press the Paint button.
It should become like this
When you are satisfied, press Save button.
Now the material has the green grass phys texture.
By default gStageEditor
has some preconfigured material: you can add/edit all the material types, to have, for example, more tarmac on a tarmac stage or more gravel
types on gravel stages: the default color/values (shown ingame when you press F1):
Color | Type | usable Grip |
---|---|---|
Tarmac max grip | 1.0 | |
Tarmac med grip | 0.5 | |
Tarmac min grip | 0.0 | |
Gravel max grip | 1.0 | |
Gravel med grip | 0.5 | |
Gravel min grip | 0.0 | |
Dirt max grip | 1.0 | |
Dirt med grip | 0.5 | |
Dirt min grip | 0.0 | |
Grass max grip | 1.0 | |
Grass med grip | 0.5 | |
Grass min grip | 0.0 | |
Snow max grip | 1.0 | |
Snow med grip | 0.5 | |
Snow min grip | 0.0 | |
Ice max grip | 1.0 | |
Ice med grip | 0.5 | |
Ice min grip | 0.0 |
Now add the other graphical textures.
The sample textures are available here.
Download them and extract them inside the "textures" folder under the Assets folder.
After this, drag&drop the right textures inside the material texture slots as shown below.
Ok. Now you can repeat this for the road material.
At the end it should be like this.
Good.
Now our "beautiful" 😊 special stage is quite complete.
It remains to add the information gRally needs to understand how to drive on it.
To do this you need to create a layout.
In the Layout page we'll show how to do it. Go to https://github.com/gRally/dev/wiki/Stages_gStageEditor_Layout
© gRally.net 2018