[Sidefx-houdini-list] ndc to world matrix

katrin schmid Katisss at gmx.de
Fri Aug 6 02:48:31 EDT 2010


hi,
found a solution to the aperture y here
http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&p=95523&sid=bffb29e70fb0ca1aa05edad4be8a2598
Can somebody confirm this is the correct calculation?
Thanks, 
katrin

-------- Original-Nachricht --------
> Datum: Tue, 03 Aug 2010 11:46:54 +0200
> Von: "katrin schmid" <Katisss at gmx.de>
> An: sidefx-houdini-list at sidefx.com
> Betreff: Re: [Sidefx-houdini-list] ndc to world matrix

> hi,
> i read to RIBframe.py and IFDframe.py and still have
> no clue about the value for fovy.
> I have to admit its the first time since working
> with Houdini i really miss Maya ;)
> Build in projecttion mtrix please please...
> Regards,
> katrin
> 
> 
> -------- Original-Nachricht --------
> > Datum: Sun, 1 Aug 2010 22:40:24 -0700
> > Von: Andrew D Lyons <tstexture at gmail.com>
> > An: sidefx-houdini-list at sidefx.com
> > Betreff: Re: [Sidefx-houdini-list] ndc to world matrix
> 
> > It kind of depends on the renderer used to generate the exr yes? mantra
> > and
> > prman have a different interface in these regards. Take a look near line
> > 175
> > in $HH/soho/python2.6/RIBframe.py as an example. IFDframe also.
> > 
> > Cheers
> > 
> > On 1 August 2010 22:27, katrin schmid <Katisss at gmx.de> wrote:
> > 
> > > hi,
> > > while its a good exercise to calculate this could be
> > > a lot easier to use... Anyone a clue why camera aperture
> > > is a single value when the docs suggest separate x and y values
> > > fovx = 2 * atn( (apx/2) / focal )
> > > fovy = 2*atan( (apy/2) / focal )
> > > for fov calculation?
> > > Thanks,
> > > katrin
> > >
> > > -------- Original-Nachricht --------
> > > > Datum: Sun, 1 Aug 2010 22:20:24 -0700
> > > > Von: Andrew D Lyons <tstexture at gmail.com>
> > > > An: sidefx-houdini-list at sidefx.com
> > > > Betreff: Re: [Sidefx-houdini-list] ndc to world matrix
> > >
> > > > Oh yes - sorry - xform in the previous example is not the projection
> > > > matrix
> > > > - which is obviously what you are looking for - just world pos
> > transform
> > > > matrix. You will need to compute the projection matrix...
> > > >
> > > > Sorry I can't be of more help...
> > > >
> > > >
> > > > On 1 August 2010 21:47, katrin schmid <Katisss at gmx.de> wrote:
> > > >
> > > > > hi,
> > > > > it's running but what matrix is this?
> > > > > The Projection matrix? And its quite hacky to this
> > > > > for the entire time line...
> > > > >
> > > > > Maybe iam just thinking to complicated:
> > > > > http://pymel.googlecode.com/svn/tags/0.7.10/pymel/vector.py
> > > > >    def worldToCamera(self, camera=None):
> > > > >        if camera is None:
> > > > >            camera = core.mel.getCurrentCamera()
> > > > >        return self *
> > node.DependNode(camera).worldInverseMatrix.get()
> > > > >
> > > > >    def worldToScreen(self, camera=None):
> > > > >        if camera is None:
> > > > >            camera = node.Camera(core.mel.getCurrentCamera())
> > > > >        else:
> > > > >            camera = node.Camera(camera)
> > > > >
> > > > >        screen = self.worldToCamera(camera)
> > > > >
> > > > >        screen.x = (screen.x/-screen.z) /
> > > > > tan(radians(camera.horizontalFieldOfView/2))/2.0+.5
> > > > >        screen.y = (screen.y/-screen.z) /
> > > > > tan(radians(camera.verticalFieldOfView/2))/2.0+.5
> > > > >
> > > > >        xres = core.getAttr( 'defaultResolution.width' )
> > > > >        yres = core.getAttr( 'defaultResolution.height' )
> > > > >        filmApX = camera.horizontalFilmAperture.get()
> > > > >        filmApY = camera.verticalFilmAperture.get()
> > > > >
> > > > >        filmAspect = filmApX/filmApY;
> > > > >        resAspect  = xres/yres;
> > > > >        ratio = filmAspect/resAspect;
> > > > >
> > > > >        screen.y = linmap( ((ratio-1)/-2), (1+(ratio-1)/2),
> screen.y
> > )
> > > > >
> > > > >        return screen
> > > > >
> > > > >
> > > > > -------- Original-Nachricht --------
> > > > > > Datum: Sun, 1 Aug 2010 21:41:23 -0700
> > > > > > Von: Andrew D Lyons <tstexture at gmail.com>
> > > > > > An: sidefx-houdini-list at sidefx.com
> > > > > > Betreff: Re: [Sidefx-houdini-list] ndc to world matrix
> > > > >
> > > > > > Oh sorry - didn't see the whole thread. Grahams example looks
> good
> > > > except
> > > > > > for one small thing ("camera" should be "cam"):
> > > > > >
> > > > > > viewer = toolutils.sceneViewer()
> > > > > > viewport = viewer.curViewport()
> > > > > > cam = hou.node("/obj").createNode("cam")
> > > > > > viewport.saveViewToCamera(cam)
> > > > > > xform = cam.worldTransform()
> > > > > > cam.destroy()
> > > > > >
> > > > > > This is the only way of accessing the matrix for an arbitrary
> user
> > > > > > generated
> > > > > > viewport matrix afaik.
> > > > > >
> > > > > > Cheers
> > > > > >
> > > > > >
> > > > > > On 1 August 2010 21:23, katrin schmid <Katisss at gmx.de> wrote:
> > > > > >
> > > > > > > hi,
> > > > > > > viewer = toolutils.sceneViewer()
> > > > > > > viewport = viewer.curViewport()
> > > > > > > as mentioned in Grahams example below.
> > > > > > >
> > > > > > > I am trying to get the actual matrix
> > > > > > > for writing to exr whatever compositors need it for.
> > > > > > > I am on p. 374 of the book linked.
> > > > > > > Thanks,
> > > > > > > katrin
> > > > > > >
> > > > > > >
> > > > > > > -------- Original-Nachricht --------
> > > > > > > > Datum: Sun, 1 Aug 2010 21:16:48 -0700
> > > > > > > > Von: Andrew D Lyons <tstexture at gmail.com>
> > > > > > > > An: sidefx-houdini-list at sidefx.com
> > > > > > > > Betreff: Re: [Sidefx-houdini-list] ndc to world matrix
> > > > > > >
> > > > > > > > Some questions below:
> > > > > > > >
> > > > > > > > On 1 August 2010 21:02, katrin schmid <Katisss at gmx.de>
> wrote:
> > > > > > > >
> > > > > > > > > so i try compositng WorldToCamera from this book for a
> start
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://books.google.com.au/books?id=jXmJqzQgdY8C&pg=PA375&lpg=PA375&dq=worldToCamera&source=bl&ots=xn94-vpnh3&sig=LboAGGX2oRAbsbf0eIRdDkUOTiQ&hl=en&ei=hApWTISjIIzqvQPyjJUZ&sa=X&oi=book_result&ct=result&resnum=7&ved=0CEsQ6AEwBg#v=onepage&q=worldToCamera&f=false
> > > > > > > > >
> > > > > > > > > Anyone knows if its a good plan?
> > > > > > > > >
> > > > > > > >
> > > > > > > > Not sure what you are trying to achieve. If it's just
> feature
> > > > > > extraction,
> > > > > > > > then there are edge detect COPs in the Houdini compositor.
> Are
> > > you
> > > > > > trying
> > > > > > > > to
> > > > > > > > write a new COP? (The link above pulled up a blank page -
> they
> > > > must
> > > > > > > > shuffle
> > > > > > > > the stuff you can't read.)
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > > Im also not quite sure what the matrix values
> > > > > > > > > viewport.saveViewToCamera(cam)
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > What is the viewport object? Is that the object returned by
> a
> > > > > > > > toolutils.activePane() calll?
> > > > > > > >
> > > > > > > >
> > > > > > > > > xform = cam.worldTransform()
> > > > > > > > >
> > > > > > > >
> > > > > > > > This one just returns a standard Houdini matrix4 object (row
> > > > major)
> > > > > > > > representing the world position of the "cam" object...
> > > > > > > >
> > > > > > > > Cheers
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > > represent really...
> > > > > > > > > thanks for helping,
> > > > > > > > > katrin
> > > > > > > > >
> > > > > > > > > -------- Original-Nachricht --------
> > > > > > > > > > Datum: Thu, 29 Jul 2010 08:46:49 -0700
> > > > > > > > > > Von: Graham Thompson <captainhammy at gmail.com>
> > > > > > > > > > An: sidefx-houdini-list at sidefx.com
> > > > > > > > > > Betreff: Re: [Sidefx-houdini-list] ndc to world matrix
> > > > > > > > >
> > > > > > > > > > There is not.  I posted some workarounds on your thread
> on
> > > the
> > > > > > forum
> > > > > > > > > > however.
> > > > > > > > > >
> > > > > > > > > > On Thu, Jul 29, 2010 at 8:42 AM, katrin schmid
> > > > <Katisss at gmx.de>
> > > > > > > wrote:
> > > > > > > > > > > hi,
> > > > > > > > > > > thanks for that, its surprisingly
> > > > > > > > > > > hard to find. I was wondering if there a way of
> querying
> > > > > > > > > > > worldTransform() in time for an animated camera?
> > > > > > > > > > > Regards,
> > > > > > > > > > > katrin
> > > > > > > > > > >
> > > > > > > > > > > -------- Original-Nachricht --------
> > > > > > > > > > >> Datum: Thu, 29 Jul 2010 08:06:59 -0700
> > > > > > > > > > >> Von: Graham Thompson <captainhammy at gmail.com>
> > > > > > > > > > >> An: sidefx-houdini-list at sidefx.com
> > > > > > > > > > >> Betreff: Re: [Sidefx-houdini-list] ndc to world
> matrix
> > > > > > > > > > >
> > > > > > > > > > >> The functions dealing with view transforms were added
> > for
> > > > > > Houdini
> > > > > > > > 11
> > > > > > > > > > >> so they aren't available in previous versions.
> > > > > > > > > > >>
> > > > > > > > > > >> You can kind of hack it by creating a dummy camera
> > node,
> > > > > > calling
> > > > > > > > > > >> hou.GeometryViewport.saveViewToCamera on that camera,
> > > > extract
> > > > > > the
> > > > > > > > > > >> transform from the camera then delete it.
> > > > > > > > > > >>
> > > > > > > > > > >> viewer = toolutils.sceneViewer()
> > > > > > > > > > >> viewport = viewer.curViewport()
> > > > > > > > > > >> cam = hou.node("/obj").createNode("camera")
> > > > > > > > > > >> viewport.saveViewToCamera(cam)
> > > > > > > > > > >> xform = cam.worldTransform()
> > > > > > > > > > >> cam.destroy()
> > > > > > > > > > >>
> > > > > > > > > > >> On Thu, Jul 29, 2010 at 7:40 AM, katrin schmid <
> > > > > Katisss at gmx.de>
> > > > > > > > > wrote:
> > > > > > > > > > >> > hi,
> > > > > > > > > > >> > so i found this here:
> > > > > > > > > > >> >>>>>>>>>
> > > > > > > > > > >> > Get the viewport's settings object
> > > > > > > > > > >> > settings = viewport.settings()
> > > > > > > > > > >> >
> > > > > > > > > > >> > Among the most useful methods on the settings
> object
> > are
> > > > > > > > > > viewTransform()
> > > > > > > > > > >> and setViewTransform(), which get and set the
> > viewport’s
> > > > > > > > > > transformation
> > > > > > > > > > >> matrix respectively.
> > > > > > > > > > >> >
> > > > http://www.sidefx.com/docs/houdini9.5/ref/windows/edittool
> > > > > > > > > > >> >>>>>>>>>
> > > > > > > > > > >> >
> > > > > > > > > > >> > Unfortunately i cant find viewTransform() in
> houdini
> > 10
> > > > > > python
> > > > > > > > > > >> > or figure out how to get it. Anybody knows?
> > > > > > > > > > >> > Thank you,
> > > > > > > > > > >> > karin
> > > > > > > > > > >> >
> > > > > > > > > > >> >
> > > > > > > > > > >> > -------- Original-Nachricht --------
> > > > > > > > > > >> >> Datum: Wed, 28 Jul 2010 10:00:12 +0200
> > > > > > > > > > >> >> Von: "katrin schmid" <Katisss at gmx.de>
> > > > > > > > > > >> >> An: sidefx-houdini-list at sidefx.com
> > > > > > > > > > >> >> Betreff: Re: [Sidefx-houdini-list] ndc to world
> > matrix
> > > > > > > > > > >> >
> > > > > > > > > > >> >> hi,
> > > > > > > > > > >> >> a python module inside a render node,
> > > > > > > > > > >> >> i will use whatever works :)
> > > > > > > > > > >> >> Regards,
> > > > > > > > > > >> >> katrin
> > > > > > > > > > >> >>
> > > > > > > > > > >> >> -------- Original-Nachricht --------
> > > > > > > > > > >> >> > Datum: Wed, 28 Jul 2010 00:57:09 -0700
> > > > > > > > > > >> >> > Von: Alex Lim <list at poh-yee.com>
> > > > > > > > > > >> >> > An: sidefx-houdini-list at sidefx.com
> > > > > > > > > > >> >> > Betreff: Re: [Sidefx-houdini-list] ndc to world
> > > matrix
> > > > > > > > > > >> >>
> > > > > > > > > > >> >> > Hi Katrin, is this in VOP net or VEX code? There
> > is a
> > > > > > > > Transform
> > > > > > > > > > VOP
> > > > > > > > > > >> that
> > > > > > > > > > >> >> > should let you convert from world to NDC. Will
> > this
> > > > work
> > > > > > for
> > > > > > > > you?
> > > > > > > > > > >> >> >
> > > > > > > > > > >> >> >
> > > > > > > > > > >> >> > Cheers,
> > > > > > > > > > >> >> > Alex
> > > > > > > > > > >> >> >
> > > > > > > > > > >> >> >
> > > > > > > > > > >> >> >
> > > > > > > > > > >> >> > On 7/28/2010 12:37 AM, katrin schmid wrote:
> > > > > > > > > > >> >> > > hi,
> > > > > > > > > > >> >> > > i am trying to write information into an exr's
> > > > metadata
> > > > > > > > > > >> >> > > and be interested in the worldToNDC matrix.
> > > > > > > > > > >> >> > > Do i need to calculate it all myself?
> > > > > > > > > > >> >> > > Best Regards,
> > > > > > > > > > >> >> > > katrin
> > > > > > > > > > >> >> >
> > > > > > > > > > >> >> > _______________________________________________
> > > > > > > > > > >> >> > Sidefx-houdini-list mailing list
> > > > > > > > > > >> >> > Sidefx-houdini-list at sidefx.com
> > > > > > > > > > >> >> >
> > > > > > > > >
> > > > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> > > > > > > > > > >> >>
> > > > > > > > > > >> >> --
> > > > > > > > > > >> >> GMX DSL: Internet-, Telefon- und Handy-Flat ab
> 19,99
> > > > > > EUR/mtl.
> > > > > > > > > > >> >> Bis zu 150 EUR Startguthaben inklusive!
> > > > > > > > > > http://portal.gmx.net/de/go/dsl
> > > > > > > > > > >> >> _______________________________________________
> > > > > > > > > > >> >> Sidefx-houdini-list mailing list
> > > > > > > > > > >> >> Sidefx-houdini-list at sidefx.com
> > > > > > > > > > >> >>
> > > > > > > >
> > > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> > > > > > > > > > >> >
> > > > > > > > > > >> > --
> > > > > > > > > > >> > GRATIS für alle GMX-Mitglieder: Die maxdome
> > Movie-FLAT!
> > > > > > > > > > >> > Jetzt freischalten unter
> > > > > > http://portal.gmx.net/de/go/maxdome01
> > > > > > > > > > >> > _______________________________________________
> > > > > > > > > > >> > Sidefx-houdini-list mailing list
> > > > > > > > > > >> > Sidefx-houdini-list at sidefx.com
> > > > > > > > > > >> >
> > > > > > >
> > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> > > > > > > > > > >> >
> > > > > > > > > > >> _______________________________________________
> > > > > > > > > > >> Sidefx-houdini-list mailing list
> > > > > > > > > > >> Sidefx-houdini-list at sidefx.com
> > > > > > > > > > >>
> > > > > >
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> > > > > > > > > > >
> > > > > > > > > > > --
> > > > > > > > > > > GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99
> > > > EUR/mtl.
> > > > > > > > > > > Bis zu 150 EUR Startguthaben inklusive!
> > > > > > > > > http://portal.gmx.net/de/go/dsl
> > > > > > > > > > > _______________________________________________
> > > > > > > > > > > Sidefx-houdini-list mailing list
> > > > > > > > > > > Sidefx-houdini-list at sidefx.com
> > > > > > > > > > >
> > > > > >
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> > > > > > > > > > >
> > > > > > > > > > _______________________________________________
> > > > > > > > > > Sidefx-houdini-list mailing list
> > > > > > > > > > Sidefx-houdini-list at sidefx.com
> > > > > > > > > >
> > > > > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99
> > EUR/mtl.
> > > > > > > > > Bis zu 150 EUR Startguthaben inklusive!
> > > > > > > http://portal.gmx.net/de/go/dsl
> > > > > > > > > _______________________________________________
> > > > > > > > > Sidefx-houdini-list mailing list
> > > > > > > > > Sidefx-houdini-list at sidefx.com
> > > > > > > > >
> > > > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > =======================================
> > > > > > > > Andrew D Lyons | Digital Artist | http://www.tstex.com
> > > > > > > > =======================================
> > > > > > > > _______________________________________________
> > > > > > > > Sidefx-houdini-list mailing list
> > > > > > > > Sidefx-houdini-list at sidefx.com
> > > > > > > >
> > > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> > > > > > >
> > > > > > > --
> > > > > > > GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl.
> > > > > > > Bis zu 150 EUR Startguthaben inklusive!
> > > > > http://portal.gmx.net/de/go/dsl
> > > > > > > _______________________________________________
> > > > > > > Sidefx-houdini-list mailing list
> > > > > > > Sidefx-houdini-list at sidefx.com
> > > > > > >
> > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > =======================================
> > > > > > Andrew D Lyons | Digital Artist | http://www.tstex.com
> > > > > > =======================================
> > > > > > _______________________________________________
> > > > > > Sidefx-houdini-list mailing list
> > > > > > Sidefx-houdini-list at sidefx.com
> > > > > >
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> > > > >
> > > > > --
> > > > > GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> > > > > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> > > > > _______________________________________________
> > > > > Sidefx-houdini-list mailing list
> > > > > Sidefx-houdini-list at sidefx.com
> > > > > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > =======================================
> > > > Andrew D Lyons | Digital Artist | http://www.tstex.com
> > > > =======================================
> > > > _______________________________________________
> > > > Sidefx-houdini-list mailing list
> > > > Sidefx-houdini-list at sidefx.com
> > > > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> > >
> > > --
> > > GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> > > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> > > _______________________________________________
> > > Sidefx-houdini-list mailing list
> > > Sidefx-houdini-list at sidefx.com
> > > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> > >
> > 
> > 
> > 
> > -- 
> > =======================================
> > Andrew D Lyons | Digital Artist | http://www.tstex.com
> > =======================================
> > _______________________________________________
> > Sidefx-houdini-list mailing list
> > Sidefx-houdini-list at sidefx.com
> > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> 
> -- 
> GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl.  
> Bis zu 150 EUR Startguthaben inklusive! http://portal.gmx.net/de/go/dsl
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list

-- 
GMX DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für nur 19,99 ¿/mtl.!*
http://portal.gmx.net/de/go/dsl



More information about the Sidefx-houdini-list mailing list