On 07/01/2015 at 21:09, xxxxxxxx wrote:
Hi Joey,
thanks for the reply, I understand that my questions are too broad
, let me simplify what I'm doing.
I got my own render engine "similar to vray, Maxwell, or any other commercial render engine" , which is registered as PLUGINFLAG_VIDEOPOST_ISRENDERER, when I click the render button or the render to picture viewer, it runs the Execute() function of my VideoPost Renderer correctly.
about what I understand "and can do" so far:
I know how to create the dialogue, and splitting/putting different stuff inside it "including user area"
I know how to handle a Bitmap "converting data, saving, loading,..."
what I don't know:
1- if I call RenderDocument() and my Renderer is chosen from the Renderers drop down menu "where there is Physical, Standard, Software,Hardware, ..." will this call the Execute() function from my VideoPost Renderer?
2- I'm still aware of how it fills the Bitmap, for example I fill the Buffer in the Execute function in a way similar to the "vpvisualizenormals" example in the SDK.
3- let's consider I have a ready Bitmap, a user area, how to draw the Bitmap in that user area
how my Renderer works:
it is a subclass of VideoPostData , inside the Execute() function:
if (vps->vp==VIDEOPOSTCALL_RENDER && vps->open)
{
vps->vd->SkipRenderProcess();
RenderCtx = RenderCtxCreate();//called from my Render Engine DLL
//init some data, like Camera, Objects from RayObject, etc..
RenderCtx ->Init();
RayCamera *RCam = vps->vd->GetRayCamera();
float trCamera[16] = { RCam->m.v1.x, RCam->m.v2.x, RCam->m.v3.x, 0.f,
RCam->m.v1.y, RCam->m.v2.y, RCam->m.v3.y, 0.f,
RCam->m.v1.z, RCam->m.v2.z, RCam->m.v3.z, 0.f,
0.f, 0.f, 0.f, 1.f};
RenderCtx ->Integrator(string("pathtracer"), -1);
RenderCtx ->Transform(trCamera);
RenderCtx ->Translate(-RCam->m.off.x, -RCam->m.off.y, -RCam->m.off.z);
RenderCtx ->Film(string("imagefilm"), string("my-test-scene.exr"), 1024, 768, nullptr);
Int32 objCount = vps->vd->GetObjCount();
for(Int32 i = 0; i < objCount; ++i)
{
RayObject *op = vps->vd->GetObj(i);
if(op->type == O_POLYGON)
{
const Vector *points = op->padr;
const RayPolygon *polys = op->vadr;
vector<int> pointIndices(0);
pointIndices.reserve(op->pcnt);
int totalPointsIndices = 0;
vector<float> AllPoints(0);
AllPoints.reserve(op->vcnt * 3);
int totalPointsData = 0;
int totalPreviousIndex = 0;
for(Int32 j = 0; j < op->vcnt; ++j)
{
int nIndices = (polys[j].c != polys[j].d)? 6 : 3;
int npIndices = (polys[j].c != polys[j].d)? 12 : 9;
pointIndices.push_back(0 + totalPreviousIndex);
pointIndices.push_back(2 + totalPreviousIndex);
pointIndices.push_back(1 + totalPreviousIndex);
if(nIndices == 6)
{
pointIndices.push_back(0 + totalPreviousIndex);
pointIndices.push_back(3 + totalPreviousIndex);
pointIndices.push_back(2 + totalPreviousIndex);
}
totalPreviousIndex += (polys[j].c != polys[j].d)? 4 : 3;
AllPoints.push_back(points[polys[j].a].x);
AllPoints.push_back(points[polys[j].a].y);
AllPoints.push_back(points[polys[j].a].z);
AllPoints.push_back(points[polys[j].b].x);
AllPoints.push_back(points[polys[j].b].y);
AllPoints.push_back(points[polys[j].b].z);
AllPoints.push_back(points[polys[j].c].x);
AllPoints.push_back(points[polys[j].c].y);
AllPoints.push_back(points[polys[j].c].z);
if(npIndices == 12)
{
AllPoints.push_back(points[polys[j].d].x);
AllPoints.push_back(points[polys[j].d].y);
AllPoints.push_back(points[polys[j].d].z);
}
totalPointsIndices += nIndices;
totalPointsData += npIndices;
}
RenderCtx ->Object(string("trianglemesh"), &pointIndices[0], totalPointsIndices, &AllPoints[0], totalPointsData, nullptr, 0, -1);
}
}
RenderCtx ->Render();//I can pass a float* for the Bitmap data, ID for which render layer to fill "copy to the pointer"