RenderEngine: Showing rendering process



  • Hello PluginCafe,
    I have been developing a render engine implementation for C4D.
    In my VideoPost (renderer) I know how to render the finished image (after the rendering is complete) using ExecuteLine (which works fine), but what I really want is to show the process aswell (like Octane or ProRender as examples where you see the rendering progress).

    I guess I would have to do that in the Execute function, but where/when?

    I hope my question is clear.
    Best Regards,
    Florian



  • Hello,

    We need more information to answer your question.
    There's actually different places where you can "show" the result of a render.
    The Pictures viewer, the viewport itself or a dialog box.
    Octane and Redshift are showing the result in a GeUserArea inside a dialog box.
    (you can also see the Picture viewer as a dialog box).

    the question:

    • Where do you want to show that result ?
    • Just to be sure : you want to show the entire picture that go better each passes ?

    Cheers,
    Manuel



  • Hello Manuel,
    ultimately I want to be able to show the result on all 3 places you mentioned.
    during rendering in the PictureViewer and in the Viewport I want the user to see the actual progressive rendering of the image until the final result.

    Best Regards,
    Florian



  • Hello,

    Is it for your own render engine ? i'm curious ^^

    I would suggest to start with the Pictures Viewer, then a GeUserArea in a GeDialog. With the DialogBox you can use CoreMessage to send pointers' adresse from your renderengine to your DialogBox.

    The viewport is a bit more complicated. Our "home" engine support it but they have access to internal functionalities.
    That depends on what you want to do. Using the Draw function from a SceneHookData could work.

    For the pictures viewver, you can do that in the Execute function of your VideoPost plugin. As you may know you have this calling sequence. You can call your render during this call VIDEOPOSTCALL::INNER - open==true

    Your solution should use Delegate Function (callback) and of course use our system to handle threads

    This is my super render example. That display a rainbow gradient in the Pictures Viewer and update the saturation each passe. But this will give you ideas.

    Of course the forum is here if you have questions.

    (never use GeSleep of course)

            if (vps == nullptr)
    		return RENDERRESULT::USERBREAK;
    
    	if (vps->thread && vps->thread->TestBreak())
    		return RENDERRESULT::USERBREAK;
    
    	switch (vps->vp)
    	{
    		case (VIDEOPOSTCALL::INNER):
    		{
    			if (vps->open && *vps->error == RENDERRESULT::OK)
    			{
    
    				VPBuffer* colorBuf = vps->render->GetBuffer(VPBUFFER_RGBA, NOTOK);
    
    				maxon::Int32 const xres = colorBuf->GetInfo(VPGETINFO::XRESOLUTION);
    				maxon::Int32 const yres = colorBuf->GetInfo(VPGETINFO::YRESOLUTION);
    
    
    				iferr_scope_handler{
    					return RENDERRESULT::OUTOFMEMORY;
    				};
    
    
    				const maxon::Int32 bufferSize = colorBuf->GetInfo(VPGETINFO::CPP);
    				maxon::Float32* buffer = NewMemClear(maxon::Float32, bufferSize * xres) iferr_return;
    				if (!buffer)
    					return RENDERRESULT::OUTOFMEMORY;
    
    				const maxon::Float colorStep = 1.0 / xres;
    
    				const maxon::Int32 renderPasses = 30;
    				const maxon::Float renderStep = 1.0 / renderPasses;
    
    
    				for (maxon::Int32 currentRenderPass = 0 ; currentRenderPass < renderPasses; currentRenderPass++)
    				{
    					for (maxon::Int32 x = 0; x < xres; ++x)
    					{
    						maxon::Vector32 color = maxon::Vector32(colorStep * x, currentRenderPass * renderStep, 1.0);
    
    						color = (maxon::Vector32)maxon::HSVToRGB(color);
    						buffer[x + x * 3] = color.x;
    						buffer[x + x * 3 + 1] = color.y;
    						buffer[x + x * 3 + 2] = color.z;
    						buffer[x + x * 3 + 3] = 1.0;
    					}
    
    					for (maxon::Int32 y = 0; y < yres; ++y)
    					{
    						colorBuf->SetLine(0, y, xres, buffer, 32, true);
    						if (vps->thread->TestBreak())
    							return RENDERRESULT::USERBREAK;
    					}
    					GeSleep(100);
    				}
    
    				DeleteMem(buffer);
    
    			}
    			break;
    		
    		}
    		case (VIDEOPOSTCALL::RENDER):
    		{
    			if (vps->vd && vps->open)
    				vps->vd->SkipRenderProcess();
    			break;
    		}
    	}
    
    	return RENDERRESULT::OK;
    
    

    Cheers,
    Manuel.



  • Hello Manuel,
    thank you very much! This was exactly what I needed!

    It is not exactly for my own render engine. I just wanted to implement an open source one as a side-project and to familiarize myself with that topic by just doing it.

    Best Regards
    Florian


Log in to reply