Page MenuHome

Cycles dupli object baking issues
Open, NormalPublic

Description

System Information
nvidia g880m

Blender Version
Broken: blender-2.73-d56c9fb-win64
Worked: (optional) probably never

Short description of error
when assigning object as duplis to some mesh, and then trying to bake these duplis to another mesh, duplis appear black. But in normals mode, it works, so they are there, just without material or something.
Also, you can see that the duplis are there actually twice, one offset quite strongly. In some other file, I got them also four times...

Exact steps for others to reproduce the error


open the file, hit bake.
the group of objects in the ceter bakes to the cube.

also, you can see another group of objects, where duplis have been made "real" and it works well, it's group of objects called "fine", baking to the cube works well with seemingly same meshes.

Event Timeline

Vilem Duha (pildanovak) set Type to Bug.
Vilem Duha (pildanovak) created this task.
Vilem Duha (pildanovak) raised the priority of this task from to Needs Triage by Developer.

just foud the reason for the fact that there are actually more duplis:

when you hit bake, you can even see in the viewport for a second, that the code triangulates the faces of the dupli parent - this causes double count of the duplis ;)

Also,
forgot to mention - the actual dupli parent renders too, while it shouldn't render at all.
It also renders totally black. You can see it if you make the duplicated object smaller, there are more artifacts coming not from the spheres, but also from the parent object.

The issue is that BKE_mesh_new_from_object() (or the python functions that use it: object_to_mesh(), new_from_object()) don't return the dupli groups converted to the final mesh.

What Blender does (in Cycles and in exporters) is to use object.dupli_list_create() and grab the objects and their matrices from it.

The options I thought of:

  1. To handle all of this in object_bake_api.c.

In order to do that I would replace all the BKE_mesh_new_from_object() calls by a new function that would get all the meshes of all the dupli objects, and join them as the final mesh to return. I have an idea of how to do this (but for the 'join'), but the biggest issue is that we need to guarantee that the mesh is "joined" just as it would in Cycles. In order to keep the primitive_id consistent.

  1. To handle this by changing the api to pass the object id and the object matrix.

This way we can pass each of the individual duplicated objects as an individual High Poly object to bake from.

@Brecht Van Lommel (brecht) , @Sergey Sharybin (sergey), any thoughts? I would like to have an agreed design before I head to the implementation.

@Dalai Felinto (dfelinto), passing object matrix seems cleaner solution for me and easier to implement. And would work faster than joining meshes i think.

At least i'd try matrix approach and see if all the corner cases are solved with this.

And would work faster than joining meshes I think.

It would be faster, but the memory footprint will go through the roofs.
I think we should first prioritize T41092 (or rather D772) before this one then.

:/ I pushed it to the wrong repository, it was never intended to go to blender.org

For the records, those are the test files I'm using lately. They both fail to bake properly at the moment.

Brecht Van Lommel (brecht) renamed this task from baking duplicate objects renders them black in Cycles, and also multiple times... to Cycles dupli object baking issues.