<div dir="ltr">here is how it is done:<br>Attribute *attr_UV = attributes.add(ATTR_STD_UV);<br><div>UVMapNode* uvmap = new UVMapNode();</div><div>uvmap->attribute = ustring("");<br><br>this is per corner not per face or per vertex.<br>here is how I modify them in custom attributes: (per vertex for example):<br>Attribute *

<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps: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);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">attr_UV<span> </span></span>= attributes.add(ustring("your uv custom name"), TypeDesc::TypeVector, ATTR_ELEMENT_VERTEX);<br>

<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">UVMapNode* uvmap = new UVMapNode();</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">uvmap->attribute = ustring("

<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps: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);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">your uv custom name</span>

");<br><br>in that case you do it per vertex, so your iteration must be on (points) not on (faces * 3)</div>

<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 21, 2018 at 3:36 PM, Mohamed Sakr <span dir="ltr"><<a href="mailto:3dsakr@gmail.com" target="_blank">3dsakr@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">sorry my previous reply is wrong, what you do is already correct for the iteration, got confused here.<div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 21, 2018 at 3:18 PM, Mohamed Sakr <span dir="ltr"><<a href="mailto:3dsakr@gmail.com" target="_blank">3dsakr@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span>

<div style="color:rgb(33,33,33);font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps: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);text-decoration-style:initial;text-decoration-color:initial">for (int f = 0; f < facecount; f++)</div><div style="color:rgb(33,33,33);font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps: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);text-decoration-style:initial;text-decoration-color:initial"><span style="white-space:pre-wrap"></span>{</div><div style="color:rgb(33,33,33);font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps: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);text-decoration-style:initial;text-decoration-color:initial"><span style="white-space:pre-wrap"></span>for (int i = 0; i < 3; i++) //al faces are tris</div><div style="color:rgb(33,33,33);font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps: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);text-decoration-style:initial;text-decoration-color:initial"><span style="white-space:pre-wrap"></span>{</div><div style="color:rgb(33,33,33);font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps: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);text-decoration-style:initial;text-decoration-color:initial"><span style="white-space:pre-wrap"></span>attr_data_uv[uv*3 + i].x = 1.0; </div></span><div style="color:rgb(33,33,33);font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps: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);text-decoration-style:initial;text-decoration-color:initial"><span><span style="white-space:pre-wrap"></span>attr_data_uv[uv*3 + i].y = float(f) / 20.0f;</span><div><span><span style="font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;font-size:15px;color:rgb(33,33,33);white-space:pre-wrap"></span><span style="color:rgb(33,33,33);font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400">attr_data_uv[uv*3 + i].z = 0.0; <br></span><br></span>//correct<br>uv++;</div></div><div style="color:rgb(33,33,33);font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps: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);text-decoration-style:initial;text-decoration-color:initial"><span style="white-space:pre-wrap"></span>}</div><div style="color:rgb(33,33,33);font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps: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);text-decoration-style:initial;text-decoration-color:initial"><span style="white-space:pre-wrap"></span>uv++; // <<<<<wrong , should be inside the inner loop of i</div><span style="color:rgb(33,33,33);font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;white-space:pre-wrap"></span><span style="color:rgb(33,33,33);font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps: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);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">}</span>

<br></div><div class="m_8005014361234286456HOEnZb"><div class="m_8005014361234286456h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 21, 2018 at 1:12 PM, F Escobar <span dir="ltr"><<a href="mailto:materialesescobar@hotmail.es" target="_blank">materialesescobar@hotmail.es</a>></span> wrote:<br><blockquote class="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 didn't manage to make this working yet</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)">
<span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400">*
 UVs are per face corner by default, verify that you are doing that or switch to ATTR_ELEMENT_VERTEX.</span><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)">
<span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400">I'm
 creating it per face, probably in the future I'll move to <span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400">ATTR_ELEMENT_VERTEX
 but it is easier to keep in the simplified method for now.</span></span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
