Forum: Poser - OFFICIAL


Subject: Geometry switching

Touchwood opened this issue on May 21, 2008 ยท 6 posts


lesbentley posted Wed, 21 May 2008 at 8:22 AM

You can find a good example of geometry switching in the hands of the Poser skelleton figures. These came with P4, and I expect they are still included in the Additional Figures folder if you have done a full install.

Basically you have a series of 'alternateGeom' blocks defining the paths to the alternate geometry files, then a 'geomChan' channel to do the actual switching.

The 'usemtl' defined in the obj files need to have matching 'material' statements in the 'figure' section of the cr2.

Below is an example of geometry switching for the head. Attached above is the text of a working example. Note that the attached example uses a Poser box prop as the default head, loaded via "objFileGeom", so as not to need to distribute an obj file with this example. Normally the default geometry would be loaded by a "figureResFile" statement.

actor head:1
        {
<span style="color:rgb(153,153,153);">       name    head<br></br>      on<br></br>        bend 1<br></br>    dynamicsLock            1<br></br> hidden          0<br></br> addToMenu       1<br></br> castsShadow             1<br></br> includeInDepthCue               1<br></br> useZBuffer              1<br></br> parent BODY:1<br></br>     creaseAngle 80</span>

        alternateGeom    head_2
                {
                objFile 1002 :Runtime:Geometries:props:ball.obj
                }
        alternateGeom    head_3
                {
                objFile 1003 :Runtime:Geometries:props:cone.obj
                }
        alternateGeom    head_4
                {
                objFile 1004 :Runtime:Geometries:props:cylTex.obj
                }

        channels
                {
                geomChan HeadSwap
                        {
                        uniqueInterp
                        name New Head
                        initValue 0
                        hidden 0
                        forceLimits 4
                        min 0
                        max 4
                        trackingScale 0.045
                        keys
                                {
                                static  0
                                k  0  0
                                }
                        interpStyleLocked 1
                        }

The 'max' value in the 'geomChan' needs to be the number of geometries used including the default geometry. The syntax I have used differs a little from that used in the skeleton figure, in that it simplifies by leaving the 'name' lines out, but it works just as well.