[Bf-cycles] Creating a sky environment programatically

Brecht Van Lommel brechtvanlommel at pandora.be
Thu Feb 22 16:34:17 CET 2018


A couple issues:
* bkNode is not added to the background shader graph.
* Don't add BSDF to the background shader, it makes no sense.
* Connect bkNode->output("Background") to graph->output()->input("Surface")
directly.


On Thu, Feb 22, 2018 at 3: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/1e2e97c0/attachment.html>


More information about the Bf-cycles mailing list