Using Blender in game development
At Embark we use Blender across the studio as our go-to tool for 3D and environment art. Just now, we also renewed our gold-level sponsorship of the Blender Development Fund another year. In this post, Daniel Bystedt details why Blender is great for game development and lets you in on a specific use-case.
My own history with Blender dates back to 2015. Blender has evolved tons since, but even back then I was surprised to find how capable this free software was, with its fantastic modeling toolset and non-destructive modifier system.
It made me fall back in love with 3D modeling again, and soon upon discovering Blender, I found myself using it for most of my tasks. Over time, I also became an active member of the Blender community. Nowadays, I’m involved in some of Blender’s development processes as a commissioner for various projects.
Embark’s embrace of Blender was in fact how I discovered this studio in the first place and a big reason why I work here today (in addition to our work with machine learning and proceduralism). At Embark, we’re constantly looking for new and effective tools and solutions to solve problems, and Blender truly speaks to what sort of studio we want to be. As a free and open-source tool, it also contributes to making game development more accessible and collaborative.
Given that Blender is an unfamiliar tool for many of our new artists, we’ve been working actively to make sure everyone here gets the know-how and support they need to quickly get up to speed. Many who were skeptics at first are now some of our most active Blender advocates, which has been fun to watch!
As we celebrate our first year as a Blender sponsor, we wanted to share some of this know-how with all of you in the Blender community too. So in this post, I’m going to describe to you in a bit more detail some of the specific reasons we think Blender is great for game development, and describe a specific use-case, as we’re now working on our first games.
So let’s get into it.
Blender has a lot of amazing features, but some of the most important ones for us at Embark is the approachable and non-destructive modeling tools and modifiers. The realtime viewport Eevee is also priceless when it comes to evaluating your model and textures before importing them into Unreal Engine. We also love Blender’s constant updates and development cycle and that the Blender Foundation is so transparent about its development process.
Blender is also very pipeline-friendly and allows us to effortlessly implement tools and applications into our pipeline. Blenders’ data management of file content provides flexibility, allowing any type of data to be stored on almost all types of data types inside the file. Custom properties can be stored on scenes, objects, meshes, collections, etc. Custom properties can hold basically any type of data such as float, string, list, dictionaries, and more.
For example: switching to the scripting tab and writing this example in the python console in Blender
bpy.context.active_object['my_string_property'] = "<3 Blender"
will give you a custom string property on the active object, that you can expose in object properties or by investigating the outliner with display mode: “Data API
Blender uses a lot of mesh component data for vertex groups, bevel weights, and creasing weights. By collecting this per-vertex/edge/polygon data and store it into a custom object property, we can export the objects using the FBX or ALEMBIC file formats (note: ALEMBIC supports custom properties as of Blender 2.91). The files can then be opened in Houdini and then we can do operations by using the vertex/edge/polygon data.
Creating real-time hair in Blender
So let’s discuss a specific Blender use-case for us here at Embark: how we use Blender to create real-time hair.
Blender offers the ability to do modeling, texturing, shading, and also display your work in a high-quality real-time rendering viewport. Therefore, it’s a great tool for creating hair, both for the classic hair-card approach, but also for importing grooms into Unreal when exported as a curve object with multiple splines to Alembic.
When creating the texture for hair cards, we create a strip of hair on a slanted plane. The grooming tools in Blender is really nice and are easy to use:
We then layout the hair strips on a grid. The hair shader that we later use in Blender and Unreal can dynamically change UV mapping to adjust to the number of rows and columns used in the hair card texture. This way we can easily change the hair texture on any character in the game engine.
The hair is then rendered out from an orthographic camera and the different shading attributes such as normals, opacity, random strand value and specular can be packed into the RGB channels of one or multiple textures.
The hair particle system is placed on a hair cap on the character. Using a hair cap makes it easier to keep a repository of hairstyles.
The geometry of a basic hair-strip looks like this (the UV is normalized):
Using a particle instance modifier on the hair card geometry and pointing the modifier's object value to the hair-cap and particle system will instance and deform the hair card to each hair curve in the hair particle system.
Hair cards can be reduced and triangulated in a non-destructive workflow using modifiers:
Viewing the hair in the real-time rendering viewport Eevee can give you a great idea of how the result will look in the game engine.