<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Sampling a Fusion shader]]></title><description><![CDATA[<p dir="auto">I'm writing a ShaderData plugin and what I want to do is sample a Fusion shader created programatically in the InitRender() function of my plugin.</p>
<p dir="auto">I'm not even sure if this is feasible, but it doesn't work as expected. Here is the code to create the Fusion shader:</p>
<pre><code>m_fusion = BaseShader::Alloc(Xfusion);
GeData gd;
if (m_fusion != nullptr)
{
	m_fusionBlendShader = BaseShader::Alloc(Xcolor);
	if (m_fusionBlendShader != nullptr)
	{
		m_fusionBlendShader-&gt;InitRender(irs);
		gd.SetBaseList2D(m_fusionBlendShader);
		const DescID blendID = ConstDescID(DescLevel(SLA_FUSION_BLEND_CHANNEL, DTYPE_BASELISTLINK, 0));
		m_fusion-&gt;SetParameter(blendID, gd, DESCFLAGS_SET::NONE);
	}
	m_fusionBaseShader = BaseShader::Alloc(Xcolor);
	if (m_fusionBaseShader != nullptr)
	{
		m_fusionBaseShader-&gt;InitRender(irs);
		gd.SetBaseList2D(m_fusionBaseShader);
		const DescID baseID = ConstDescID(DescLevel(SLA_FUSION_BASE_CHANNEL, DTYPE_BASELISTLINK, 0));
		m_fusion-&gt;SetParameter(baseID, gd, DESCFLAGS_SET::NONE);
	}
	m_fusion-&gt;InitRender(irs);
	m_fusionInitCount++;
}
</code></pre>
<p dir="auto">I've just used color shaders in the Fusion blend and base channels for convenience; this should cause the Fusion to return pure white.</p>
<p dir="auto">Everything seems to work as expected, in that it compiles and runs and the shaders are all allocated, but when I sample the Fusion shader in my shader's Output function, it always returns black. I'm not sure if this is because I haven't set the blend and base channels correctly or if this simply can't work, so any advice would be greatly appreciated.</p>
<p dir="auto">Many thanks,<br />
Steve</p>
]]></description><link>http://developers.maxon.net/forum/topic/15565/sampling-a-fusion-shader</link><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Nov 2026 20:02:32 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/15565.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 11 Jun 2024 12:48:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Sampling a Fusion shader on Tue, 11 Jun 2024 18:33:05 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/ferdinand">@<bdi>ferdinand</bdi></a>,</p>
<p dir="auto">Thanks for this, inserting the colour shaders uner the Fusion shader and then inserting the Fusion shader under my shader works fine.</p>
<p dir="auto">I must admit this is my fault. Because the  shaders are all created in the InitRender() of my plugin, I didn't think they needed to be (or could be) inserted under my shader. I figured it would be different if the shaders were going to be added to a link field and stay in the document, but not if they're just created then destroyed when done with. So that's very useful to know.</p>
<p dir="auto">Thanks again,<br />
Steve</p>
]]></description><link>http://developers.maxon.net/forum/post/74459</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/74459</guid><dc:creator><![CDATA[spedler]]></dc:creator><pubDate>Tue, 11 Jun 2024 18:33:05 GMT</pubDate></item><item><title><![CDATA[Reply to Sampling a Fusion shader on Tue, 11 Jun 2024 16:47:48 GMT]]></title><description><![CDATA[<p dir="auto">Hey <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/spedler">@<bdi>spedler</bdi></a>,</p>
<p dir="auto">Thank you for reaching out to us. At a glance, the issue seems to be that you do not insert the shaders into the fusion shader. You might want to have a look at <a href="https://developers.maxon.net/docs/cpp/2024_4_0/page_manual_baseshader.html#page_manual_baseshader_access" target="_blank" rel="noopener noreferrer nofollow ugc">Base Shader Manual: Access and Structure</a> which I once added for the very case of you are currently in: Shaders which own shaders.</p>
<p dir="auto">In case that this does not solve your issue, I would have to ask for a bit more complete code example, so that we can more easily run your code.</p>
<p dir="auto">Cheers,<br />
Ferdinand</p>
]]></description><link>http://developers.maxon.net/forum/post/74458</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/74458</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Tue, 11 Jun 2024 16:47:48 GMT</pubDate></item></channel></rss>