[Bf-cycles] Creating a sky environment programatically

Mohamed Sakr 3dsakr at gmail.com
Thu Feb 22 16:28:59 CET 2018


 graph->add(diffuseBSDF);// << wrong, no diffuse in bg (environment)
material
graph->connect(sky->output("Color"), bkNode->input("Color"));// << correct
graph->connect(bkNode->output("Background"), diffuseBSDF->input("Color"));
//<< wrong as there is no diffuse
graph->connect(diffuseBSDF->output("BSDF"),
graph->output()->input("Surface"));//<<
wrong as there is no diffuse


graph->connect(sky->output("Color"), bkNode->input("Color"));
graph->connect(bkNode->output("Background"), graph->output()->input("
Surface"));

On Thu, Feb 22, 2018 at 4:27 PM, F Escobar <materialesescobar at hotmail.es>
wrote:

> 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
>
>
>
> _______________________________________________
> Bf-cycles mailing list
> Bf-cycles at blender.org
> https://lists.blender.org/mailman/listinfo/bf-cycles
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-cycles/attachments/20180222/1efa064c/attachment.html>


More information about the Bf-cycles mailing list