Slow preview object rotation in custom material
-
On 02/06/2017 at 08:55, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R18
Platform: Windows ; Mac ;
Language(s) : C++ ;---------
Hi,not sure this is a bug, but I am handling the material previews as suggested in the simplematerial example.
Since R18, rotating the material preview object in my custom material causes high cpu usage and each frame renders very slowly (~1s), which is odd, because it is using RENDERENGINE_PREVIEWSOFTWARE.
Apart from handling MATPREVIEW_GET_OBJECT_INFO and MATPREVIEW_GENERATE_IMAGE, none of my code is called when rotating.
Something similar can be observed in C4Ds own material. When you start rotating, there is a long delay (~1s) on the first frame and then it's smooth.
R17 and prior, everything works as expected.
-
On 05/06/2017 at 09:48, xxxxxxxx wrote:
Hi Fused, thanks for writing us (and personally speaking nice to talk you back here after not being active for a way looong time in the Indigo Renderer forum).
With reference to your request, I confirm I'm able to reproduce the behavior mentioned and at a first glance it seems you've hit a bug. I need a few days more to better investigate the behavior change from R17 to R18 in order to confirm it.
At the same time, to limit the material thumbnail generation issue and stick to the behavior occurring when using standard R18 material (lag occurring only at beginning of the material preview interaction) i suggest, rather than using the messaging mechanism implemented in the simplematerial example, to include in the .res file the Mpreview widget beside the Mbase , and Massign ones and rely on this mechanism for material thumbnail generation.
CONTAINER Msupport_13632 { NAME Mrgigante_13632; INCLUDE Mpreview; INCLUDE Mbase; GROUP ID_MATERIALPROPERTIES { COLOR SUPPORT_13632_COLOR {} } INCLUDE Massign; }
Once you're done with this change you can consider even to implement the MaterialData::InitGLImage() in order to provide the preview dummy object, while interacting with the preview scene, with a GL representation to see textures and shaders shown on the fly.
Looking forward talking to you again, give best.
Riccardo -
On 06/06/2017 at 03:32, xxxxxxxx wrote:
Hey Riccardo,
Thank you for your help, I will look into your suggestion.
It really has been a long time, and a very nice surprise to meet you here.
Much appreciated, we should catch up some time.
Best wishes,
Yves