Shader to texture?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/11/2010 at 19:44, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R12
Platform: Windows ;
Language(s) : C++ ;---------
I have a material using a Xtiles shader in the color channel, and I want to convert it to a bitmap.
I followed the code here:
https://developers.maxon.net/forum/topic/5075/5001_reading-texture-data&KW=PluginShader&PID=20508#20508
However, InitRender() always returns 0. No bitmap is generated. All passed parameters appear valid.
How can I convert this shader to a bitmap?//BaseContainer *data = mat->GetDataInstance(); //PluginShader *shader = (PluginShader* )data->GetLink(MATERIAL_COLOR_SHADER, doc, Xbitmap); BaseChannel *channel = mat->GetChannel(CHANNEL_COLOR); BaseShader *shader = channel->GetShader(); Filename docpath = doc->GetDocumentPath(); String matname = mat->GetName(); InitRenderStruct rs; rs.version = GetC4DVersion(); rs.time = doc->GetTime(); rs.fps = doc->GetFps(); rs.docpath = docpath; rs.matname = &matname; rs.errorlist = NULL; rs.vd = NULL; rs.doc = doc; rs.thread = NULL; rs.flags = INITRENDERFLAG_TEXTURES; BOOL br = shader->InitRender(rs); // returns zero BaseBitmap *bmp = shader->GetBitmap(); if (!bmp) return FALSE; // returns NULL GePrint(LongToString(bmp->GetBw())); GePrint(LongToString(bmp->GetBh())); shader->FreeRender();