[Bf-cycles] 2 questions and progress report on Cycles baking

Dalai Felinto dfelinto at gmail.com
Thu Jan 16 01:04:03 CET 2014

Hi Brecht,
Some heads up and two questions:

For reference through this email, the current work is on:
https://github.com/dfelinto/blender-git/tree/bake-cycles-dev (current work)
https://github.com/dfelinto/blender-git/tree/bake-cycles (stable, a
few commits before)

1) How to convert UV Barycentric to world coordinates?
uv_barycentric_to_world() in blender_camera.cpp

I assume Cycles may already have something for that?
If not, could you land me a hand on this?

2) How to access engine.re->result from Cycles?
(I need that for the populate_bake_result() in blender_session.cpp )
This I should be able to find by myself later, but I thought I may as
well ask ;)

3) How to test the current progress:
If you want to test the current status of the work you need:

(i ) A mesh with UV and some material
(ii) Set 'Save Buffers'
(iii) bpy.ops.object.bake(type='COMBINED')

[it can be any of Cycles renderpasses, but it has to be enabled in the
renderlayer panel, the renderlayer must be called "RenderLayer" for

(iv) Open the .exr Blender created temporarily.

Sample file: (press Run Script in Text Editor to run it, and open the
temp exr manually inside Blender):


4) Some Notes:

I decided to use the render structure for the baking (instead of
mimicking the importance sampling code). For that I created a new
internal camera type (BAKE) and I feed the camera with a few lookup
tables for the position and direction of the rays.

It seems like working well, apart from some small issues and the 2
open questions. The code to take a float result[] and write an
external image is already working, but for Cycles (see question 2) I'm
relying on the temporary EXR to see the result.

(I decided to post in the list since someone else may be interested on
this and may even be able to help with those questions)


More information about the Bf-cycles mailing list