Hey everybody, in this tutorial I’ll be talking about a PBR (Physically Based Rendering) workflow for Sketchfab. Starting with creating your model inBlender, baking maps and using a PBR texturing application like Quixel Suite or Allegorithmic Substance Painter to create your textures and finally creating Sketchfab materials using these textures. This guide presents a proven workflow for achieving great results with Sketchfab’s PBR rendering engine, for example I used it when creating my Pokeball model:
I’ll skip the theory behind physically based rendering/texturing for now, since there are very good explanations around, and freely available to anyone.
Resources I can really recommend are:
- Marmoset PBR Theory
- Marmoset PBR Practice
- Allegorithmic PBR Guide 1&2
- Artisaverb Physically Based Texturing
- 3D Coat PBR Overview
What’s important to know is that there are two workflows, commonly referred to as “Specular/Gloss” and “Metalness/Roughness” workflow. They both make use of a base color texture (commonly referred to as “albedo”) as well as a normal- and ambient occlusion map. The main difference is that the Specular Workflow utilizes a “specular texture” (a rgb color map) to control reflection amount/color, while the Metalness Workflow relies on a “metalness” texture, which is basically a black/white map. White parts of the metalness texture mean the material should be treated as a metal and black parts are non-metals, easy as that. The roughness/glossiness maps are black/white textures used to control the “sharpness” of the reflections. You can easily turn a roughness texture into a glossiness texture by just inverting it and vice versa. That’s pbr in a nutshell, please refer to the links above for more detailed explanations. :)
Part 1: Generating Maps
So let’s start by creating the model in Blender. Since I usually create assets for real time use cases like games or augmented reality applications, I first create a highpoly (=high polygon count) model with lots of details. Based on this a lowpoly version of the model is created and UV unwrapped. If you’re not a friend of the additional work required to get a lowpoly model or just want to showcase your highpoly one, don’t worry, Sketchfab handles models up into the millions of polygons just fine!
After the model is finished and unwrapped it’s time for baking maps. Depending on which software you’re using later for texture creation you need slightly different maps, however most of the time a normalmap and an ambient occlusion map are the bare minimum for Substance Painter/Quixel dDo.
For baking I usually use Blender Internal, Cycles or XNormal, which is a really powerful, free application and produces superior results to Cycles in some cases. The “Bake” settings in Blender can be found at the bottom of the Render tab of the Properties window and change according to the render engine you have selected:
You can choose the type of texture you want to bake from the “Bake Mode” drop-down menu. Tick “Selected to Active” if you’re intending to bake down the details from a highpoly model to a lowpoly one and make sure the lowpoly has proper UV coordinates. It’s also important to select the highpoly first and then shift-select the lowpoly to add it to the current selection and make it the active object. Also make sure the model you wish to bake has a image assigned to bake to, if not, go to edit mode, select the mesh and add a new image in UV/Image-Editor (“Image -> New Image”).
Tip: To bake maps using Cycles make sure your lowpoly (or highpoly mesh if you have no lowpoly version) has a material assigned to it and there is an Image Texture node (with the texture you’re intending to bake to) somewhere in the node tree, it doesn’t even have to be connected to any other nodes.
For best results with complex meshes I recommend to use a cage. This is basically a duplicate of the lowpoly mesh which is modified so it encapsulates the high-/lowpoly completely. A fast and easy way to create a cage is to duplicate the lowpoly mesh, scale it up using Alt+S in edit mode and correct intersections/weird topology by hand. Cages can be used with Cycles and XNormal, Blender Internal doesn’t support them unfortunately.
If you’re creating maps to use with Quixel dDo you’d want to bake a tangent space as well as a object space normal map, while Substance Painter expects a tangent space and a world space normal map. The ambient occlusion map is the same for both applications, if you need a detailed list of input maps check this:
Since I usually start my texturing in dDo some additional words to providing proper input maps for it: An ID map is very much needed to work efficiently with dDo and assign different materials to different parts of the mesh. Substance painter uses a naming convention (TextureSetName_AdditionalMapSlot) for this. The ID map dDo needs however is just a different solid color for every part of the mesh that is supposed to have its own dDo-material. You can either paint it by hand or assign colored materials to different parts of the mesh and then bake this colors to a texture. To bake the material colors to a texture you can use the “Textures” bake mode of Internal or “Diffuse Color” bake mode of Cycles. If you’re just exporting a highpoly mesh you can skip the baking step and just use this handy script for saving an ID map.
Since creating the colored materials can be a rather tedious task I usually create a lot of default materials, assign them to different parts of the mesh and use the Random Object Color Script to assign different colors to them. If you already know exactly which dDo-material should be assigned to which part of the mesh, you can make use of the dDo Swatch when assigning materials.
Tip: Check this polycount thread for baking gradient maps with Cycles.
Part 2: Creating PBR Textures
Once you have your maps ready, the actual texturing can begin. Of course exporting the mesh in .obj (dDo) or .fbx (Substance Painter) shouldn’t be forgotten. ;)
If you’re not familiar with pbr texturing applications you might wonder why we’re going through the hassle of setting them up and creating all of these input maps instead of just using that time to just paint the actual textures? You may remember the different kinds of maps needed for physically based rendering (albedo, spec, gloss, normal, etc.), which are pretty tiresome to create all from scratch, not to mention, most of the time you have to change all of them for adjustments to the final look of the model. Using applications like Quixel dDo, Substance Painter or 3D Coat one is able to work with pre-defined or user defined “materials” like wood, concrete or metal and the software creates all the different necessary pbr textures in the background, effectively taking the hassle of altering a few textures at a time away from the user and letting him focus on the final look. It’s also possible to apply effects like weathering or scratches procedurally to exposed areas, or dirt to occluded areas, using the information from the normal/ao or other maps. Neat!
Here are the generated maps I used as input for dDo, from left to right: ID, Tangent Normal, Object Space Normal, AO, UV Layout.
I won’t go into detail about how to create your final materials inside of ddO/Substance Painter as this would go way beyond the scope of this article. Please refer to the documentation/tutorials of either software for more info on how to use them.
Once you’ve finished texturing it’s time to export the final pbr textures to use with Sketchfab. As you’ll see shortly it doesn’t really matter which pbr workflow (Specular vs. Metalness remember?) you choose, but bear in mind that you can’t export Specular Workflow textures from Quixel if you checked the “Metalness” checkbox when creating your project. The dDo export preset I usually use for Sketchfab is named “Generic PBR” and depending on the “Metalness” checkbox from the project creation wizard you either get Specular or Metalness pbr textures. When using Substance Painter I usually make use of the “PBR MetalRough” or “PBR SpecGloss”preset when exporting.
Here’s the final set of pbr textures I ended up with (the ID map is not used on the final model). From left to right, top to bottom: ID, Color, Metalness, Normal(tangent), AO, Roughness
Part 3: Applying Textures in Sketchfab
There are several ways for uploading your models and textures to Sketchfab, check out my previous tutorial for more information. Since I already have my model in .obj/.fbx format (from the Blender export) I usually use this for the upload since Sketchfab conveniently supports all of these formats. However it’s totally fine to upload the .blend or use the Blender export script, it all comes down to personal preference. Once the basic properties (name, description, tags, etc.) are entered, click on “Settings” and choose “3D Settings”:
Now all the important visual properties like materials or lighting can be changed. The first and most important setting is found in the “Scene” tab: Set the Renderer to “PBR” to use Sketchfabs great physically based rendering mode! :)
After the rendering mode is set to “PBR” head over to the “Materials” tab to set up our pbr textures. Remember when I said it’s not that important which workflow you’re using? That’s because Sketchfab supports Specular Workflow as well as Metalness Workflow! Just choose which one you want to use by clicking on either Metalness or Specular, the user interface presents different texture options based on which workflow you choose. The appropriate pbr textures can then be uploaded and applied to their respective channels. Note: If you’re using the Metalness Workflow don’t worry about the Specular F0 parameter, usually you’re supposed to leave it at 50%. Although Metalness Workflow is associated with a roughness texture most of the time and Specular with glossiness, Sketchfab conveniently lets you choose which one to use! It’s also possible to choose between a normal-map or a simple greyscale bump-map.
If you’re not sure what a texture slot is supposed to do, just hover over the little “?” icon with your mouse cursor to display a helpful tooltip. The slider next to each texture are used to control the influence of each texture channel, these can be used to further tweak the final look of your material. Once satisfied with the materials adjust lighting, or choose a different scene background. I also really recommend digging through the post processing filters, a little sharpness and vignette almost always enhance the final look of your model.
Don’t forget to click on “Save Settings” once you’re satisfied with your settings! And once that’s done, go out and share your model with the world! :)
I hope this article was of a little help and cleared some of the confusion around the buzzword “pbr”. If you have any comments or questions, let me know!