LoadDocument()
-
On 18/02/2015 at 07:01, xxxxxxxx wrote:
Hello,
sorry, I cannot reproduce your results. Can you please share details about your Cinema 4D version and provide a scene file illustrating your results?
Best wishes,
Sebastian -
On 18/02/2015 at 19:20, xxxxxxxx wrote:
Hi Sebastian,
yeah sure. Doing all testing on R14.042 32bit. Build RC76788. PM sent with scene file as I don't think I can upload files here.
One thing I've noticed is that I only seem to get the alpha when the save path etc details are included. So if you untick the save in the render settings, or leave the path blank, it won't work. Don't know if that helps any more?
Cheers,
WP.
-
On 20/02/2015 at 06:37, xxxxxxxx wrote:
Hello,
the alpha channel you discovered is actually no feature of Cinema 4D. It is only usefull in special, internal cases and should not be used.
Best wishes,
Sebastian -
On 20/02/2015 at 16:56, xxxxxxxx wrote:
Hi Seb,
thanks for the update!
This still leaves the question though - how can I get an editor-style render with an alpha? A virtual viewport? VideoPost plugin? Something else?
A big part of the plugin is riding on this bit working
WP.
-
On 20/02/2015 at 18:56, xxxxxxxx wrote:
hey,
here is how you can get the alpha , it is a video post plugin for sure, modify vpvisualizenormals example to be like this:
RENDERRESULT VisualizePostData::Execute(BaseVideoPost* node, VideoPostStruct* vps) { if (vps->vp == VIDEOPOSTCALL_RENDER && !vps->open && *vps->error == RENDERRESULT_OK && !vps->thread->TestBreak()) { VPBuffer* rgba = vps->render->GetBuffer(VPBUFFER_RGBA, NOTOK); RayParameter* ray = vps->vd->GetRayParameter(); // only in VP_INNER & VIDEOPOSTCALL_RENDER if (!ray) return RENDERRESULT_OUTOFMEMORY; if (!rgba) return RENDERRESULT_OUTOFMEMORY; Int32 x1, y1, x2, y2, x, y, cnt; // example functions Int32 cpp = rgba->GetInfo(VPGETINFO_CPP); x1 = ray->left; y1 = ray->top; x2 = ray->right; y2 = ray->bottom; cnt = x2 - x1 + 1; Int bufferSize = cpp * cnt; Float32* b, *buffer = nullptr; if (bufferSize > 0) buffer = NewMemClear(Float32, bufferSize); if (!buffer) return RENDERRESULT_OUTOFMEMORY; for (y = y1; y <= y2; y++) { rgba->GetLine(x1, y, cnt, buffer, 32, true); VPFragment** frag = vps->vd->GetFragments(x1, y, cnt, VPGETFRAGMENTS_Z_P | VPGETFRAGMENTS_N), ** ind = frag; if (!frag) continue; for (b = buffer, x = x1; x <= x2; x++, b += cpp, ind++) { //Vector32 col = Vector32(0.0); //VPFragment* f; //for (f = (*ind); f; f = f->next) // col += (Vector32(Abs(f->n.x), Abs(f->n.y), Abs(f->n.z)) * f->weight) * f->color; //col /= (Float32) 256.0; //b[0] = col.x; //b[1] = col.y; //b[2] = col.z; Ray anyray; vps->vd->GetRay(x, y, &anyray); SurfaceIntersection si(DC); if(vps->vd->TraceGeometry(&anyray, 1e30, RayHitID(), &si) == TRUE)//intersects, fill alpha, here i fill color { b[0] = 1.f; b[1] = 1.f; b[2] = 1.f; } else { b[0] = 0.f; b[1] = 0.f; b[2] = 0.f; } } DeleteMem(frag); rgba->SetLine(x1, y, cnt, buffer, 32, true); } DeleteMem(buffer); } return RENDERRESULT_OK; }
Bool VisualizePostData::RenderEngineCheck(BaseVideoPost* node, Int32 id) { return true; }
happy ray tracing
-
On 20/02/2015 at 19:58, xxxxxxxx wrote:
BTW it doesn't work for software renderer with picture viewer "only in viewport" , may the SDK support team help in this case
-
On 20/02/2015 at 20:40, xxxxxxxx wrote:
Hi Mohamed!
unfortunately, on some (and possibly many) occasions I'll need this to happen without a viewport! I.e. with a doc in memory. I'm not making things easy I know, but it's just the way it has to be
The last option I could think of would be to render it with a chosen background colour and key it out ala green-screen-style. Maybe pick a colour brighter than white - I don't know if the software renderer would clip this or not though. But this then brings other things into play such as how to deal with transparency etc.
I'll have a play around with the above to see what I can get out of it. Thanks for your efforts! If support or anyone else can think of something I'm all ears!
Cheers,
WP.
-
On 23/02/2015 at 00:05, xxxxxxxx wrote:
Hello,
as said before, Software and Hardware renderers do not render Alpha channels and the Alpha channel you discovered is not supposed to be used.
So I think the best solution to get an Alpha channel is to render the given scene with the Standard renderer (and enabled Alpha channel). Since you just want the Alpha channel you can decrease the render time by disabling many render features. Then you can combine this Alpha channel with the Software RGB image.
Best wishes,
Sebastian -
On 23/02/2015 at 03:07, xxxxxxxx wrote:
Hi there Sebastian,
hadn't thought of using the software render with a standard render alpha! Maybe. But I think this will quickly become unusable once scenes start to get a bit of oomph in them. A cube on it's own is fine. But an animated character under hypernurbs won't be. I don't really want to be doing anything with the scene itself, it's only meant to be a preview. Maybe worth a try though.
Oddly enough, I've been using this software alpha channel for a long time! I didn't realise we weren't suppose to use it. It's been quite useful in projects of the past! Am I allowed to ask why we're not suppose to use it? (you don't have to answer that)
At this stage I've tried a VideoPost plugin but I couldn't seem to get it working with the software renderer. I've also attempted keying the background out, which works, but I don't know if this will cater for all scenarios. Is it possible to test for depth in the preview? Maybe then key out using depth info? Get depth via a virtual viewport of some sorts?
I'm a little hesitant to mention this one - this one might be the elephant, but would an ogl access point give me my alpha channel? Can I draw/render into a frame buffer using the sdk and get things there somehow? Trying to think outside the box. I'd be prepared to throw someone a few dollars to get me going with the ogl route though. I need a simple ogl for another purpose anyway, a bit like the material preview, but of course, different enough to make the material one not usable. I always pick the hard ones. Anyway, would anyone know if something like this could be an option?
WP.
-
On 24/02/2015 at 01:04, xxxxxxxx wrote:
Hello,
the alpha channel you discovered is no feature of Cinema 4D, it is only used internally in some special cases. Because of this it is not properly integrated and not meant to be used.
The only way to render using the "viewport" is through the Software or Hardware renderer. Both renderers are closed render engines that only return the RGB image.
Best wishes,
Sebastian