1
$\begingroup$

There is a bug posted at the following page which shows that baking using raytracing (Selected to Active) is showing artifacts in some situations that ruin the bake.

https://developer.blender.org/T43696

By looking at the bolts, it can be seen that they are being sheared vertically along the middle. It seems that elongated polygons are not being handled well on the code side of things.

enter image description here

Until this issue can be fixed with a proper code solution, a quick walk-through using an artist's workflow would be useful until things are repaired.

$\endgroup$

3 Answers 3

3
$\begingroup$

This issue can be solved by adding evenly spaced loops along the long axis of the model and then later deleting them after the normal map is baked.

The problem here is that altering a models geometry after the Tangent map is baked can invalidate a Tangent Space map.

There is a way around this:

(i) We can bake to an Object Space map first

(ii) Now the extra loops can be removed

(iii) Finally, a second bake pass that uses the Object Space map as Input for the Material normals can then be used to transfer the Object Space map info to a Tangent Space map and the resulting map will be valid for the low poly model that has had its control loops removed after the bake has taken place.

You can safely treat this second bake pass as a color transfer more than anything else. Blender internal makes this quick and straight-forward. With practice, it shouldn't take more than 30 seconds even if you are being patient and going slow. Back to this in a minute.

To start with, add the control loops to one of the boards and then by using linked-duplicates, move and rotate the other boards into place; now most of the setup can be done on only one of the components and the changes will be reflected on all of them.

Here the loops are added in by using Ctrl+r and then pressing the NumPad(+) key about 30 times to increase the number of segments.

enter image description here

Now the pieces can be joined into one Object so the UV's can be layed out(mostly)properly as shown next. Try to use all the available space so that the texture resolution is not wasted. Also, try to leave a fair amount of space between the UV Islands and the borders so the textures do not bleed across the seams. Mipmapping can exaggerate this issue so it's best to not skip this last detail.

enter image description here

Now bake to an Object space map and the results should be error free so long as the 'Selected To Active' settings are correct with regards to Bias/Distance/Cage controls that are available when Using Selected To Active for baking from a High-Poly Model to a Low-Poly model.

enter image description here

There are two good reasons to start with Object Space maps in a situation like this. First, the models' geometry can be further reduced after the bake has taken place without invalidating the Normal Map because Object Space Maps are not susceptible to that problem.

Second, Object Space maps can be blurred without issue in a 2D Editor such as GIMP.

Blurring Tangent Space maps will almost certainly cause you problems.

The following animation shows how to quickly remove all the extra control loops prior to converting the Object Space map to Tangent Space.

To start with, Select the end faces and then use Ctrl+i to invert the Selection. Now Use Ctrl+Numpad(-) to contract the Selection.

Switch to Edge Selection Mode and hold down the Shift and Alt keys and start mouse-clicking the long edges one at a time. The combination of keys and clicks will remove the long edges from being selected.

When only the extra loops are still selected, use x+g to delete all the loops. Now there should only be the basic framework of the pieces just as before.

enter image description here

Next add a Blender Render(Blender Internal) Material and a texture to the material which should be set as an Object Space normal map using the settings shown in the following image. The bake settings are also shown at the top right.

enter image description here

Now when you press bake, you should end up with a Tangent map that does not require the use of Selected to Active and its encoding should match up with the Low-Poly model.

Now for the Materials texture, replace the Object Space map with the Tangent space map and set the Image Sampling to 'Tangent' instead of 'Object' and you should have the following results.

Here is the Tangent map being used to light the model with GLSL.

enter image description here

Next the same normal map is being used in Cycles. A Glossy shader is being used to exaggerate the normal map's detail in order to look for errors. Glossy is basically a worse-case scenario for normal maps. If looks good for shiny, it should always look good.(maybe not if it's really small and far away; then shiny will cause twinkles when the normal map detail is smaller that the computer screens pixels. :) <-You can fix that by blurring the map by a few pixels in GIMP, Krita, Photoshop, etc.

enter image description here

$\endgroup$
2
  • $\begingroup$ Very nice but could you make this more about object-space tangent-space normalmap workflow and less about specific bug workaround? You can build it on that with objectspace its easier to generate high-quality curvature because it completely ignores smoothing of the low-poly vertex normals etc. and then list the advantages and that it fixes this bug. After the bug will be removed this answer will still be good, useful and also broader. If someone asked this it would be probably closed as too specific. Anyway nice answer +1. $\endgroup$ Mar 12, 2015 at 12:22
  • $\begingroup$ I will put some more thought into rounding this out so it's less specific to a particular problem. I'll be reviewing the post thoroughly over the next few days and responding to comments and questions so it can be polished up a bit more. Given all that, I'm fairly certain that this issue is not just going to go away with some simple alterations to the code. There is a similar baking report that has been unresolved for several years now. $\endgroup$ Mar 12, 2015 at 15:24
