Need to render the camera view on a separate preview window in c++
gogeta last edited by r_gigante
I have created a preview window for the camera output and I am able to get the camera output in that window but I am stuck in its rendering. I want to render the output of the camera in main editor window and show it on the preview window.
I am using C++ as my development language with R19 SDK.
Please help me with this .
Hi Gogeta, thanks writing us.
With regard to your question I've a bunch of notes:
- add the proper tags to this topic - a topic without tags can be easily lost in the knowledgebase;
- since it's not completely clear to me your use-case scenario please be more specific (what is your "preview window" you've created? Are you talking about the output generated by your own rendering engine? Are you talking about rendering the active document or any another document?)
- For the sake of completeness, please have a look at the BaseDocument::RenderDocument()
Looking forward refined information, give best.
gogeta last edited by gogeta
Thanks for your reply. Pardon me for my incomplete post as I am new in Cinema 4D plugin development.
Regarding your questions, here are my answers :
Are you talking about the output generated by your own rendering engine?
No The output is not being generated by my own rendering engine. I am using the default cinema 4D rendering engine.
Are you talking about rendering the active document or any another document?
Yes , I am talking about rendering the active document.
The preview window is same as the "new view panel" created from Window menu. In my case I have created it using the C++ code.
In this newly created window I have set the camera from which I want to see the output viz. camera 1 or any other camera( which is present in main window at startup of cinema 4D).
So by preview I mean I want to see the rendered output of camera in a separate window. As I move my camera at different angles and positions I want to see the rendered output in a separate window at the same time.
So I want to ask is this possible to achieve ? If possible what are the possible ways to achieve this.
Thanks in advance.
Hi Gogeta, thanks for providing the additional information and sorry for coming late here.
With regard to your question, I think there's around a plugin which more or less does what you're referring in your post. Is this the desired behavior?
If that's the final intent, consider that the rendered image is sent to a GeUserArea inside a GeDialog rather than the "newly created window" added via "Panel -> New View Panel".
Aside from this note, the mechanism to put down in place should rely on rendering thread spawn when the GeUserArea is created and "listening" to the changes happening in the scene in order to restart the rendering process and align the rendered image to the updated scene.
For this purpose I warmly suggest to get you comfortable with threading in Cinema by looking both to the Classic threading classes and to the more flexible MAXON threading classes available in R20.
It's also pretty likely that you need to take advantage of the functionalities brought by implemeting SceneHookData and, finalyl, having a look a the MessageData class could be helpful if certain "time-based" events should be trigger during your plugin execution.
gogeta last edited by gogeta
Thanks a lot for your reply. I'll analyze that and will update you on the results. Thanks again !