generate stereo preview images



  • On 24/02/2015 at 09:58, xxxxxxxx wrote:

    Hi,

    sorry to bother, but I got stuck again with my plugin. I am building a plugin for a "glasses free" 3D screen. Everything works really well and I learned and enjoyed working on it so much.

    The last piece I'm trying to accomplish is a fast preview from the c4d stereo camera with 8 single channels.

    Hard- or software render won't work, because there are no stereo options anymore.

    Under the viewport preferences are also stereo options. You can switch to mono mode. It recognizes the channel count from the render settings, but reacts only to channel 0 and 1. The views between are ingnored. The idea was to grab screenshots from the editor while switching the channels.

    I would be again very thankful for ideas or hints into the right direction.

    Cheers, Volker.



  • On 25/02/2015 at 07:53, xxxxxxxx wrote:

    Hello,

    can you give us some more information on what kind of plugin you are working on and what your workflow is?

    It is not possible to "grab screenshots", at least nor from within Cinema. But I think there could be another way of handling your issue. You could render a given document using RenderDocument() and using the software renderer. After that you could adapt the camera position of your preview document and render that document again with RenderDocument(). This way you could create the angles you need for your preview.

    Best wishes,
    Sebastian



  • On 25/02/2015 at 11:01, xxxxxxxx wrote:

    Hi Sebastian,

    I am building a CommandPlugin in R16 (Windows only), which has a few tools. The main function is to send a 2x4 matrix image to the 3D screen player software.

    The command "Preview Active Render" is called from the dialog part of my command plugin. It calls the render command, starts a new second thread, which checks for 'c4d.CheckIsRunning', when finished it sends a message via 'c4d.SpecialEventAdd' to my Message Plugin part. This part collects in the main thread again the 8 image paths and sticks them together to the 2x4 matrix image by using the bitmaps class. After saving the matrix image, a 'subprocess.call', with the matrix path, is send to the 3D screen player software, which shows the sterocopic image on the screen.

    This works quite well, but if Vray is the active render it takes quite long for the 8 single images. A fast preview, like the soft- or hardware renderer would do, would be a nice last addition to the plugin. But since there are no stereo options under soft- or hardware renderer, this is not an option.

    I am not sure, if I got your advice right. Also my plugin has a command, which generates a TagPlugin for the camera with special values and formulas. How could I generate 8 single cameras from the stereo camera with all their distortions?

    If you need, or are interested to look into the code, just let me know. It's too long to post the entire code. I would try to post parts.

    Thanks so much in advance...Volker



  • On 26/02/2015 at 01:33, xxxxxxxx wrote:

    Hello,

    Originally posted by xxxxxxxx

    How could I generate 8 single cameras from the stereo camera with all their distortions?

    Probably only you can answer that since only you know what exactly you do and what you need. Details on the placement of the (intermediate) cameras are described in the documentation of the Cinema 4D camera. With those intermediate cameras you could render (a copy of) the document with RenderDocument() multiple times in memory, build your matrix image and send it to your monitor.

    best wishes,
    Sebastian



  • On 26/02/2015 at 11:06, xxxxxxxx wrote:

    Hi Sebastian,

    the command 'StereoGetCameraInfo()' should do it for me, but I am having serious troubles getting it to work. This would give me the matrix and the camera film offsets. With a stereo camera and a python tag on it like this :

    import c4d
    from c4d import documents
      
    def main() :
        doc = c4d.documents.GetActiveDocument()
        rd = doc.GetActiveRenderData()
        bd = doc.GetActiveBaseDraw()    
        camera = op.GetObject()
        
        camera.SetFocus(21.78)    
        
        print camera.StereoGetCameraInfo(doc, bd, rd, 1)
    

    it gives me the error:

    'c4d.CameraObject' object has no attribute 'StereoGetCameraInfo'

    I don't know anything about C++ and the command is from the C++ SDK. The Python SDK has very few stereo information. Any Idea, where my mistake is?

    Thanks, Volker



  • On 27/02/2015 at 00:22, xxxxxxxx wrote:

    Hello,

    the Python API is not a complete copy of the C++ API, several functions and classes are missing. StereoGetCameraInfo() does not exist in Python.

    So either to re-write your plugin as a C++ plugin or you access the stereo settings from the camera and the render settings to calculate the camera positions yourself.

    Best wishes,
    Sebastian


Log in to reply