CreateExtendedRay() never called [SOLVED]



  • On 04/03/2015 at 10:42, xxxxxxxx wrote:

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

    ---------
    Hi!

    I'm trying to create a custom lens video post, but I hit some problems.

    I can't get VideoPostData::CreateExtendedRay() to be called.
    I return VIDEOPOSTINFO_CUSTOMLENS_EXTENDED from VideoPostData::GetRenderInfo(), but that
    doesn't seem to be all of what's necessary. I also tried adding VIDEOPOSTINFO_CUSTOMLENS in addition.

    skyphyr seems to have had the same problem in this thread.

    So what I was trying to do to work around this, is to use VideoPostData::CreateRay() instead and
    compute the lens X and Y values using the renders resolution. But I get resolution values that do not
    appear to make sense to me.

    RENDERRESULT CamVideoPost::Execute(BaseVideoPost* vp, VideoPostStruct* vps) {
      /* Read the render resolution so we can use it in CreateRay(). */
      if (vps->vp == VIDEOPOSTCALL_RENDER && vps->open) {
        BaseContainer bc = vps->render->GetRenderData();
        m_width = bc.GetReal(RDATA_XRES);
        m_height = bc.GetReal(RDATA_YRES);
        m_valid = (m_width > 0.001 && m_height > 0.001);
        GePrint("Width: " + RealToString(m_width) + ", Height: " + RealToString(m_height));
      }
      return RENDERRESULT_OK;
    }
    

    This gives me "Width: 1183, Height: 764" on a scene with resolution 200x100 ??

    Any hints are highly appreciated.

    Best,
    Niklas



  • On 05/03/2015 at 03:04, xxxxxxxx wrote:

    Update : For #2, I seem to have messed up the output of the editor render with the output of the
    Picture Viewer render. The values seem to be ok! Still, it would be nice to use CreateExtendedRay(). :)



  • On 09/03/2015 at 07:41, xxxxxxxx wrote:

    Is it also possible to change the lens of the Viewport, not only of the
    final rendering?



  • On 10/03/2015 at 06:18, xxxxxxxx wrote:

    Hello,

    CreateExtendedRay() only works with the Physical renderer. You have to set VIDEOPOSTINFO_CUSTOMLENS to get CreateRay() called and you have to set also VIDEOPOSTINFO_CUSTOMLENS_EXTENDED to have CreateExtendedRay() called.

    Best wishes,
    Sebastian



  • On 10/03/2015 at 08:03, xxxxxxxx wrote:

    That explains it, thanks. Do you also know if it is somehow possible to preview the lens in the Viewport?



  • On 11/03/2015 at 02:40, xxxxxxxx wrote:

    Hello,

    the only way to do something similar in the viewport I can think of is using the GlDraw() method to create an equivalent GLSL fragment shader. Please notice that this functionality is not documented.

    Best wishes,
    Sebastian


Log in to reply