2
$\begingroup$

Blender has lots of options texture baking.

If one situation is showing up errors, there are multiple fall-backs.

The most obvious issue people have with Object Space maps is that Commercial game Engines rarely have full support if any at all for this format.

These maps can be usable outside of Blender if you:

(1) Know how to write GPU shaders

(2) Know how to send the proper rotation matrix to the shader.

That's a whole other topic.

In Blender, Object Space maps offer by far the easiest and fastest workflow available.

Any Blender tool which alters a model produces information that an Object Space map is able to capture with no special treatment needed.

Your high-Poly model can be the very same model as your low-poly model.

Only one asset is needed here. Often with Tangent Space baking, it will be necessary to trace a ray from one model through to the other using "Selected To Active"

Then you may also want to use a cage; Now that's 3 assets instead of only one to keep track of, and they also have dependencies with one another that can break the bake if anything is changed on one of them.

In comparison, to bake an Object space map using Blender internal is one of Blenders easiest tools to use.
It's only three or four easy steps to produce one.

Only one model is needed for this to work.

(i) Make a UV layer.

enter image description here

(ii) Click the 'New' Image Button or drag and drop a texture from your Hard-Disk-drive onto the newly created UV layout in the UV Image Editor. Be sure to select all the faces prior to adding the image texture.

enter image description here

(iii) Press the 'Bake' button in the Render panel. The animated .gif makes it look bad but it should come out flawlessly so long as the UV's are nicely shaped and proportional.

enter image description here

enter image description here

(iv) Use the map in a render.

enter image description here

(v) Add a multi-resolution modifier and change to Sculpt Mode. Increase the Sub-Division iterations as high as you can go and start sculpting.

enter image description here

You can bake object space maps any time simply by pressing the 'Bake' button

enter image description here

That's all that's needed for a basic bake and it can be used for Blender Render(Internal), Cycles and GLSL renders.

enter image description here

It should also be mostly easy to do for the BGE shader system so long as the proper Reversed Rotation Matrix can be accessed.

The efficiency gain here is really substantial both in terms of memory requirements and also with the GPU shader instructions.

(i) In the Vertex shader, an Object Space map shader requires only a Simple 3x3 Matrix multiply against the light position. No Normals, Tangents, BiTangent's are needed so the arrays can be much smaller.(less memory, shorter transfer times, more of the model fits into the faster but small cached memory pool which helps to eliminate redundant calculations :)

The efficiency of object space maps leaves the GPU free to do other lighting effects.

A limitation of them is that you should never "Apply The Rotation" of your models because that extra Rotation info from Object mode is being used in the shader to correct the object space map vectors. That's a tiny limitation, in practice it's not usually a big deal so long as you are aware of it.

Scatter and Rotate small rocks and whatever else all over all the scene and the normal maps should hold up fine just as Tangent maps do.

You can Join and Separate Objects and still have valid Object space maps so long as you do not rotate any of the meshes in Edit Mode before re-separating them.

The Displacement Modifier also bakes to Object space maps with results the same as with Multi-res Sculpting. It works beautifully. :)

Blender has excellent support for Object space maps even when they are being rotated so long as the model is not an animated character mesh.

I don't think the bone system has been upgraded to support them yet, but for mechanical toy-like models with hinges and for background objects or still renders, they are ideal due to the simple setup and the ray-trace free workflow.

Here is an example of a particle system that uses duplicated objects which are set to rotate across the surface of another model. Cycles is handling the normal map rotations without any issue that I can see.

The sphere that is being duplicated is very low poly but appears to have a lot of detail.
The 3D viewport response is excellent, even with many more instances, since there are no high-resolution generative modifiers being used.

enter image description here

$\endgroup$
0
$\begingroup$

I'm using this answer space for other Blender-SE Q&A pages that are are related to these tools.

For instance, the question asked at the following page does not actually mention texture baking, yet the answer there is directly related to what's being discussed here. The problem there will definitely affect the results here.
It should be used prior to anything on this page.

Unwrap model with UVs at proper size?


Unwrap UV map proportionally to object size

Problem with normal map display in glsl texture paint mode

making texture atlas for only some part of objects

How can I bake to a texture a floor

Unwrapped map gets distored

Create a low poly mesh with high detailed textures?

Create a low poly mesh with high detailed textures?

Why does one face appears so warped when UV unwraping?

UV Mapping Issues

Baking to an image using cycles with two sets of existing uvs

Mark seam to not be cut by Smart UV

How can I bake alpha in cycle nodes-images to make leave textures for my trees?

Long rectangular quads? Or neat squarish quads with tris?

What is the best way to unwrap a sphere?


Bug reports can often be related to artists work-flow just as much as they are to code limitations and failures.

In this example, changing how the UV's are defined makes it so the code problem never shows itself. https://developer.blender.org/T42056#295324

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .