Wow, thanks for the info, Jonathan. I looked at CameraOp::LensNFunc, but
didn't know what to make of it, or where to start, really. So that's exactly
the kind of info I was hoping for.

At DD there was a custom 'HypeCamera' that supported the 'Hype' distortion
> file format so you could load a Hype file directly into the camera and it
> applied the forward distortion via this method.  There was also a
> 'HypeDistort' geometry modifier that warped a card with the reverse
> distortion so you could do a undistort/redistort in a single render/filter
> pass.
>

And that's exactly the kind of application I wanted it for. :)

Thanks,
Ivan


On Mon, Jun 27, 2011 at 11:03 AM, Jonathan Egstad <jegs...@earthlink.net>wrote:

> So the current scanline renderer does handle general camera distortions -
> with poly subdivision memory limitations.
>
> The CameraOp class supports several built-in linear projection and
> non-linear distortions using its LensFunc/LensNFunc methods that are passed
> back to the renderer via the CameraOp::lens_function()/lensNfunction()
> virtual methods, then on to the Primitives in the Scene structure for use
> during tessellation.
>
> You can implement your own LensFunc routines and return them via the
> virtual method.  The idea is that a primitive can subdivide itself using the
> output of a LensFunc by passing in vertex info which gets modified.  The
> 'void *' parameter at the end is a way to get add'l info from the Primitive
> into the lens function.
>
>
> /*! Simple perspective projection lens function.  */
> static void perspLensFunc(Scene* scene, CameraOp* cam, MatrixArray*
> transforms,
>                           const VArray& in, Vector4& out,
>                           void* data) {
>    out = transforms->matrix(LOCAL_TO_SCREEN).transform(in.PL(), 1.0f);
> }
>
> /*! Simple UV projection lens function.  */
> static void perspLensFunc(Scene* scene, CameraOp* cam, MatrixArray*
> transforms,
>                           const VArray& in, Vector4& out,
>                           void* data) {
>    out = transforms->matrix(CLIP_TO_SCREEN).transform(in.UV()*2.0f -
> Vector4(1,1,1,1));
> }
>
> The LensNFunc method does the same thing, but operates on arrays of vert
> info.
>
> At DD there was a custom 'HypeCamera' that supported the 'Hype' distortion
> file format so you could load a Hype file directly into the camera and it
> applied the forward distortion via this method.  There was also a
> 'HypeDistort' geometry modifier that warped a card with the reverse
> distortion so you could do a undistort/redistort in a single render/filter
> pass.
>
>
> Have fun,
>
> -jonathan
>
>
> On Jun 26, 2011, at 2:12 PM, Ivan Busquets wrote:
>
> > Hi,
> >
> > I've been looking at the lens_distortion parameters in CameraOp, and was
> wondering if there's any way to implement a different lens
> distortion/correction model within a CameraOp, or if one would need to write
> a specific renderer to handle that.
> >
> > Specifically, I'm looking for a way to handle off-center and asymmetric
> distortions. Assuming I can get a function that maps destination to source
> vectors(uvs), would this be possible within a CameraOp?
> >
> > Many thanks,
> > Ivan
> >
> >
> >
> >
> >
> > _______________________________________________
> > Nuke-dev mailing list
> > Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev
>
> _______________________________________________
> Nuke-dev mailing list
> Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev
>
_______________________________________________
Nuke-dev mailing list
Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

Reply via email to