<?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[Shader bitmap rendering with MemoryFileStruct]]></title><description><![CDATA[<p dir="auto">Hi Folks,</p>
<p dir="auto">Terribly sorry, hoping not to take up anyone's time too much. But I can't see the forest through the trees on this one, and hoping someone can easily fix me!</p>
<p dir="auto">I have a document, housed at class level. I use it to render a simple scene, and then display the resulting image as a bitmap for the user. Inside this scene is an object with an assigned material that has a bitmap shader in it's colour channel. Everything works fine if I set the shader bitmap to a file on disk. But as soon as I try to use a bitmap I've drawn myself, it either renders blank, or throws a 'missing asset' error.</p>
<p dir="auto">End goal here is to render the shader with a bitmap I've created in memory.</p>
<p dir="auto">Some pseudo code below. Note - I'm cutting all the fluff out trying to keep it simple and to the point:</p>
<pre><code>void RenderMyDoc(...)
{
	// setup scene objects and shaders etc..
	
	BaseBitmap *bmp = ...;
	AutoAlloc&lt;BaseFile&gt; writeHandler;
	MemoryFileStruct *mfs = ...;
	Filename fn;
	fn.SetMemoryWriteMode(mfs);
	bmp-&gt;Save(fn,...);
	
	/* Also tried with the following (scoped here just for clarity) */
	{
		fn.SetMemoryReadMode(void_p_here,void_p_sizehere);
		writeHandler-&gt;Open(fn,...);
		writeHandler-&gt;WriteBytes(void_p_here,void_p_sizehere);
		// p.s. the void* and void data size all report numbers
		
		/* Wondering if it was because of the empty fn path, I tried calling GenerateTexturePath() on the fn, to no avail */
	}
	
	// Add to shader
	shader-&gt;SetParameter(BITMAPSHADER_FILENAME,GeData(fn),...);
	
	// A few other things here etc..
	
	// Render doc here all works, except when using my own bitmap
	RenderDoc(...);
}
</code></pre>
<p dir="auto">If I show the bitmap using the filename in the picture viewer, it works. But not when rendered. Sometimes it presents an 'Open file' dialog, despite having WriteMode set to the memory struct. I've seen quite a few topics elsewhere with python code, but my interpretation of python into C++ just isn't working. What am I doing wrong here?</p>
<p dir="auto">Hoping someone can fill the gaps for me. Cheers,</p>
<p dir="auto">WP.</p>
]]></description><link>http://developers.maxon.net/forum/topic/16409/shader-bitmap-rendering-with-memoryfilestruct</link><generator>RSS for Node</generator><lastBuildDate>Sat, 09 May 2026 08:31:54 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/16409.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 07 May 2026 10:28:47 GMT</pubDate><ttl>60</ttl></channel></rss>