logo80lv
Articlesclick_arrow
Research
Talentsclick_arrow
Events
Workshops
Aboutclick_arrow
profile_loginLogIn

Building a Realistic Gun with Zbrush and Substance

Jonatan Hagström talked about the creation of automatic pistol model with Zbrush and Substance Painter. This piece is rendered in Unreal Engine 4.

We’re thrilled to present a little breakdown by Jonatan Hagström. In this post Jonatan talks about the way he used Zbrush to create the amazing automatic pistol model. This excellent piece is textured with Substance Painter  and rendered in Unreal Engine 4. More tips & tricks under the break.

jonatan-hagstrom-guntablebeautyfullres

Introduction

My name is Jonatan Hagström and I’m from Sweden. At the moment I’m studying to become a ‘Game Artist’ at The Game Assembly in Malmö. I’ve been a part of several student game projects as 3D Artist though have not yet worked professionally as one.

jonatan-hagstrom-policebeautyb2fullres

jonatan-hagstrom-policebreakdownfullres

jonatan-hagstrom-a6policeclaynew

Modeling

If I need the model to be accurate to a real world item I will create all the base pieces inside Maya and then take them into Zbrush. If I’m making my own concept and want to test designs on the fly, I will create most of the pieces inside Zbrush directly.

jonatan-hagstrom-propspilebeautyshotbfullres

jonatan-hagstrom-propspilebreakdownbfullres

After I’m done with the highpoly I will go into Maya and create the lowpoly from scratch.

jonatan-hagstrom-hipsterbeautyafullres

jonatan-hagstrom-hipsterbeautybfullres

Automatic Pistol Model

The reason I think Zbrush has an advantage over other 3D packages when creating hard surface is that it has properly working boolean operations.  I’ve been heavily inspired by the Zbrush Summit presentation by Red Storm Entertainment which can be found on YouTube. Basically you use high quality Dynamesh while adding or subtracting shapes without having to think about edge flow. Though like in their demonstration, I still build the rough base pieces in Maya and import them into Zbrush to save time and add accuracy.

ZbrushBooleans

RenderdPistol

After I’m done with the highpoly I decimate it heavily to get the poly count down and import it into maya. Here I use a mix between the Maya 2016 ‘Quad Draw’ and ‘Live Object’ functions and basic box modeling to create the low poly.

Tips: Assign a shader to the High Poly Live Object with minor transparency and change your Viewport render settings to Depth Peeling to more easily see your Quad Draw mesh through the High Poly.

QuadDraw

When I was done with the Low Poly I went on to UV map it. This is usually very tedious work. However I recently found a free UV editor script for Maya called Nightshade UV Editor. This package has several time saving tools.

The equivalent type of scripts for 3DsMax would be TexTools.

Making a perfect normal map bake can be very complicated, though a rule of thumb that avoids a lot of problems is to first smooth all edges of the model and then harden all edges that have a UV split.

Here is a useful script that automates this in Maya.

When I’m satisfied with the UV mapping I want to do several normal map test bakes to determine if there are any issues with the low poly model or the UV mapping. Here can I also see if there are areas that need more polygons.

I’ve tested several baking packages and the one I’ve stuck with is inside Substance Painter. This is primarely a texturing program, though I have found it to give very good results when baking normal maps. And a large plus is that it automatically applies the textures to your model so that you can check for issues in the viewport directly.

I recommend “exploding” your model when baking to avoid having to use a cage and other issues.

Exploded

When you are satisfied with the results you can easily import an assembled low poly model under ‘Project Configuration’ in Substance Painter.

Tips: If you get problems with UVs disappearing in Substance Painter, make sure you only have 1 material assigned to the whole model in Maya. Or that you have several ‘UV sets’ on the same model.

I recommend to test out your normal map and your model in the final program or engine you are going to present it before you start texturing everything.

Material Production

Most modern game engines including Unreal Engine 4 now use Physically Based Shading. This is different from the traditional Diffuse, Specular and Gloss shading model. Instead you use Albedo, Roughness and Metallic together with an environment Cube Map. The benefit of using PBS is that long as you use correct values for the material type you want to emulate, the model will look realistic in any type of lighting.

I have always been a fan of texturing my model directly in 3D. Substance Painter enables me to do this and to directly see the changes I make in real time in a PBS environment.

To create the material definitions in this piece I’ve used a mixed approach. About half of the materials I’ve created from scratch in Substance Painter and half I’ve used a base material from share.allegorithmic.com. The site allows you to preview and download community made materials of varying quality. These can be a good start to your materials though I often heavily modify them once they are inside substance painter.

