<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
The BSDF was just a desesperate try, </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
For future readers: my bad was not connecting bkNode to the graph!<br>
<br>
<br>
Regards, F.</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>De:</b> Bf-cycles <bf-cycles-bounces@blender.org> en nombre de Brecht Van Lommel <brechtvanlommel@pandora.be><br>
<b>Enviado:</b> jueves, 22 de febrero de 2018 16:34<br>
<b>Para:</b> Discussion list to assist Cycles render engine developers<br>
<b>Asunto:</b> Re: [Bf-cycles] Creating a sky environment programatically</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>A couple issues:</div>
<div>* bkNode is not added to the background shader graph.<br>
* Don't add BSDF to the background shader, it makes no sense.<br>
* Connect bkNode->output("Background") to graph->output()->input("Surface") directly.</div>
<div><br>
<div><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:16px; font-style:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; background-color:rgb(255,255,255); float:none; display:inline"></span></div>
</div>
</div>
<div class="x_gmail_extra"><br>
<div class="x_gmail_quote">On Thu, Feb 22, 2018 at 3:27 PM, F Escobar <span dir="ltr">
<<a href="mailto:materialesescobar@hotmail.es" target="_blank">materialesescobar@hotmail.es</a>></span> wrote:<br>
<blockquote class="x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgba(0,0,0,0)">
I thought that this could be easy... but I was wrong<br>
<br>
<div>ccl::BackgroundNode* bkNode = new ccl::BackgroundNode();</div>
<div>ccl::Background* bk = scene->background;</div>
<div>ccl::Shader *shader = scene->default_background;
<div><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:16px; font-style:normal; font-weight:400">ccl::ShaderGraph *graph = </span><span style="font-style:normal; font-weight:400; font-size:16px; font-family:Calibri,Helvetica,sans-serif; color:rgb(0,0,0)">shader->graph </span><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:16px; font-style:normal; font-weight:400">;</span><br>
</div>
<div><br>
</div>
<div><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:16px; font-style:normal; font-weight:400">ccl::SkyTextureNode* sky = new ccl::SkyTextureNode();
<div><span style="background-color:rgba(0,0,0,0)">graph->add(sky);</span></div>
</span></div>
</div>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgba(0,0,0,0)">
<br>
<div>ccl::DiffuseBsdfNode *diffuseBSDF = new ccl::DiffuseBsdfNode();</div>
<div>graph->add(diffuseBSDF);</div>
<div>graph->connect(sky->output("<wbr>Color"), bkNode->input("Color"));</div>
<div>graph->connect(bkNode->output(<wbr>"Background"), diffuseBSDF->input("Color"));</div>
<div>graph->connect(diffuseBSDF-><wbr>output("BSDF"), graph->output()->input("<wbr>Surface"));</div>
<div>
<div><br>
</div>
<div>shader->tag_update(scene);</div>
<div><span style="white-space:pre-wrap"></span><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:16px; font-style:normal; font-weight:400">bk</span>->tag_update(scene);<br>
<br>
That looks fair on my head but I only get a black environment so that's wrong for sure.</div>
<div><br>
</div>
<div>Any Idea on this? I bet that is something related to update the bk or the bkNode.</div>
<div><br>
</div>
<div>Thank you in advance</div>
<br>
</div>
<br>
</div>
</div>
<br>
______________________________<wbr>_________________<br>
Bf-cycles mailing list<br>
<a href="mailto:Bf-cycles@blender.org">Bf-cycles@blender.org</a><br>
<a href="https://lists.blender.org/mailman/listinfo/bf-cycles" rel="noreferrer" target="_blank">https://lists.blender.org/<wbr>mailman/listinfo/bf-cycles</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</body>
</html>