Quantcast
Channel: Intel Developer Zone Articles
Viewing all articles
Browse latest Browse all 3384

Retopologizing VR and Game Assets Using Blender*

$
0
0

retopolgized images

This article covers how to both retopologize a mesh to a clean, low-density model, and then UV unwrap that mesh to support adding texture maps to the new model. It also discusses the use of free tools like Blender* and its BSurface add-on for retopologizing a sculpted 3D mesh.

About Retopology

Retopology is the act of rebuilding a 3D mesh so it's lower in size and designed cleaner for use. Retopology may seem like just busy work in the 3D creator’s process, but it is a key task and also allows flexibility in working with your models. Most original meshes, built using 3D modelers, sculpted, or scanned, capture a level of detail to make the model look good. However that same detail creates a large file that is difficult on reads, writes, and memory for your target application. Also, most highly detailed meshes can have too much detail or be nonsymmetrical, creating odd or unwanted creases, folds, and movement when animating the mesh.

high topology mesh and renderlow topology mesh and render

To avoid this, you’ll need to retopologize the mesh to a more basic, usable structure, and then transfer the detailed data about the color, bumps, and creases out of the 3D structure and into “baked” 2D materials maps. This allows the 3D mesh to be a much smaller file with fewer vertices, yet produce the same results in rendering. In the images above, the original mesh was reduced from 500,000 faces to 2,000 faces, yet the output looks relatively the same.

What you need to get started:

  • PC, Mac*, or Linux* computer; Intel® Core™ i5 or Intel® Core™ i7 processor recommended
  • Blender 3D with the BSurface add-on enabled (free to download)

Blender* and BSurface

Blender is a free, full-purpose 3D modeling, rendering, and animation studio. With this powerful tool, you can create simple 3D objects or produce a full-featured animated film in Blender. For the purpose of this exercise we focus on the modeling side of Blender. If you have never used Blender before, I suggest watching this getting started video to learn how to set up Blender for good results.

To do the work in this tutorial you will need a high topology 3D mesh. For instructional purposes we used the Suzanne monkey head model that is a mesh object in Blender. To create a higher density version of this model, one with over 500K vertices, follow these steps:

  1. AddMesh, and then select Suzanne.
  2. Under the Tools panel, select Smooth.
  3. Under the Properties panel, click the wrench icon to get to modifiers.
  4. Add the modifier called Subdivision Surface.
  5. Set Subdivision to 5.
  6. Click Apply.

Retopology Using BSurface

The following retopology steps are covered in this video.

Setting up BSurface

To install BSurface, from the File menu, click User Preferences. Select the Add-Ons tab. Search for “bsurf”. On the right the add-on for BSurface will appear. To enable, check the box to the left of its name.. BSurface should now be installed and enabled.

In order for BSurface to place vertices in the right place lined up with the original model, you’ll need to have the original model loaded and initially selected while in Object Mode in the scene. Then to create your retopology, add a plane, which creates a new asset. Go to the Edit menu, and then select Snap to Features.

To configure BSurface, from the Tools menu, select the Grease Pencil tab. Then do the following:

  • Select Continue.
  • Under Data Source, select Object.
  • Under Stroke Placement, select Surface.

surface button in the menu

You may find you can move some of the vertices, edges, or faces around manually. To get those items to also cling to the surface of your model, select the following while in Edit mode: Under Snap, select on, and then under Snap Element, select Face. Finally, click the next four icons on the bottom right.

face button in the menu

You are now ready to use BSurface.

Creating your first grid mesh

BSurface automatically creates a mesh based on a few lines you draw over the original mesh.

  • You only need to draw a few parallel lines in one direction. BSurface will create a crossing mesh based on those lines. Do not draw lines from different directions or in crossing directions.
  • In the Tools tab under the Tools panel, you will see BSurface. Click the Add Surface button.

steps to add surface

  • To adjust what has been created, set the number of Cross strokes or Follow (lines between the lines you drew). You can also clear Loops on strokes if you want BSurface to ignore all but the first and last lines you drew. Follow will now be subdivisions between the first and last stroke.

cross strokes example

Creating a radial mesh

Often you need a mesh that circles around an area like an eye or mouth. To create these types of meshes, simply draw evenly spaced radial lines from the area you are circling.

radial mesh

Click Add Surface, and then select Cycle Cross to close the radial and set the number of cycle crosses needed.

radial mesh example

As before, clear Loops on strokes to set the subdivisions more evenly.

Corner Fill

You will find you often have two sides of a mesh completed, but you still need to fill the mesh between them. To do that, select all the points on the two sides. Use SHIFT+ RIGHT+CLICK to unselect the point in the corner, and then draw one of the missing sides. In the example below the top and right edges were set and selected. A bottom edge was drawn, following the curve of the mesh points. Click Add Surface to fill it in.

corner fill

corner fill grid

Connecting Meshes

To connect two meshes, select all the points you need to connect. Be sure you have selected the same number of points one each side. Then imagine a series of lines between them. Draw at least two of those lines with the last line drawing over one set of highlighted vertices.

connecting meshes

connecting meshes detail

You now have the basics of BSurface needed to quickly retopologize a model. Continue to use BSurface to create a full mesh over your high topology model.

UV Unwrapping and Adding Detailed Texture Maps

UV unwrapping is a key piece to the process and is a part of the pipeline that allows you to get details lost from your high topology model onto your newly retopologized model.

UV unwrapping is the process of defining how a 2D image will be mapped over all the vertices in the mesh. Imagine a world globe where you have a smooth sphere and plan to have a printed image of the globe’s features wrapped onto the globe. For the 2D image to wrap over the globe, you will need to make cuts into the image in a way that allows that image to wrap properly over a sphere. This is called a map projection.

