Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    CreateRay() kills Object Glow

    Bugs
    0
    10
    1.4k
    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
      Helper
      last edited by

      On 15/11/2014 at 19:55, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R13 
      Platform:    Mac  ;  Mac OSX  ; 
      Language(s) :     C++  ;

      ---------
      Hello,

      When I use CreateRay() on a Video Post effect, any glowing objects stop glowing... 😕

      Any clues?

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

        On 17/11/2014 at 02:25, xxxxxxxx wrote:

        I think, you will need to give us some more information. At best you'd post some code.

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

          On 17/11/2014 at 07:29, xxxxxxxx wrote:

          I create a simple object and apply a material that has Glow to it.
          I render and it glows, as expected.
          When i add my Video Post plugin that has custom lens using CreateRay, the object does not glow anymore.
          If I recompile the plugin removing the CreateRay access, the glow comes back.
          I fill everything on the Ray structure but the ior, as I have no idea what it does.

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

            On 17/11/2014 at 09:40, xxxxxxxx wrote:

            ior is the index of refraction. Which value has it? If it's zero, can you please try, if it makes any difference setting this to 1.0?
            Otherwise can you please show me some code, so I can get a clearer picture, of what is going on?

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

              On 17/11/2014 at 10:52, xxxxxxxx wrote:

              Tried with ior 0.0 and 1.0, makes no difference.

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

                On 17/11/2014 at 10:53, xxxxxxxx wrote:

                And will you post me some code?

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

                  On 17/11/2014 at 12:58, xxxxxxxx wrote:

                  Sure, but there ain't much to see on code.
                  The strange thing is that if my plugin used CreateRay(), glowing textures won't glow.
                  If I remove VIDEOPOSTINFO_CUSTOMLENS from GetRenderInfo, but glow works.

                  VIDEOPOSTINFO BDVJData::GetRenderInfo(BaseVideoPost* node)
                  {
                  	if ( bEnabled )
                  		return VIDEOPOSTINFO_CUSTOMLENS|VIDEOPOSTINFO_EXECUTEPIXEL|VIDEOPOSTINFO_EXECUTELINE;
                  	else
                  		return VIDEOPOSTINFO_0;
                  }
                    
                  void BDVJData::CreateRay(Ray* dst, Real x, Real y)  
                  {  
                  if ( ! bEnabled )  
                  {  
                  //this->VideoPostData::CreateRay(dst, x, y);  
                  return;  
                  }  
                  // Get ray  
                  LVector dir = CreateRay( x, y );  
                  if ( dir == LVector(0) )  
                  {  
                  dst->p = LVector(0);  
                  dst->v = LVector(0);  
                  return;  
                  }  
                  // Get camera  
                  LMatrix camMatrix = mCamera->GetMg();  
                  LVector camPos = camMatrix.off;  
                  // Make ray  
                  dst->p = camPos;	// posiciona na camera  
                  dst->v = dir;	// direcao do raio  
                  dst->v *= camMatrix;	// transformacao da camera  
                  dst->v -= camPos;	// volta pra 0,0,0  
                  //dst->ior = 0.0;  
                    
                  // p - 0  
                  //   /  
                  // 1 - 2  
                  for ( int n = 0 ; n < 3 ; n++ )  
                  {  
                  Real xx = x + ( n % 2 == 0 ? 1.0 : 0.0 );  
                  Real yy = y + ( n > 0 ? 1.0 : 0.0 );  
                  LVector dd = CreateRay( xx, yy );  
                  if ( dd == LVector(0) )  
                  dd = dir;  
                  dst->pp[n] = camPos;	// posiciona na camera  
                  dst->vv[n] = dd;	// direcao do raio  
                  dst->vv[n] *= camMatrix;	// transformacao da camera  
                  dst->vv[n] -= camPos;	// volta pra 0,0,0  
                  }  
                  }  
                    
                  LVector BDVJData::CreateRay(Real x, Real y)  
                  {  
                  if ( bPanoramic )  
                  {  
                  // Panoramic projection  
                  LVector uv = LVector( x - area.start.x, y - area.start.y, 0 ) / (mRadius * 2.0);  
                  if ( uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0 )  
                  return LVector(0);  
                  uv.x = 1.0 - uv.x;  
                  return geoToDome( uv );  
                  }  
                  else  
                  {  
                  // Fulldome projection  
                  LVector uv = LVector( x - area.start.x, y - area.start.y, 0 ) / (mRadius * 2.0);  
                  uv.y = 1.0 - uv.y;  
                  return texelToDome( uv, mFov, mMask != VP_MASK_DISABLED );  
                  }  
                  }
                  
                  1 Reply Last reply Reply Quote 0
                  • H
                    Helper
                    last edited by

                    On 20/11/2014 at 02:44, xxxxxxxx wrote:

                    Hi,

                    I'm terribly sorry, I should have tested this earlier. I think you found a bug in C4D. The same is happening, when using glow with the cylindrical lens effect. I have reported the issue and will keep you updated.

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

                      On 20/11/2014 at 07:31, xxxxxxxx wrote:

                      By now, I got confirmation that this is a bug. Sorry 😢

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

                        On 20/11/2014 at 10:19, xxxxxxxx wrote:

                        That's both bad and good news, thanks!

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