meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
impue4 [2020/03/31 10:24] – external edit 127.0.0.1impue4 [2022/03/09 17:17] (current) croft
Line 1: Line 1:
-====== Importing Models into UE4 ======+====== Importing into Unreal Engine (Legacy) ======
  
-**NOTICE: These instructions are applicable for Unreal Engine 4.19.2. SpeedTree will not work with earlier versions of UE4.**+SpeedTrees are supported in the [[https://www.unrealengine.com/|Unreal Engine game engine]]. The .ST files exported by SpeedTree 9 can be imported with Unreal Engine 4.19.2 or later.
  
-When you save a model in the UE4 version of the Modeler (or use the compiler for custom licensees) you should have an ".st" file that represents your model.  This is the file you will import into the UE4 Editor.  The SpeedTree model will be imported into a normal static mesh object.  Click [[creating_models_for_ue4|here]] if you don't have an .st file. 
  
-Import the .st file as you would any other asset.  You may want to make a folder for your model to keep the resulting assets organized as pictured below.  Press "Import" to import your model. 
  
-{{ :ue4_import.jpg?nolink |}}+=====Pipeline to UE4/UE5=====
  
-Several options are presented during the import process. First is the choice between 3D geometry, billboards, or both. If a tree will only be used close-up, it is a “hero” tree, or you otherwise have trouble with the billboard as the lowest LOD (as is sometimes the case with dynamic shadows falling on the flat billboard geometry), you can choose to ignore the billboard mesh. Or, if a tree will only be used far away and you want to save loading the 3D geometry, you can only import the billboard. Just importing the billboard mesh also creates a static mesh that can be used with UE4's foliage layers+Before exporting a tree for UnrealEngine, be sure that your tree is set up for real-time use by using [[kcgameslod|LOD]]. Also ensure that wind is correctly set for UnrealEngine by setting the fan to [[windlegacy|Legacy UE4/Unity mode]] and tuning the wind effects, if necessary.
  
-In the import dialog, you can also choose to include detailspecular, and branch seam blending in the materials used on the 3D treeYou can also add vertex processing to the materials, which puts a special SpeedTree node into the material that can handle wind, billboarding, and other effects computed per-vertex on the tree+If this is the first time exporting to UEbe sure to pick one of the UE4 presets in the [[expgame|export mesh dialog]], to ensure all the export settings are correct for UEExport an .ST file to diskthen switch to UnrealEd and import the ST file there. The mesh and all textures should be found and imported into your UE4 project assets.
  
-Finally, you can import any collision primitives that were set up in the SpeedTree Modeler into collision information on the new SpeedTree mesh.+{{ ::ue4importer.png?direct&200|}} 
 +On import in UE, you will be presented with a few options, such as whether to include the [[collision_object|collision objects]] you have placed in the tree. The "LOD Setup" option allows you to select whether you wish to use SpeedTree-style LOD (with growing/shrinking geometry) on a static mesh actor, or UE4's crossfaded LOD which will also work on painted foliage
  
-{{ :ue4_import2.jpg?nolink |}}+It is recommended that you allow the importer to create materials for you, and tick the "Include Vertex Processing" option. This will create the materials for you and place the SpeedTree node into them with the correct settings for each draw call (based on the wind type and geometry type).
  
 +>**Note:** At this time only crossfaded LOD will work on painted foliage.
  
-Once the import process is complete you should have the following new assets (pictured below): 
  
-  * A static mesh that represents your model.  You can edit options on this asset like you would any other static mesh (e.g., LOD ranges, lightmap resolution, etc.).+=====Placement=====
  
-  * Texture assets for each atlas, billboard atlas, and tiling texture map on your model.+{{:ue4_tree_in_scene.jpg?400&direct }} 
 +Once you've imported the model as an asset you can place it in your scenes like you would any other static mesh. Simply drag the asset and drop it in the scene to place a model. Mark them as “static” to use them with Lightmass (you'll need a good [[kcgameslightmap|lightmap uv]]) or “moveable” to have them be dynamically lit and shadowed. 
 +<WRAP clear></WRAP>
  
-  * Material assets for each component (draw call) of the model.+{{:ue4_painted_grass.jpg?400&direct }} 
 +You can also paint the tree with a foliage layer. Drag the asset into foliage painting area and paint the SpeedTrees like any other static mesh. See [[https://docs.unrealengine.com/en-US/BuildingWorlds/Foliage/index.html|UE4's foliage tool documentation]] for more information. 
 +<WRAP clear></WRAP>
  
-{{ ::ue4_assets.jpg?nolink |}}+=====Wind=====
  
-The materials are of particular importance It is important to note that **you are completely free to edit the materials generated by the importer**.  These materials get the basics in place but can be improved and tailored to suit your scenes.+Wind behavior is tuned inside of the SpeedTree ModelerTo see the animation in UE4, you must add a WindDirectionalSource object. The “Speed” property controls the wind speed while the "Strength" property affects the blending of multiple sources together.
  
-The SpeedTree node connected to "World Position Offest" (pictured below) is the only SpeedTree specific component If you disconnect it everything rendered with that material will be identical to a static mesh.  With it connected you will get SpeedTree wind and smooth LOD transitions There are several options available on the SpeedTree node:+>**Note**: You'll probably want to turn down the speed since the default is 1.0 (high wind).
  
-  * **Geometry Type**.  This setting controls what type of geometry is rendered and is set automatically.  This value rarely needs to be edited.+=====LOD=====
  
-  * **Wind Type**.  This property controls the complexity/quality of the wind shader applied to the material.  This value matches what you set in the Modeler on import.  If vertex processing performance is an issuethis is a good way to reduce the vertex overhead on SpeedTree objects quickly.+Your [[kcgameslod|LOD behavior]] is set in the SpeedTree Modeler, but you can adjust when the LOD changes occur inside of UE4. LOD transitions are based on screen space areaand these values can be edited in the static mesh editor associated with the SpeedTree model. Default values are chosen upon import that work for typical situations
  
-  * **LOD Type**.  Use this to control whether SpeedTree models smoothly transition between LOD states or pop between them like standard static meshes.+=====Materials=====
  
-  * **Billboard Threshold**.  Billboards are modeled as a cluster of planes, each with a different billboard image applied.  Use this property to control how quickly each plane disappears based on its viewing angle.+{{ ::ue4material.png?direct&200|}}
  
 +The SpeedTree materials created by the importer get the basics in place but can be edited to improve and tailor them to suit your scenes.
  
-The "SpeedTree Color Variation" node (also pictured below) adds color variation to the material based on the model's position/orientation Use this to add subtle color change effects without adding multiple tree models.+The SpeedTree node connected to WorldPositionOffest is the only SpeedTree-specific component in the material. If you disconnect it, everything rendered with that material will be identical to a static mesh. With it connected you will get SpeedTree wind, camera-facing geometry, and smooth LOD transitions.  
 + 
 +There are several options available on the SpeedTree node. 
 + 
 +<WRAP clear></WRAP> 
 + 
 +| Geometry Type|This setting controls what type of geometry is rendered and is set automatically by the importerThis value rarely needs to be edited.| 
 +| Wind Type|This property controls the complexity/quality of the wind shader applied to the material. This value matches what you set in the Modeler. To optimize rendering, this value can always be dropped down from where it was when imported. If you wish to go up in quality, you will need to go back to the Modeler to re-tune that higher wind effect before exporting and re-importing.| 
 +| LOD Type|Use this to control whether SpeedTree models smoothly transition between LOD states or pop between them like standard static meshes.| 
 +| Billboard Threshold|This option is unused with ST files| 
 +| ExtraBendWS|To achieve additional bending effects on a tree, such as from explosions or player interactions, you can provide a Vector3 input giving the unnormalized direction you wish the tree to bend. It uses the same info about the tree as the shared/global bending to achieve this additional direction. | 
 + 
 + 
 +Billboard materials contain a few extra material functions that remove non-camera-facing polygons from the billboard mesh and adjust the normals to avoid seams in the billboard mesh. These can be opened up for editing, as well.
  
-{{ ::ue4_material.jpg?nolink |}}