On 08/11/2014 at 02:10, xxxxxxxx wrote:
to support perfect spheres and also different projection types set in the Texture Tag you have to set the VOLUMEINFO_EVALUATEPROJECTION flag in GetRenderInfo().
You are right, that this solves the uv-mapping of the parametric spheres without turning the "render perfect" off. But it breaks my material preview. When I use the VOLUMEINFO_EVALUATEPROJECTION flag my material preview still shows my diffuse color, but as soon as I load a texture, the preview becomes completely black, when I remove my texture, it shows the diffuse color again and seems to work.
EDIT: I debugged it and this call in CalcSurface() :
m_pDiffuseTexture->GetPixel(x, y, &r, &g, &b);
always returns 0, 0, 0 for r, g, b when the render call is made for the preview.
When you use InitGLImage() you have to set the filled bitmap dirty using SetDirty(). This will trigger the update.
NICE! It works! For everyone else:
In: Bool MyMaterial::InitGLImage(BaseMaterial* mat, BaseDocument* doc, BaseThread* th, BaseBitmap* bmp, Int32 doccolorspace, Bool linearworkflow)
when you have set your pixels (in my case fetch a texture and multiply a color value) simply call:
in addition to the call, already in my sample:
I will close the other related thread and set it to solved. In this one we still have some issues with the preview and the projection evalutation.
My sample project available at the top shows how to create the preview. I copied it from one of the examples. As you might have noticed, there are still bugs in it.