Page MenuHome

Baking overlapping geometry into a texture does not work with back-facing polygons
Closed, ResolvedPublic

Description

System Information
Windows 7 Pro (64 bit) and Windows 10 Pro (64 bit), Nvidia Geforce GTX 560 Ti

Blender Version
Broken: 2.77a and at least 2.76

Short description of error
I tried to bake a bunch of more or less randomly oriented polygons into a texture (diffuse color and normals). The resulting texture was "incomplete": polygons that were backfacing from the camera's point of view (correctly) occluded other polygons that were further away. But those occluding polygons did not create color output, the texture just contained the (transparent) background.
I simplified the problem to this scene setup:


The blue, green and red (only outline visible because of enabled backface culling) polygons are one object that I want to bake onto the white polygon.
This is my baking result:

The red polygon clearly blocks visibility to the green one, but actually does not show up in the baked texture.

I would expect one of the two following results:

  1. the red backfacing polygon being completely ignored by the baking, hence the green polygon should be fully visible
  2. the red backfacing polygon is not ignored by the baking, hence it should be visible in the upper part of the baking result

The second case is what I actually want and it would be consistent with what the cycles renderer does (at least from what I noticed so far): ignoring the backfacing property and render the polygons from any direction.

Separating the three polygons, selecting them all and baking them does actually work as "expectation 1". The green polygon fills the entire inner part of the blue polygon, the red one is not visible at all.

Exact steps for others to reproduce the error

  1. Open this blend file:
  2. In the Render settings, hit the "Bake" button.

The objects should already be selected in the correct order for baking (red/green/blue polygons as "selected", the white polygon as "active").
In the UV/Image Editor at the top you should see the result I posted above.

Revisions and Commits

Event Timeline

Anselm (tirbelain) renamed this task from Baking overlapping geometry into a texture does not work with back-facing poligons to Baking overlapping geometry into a texture does not work with back-facing polygons.Sep 19 2016, 1:43 AM
Anselm (tirbelain) created this task.
Sergey Sharybin (sergey) lowered the priority of this task from 90 to Normal.

@Dalai Felinto (dfelinto), can you have a look here? Thanks! :)

I can confirm it, and I'm surprised about it. @Anselm (tirbelain) do you know if Blender Internal follows the same behaviour?

Anselm (tirbelain) added a comment.EditedSep 20 2016, 9:57 PM

Just tested it and Blender Render does this correctly. The lower part is green, the upper part is red. Just as you would expect. Here's the result:

But actually the alpha channel is broken when performing a "Texture" baking. In the "Full Render", alpha is correct. But maybe there's something wrong with my setup...?

Under initial investigation the problem is before the baking itself. If I fill all the non -1 pixels I still get the "alpha" block in `RE_bake_pixels_populate_from_objects`.