<span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400"><span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400"><br>
</span></span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
<span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400"><span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400"><span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400">*
 Adding some random value like 0.12345 to all UV coordinates to see if they are having an effect at all.</span><br>
</span></span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
<span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400"><span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400"><span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400">Unfortunatly
 I had no luck with this.<br>
<br>
<div><span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400">*
 Create just an UVMapNode and output that directly, to see if the UV coordinates are getting loaded.</span><br>
</div>
<div><span style="white-space:pre-wrap"></span>ccl::UVMapNode *uvnode = new ccl::UVMapNode();</div>
<div><span style="white-space:pre-wrap"></span>uvnode->attribute = ccl::ustring("UVMap");</div>
<div><span style="white-space:pre-wrap"></span>graph->add(uvnode);</div>
<div>
<div><span style="white-space:pre-wrap"></span>graph->connect(uvnode->output(<wbr>"UV"), bsdf->input("Color"));</div>
<div><br>
</div>
<div>I tried that but it is always black (I assume that it means 0 0 ), notice that if I connect a texture to bsdf->input("Color") it is rendered in a plain color (uvs are wrong) but the color is given by the texture so the shader looks ok.</div>
<br>
</div>
<br>
<br>
The mesh was created like this:<br>
<div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>ccl::Attribute *attr_uv = mesh->attributes.add(ccl::ATTR<wbr>_STD_UV, ccl::ustring("UVMap"));</div>
<div><span style="white-space:pre-wrap"></span>ccl::float3 *attr_data_uv = attr_uv->data_float3();</div>
</div>
<div><span style="white-space:pre-wrap"></span>for (int f = 0; f < facecount; f++)</div>
<div><span style="white-space:pre-wrap"></span>{</div>
<div><span style="white-space:pre-wrap"></span>for (int i = 0; i < 3; i++) //al faces are tris</div>
<div><span style="white-space:pre-wrap"></span>{</div>
<div><span style="white-space:pre-wrap"></span>attr_data_uv[uv*3 + i].x = 1.0; </div>
<div><span style="white-space:pre-wrap"></span>attr_data_uv[uv*3 + i].y = float(f) / 20.0f;
<div><span style="font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;font-size:15px;font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;color:rgb(33,33,33);white-space:pre-wrap"></span><span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400">attr_data_uv[uv*3
 + i].z = 0.0; </span><br>
</div>
</div>
<div><span style="white-space:pre-wrap"></span>}</div>
<div><span style="white-space:pre-wrap"></span>uv++;</div>
<span style="font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;font-size:15px;font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;color:rgb(33,33,33);white-space:pre-wrap"></span>}<br>
</span></span></span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
<span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400"><span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400"><span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400"><br>
</span></span></span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
<span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400"><span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400"><span style="color:rgb(33,33,33);font-family:"Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400">I'm
 not sure if I missed any step.<br>
