[Bf-cycles] 2 questions and progress report on Cycles baking
Brecht Van Lommel
brechtvanlommel at pandora.be
Thu Jan 16 15:40:05 CET 2014
On Thu, Jan 16, 2014 at 1:04 AM, Dalai Felinto <dfelinto at gmail.com> wrote:
> 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?
There isn't really a function for this outside the kernel, but why do
you need this here? You should pass the UV coordinates to the kernel,
and in the kernel it can then map them to world coordinate on the
surface of the mesh. If you look at kernel_displace.h, there it calls
shader_setup_from_displace with UV coordinates, and then ShaderData.P
will be the world space position.
> 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 ;)
Not sure what you need this for, but the typical way is to call
b_engine.begin_result() and then it gives you a temporary RenderResult
for the tile, which will be merged back into the main one which is not
For baking you shouldn't need access to a RenderResult, it shouldn't
exist then as far as I know?
> 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.
Why did you do this, what problem does it solve? It doesn't seem like
a good idea to mix these things. You could prototype the code like
this, but it shouldn't be difficult to create a dedicated kernel
function for baking.
More information about the Bf-cycles