The approach I use when I create my materials from scratch in Substance Painter usually goes as follows:

  • I bake all the different textures I can such as Curvature and Ambient Occlusion. These are used by Substance Painter’s ‘Generators’.
  • I create a new folder. In this folder I create a fill layer where I set the basic values such as color, roughness, and metallic etc.
  • To the folder layer I add a ‘Black Mask’. With this black mask can add white paint to fill an entire area with the material. Alternatively I can add a ‘Generator’ with for example an ‘Edge Damage’ preset that only shows the material at the edges of the model. This includes a lot of tweaking though you get a fast result. Afterwards make sure you paint out the areas where there should be no scratches by adding a ‘Paint effect’ to your black mask. Now you can use a brush and paint black to remove the mask in specific areas.

GeneratorMasking

  • When the base materials are all in place I tweak the color, roughness and metallic values so that they fit the material I want them to represent.
  •  Most materials are not evenly one value either in neither color nor roughness. To make them more realistic you should add variations to them. You can do this in several ways in substance painter. The way I most frequently uses is that I create a new fill layer on top of my main fill layer inside the folder I created earlier. On this new layer I turn off all channels except the roughness. I change the roughness value to 100% roughness and then add a black mask. Now I can for example use a brush to paint in areas of roughness in the Black Mask.

232

The same technique can be used for creating variation in color as well.

Tip: Your metals should be either 100% metal or 0% metal. There are extremely few exceptions where there would be a part of the model with 50% metalness. Your texture should mostly be black and white with little to no grayscale inbetween.

Tip: Extremely rarely have 100% saturation or 100% Black/White values in your Albedo color. This is unnatural and the Physical Shading works better if it has more room in the spectrum when lighting the material.

Tip: Changing the channel type above the layer stack allows you to then set the blending mode of the layer for each type. You can for example set it to Multiply or Overlay when creating color variations to get a better blend.

222

Some of the details on the pistol such as the handle ribbing and the mantle grip I painted inside Substance Painter using a height layer. I thought this would be easier than to create it inside Zbrush, though in retrospect I would have sculpted those details as well.

I have used Substance Painter a lot this past year and I’ve learned a lot by doing so. There is too much to write down everything, though I recommend watching Allegorithmic’s YouTube videos and experimenting a lot yourself.

Extra Tear and Wear Effects

I used generators in Substance Painter that use a curvature texture to determine all the edges on your model. This can quickly be added though you also need to think about the logical size and positioning of your wear and tear.

If you dragged the gun on the ground which places would be scratched? Using the gun, are there areas where it would get worn from having it in your hands and holster? Are there additional scratches that would result from firing and reloading the gun?

What caused the scratches makes a difference. For example the scratches on the mantle have a harder edge than the wear on the handle. This is because the handle wear comes from the rubbing of soft hands while the mantle scratches are from dropping and banging the gun on hard surfaces.

Another part of making the gun belivable was to add dirt in the crevices.  To achieve this I would start off with adding the baked ambient occlusion as an inverted mask. Then I would paint out the undesired areas with a paint effect.

I’m fairly pleased how I placed the dirt and scratches on this weapon though I can also see a lot of areas where I could have done a better job. This I will improve on the next time I create a weapon.

I wanted the pistol to look a slightly more science fiction than the original P99 so I created a different color scheme.

Tips and Tricks

Use a lot of reference from real weapons. Research what each piece does. Preferably find an instruction manual of a real weapon that has an exploded diagram where you see each piece.  Any type of weapon usually has several different variations that have slightly different design. Make sure your reference is of the same model or else you might find out too late that the pieces don’t fit together.

I prefer to make my models fairly dirty. It is possible that you want a gun that has just come off the assembly line and is prestine, though most likely it has been used and then most likely there should be some dust, grime and grease stains on it.

Know what ammo type your weapon uses. A mistake I did with this gun is that the bullets don’t actually correspond to the 9mm used for the real weapon I used as a reference.

Rendering

I chose to use Unreal Engine 4 to render the pistol. A good alternative is using Marmoset Toolbag 2. Both of these have a learning curve and their own weeknesses and strenghts. Though in general I’ve found that in Marmoset it’s much easier to make something look good, though Unreal is more flexible.

The setup I have for my lighting in Unreal is quite simplistic with a cubemap background sphere, a directional light, a couple of pointlights and some sphere reflection captures.

UE4Lighting

One thing I had issues with was that the metalness did not correspond to what I was seeing in Substance Painter. What I ended up doing was modifying the texture inside the material.

Ue4Material

Also remember to uncheck SRGB in the metal and roughness textures after you import them into Unreal.

sRGB

Lastly I greatly recommend getting feedback on your models. As early and often as possible. Changing something is much easier in the beginning than later in the pipeline. There are a lot of online forums where you can post your work in progress. You don’t have to use all feedback you receive though give it an honest though.

jonatan-hagstrom-policebeautyshotnew

ProfilePicture

Join discussion

Comments 0

    You might also like

    We need your consent

    We use cookies on this website to make your browsing experience better. By using the site you agree to our use of cookies.Learn more