<br>
Thank you in advance</span></span></span></div>
<hr style="display:inline-block;width:98%">
<div id="m_8005014361234286456m_7312951171274461593m_8538331014972243960divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>De:</b> <a href="mailto:brechtvanlommel@gmail.com" target="_blank">brechtvanlommel@gmail.com</a> <<a href="mailto:brechtvanlommel@gmail.com" target="_blank">brechtvanlommel@gmail.com</a>> en nombre de Brecht Van Lommel <<a href="mailto:brechtvanlommel@pandora.be" target="_blank">brechtvanlommel@pandora.be</a>><br>
<b>Enviado:</b> martes, 13 de febrero de 2018 15:05<br>
<b>Para:</b> F Escobar<br>
<b>Cc:</b> Discussion list to assist Cycles render engine developers<br>
<b>Asunto:</b> Re: [Bf-cycles] Any sample on creating basic materials from scratch?</font>
<div> </div>
</div>
<div>
<div dir="ltr">The checker texture will not use UV coordinates by default, you'd need to link in a UVMapNode node for that. For the image texture node it should work though.
<div><br>
</div>
<div>It's not clear to me what is wrong. A few things you could try:</div>
<div>* UVs are per face corner by default, verify that you are doing that or switch to ATTR_ELEMENT_VERTEX.</div>
<div>* Adding some random value like 0.12345 to all UV coordinates to see if they are having an effect at all.</div>
<div>* Create just an UVMapNode and output that directly, to see if the UV coordinates are getting loaded.</div>
<div><br>
</div>
</div>
<div class="m_8005014361234286456m_7312951171274461593m_8538331014972243960x_gmail_extra"><br>
<div class="m_8005014361234286456m_7312951171274461593m_8538331014972243960x_gmail_quote">On Tue, Feb 13, 2018 at 2:25 PM, F Escobar <span dir="ltr">
<<a href="mailto:materialesescobar@hotmail.es" target="_blank">materialesescobar@hotmail.es</a>></span> wrote:<br>
<blockquote class="m_8005014361234286456m_7312951171274461593m_8538331014972243960x_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)">
Thank you it worked like a charm!</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)">
I'm driving nuts with other issue now <br>
<br>
I've created my UVs with<br>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>ccl::Attribute *attr_uv = mesh->attributes.add(ccl::ATTR<wbr>_STD_UV, ccl::ustring("UV"));</div>
<div><span style="white-space:pre-wrap"></span>ccl::float3 *attr_data_uv = attr_uv->data_float3();</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>
Filled <span style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif;font-size:16px;font-style:normal;font-weight:400">attr_data_uv</span> and so, but I cannot see the checker only one plain color, same issue if I use a ImageTextureNode even if
 I set Tex->projection = ccl::NodeImageProjection::NODE<wbr>_IMAGE_PROJ_BOX;</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)">
Any tip on this?</div>
<hr style="display:inline-block;width:98%">
<div id="m_8005014361234286456m_7312951171274461593m_8538331014972243960x_m_-5956384996399456495divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>De:</b> Bf-cycles <<a href="mailto:bf-cycles-bounces@blender.org" target="_blank">bf-cycles-bounces@blender.org</a><wbr>> en
 nombre de Brecht Van Lommel <<a href="mailto:brechtvanlommel@pandora.be" target="_blank">brechtvanlommel@pandora.be</a>><br>
