top of page
Search
Writer's pictureychen3129

UE4 Car Configurator Devlopment Diary

Updated: Apr 27, 2021

To make a Car configurator, we need a car

I decide to purchase a model from CG trader.com

In General, When choosing or modeling 3d vehicle, the clean topology is very important. (Clean Topology means quad. Evenly space out, avoid ngon)

Therefore, I have this Range Rover Evoque 3D model,obj file made by Vizpeople

Before bring the model into the engine, We need to do some model preparation. The software I used is Autodesk maya


Model preparation: Optimizing Geometry For Realtime



3D Vehicle is Purchased From Cgtrader.com

By Vizpeople


Things to look out when preparing the model for game engine

• Size

make sure maya unit and UE4 setting is same, scale 1:1 real life size is recommended for better lighting, shading, and physics







• Clean Topology

Quad,avoid ngons, evenly space out


• Balance of Quality and Poly Count,

Identify the high poly part of the model see if it can be simplified

Bake details to normal

Remove back face and unseen Geometry


• Correct smoothing and Normal

Turn on Backface Culling to check


• Minimize the number of materials channels used per object

One mesh can have multiple materials

But at a glance it’s hard to know which material is attached to which mesh

This is easier to manage

Combine the objects with same material into one object(this is a personal choice)


I also color code/assign materials in maya for slots in ue4






• Organize the Model

  • Combine Geometry

  • Body, Interior, Doors, lights, Tire

  • Organize the outliner

  • Follow Naming Conventions




• UV

proper uv is important, open uv might work for some project with uvfree materials

In this project, I take advantage of automotive material pack that does not require UV

Only did the UV for the Tires


• Pivot Point

Have objects pivot at the origin


For dynamic object:

  • Such as doors: put pivot around axis of rotation

  • Tire: pivot around the axis of rotation

  • Export one set of the tire if all four tire are same

  • Export 2 sets of tire if the front tire and back tire is different




For more information about preparing assets for real-time game engine please check out my blog post:https://www.yanchen3d.com/post/3d-optimization-pipeline


Export from may and import to UE4


Export setting

  • Export as FBX

Import setting

  • Do not create new Materials, textures

  • Generate light map uv


__________________________________________________________________________________________


After done with the preparation of models, let's dive into the game engine


Export from Maya and import to UE4

Car blueprint: BP_Car

• An Actor Blueprint that contains Car model


This is the main part of configurator,

The car model was assembled here

changing car paint function is also add in the car blueprint later

Automotive materials pack (PBR)

• 10 Master Materials

• High-quality 4K Textures

• Support Object Uvs

• Triplanar mapping (imperfect UV mapping)

• Ray tracing ready


The materials have been optimized to take advantage of techniques and features such as ray tracing and object space triplanar projection.



Assign Material Instances to mesh

  • Material Instances are created from Master Materials

  • By setting the parameters, multiple variations of the master material were created

In UE4, an instance of a Material can be used to change the look and properties of that Material without requiring an expensive recompile. These Material Instances are created from a Master Material, which contains several properties that have been designated as parameters. The Material Instance can see these parameters and you can use them to create multiple variations of a Master Material quickly.






Setting up Environment



• HDRI backdrop to create an environment

• Main level: Car_map

  • Car

  • Player start

  • Postprocessing

• Env01_Map

• Environment

• lighting

The way I set it up is to nest the environment map as a sublevel of the car map


Make sure HDRI backdrop plugin in enabled

• Winter Lake

Snow

Sunrise, cloudy sky

Tire track, footprint on the snow

• Intensity for lighting

1.2

• Size

150

Project center Z for distortion fix

170



Lighting

keep it simple


• Image-based lighting by HDRI

• 1 Directional light: movable

• 2 Point lights: stationary, no shadow

• 1 Reflection capture

• 1 Post Processing Volume



Time for some Visual scripting/Blueprint


USER CAN move around the car using the mouse to drag

Move the mouse wheel forward and backward

Automatically focus by adding The depth of field


Setting the mouse and camera

• Allow input for Mouse X and Mouse Y

• BP_GM: Game mode, set which pawn to use and which player controller to use

• BP_Pawn: first-person view camera

• BP_PC: PlayerControl, for operation

• BP_PCM: Player Camera Manager, for camera operation



• BP_GM

Set player controller class to BP_PC

Set Default pawn class to BP_Pawn

• BP_PC

Set player camera manager class to BP_PCM

Check show mouse coursor

Check enable click events

• BP_PCM

Set view Pitch Max to 0


• BP_Pawn set up : Spring Arm


• Spring arm

Camera (as a child of spring arm)

• Spring arm Setting:

Target arm length:400,

Uncheck do collision test,

Check use pawn control rotation,

Check enable camera rotation lag,

Lag speed :5





BP_Pawn set up : Event Graph


I used add controller yaw input and add controller pitch input function

Setting the mouse and camera

• Turn left, right by feed value of mouse X to Yaw

• Look Up/down by feed negative value of mouse Y to Pitch



• Zoom in and out by adjust the spring arm’s target arm length



• FInterp To function that allows for more smooth camera movement



Now setting up the car paint changeable materials


there are so many ways you can control the dynamic materials in the UE4

MPC_CarPaint node

I create material parameter collection to store all the parameters,

M_CarPaint_Changable

Duplicate the original car paint materials, name it M_CarPaint_Changable

I replace the base color node with MPC_CarPaint node, set the parameter to Color_Original_Red


In this way, Changing the parameter value of Color_Original_Red of MPC_CarPaint will change the color of the material instance.





• Made a Material Instance of M_CarPaint_Changable

• Apply to meshes for color change function



• Get Color From MPC_CarPaint

• Set color To MPC_CarPaint

Use simple logic, Get color value from the Material Parameter Collection (MPC_CarPaint), then set Color Value to Material Parameter Collection (MPC_CarPaint)





use setRelativeRotation function to open and close the car door

use timeline and ease function to help ease the open door animation


For Frontlight on and off, I used set scalar parameter value on materials to set the glow on the light material


All this functionality will be link to UI elements later



So, Let's implement some UI


UMG_Main (widget blueprint)


Create 5 Buttons for 5 different colors

a button for light switch

a button for door open and shot

a button for change camera angle


UMG_Main Event Graph: Set Color name

• Button click> Set Car Paint Name Variable>Call ED Car Paint

• This Car Paint Name Variable will be called in BP_Car Blueprint

• This step transfer the button click action to save as naming value



To display the UI in the viewport, we need to use create umg and add to viewport function in the game mode blueprint


• BP_GM Event Graph : Create UMG Widget, add to Viewport


Back to BP_Car event graph

We have to link Buttons to change color

Color name-value feed into switch on name flow control node to control the color of the car paint material





66 views0 comments

Comments


bottom of page