texture map
Source Wikipedia: Goode homolosine projection of the world

For 3D modeling, UV unwrapping of a model allows you to define this projection pattern, which works as a guide for all sorts of 2D information to be mapped over the 3D object. In the globe example, you could bake information into 2D image maps for the color, roughness/gloss, and height information for the land or water of the earth, and then have that projected onto the sphere using the UV map.

Below is an example of a UV map of a 3D alien head model. The left image is called a color map, and the middle image is called a normal map or bump map. Both images have a wireframe mesh flattened out over the respective images. This flattened out mesh pattern is the UV map.

UV map

What you need

For this part of the tutorial, you need a high poly mesh with texture details, which is a file you can use, or alternatively you can take the high poly object you created and added texture details using Sculpt. The linked file is an example of the monkey head sculpted with wrinkles and lines and skin folds.

First be sure the high poly mesh and the retopology or low poly mesh are in the same space. Set their X, Y, and Z coordinates to the same location using the translate options in the properties panel.

The steps that follow are also covered in this video.

Step 1: Marking Seams

Marketing seams is the process of selecting where the mesh will cut or break apart in order to be a flat 2D pattern of the 3D model. Think of seams like seams on a shirt or plush toy, where the 2D material will be stitched together. And like those seams you wouldn’t want too many of them, nor would you want to put seams in highly visible areas. Put them where there is a lot of geometry that curves around and where it makes sense to have natural edges. When baking texture maps as we are doing, the seams will likely not show. However if you use procedural maps of noise or other patterns, those patterns will often break at the seams.

To mark you seams, select your Low Poly Object, and then go to Edit mode. Select the Edge selection tool, and then select where you want your seams to go.

marking seams example

  • Select Mesh Menu> Edge> Mark Seams. Do this for every seam you want to mark.

steps to follow

Seams will appear as red-colored edges on your model.

red colored edges of seams

Step 2: Unwrap the Low Poly Mesh

This step is straightforward and consists of unwrapping the model, and then creating a texture file to be mapped. Again you need to be in Edit mode of your low poly model. Select all, verifying that every mesh face is selected. Type “U” to bring up the Unwrap menu. Select UV Unwrap at the top of the menu.

For the UV map to work, you’ll want it as a guide for a texture file you are going to bake or render. Create a new viewport window and set that viewport to UV Image Editor. Under Image in that view port select New Image.

red colored edges of seams

Set any desired resolution options, give it a name, and then save.

steps to unwrap the low poly mesh

It should now be a black image with nothing in it. You however can see the UV map over the black image.

steps to unwrap the low poly mesh

Step 3: Bake a Normal Map of the High Poly Mesh

In this step, you will “bake” the texture information on your high-resolution model to a 2D image file called a normal map. This texture will then be added to the material on your low-resolution model. The first step is to make sure your low-resolution model has a material with a texture in it.

Select your low-resolution or retopology model. In the Properties panel go to the Materials tab. If a material doesn’t already exist, add a material and select Nodes. (Be sure your render settings at the top of the Blender application are set to Cycles Render.)

cycles render

Open the Node Editor by setting one of your viewports to Node Editor. From the Add menu, select Texture, and then Image Texture.

steps to select image texture

With this added, set the file to the name of the UV image you created in the previous section. Also set it to Non-Color data.

steps to select non-color data

Next you need to select the bake settings. Under the Properties Panel, select the Render setting, which is the camera icon. Scroll to the bottom to the Bake section and do the following:

  • For Bake Type, select Normal.
  • For Space, select Tangent.
  • Select Selected To Active.
  • Set Ray Distance to be at least 1.00.

bake section

The next part can be tricky. You need to select both models, but you also need to be sure to first select the high-res version, and then the low-res version. Be sure you are in Object Mode and not Edit Mode.

Once in Object mode, using the Asset Inventory panel, verify that both the high topology model and the low topology model are visible and have the eye icons to the right of their names. Select the high topology model so it appears in white. Right-click it, and then click Select. You should see the model selected in gold with its name in the 3D Viewport.

bake section

Now press and hold the SHIFT key, and then right-click the low poly model in the 3D viewport. This action causes the name of the low poly model to now appear in white, the low poly model will be named in the 3D viewport, and the selection color will change from gold to orange. With that done, click Bake in the Render panel.

steps to select high topology

Step 4: Apply the normal map to your model

In this final step we take the baked file and connect it to the material of our low poly model. First you’ll need to save the Baked render from the last step. In your viewport, under the UV image map, first verify that the name of your saved UV map is listed in the file browser. The image should be shaded blue/purple, similar to the image shown below. The image on the left shows the normal map when in Edit mode; the image on the right shows the baked image while in Object Mode. While in the UV Map Image editor, select the Image Menu, and then click Save.

texture ready to connect to the model

We are now ready to connect this texture to our model.

Go to the Node Editor where you have the Texture Image Node. Connect the Texture Node to a Normal Map Node. You can get this Normal Map Node under the Add> Vector> Normal Map.

image in normal map mode

Connect the Normal Map Mode into the Normal slot on the Principled BSDF Shader. You should now see all the details from your high-resolution model in your low-resolution model.

image in normal map mode

You have now completed a major part of the 3D asset workflow for use in games or virtual reality software. In addition to texturing normal information on a model, you can texture with other material maps that create realistic skin, hair, or other materials from cracked concrete to scratched gun metal. For reference on this next workflow, do a web search on PBR materials using tools like Substance Painter* and Blender.


Viewing all articles
Browse latest Browse all 3384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>