<b>Enviado:</b> jueves, 8 de febrero de 2018 15:34<br>
<b>Para:</b> Discussion list to assist Cycles render engine developers<br>
<b>Asunto:</b> Re: [Bf-cycles] Any sample on creating basic materials from scratch?</font>
<div> </div>
</div>
<div>
<div class="m_8005014361234286456m_7312951171274461593m_8538331014972243960x_h5">
<div>
<div dir="ltr">Hi,
<div><br>
</div>
<div>We don't have any example code for this specifically. It's easiest to create node with the corresponding class directly.
<div><br>
</div>
<font face="monospace, monospace">CheckerTextureNode *checker = new CheckerTextureNode();<br>
checker->color1 = make_float3(1.0f, 0.0f, 0.0f);<br>
checker->color2 = make_float3(0.0f, 0.0f, 1.0f);<br>
checker->scale = 1.0f;<br>
graph->add(checker);<br>
shader->set_graph(graph);</font>
<div><br>
</div>
<div>If you want to use the generic API, don't create your own <font face="monospace, monospace">
SocketType</font>, look it up in the node.</div>
<div><br>
</div>
<div><font face="monospace, monospace">const SocketType *color1 = snode->find_input(ustring("col<wbr>or1"));</font></div>
<div><font face="monospace, monospace">snode->set(*color1, make_float<wbr>3(1.0f, 0.0f, 0.0f));</font></div>
<div><br>
Regards,</div>
<div>Brecht.</div>
<div><br>
</div>
</div>
</div>
<div class="m_8005014361234286456m_7312951171274461593m_8538331014972243960x_m_-5956384996399456495x_gmail_extra"><br>
<div class="m_8005014361234286456m_7312951171274461593m_8538331014972243960x_m_-5956384996399456495x_gmail_quote">On Thu, Feb 8, 2018 at 2:13 PM, F Escobar
<span dir="ltr"><<a href="mailto:materialesescobar@hotmail.es" target="_blank">materialesescobar@hotmail.es</a>></span> wrote:<br>
<blockquote class="m_8005014361234286456m_7312951171274461593m_8538331014972243960x_m_-5956384996399456495x_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)">
<div><span style="background-color:rgba(0,0,0,0)">I tried with this:</span><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>ccl::Shader *shader = new ccl::Shader();</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>if (scene != NULL)</div>
<div><span style="white-space:pre-wrap"></span>scene->shaders.push_back(shade<wbr>r);</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>shader->name=ccl::ustring(mate<wbr>rial->mName);</div>
<div><span style="white-space:pre-wrap"></span>ccl::ShaderGraph *graph = new ccl::ShaderGraph();</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>const ccl::NodeType *node_type = ccl::NodeType::find(ccl::ustri<wbr>ng("checker_texture"));</div>
<div><span style="white-space:pre-wrap"></span>if (!node_type) {</div>
<div><span style="white-space:pre-wrap"></span>fprintf(stderr, "Unknown shader node \n");</div>
<div><span style="white-space:pre-wrap"></span>}</div>
<div><span style="white-space:pre-wrap"></span>else if (node_type->type != ccl::NodeType::SHADER) {</div>
<div><span style="white-space:pre-wrap"></span>fprintf(stderr, "Node type \"%s\" is not a shader node.\n", node_type->name.c_str());</div>
<div><span style="white-space:pre-wrap"></span>}</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>ccl::ShaderNode* snode = (ccl::ShaderNode*)node_type->c<wbr>reate(node_type);</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>ccl::SocketType color1;</div>
<div><span style="white-space:pre-wrap"></span>color1.type = ccl::SocketType::COLOR;</div>
<div><span style="white-space:pre-wrap"></span><a href="http://color1.name" target="_blank">color1.name</a> = ccl::ustring("color1");</div>
<div><span style="white-space:pre-wrap"></span>snode->set(color1, ccl::make_float3(1.0f, 0.0f, 0.0f));</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>ccl::SocketType color2;</div>
<div><span style="white-space:pre-wrap"></span>color2.type = ccl::SocketType::COLOR;</div>
<div><span style="white-space:pre-wrap"></span><a href="http://color2.name" target="_blank">color2.name</a> = ccl::ustring("color2");</div>
<div><span style="white-space:pre-wrap"></span>snode->set(color2, ccl::make_float3(0.0f, 0.0f, 1.0f));</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>ccl::SocketType scale;</div>
<div><span style="white-space:pre-wrap"></span>scale.type = ccl::SocketType::FLOAT;</div>
<div><span style="white-space:pre-wrap"></span><a href="http://scale.name" target="_blank">scale.name</a> = ccl::ustring("scale");</div>
<div><span style="white-space:pre-wrap"></span>snode->set(scale, 1.0f);
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>graph->add(snode);</div>
<div><span style="white-space:pre-wrap"></span>shader->set_graph(graph);</div>
</div>
<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)">
<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)">
But I had crashes creating color2 probably I'm doing it wrongly, is there any sample on this?</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)">
<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)">
Thank you in advance.</div>
</div>
<br>
______________________________<wbr>_________________<br>
Bf-cycles mailing list<br>
<a href="mailto:Bf-cycles@blender.org" target="_blank">Bf-cycles@blender.org</a><br>
<a href="https://lists.blender.org/mailman/listinfo/bf-cycles" rel="noreferrer" target="_blank">https://lists.blender.org/mail<wbr>man/listinfo/bf-cycles</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>

<br>______________________________<wbr>_________________<br>
Bf-cycles mailing list<br>
<a href="mailto:Bf-cycles@blender.org" target="_blank">Bf-cycles@blender.org</a><br>
<a href="https://lists.blender.org/mailman/listinfo/bf-cycles" rel="noreferrer" target="_blank">https://lists.blender.org/mail<wbr>man/listinfo/bf-cycles</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>