Sunday, 25 May 2014

Prototype - Sci Fi Environment Import

It's time to import Sci Fi Environment to the UE4. As far I can know Manufactura K4 is working to ship this package to Unreal Engine 4 Marketplace when it will be live. However you don't need to wait because this pack works great in UE4 imported from Unity.

Steps to import assets to UE4:

  1. Chose which type you will pick: PC or Mobile I'm using Mobile version because of lower poly count and one atlas texture for everything. PC version is more advanced and have more materials IDs to use which can be useful creating more detailed environment.

    Download chosen pack and import it to Unity.
  2. You will need .FBX files and textures. Use Project window to navigate.

    If you don't know where your assets are use Show In Explorer
  3. Convert .tif textures to 32bit .TGA. You can use Photoshop or InfranView to do that. UE4 can't import .tif files.
  4. Open UE4 - create new project using TP_FirstPersonBP.

    We will be using First Person Blueprint Template
  5. Create new main folder for your SCI-FI pack. Name it whatever you like for example "SF_PACK"
  6. In SF_PACK create another folders: Textures, Materials, Props, Architecture.
  7. Import all .tga files (.tif's which you convert earlier) textures to SF_PACK/Textures folder. UE4 will take care for normalmap compression.
     
  8. Import all .fbx files to SF_PACK/Architecture. Select all FBX files and Import All. Make sure you don't have Combine Mesh option turned on. When importing from Unity it's always better to import everything without combining assets.

    It should look like that.
  9. Move Barrels, Crates, Cables, Core, LCDs, Lights, Pipes, Pylons, Wents models to SF_PACK/Props folder. So you will have scene architecture in one place and props in another. Easier to navigate later on.
  10. Generate Lightmap UV on meshes.

    - In this step you will need to open every mesh and do the same everywhere,
    - Open mesh,
    - Chose Window and enable Generate Unique UV window,

    We are in mesh view window -> double click on mesh to open it.

    - In new window leave everything default and Apply. Make sure you are creating new UV to new Channel - for SCI-FI Pack assets it's Channel 1 - it should be default when generating.


    You can work with variables here if you see glitches on your lightmap.
    - In the Search tab find Coordinate and change it from 0 to 1. It will be using our new UV channel for Lightmap.


    Remember to change LightMap Coordinate
    UE4 is baking lighting information and normalmaps into this UV. If you see that your object is black or weird after building lights then you haven't created lightmap UV and changed coordinates. Basically you should create your own UV for lightmaps to have better quality but it isn't necessary.

    - You will see that your meshes are small when you put them to the scene. That's because of Unity is using different metrics system than UE3.
    You need to scale mesh up by 10.





  11. Enable Collisions on Meshes.
    - In this step you will need to open every mesh and do the same everywhere,
    - Open Mesh,
    - Search for Collision,
    - Chose Use Complex Collision As Simple


    This means that UE4 will use Per Poly collision which isn't cheap but I've found that it's causing really small performance drop. Not visible for me.

    You can generate your Collisions using Collision Window (after that you need to select Use Simple Collision As Complex in Collision) or you can create your own collisions in 3d program and import it with the mesh. 



  12. (PC SCI-FI PACK ONLY) Create master material.
    - In Materials folder create Material - name it how you like it will be master material for all other architecture materials,
    - Create Constant variable parameter for Metallic and Roughness - name it how you like,


    - Create Texture Sample parameter for Base Color and Normal,

    You will use parameters a lot. Try to read about Layers as well 
    - All others materials will be instanced from this. Thanks to that you will be able to globally change roughness and metallic which is critical.

    Create Material Instance using selected Material
    - Create materials for all of the diffuse textures that you have. Name it the same as diffuse texture - it will be easier to assign material into the mesh as Unity project will be reference.


  13. (PC SCI-FI PACK ONLY) Assigning materials into your meshes. It's hard because material IDs will be changed.

    I've done this watching which material (texture) is used in Unity, and highlight it in Unreal. Lot's of clicking but can be done.

    Place prefab into your scene. Change Color to find out where material is assigned. 
    And then in Unreal search for the same material by Highlighting materials ID.


  14. (MOBILE SCI-FI PACK ONLY - which I'm using) create materials.
    - Find Atlas_sf texture, right click on it and chose Create Material,
    - Open Created Material and move normalmap Atlas_sf_nmp to your Normal channel,
    - Create Constant variable for Metallic and Roughness. I've found Metalic = 1 and Roughness = 0.6 is looking good but you can try by yourself.
    - Find Atlas_sf_alpha texture and create material from it. Place normalmap as well,
    - Atlas_sf_alpha material need to be Masked and need to have opacity.

    Masked materials have 1 bit alpha
    - Find core_glow_1 texture and create material from it. We will be animating this material. Take a look at the screen and try to do the same. Panner have X speed set to 1. Check out properties of the material as well it need to be masked and opacity mask clip is set to 0.001. We are multiplying emissive to get more bloom.

    You will use Panner a lot.
    - Do the same with other glow textures. 
That's all. Now you need to assign your materials to your meshes and you are ready to go! This is only the basic part of the material we will be creating some effect later on.

In next post we will create our prototype scene from imported assets.