Custom Cameras (FishEye, Panorama, Etc)



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

    On 13/10/2005 at 12:26, xxxxxxxx wrote:

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

    ---------
    Hi All,
    I've developed custom camera's for Mental Ray by using Lens Shaders that I would now like to migrate to Cinema 4D.  This is my first exposure to the C4D SDK so I'm hoping someone can point me in the right direction.  The way Mental Ray Lens Shaders work is:  I define a callback function that mental ray executes for each ray that leaves the camera.  Mental Ray tells the function things like rendered image size, which pixel (x,y) in the image it's working on, and the 3D vector for the ray emanating from the camera.  My custom camera functions use that information and some math to reroute the camera's ray origin and direction before passing that info back to Mental Ray to continue it's rendering as normal.  Is something similar possible in Cinema 4D?  Does anyone have sample code I can work from?
    Thanks



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

    On 15/10/2005 at 08:00, xxxxxxxx wrote:

    This can be done by creating a small sphere around the camera that contains a volume shader that bends the rays accordingly in a MaterialData plugin. You can test this by modifying ParticleVolume.cpp to not set SHADER_VOLUMETRIC and then do something like:

        
        
        void ParticleVolume::CalcSurface(PluginMaterial *mat, VolumeData *vd)  
        {   
          if (vd->tray)  
          {  
            // Disperse rays in camera X direction  
            vd->tray->v -= LV(0.2 * vd->GetRayCamera()->m.v1 * (SV(vd->tray->v) * vd->GetRayCamera()->m.v1));  
          }  
          vd->trans = 1.0;  
        }
    

    Put it on a small sphere surrounding the camera. Then you can play with different ways to modify the ray.



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

    On 01/11/2005 at 12:29, xxxxxxxx wrote:

    After strolling through the R9.5 documentation, I'm wondering if this shouldn't be possible by using "Custom lenses with VIDEOPOST_CUSTOMLENS"?

    Kabe



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

    On 01/11/2005 at 12:36, xxxxxxxx wrote:

    Yes. Though please note that this feature requires the next update of C4D, which will be released soon. (As does everything below "Browser library" in the list of changes.)



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

    On 18/12/2005 at 13:52, xxxxxxxx wrote:

    Well, as that version is released now, would you mind giving a hint how to do this with VIDEOPOST_CUSTOMLENS?

    Thanks!

    Kabe



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

    On 02/01/2006 at 14:33, xxxxxxxx wrote:

    You give the VIDEOPOST_CUSTOMLENS flag for your videopost node in GetRenderInfo(). Then C4D will send MSG_VIDEOPOST_CREATERAY messages to you. Simply cast the data parameter to VideoPostCreateRay and set p/v depending on x/y.
    If this doesn't work, please tell me what fails so that I can investigate further.



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

    On 22/03/2006 at 09:48, xxxxxxxx wrote:

    Hi!
    I tested VIDEOPOST_CUSTOMLENS flag by making a camera similar to cinema4d perspective camera and there are some diferences in rendered images. Looks like the antialiasing is somehow lost during the CREATE_RAY process...
    The test was really simple, only received x/y converted to perspective and the set p/v.
    Marco Silva



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

    On 29/03/2006 at 07:57, xxxxxxxx wrote:

    Hi again!
    this is my code for message function:

        
        
        
        
        Bool Message(GeListNode* node, LONG type, void *data) {
        
        
        
        
        switch (type) {
        
        
        
        
        case MSG_VIDEOPOST_CREATERAY: {
        
        
        
        
        VideopostCreateRay *vpcr = (VideopostCreateRay * ) data;
        
        
        
        
        LReal x = (vpcr->x - width/2.0) / xFactor;
        
        
        
        
        LReal y = (vpcr->y - height/2.0) / yFactor; 
        
        
        
        
        LReal alt, azi, z;
        
        
        
        
        // gnomonic projection, it's a spherical projection equivalent to perspective
        
        
        
        
        gnomonicProjection(-x, y, alt, azi);
        
        
        
        
        // convert altitude and azimuth to vector form
        
        
        
        
        LReal cos_alt = cos(alt);
        
        
        
        
        y = cos(azi) * cos_alt;
        
        
        
        
        x = sin(azi) * cos_alt;
        
        
        
        
        z = sin(alt);
        
        
        
        
        // camera position
        
        
        
        
        vpcr->p.x = camera_x;
        
        
        
        
        vpcr->p.y = camera_y;
        
        
        
        
        vpcr->p.z = camera_z;
        
        
        
        
        // precalculated values for vector rotation
        
        
        
        
        vpcr->v.x = x*v11 + y*v12 + z*v13;
        
        
        
        
        vpcr->v.y = x*v21 + y*v22 + z*v23;
        
        
        
        
        vpcr->v.z = x*v31 + y*v32 + z*v33;
        
        
        
        
        return TRUE;
        
        
        
        
        }
        
        
        
        
        }
        
        
        
        
        return TRUE;
        
        
        
        
        }
        
        
        
    

    this code works perfectly if antialiasing is set to best (16x16), otherwise object edges become aliased...
    can someone please help me... I don't understand why this is happening...
     
    Marco Silva



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

    On 31/03/2006 at 10:34, xxxxxxxx wrote:

    Does everything else than Best 16x16 equal None in the AA settings or are the edges just less AA'd the less AA you have set in there? Could you post a complete ray creation algorithm (not necessarily your real one) that shows the problem? I always got somewhat decent AA when I tried.



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

    On 31/03/2006 at 10:37, xxxxxxxx wrote:

    According to the developers VIDEOPOST_CUSTOMLENS will always force the Best AA setting (same as with QTVR, since no projection of geometry edges is possible). Could that be what you're seeing?



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

    On 03/04/2006 at 11:41, xxxxxxxx wrote:

    Probably...
    The AA Best 16x16 or no AA both make a perfect render. But using other options all the edges suffers from aliasing...
    It isn't very perceptible but he problem is there...
    I don't known if you already seen this problem nor if it possible to solve...
    Other question, is possible to invalidate one ray in MSG_VIDEOPOST_CREATERAY?
    By other other words, don't render one specific ray, or give it a color, like black.
    thanks
    Marco Silva



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

    On 12/05/2006 at 07:34, xxxxxxxx wrote:

    Hi all!

    I may have found a bug on CUSTOMLENS, when I set 2 planes, one in front of the other, and the nearest is transparent, the ray generated by CREATERAY doesn't hit the far plane!

    I think this problem is in CUSTOMLENS code, since transparency seems not to be honored...

    sdk version: 9.5

    Thanks
    Marco Silva



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

    On 16/05/2006 at 07:40, xxxxxxxx wrote:

    Hi again!

    Ok this problem has been solved in this new release...
    In 9.6 CUSTOMLENS works fine!

    Marco Silva



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

    On 29/08/2006 at 08:30, xxxxxxxx wrote:

    Hi all,

    Again one question about CUSTOMLENS, when I set this flag on my code the post effect "lens effect" simply doesn't render anything...

    Is this supposed to happend?

    Cheers,
    Marco Silva



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

    On 02/09/2006 at 07:33, xxxxxxxx wrote:

    Yes, it seems like some post effects will not work with a custom lens. I've passed this on to the developers. Thanks for reporting!


Log in to reply