On 30/10/2014 at 09:45, xxxxxxxx wrote:
Cinema 4D Version: 15
Platform: Windows ;
Language(s) : C++ ;
===== Download for complete sample that illustrates the described bugs ======
Test scene including a texture and some geometry to showcase the bugs:
Visual Studio 2012 Project with "MyMaterial" including all resources. I kept the Plugin.cdl64 in it if you simply want to test the plugin without recompiling it. Note that it was compiled for R15.
===== Problem 1 - UV mapping of parametric sphere with parent in editor viewport ======
I got the rendering of my material working in the editor by using InitGlImage().
It seems to work for:
* Everything when OpenGL is disabled in the Preferences (so software rendering is used)
* All polygonized/editable objects (at least I have not encountered a problem here)
* All parametric objects except spheres
* Spheres if they are not in any hierarchy
It does not work for:
* A sphere that is a child of another object where the material is assigned to one of its parents
To verify this bug please download and open the test scene. Simply turn OpenGL on and off and watch how the uv mapping of the sphere is broken when OpenGL is on:
_<_img src="https://dl.dropboxusercontent.com/u/15216944/c4dforum/mymaterial_sphere_uv_mapping.png" height="249" width="901" border="0" /_>_
===== Problem 2 - UV mapping of parametric spheres when rendering ========
I also got the rendering working by implementing CalcSurface etc.
It seems to work for all polygonzed/editable objects as well as for all parametric object, except:
To verify this bug, please download and open the test scene and simply hit render. Below you can see that the two parametric spheres have wrong uv-mapping where the right one, being a polygon object, shows the correct uv-mapping.
<_<_img src="https://dl.dropboxusercontent.com/u/15216944/c4dforum/standardrenderer_sphere_wrong_uv_mapping.png" height="358" width="843" border="0" /_>_" />
===== Problem 3 - Parameter updates when OpenGL is enabled ========
This problem was already explained here:
Nobody seems to know an answer and Andreas Block told me that this is a little bit more complicated, so I decided to reformulate the problem here including a whole project to replicate the bug.
In the next image you can see that all parameter updates are performed "one step behind". This only happens when OpenGL is enabled. If the diffuse color is, for example, green and I want to change it to blue, then the update is only performed in the preview but not visible in the editor. As soon as I change any other parameter or the diffuse color, the changes can be seen in the editor, but always on update step behind. The "dark purple" in the last image should be blue, I had to recreate the image, sorry for that ;-)
Note that I added an EventAdd() to solve the same issue when OpenGL was disabled. This unfortunately didn't solve the problem for OpenGL though.
===== Outro ========
If you have any problems compiling/opening any of the attached files, please tell me.
This post cost me quite some time, so I would really appreciate help and answers from the support team. Some of the bugs seem to require one of the developers, I believe.
If we could solve all the problems in this post, it seems to be a great addition to the sdk-samples, because it illustrates how to emulate the C4D materials in a custom way.
Thank you all!