Aeronautical Interior Dynamic Material System
During a collaborative project with Gulfstream, I created a dynamic material system that changes the material of unique models for the scene at once.
Textures and Models:
All textures for materials used combined maps. The primary texture had a normal on the RGB and a greyscale map to have the color multiplied to on the Alpha. This saved on texture calls which has a large limitation on mobile.
Fabric texture; RGB is Normals; Alpha is used for color multiply for material
The secondary texture that we used was the objects normal and ambient occlusion map. Again we combined the two maps using both the RGB and Alpha channel.
Divan Mesh texture; RGB is Normals; Alpha is AO
An issue with using a standard tile size for all material textures was that the UV density was different for each model. To adjust for this I created a new scalar parameter that allows the UV coordinates to be adjust only for the texture that was used as the material. Whereas the texture for the model would not be effected.
Interior scene with material to test UV density
Master Material Evolution:
Quickly we realized that a unified material would be the fastest way to develop in the time that we had. This lead to creating a flexible material which would be used everywhere.
Original Master Material created with assistance from Will Cavanagh
The first version was targeted at having textures that held multiple textures inside of it to save on texture calls. Unfortunately this caused several issues. On mobile there were large anti-aliasing issues, which was quickly seen. It also added extra processes to generating texture maps. Due to this we moved away from combining multiple texture maps together.
Final Master Material
The final master material that was used was more simplistic. We had two texture calls, the models normal/AO and the patterns normal and an alpha to help drive the base color. Both normal maps have the ability to have its intensity increased if needed. The base color is derived from a 3-vector combined with the patterns alpha. Along with a SoftLight function that is used for color correction.
Once the final master material was created we needed a fast way to test and implement new materials. When another artist needed to test a new primary texture, they would set the texture and use scalar values inside of a dynamic material instance to quickly find the values need for the material. They would then add these values to the spreadsheet. This allowed the other artists to work quickly with minimal need to touch the current build.
Spreadsheet before all the values were added.
When the aircraft level is loaded a new Game State is used. It creates a dynamic material instances (DMI) for the level and are assigned the model normal map. Each DMI is added to an array the falls under a section type (Furniture Cushions, Furniture Base, etc). Then sets the rest of initial values for each of the DMIs. The Game State holds several variables that are used as global variables including the Current Selection, which holds the current target section type.
Each mesh that is seen in the level is an interactive model. When they are spawned they run the Event Begin Play (this happens after the Game State is loaded). Where it casts to the Game State and stores it as a variable. It then sets each material element of the model to the associated DMIs stored inside of the game state. Inside of the asset are independent collisions for each material element area (besides the metal plating). These are used to set the Current Selection.
There are three pawns in the level each with unique camera controls. The aircraft interior pawn is attached to a spline. It has a function to trace to an object and then move a sphere collision to where the trace hits. When the sphere collision moves the interactive model it triggers the overlap event to change the Current Selection. This pawn has an additional widget that gives the pawn the ability to move forward and backwards using a slider.
The widget on construction casts to both the Game State and the last aircraft interior pawn, then stores both as variables. Afterwards hides the inner and outer ring of the widget and creates dynamic material instances for each button on the outer ring. This allows the buttons image to be dynamic and be assigned relatively to the Current Selection. At this point the material system is fully initialized.
When the user clicks the center icon the widget tells the Pawn to trace and move the sphere collision and the widget’s the inner ring is shown. Updating the Current Target variable and gices the user to select: Color, Swatch, Material, and Plating. When they select any of these it displays the outer rings. Then generates the values for the dynamic material instances for each button depending on what the Current Selection is and material type (fabric, leather, etc). All of these values are pulled from the spreadsheet.
Now the user can either close the menu, change the current selection for the outer ring, or tap an outer ring button. If they were to do the last it tells the Game State to update the value for the dynamic material instance. By updating it in the Game State it will update to the rest of the interactive models in the level that use the dynamic material instance.