[Bf-cycles] Creating a sky environment programatically

F Escobar materialesescobar at hotmail.es
Thu Feb 22 15:27:18 CET 2018


I thought that this could be easy... but I was wrong

ccl::BackgroundNode* bkNode = new ccl::BackgroundNode();
ccl::Background* bk = scene->background;
ccl::Shader *shader = scene->default_background;
ccl::ShaderGraph *graph = shader->graph ;

ccl::SkyTextureNode* sky = new ccl::SkyTextureNode();
graph->add(sky);

ccl::DiffuseBsdfNode *diffuseBSDF = new ccl::DiffuseBsdfNode();
graph->add(diffuseBSDF);
graph->connect(sky->output("Color"), bkNode->input("Color"));
graph->connect(bkNode->output("Background"), diffuseBSDF->input("Color"));
graph->connect(diffuseBSDF->output("BSDF"), graph->output()->input("Surface"));

shader->tag_update(scene);
bk->tag_update(scene);

That looks fair on my head but I only get a black environment so that's wrong for sure.

Any Idea on this? I bet that is something related to update the bk or the bkNode.

Thank you in advance


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-cycles/attachments/20180222/ca6b25ee/attachment.html>


More information about the Bf-cycles mailing list