Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Preview Render

    Scheduled Pinned Locked Moved SDK Help
    6 Posts 0 Posters 471 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 21/08/2008 at 17:43, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   10.008 
      Platform:      
      Language(s) :     C++  ;

      ---------
      I'm trying to generate a quick preview render - basically a screen capture of the current editor view. What I have done thus far is to change my render settings to render as editor, then generate a render. This works fine, except for when large particle systems are in the project. Cinema pre-rolls and calculates all the particles before generating the render, which can take several minutes to half an hour, depending on which frame the user is parked on. I have tried setting my render flag to RENDERFLAG_PREVIEWRENDER, but that only generates a completely white image. Not sure why... I had my thread parameter set to NULL, but even when setting it to my own thread, I still get a white frame. I have also tried variations with RENDERFLAG_NODOCUMENTCLONE added as well with the same results. Unless I'm using RENDERFLAG_EXTERNAL I get a white frame.

      Here is some of my code...

      //To set up thread...

      class RenderThread : public Thread
      {
         public:
              virtual void Main(void);
              virtual const CHAR *GetThreadName(void) {return "My Thread";}
      }

      void RenderThread::Main(void)
      {
      }

      //Generate the render. All render settings have already been set...

      AutoAlloc<BaseBitmap> bmp;
      bmp->Init(renderData->GetLong(RDATA_XRES), renderData->GetLong(RDATA_YRES));
      C4DAtom* docCloneAtom = doc->GetClone(COPY_DOCUMENT, NULL);
      BaseDocument* docClone = (BaseDocument* )docCloneAtom;
      StopAllThreads();

      RenderThread myThread;
      myThread.Start(FALSE);
      RenderDocument(docClone, docClone->GetActiveRenderData()->GetData(), NULL, NULL, bmp, RENDERFLAG_NODOCUMENTCLONE || RENDERFLAG_PREVIEWRENDER, myThread);

      Any advice on setting up a thread correctly for rendering or disabling the render preroll would be greatly appreciated.

      Thanks!
      Adam

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 22/08/2008 at 05:53, xxxxxxxx wrote:

        Currently I can't help you about disabling the preroll but here is some simple code how to use an own thread for rendering.

        > \> class RenderThread : public Thread \> { \>      private: \>           BaseDocument \*m_doc; \>           BaseBitmap \*m_bmp; \>           BaseContainer m_rc; \> \>      public: \>           RenderThread(BaseDocument \*doc, BaseBitmap \*bmp, BaseContainer rc) { m_doc = doc; m_bmp = bmp; m_rc = rc; } \>           virtual ~RenderThread() { m_doc = NULL; m_bmp = NULL; End(); Wait(FALSE); } \> \>           virtual void Main(void); \>           virtual const CHAR \*GetThreadName(void) { return "RenderThread"; } \> }; \> \> static void ProgressFunction(Real p, void \*data) \> { \>      GePrint(RealToString(p)); \> } \> \> void RenderThread::Main(void) \> { \>      GePrint("render thread"); \>      if(RenderDocument(m_doc, m_rc, ProgressFunction, NULL, m_bmp, RENDERFLAG_EXTERNAL|RENDERFLAG_NODOCUMENTCLONE|RENDERFLAG_PREVIEWRENDER, this->Get()) != RAY_OK) \>           GePrint("not ok"); \> } \> \> class MenuTest : public CommandData \> { \>      public: \>           virtual Bool Execute(BaseDocument \*doc); \> }; \> \> Bool MenuTest::Execute(BaseDocument \*doc) \> { \>      AutoAlloc<BaseBitmap> bmp; \>      if(!bmp) return FALSE; \> \>      BaseDocument \*cdoc = (BaseDocument\* )doc->GetClone(COPY_DOCUMENT, NULL); \> \>      BaseContainer rc = cdoc->GetActiveRenderData()->GetData(); \>      bmp->Init(rc.GetLong(RDATA_XRES), rc.GetLong(RDATA_YRES), 24); \> \>      rc.SetLong(RDATA_RENDERASEDITOR, 3); \> \>      RenderThread rt(cdoc, bmp, rc); \>      rt.Start(FALSE); \> \>      ShowBitmap(bmp); \> \>      BaseDocument::Free(cdoc); \> \>      return TRUE; \> } \>

        Btw. from your code

        > \> RenderDocument(docClone, docClone->GetActiveRenderData()->GetData(), NULL, NULL, bmp, RENDERFLAG_NODOCUMENTCLONE || RENDERFLAG_PREVIEWRENDER, myThread) \>

        RENDERFLAG_NODOCUMENTCLONE and RENDERFLAG_PREVIEWRENDER are flag bits so if you want to combine them you have to write

        RENDERFLAG_NODOCUMENTCLONE|RENDERFLAG_PREVIEWRENDER
        and not
        RENDERFLAG_NODOCUMENTCLONE || RENDERFLAG_PREVIEWRENDER

        cheers,
        Matthias

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 22/08/2008 at 16:58, xxxxxxxx wrote:

          Sorry,Matthias. I was retyping from my code. That was a typo.

          I'll try out the threading and see how that works.

          Thanks!
          Adam

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 22/08/2008 at 17:50, xxxxxxxx wrote:

            I tried it out. Still getting the same problem as before.

            Am I misunderstanding the RENDERFLAG_PREVIEWRENDER flag? Shouldn't that create a preview like the kind seen in "Make Preview" renders?

            And any explanation about why I get a white frame when RENDERFLAG_EXTERNAL is missing? The SDK leads me to believe it is not a necessary flag, but that doesn't seem to be the case.

            Thanks!
            Adam

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 04/09/2008 at 08:21, xxxxxxxx wrote:

              Just got an answer from the developers. Unfortunatly it is currently not possible to make a snapshot without a preroll of the previous frames.

              cheers,
              Matthias

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 04/09/2008 at 09:47, xxxxxxxx wrote:

                Thanks for checking on that, Matthias.

                -Adam

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post