Adding Geometry Switching (Oldschool Stuff) - What Stupid Mistake Am I Making ?



  • @3dcheapskate not sure then. That's what I'd changed when I converted a figure to unimesh, and it immediately broke the geometry switching, until I reverted.

    Can you show the entire obj declaration section for all the shelves?



  • @anomalaus I posted the lines specifying the base geometry (all six shelves) a couple of posts back - here it is again:

    {
    
    version
    	{
    	number 10.04
    	build 28925
    	}
    figureResFile :Runtime:libraries:Character:BookrowsTest01.obj
    actor BODY:2
    ...
    

    I've only created an alternate geometry OBJ for shelf4. Here's the altGeom and geomChan bits inserted into the main shelf4 section...

    actor shelf4:2
    	{
    	name    Shelf_4
    	on
    	bend 1
    	animatableOrigin 0
    	dynamicsLock		0
    	hidden		0
    	addToMenu	1
    	castsShadow		1
    	includeInDepthCue		1
    	useZBuffer		1
    	parent bone_1:2
    	creaseAngle 80
    	subdivLevels 0 
    	subdivRenderLevels 0 
    	subdivideWithFigure 1 
    	backfaceBehavior 1
    	alternateGeom Shelf4_1
    	{
    			name	Shelf41
    			objfile	9401 :Runtime:libraries:Character:Shelf4B.obj
    	}
    	channels
    		{
    		groups
    			{
    			groupNode Transform
    				{
    				parmNode xRotate
    				parmNode yRotate
    				parmNode zRotate
    				parmNode Scale
    				parmNode xScale
    				parmNode yScale
    				parmNode zScale
    				parmNode xTran
    				parmNode yTran
    				parmNode zTran
    				}
    			groupNode Other
    				{
    				parmNode OriginZ
    				parmNode OriginY
    				parmNode OriginX
    				}
    			}		
    		geomChan shelf4Geom
    			{
    			uniqueInterp
    			name Shelf_Variants
    			initValue 0
    			hidden 0
    			forceLimits 4
    			min 0
    			max 2
    			trackingScale 0.045
    			keys
    				{
    				static  0
    				k  0  0
    				}
    			interpStyleLocked 0
    			}
    		xOffsetA OriginX
    			{
    			...
    


  • F*ing 150 second post edit timeout ! That's only 2½ minutes !

    P.S. The book advised against setting tracking scale to 1 as that makes it too sensitive (I know that's correct - I tried it ages back)



  • Okay, I found why the shelf4 mesh isn't appearing when I load the edited CR2.
    I did a global change in the CR2 of the name 'bone_5' to 'shelf4' - but overlooked the 'g bone_5' in the base mesh OBJ file.
    So now all 6 shelves appear when I load my edited CR2.

    Changing the 'Shelf_Variants' dial on the parameter tab for Shelf_4 still has no effect on the mesh - the base shelf 4 mesh remains.



  • The alternate geometry for shelf4 is in the exact same location asthe base geometry, i.e. 'Runtime\libraries\Character' (cut-and-pasted from Windows Explorer) and the file is 'Shelf4B.obj'

    And I can manually import that OBJ without a hitch.

    And the location matches the 'objfile 9401 :Runtime:libraries:Character:Shelf4B.obj' in my edited CR2.



  • Hmmm... if I rename my alternate geometry OBJ file, so the CR2 'alternateGeom' 'objfile' line is pointing at a file that doesn't exist then I get exactly the same symptom - I turn the 'Shelf_Variants' dial and,apart from the dial value changing 0-> 1, nothing happens.



  • @3dcheapskate said in Adding Geometry Switching (Oldschool Stuff) - What Stupid Mistake Am I Making ?:

    		name	Shelf41
    		objfile	9401 :Runtime:libraries:Character:Shelf4B.obj
    

    No idea if it will help, but try renaming .. name Shelf41 To same same as the alternateGeom of Shelf4_1. So it would be

    		name	Shelf4_1
    		objfile	9401 :Runtime:libraries:Character:Shelf4B.obj

  • Poser Ambassadors

    https://www.renderosity.com/mod/freestuff/geometry-stripper/48560

    Nice utility to extract and swap the geometry.



  • @3dcheapskate what I meant by the obj declaration section is the earliest section where the geometries for the figure and it's actors have their file references specified, not the actual actor block with its channel definitions.

    So, something that looks like:

    figureResFile :Runtime:Geometries:<some_place>:<Some_thing>.obj
    actor BODY:1
    	{
    
    	}
    controlProp GoalCenterOfMass:1
    	{
    
    	}
    controlProp CenterOfMass:1
    	{
    
    	}
    actor Base:1
    	{
    	storageOffset 0 0 0
    	geomHandlerGeom 13 Base  
    	}
    actor RearPivot:1
    	{
    	storageOffset 0 0 0
    	geomHandlerGeom 13 RearPivot  
    	}
    actor FrontPivot:1
    	{
    	storageOffset 0 0 0
    	geomHandlerGeom 13 FrontPivot  
    	}
    ...
    prop CapsuleTop 1:1
    	{
    	storageOffset 0 0.3487 0
    	objFileGeom 0 0 :Runtime:Geometries: GeoffIX:CapsuleTop.obj
    	}
    

    which ties the group names specified in the obj files to the actors' internal names, via the geomHandlerGeom statement. They need to match exactly at the actor name:number lines. The group name within the geometry file does not need to match the alternateGeom reference, as long as it is specified correctly in the geometry declaration section.

    @rlowens68 from looking at my own geometry switching examples, which I used to use extensively back in Poser 7 days to hide body parts without scaling, prior to Poser supporting animatable visibility for actors, (I'd swap the geometry for Null.obj to hide body parts), the names specified on and within the alternateGeom block don't need to match anything. The match occurs between the alternateGeom declaration and the geomChan declaration:

    prop CapsuleTop 1:1
    	{
    	...
    	alternateGeom    capsuleTop_1
    		{
    		name Hidden CapsuleTop
    		objFile 20 <long_omitted_path>/Runtime/Geometries/Null.obj
    		}
    	creaseAngle 80
    	channels
    		{
    		groups
    			{
    			...
    			groupNode Other
    				{
    				collapsed 1
    				parmNode OriginZ
    				parmNode OriginY
    				parmNode OriginX
    				parmNode Flex
    				parmNode HideCapsule
    				}
    			groupNode Morph
    				{
    				parmNode Open
    				parmNode TwistTop
    				parmNode SquaredTop
    				}
    			}
    		...
    		geomChan HideCapsule
    			{
    			uniqueInterp
    			name Hide Capsule
    			initValue 1
    			hidden 0
    			forceLimits 1
    			min 0
    			max 1
    			trackingScale 1
    			keys
    				{
    				static  0
    				k  0  1
    				}
    			interpStyleLocked 1
    			valueOpDeltaAdd
    				Figure 1
    				Base:1
    				Capsule
    			deltaAddDelta -1.000000
    			}
    		targetGeom SquaredTop
    

    You'll notice that not one of the "capsuleTop_1", "Hidden CapsuleTop", "HideCapsule" or "Hide Capsule" references actually matches another, yet it still works.

    I guess the 9401 has been copied from some other example of geometry switching. Along with the 13 for body actors and the 20 I've used, I imagine it's meaning and relevance has evaporated in the mists of time.

    @3dcheapskate another thing to try, though it's not geometry switching, is to temporarily replace the geomHandlerGeom line for that shelf with "objFileGeom 0 0 :Runtime:libraries:Character:Shelf4B.obj" and see if the figure will load with the alternate shelf geometry. That would confirm that Poser is finding the file from that reference, rather than you locating it manually.



  • @Biscuits -Thanks, just downloaded it. Although manually extracting geometry to an external OBJ and replacing it with a reference via an 'objfile' is something that's never caused me problems in the past, Ifind that making typos is something I (or more accurately, my keyboard ;o) tend to domore frequently nowadays.



  • @rlowens68 Thanks for the suggestion. Tried it - same problem ,so it's not that. In the book it used different names,and anomalaus has confirmed that too a few posts below yours.



  • @anomalaus Sorry, it was late and I was half asleep ! ;o)

    {
    
    version
    	{
    	number 10.04
    	build 28925
    	}
    figureResFile :Runtime:libraries:Character:BookrowsTest01.obj
    actor BODY:2
    	{
    	storageOffset 0 0 0
    	geomHandlerGeom 13 BODY  
    	}
    controlProp CenterOfMass:2
    	{
    
    	}
    controlProp GoalCenterOfMass:2
    	{
    
    	}
    actor bone_1:2
    	{
    	storageOffset 0 0 0
    	geomHandlerGeom 13 bone_1  
    	}
    actor bone_2:2
    	{
    	storageOffset 0 0 0
    	geomHandlerGeom 13 bone_2  
    	}
    actor bone_3:2
    	{
    	storageOffset 0 0 0
    	geomHandlerGeom 13 bone_3  
    	}
    actor bone_4:2
    	{
    	storageOffset 0 0 0
    	geomHandlerGeom 13 bone_4  
    	}
    actor shelf4:2
    	{
    	storageOffset 0 0 0
    	geomHandlerGeom 13 shelf4  
    	}
    actor bone_6:2
    	{
    	storageOffset 0 0 0
    	geomHandlerGeom 13 bone_6  
    	}
    actor bone_7:2
    	{
    	storageOffset 0 0 0
    	geomHandlerGeom 13 bone_7  
    	}
    figureResFile :Runtime:libraries:Character:BookrowsTest01.obj
    
    actor BODY:2
    	{
    	...
    


  • (Darn 150s timeout - who's stupid idea was that? 10 minutes was bad enough!)

    The 9401 was completely arbitrary. The book said to use four digits in format BBAA where BB indicates bodypart and AA indicates which alternate geometry. So I randomly decided that shelf4 is 94, and this is the first alternate geometry, so it's 9401. I tried a different number,1001 -same problem.



  • This is the BookrowsTest01.obj, created by Poser when I used the Setup Room (and after I changed 'bone_5' to 'shelf4'to match the edited CR2)

    #		numbVerts    48
    #		numbTVerts    6
    #		numbTSets     144
    #		numbElems   36
    #		numbSets    144
    v -0.262818 0.022949 0.049910
    ...
    vt 0.000000 0.000000
    ...
    usemtl None
    s 5
    g bone_2
    f 1/1 2/1 4/1 3/1
    ...
    g bone_3
    f 9/2 10/2 12/2 11/2
    ...
    g bone_4
    f 17/3 18/3 20/3 19/3
    ...
    g shelf4
    f 25/4 26/4 28/4 27/4
    ...
    g bone_6
    f 33/5 34/5 36/5 35/5
    ...
    g bone_7
    f 41/6 42/6 44/6 43/6
    ...
    
    

    This was the original OBJ for the alternate geometry:

    # Blender v2.79 (sub 0) OBJ File: ''
    # www.blender.org
    v 0.050179 0.475192 0.050000
    ...
    vt 0.000000 0.000000
    ...
    usemtl None.003
    s off
    g bone_5
    f 1/1/1 2/2/1 3/3/1 4/4/1
    ...
    
    

    I wondered if perhaps I needed to match the group name in that to the CR2 and base OBJ as well,soI changed it to this:

    # Blender v2.79 (sub 0) OBJ File: ''
    # www.blender.org
    v 0.050179 0.475192 0.050000
    ...
    vt 0.000000 0.000000
    ...
    usemtl None
    s 5
    g shelf4
    f 1/1/1 2/2/1 3/3/1 4/4/1
    ...
    
    

    Still the same problem.



  • @anomalaus said in Adding Geometry Switching (Oldschool Stuff) - What Stupid Mistake Am I Making ?:

    ...@3dcheapskate another thing to try, though it's not geometry switching, is to temporarily replace the geomHandlerGeom line for that shelf with "objFileGeom 0 0 :Runtime:libraries:Character:Shelf4B.obj" and see if the figure will load with the alternate shelf geometry. That would confirm that Poser is finding the file from that reference, rather than you locating it manually.

    Indeed it does, so Poser can definitely find and load the alternate geometry OBJ. So that seemsto confirm that I'm doing something wrong in the actual geometry swapping code in the CR2. But there's so little of it!
    0_1534909428775_altbase.jpg



  • @3dcheapskate AH! Ah! you need to have

    			interpStyleLocked 1
    

    not 0, as I notice in your early post.

    I went back and searched my Poser 4 Runtime, and came up with a figure that has multiple alternateGeoms, (20 of them (including the original)!) for a hand style. Interestingly it also has a defaultGeomName referring to a string resource, but I don't think that's an issue.

    actor lHand:5
    	{
    	...
    	alternateGeom    lHand_2
    		{
    		name GetStringRes(1037,2)
    		objFile 1002 :Runtime:Geometries:maleSkeleton:hands:lHandShape_2.obj
    		}
    	alternateGeom    lHand_3
    		{
    		name GetStringRes(1037,3)
    		objFile 1003 :Runtime:Geometries:maleSkeleton:hands:lHandShape_3.obj
    		}
    	alternateGeom    lHand_4
    		{
    		name GetStringRes(1037,4)
    		objFile 1004 :Runtime:Geometries:maleSkeleton:hands:lHandShape_4.obj
    		}
    	alternateGeom    lHand_5
    		{
    		name GetStringRes(1037,5)
    		objFile 1005 :Runtime:Geometries:maleSkeleton:hands:lHandShape_5.obj
    		}
    	alternateGeom    lHand_6
    		{
    		name GetStringRes(1037,6)
    		objFile 1006 :Runtime:Geometries:maleSkeleton:hands:lHandShape_6.obj
    		}
    	alternateGeom    lHand_7
    		{
    		name GetStringRes(1037,7)
    		objFile 1007 :Runtime:Geometries:maleSkeleton:hands:lHandShape_7.obj
    		}
    	alternateGeom    lHand_8
    		{
    		name GetStringRes(1037,8)
    		objFile 1008 :Runtime:Geometries:maleSkeleton:hands:lHandShape_8.obj
    		}
    	alternateGeom    lHand_9
    		{
    		name GetStringRes(1037,9)
    		objFile 1009 :Runtime:Geometries:maleSkeleton:hands:lHandShape_9.obj
    		}
    	alternateGeom    lHand_10
    		{
    		name GetStringRes(1037,10)
    		objFile 1010 :Runtime:Geometries:maleSkeleton:hands:lHandShape_10.obj
    		}
    	alternateGeom    lHand_11
    		{
    		name GetStringRes(1037,11)
    		objFile 1011 :Runtime:Geometries:maleSkeleton:hands:lHandShape_11.obj
    		}
    	alternateGeom    lHand_12
    		{
    		name GetStringRes(1037,12)
    		objFile 1012 :Runtime:Geometries:maleSkeleton:hands:lHandShape_12.obj
    		}
    	alternateGeom    lHand_13
    		{
    		name GetStringRes(1037,13)
    		objFile 1013 :Runtime:Geometries:maleSkeleton:hands:lHandShape_13.obj
    		}
    	alternateGeom    lHand_14
    		{
    		name GetStringRes(1037,14)
    		objFile 1014 :Runtime:Geometries:maleSkeleton:hands:lHandShape_14.obj
    		}
    	alternateGeom    lHand_15
    		{
    		name GetStringRes(1037,15)
    		objFile 1015 :Runtime:Geometries:maleSkeleton:hands:lHandShape_15.obj
    		}
    	alternateGeom    lHand_16
    		{
    		name GetStringRes(1037,16)
    		objFile 1016 :Runtime:Geometries:maleSkeleton:hands:lHandShape_16.obj
    		}
    	alternateGeom    lHand_17
    		{
    		name GetStringRes(1037,17)
    		objFile 1017 :Runtime:Geometries:maleSkeleton:hands:lHandShape_17.obj
    		}
    	alternateGeom    lHand_18
    		{
    		name GetStringRes(1037,18)
    		objFile 1018 :Runtime:Geometries:maleSkeleton:hands:lHandShape_18.obj
    		}
    	alternateGeom    lHand_19
    		{
    		name GetStringRes(1037,19)
    		objFile 1019 :Runtime:Geometries:maleSkeleton:hands:lHandShape_19.obj
    		}
    	alternateGeom    lHand_20
    		{
    		name GetStringRes(1037,20)
    		objFile 1020 :Runtime:Geometries:maleSkeleton:hands:lHandShape_20.obj
    		}
    defaultGeomName  GetStringRes(1037,1)
    
    	channels
    		{
    		...
    		geomChan handGeom
    			{
    			uniqueInterp
    			name hand type
    			initValue 0
    			hidden 0
    			forceLimits 4
    			min 0
    			max 19
    			trackingScale 0.045
    			keys
    				{
    				static  0
    				k  0  0
    				}
    			interpStyleLocked 1
    			}
    		}
    	...
    	}
    


  • @anomalaus Well spotted with the interpStyleLocked - it was even highlighted in bold in the book, which stated specifically that it should be set to 1.

    Unfortunately that doesn't seem to fix it.

    I think I'll go back to the original CR2, as created by Poser on leaving the Setup Room, and add the alternate geometry stuff again from scratch. I've had a couple of coffeesso I'm less half-asleep than when I originally did it last night. Fingers crossed!



  • Okay, I redid the CR2 and it's now working. I've even got two variants now !

    (I had to change the 'g shelf4' in the base OBJ back to the original 'g bone5' of course - when I first loaded the newly edited CR2 the shelf4 geometry was missing, but I remembered why)

    Differences between what I did this time and the first time. This time I...

    • ...didn't change all the 'bone_5's to 'shelf4's
    • ...used different names
    • ...put the alternateGeom section slightly earlier, directly after the 'parent' line,instead of directly before the channels section.
    • ...put the 'geomChan' section at the end of the bone_5 channels, instead of at the start

    So it was either something to do with one of those or a simple typing cock-up on my part.



  • Here's the bits I inserted - two 'alternateGeom' sections and a 'geomChan' section: - and this is working fine

    actor bone_5:2
    	{
    	name    Shelf_4
    	on
    	bend 1
    	...
    	useZBuffer		1
    	parent bone_1:2
    	alternateGeom Variant1
    	{
    		name Variant1
    		objFile 1002 :Runtime:libraries:Character:Shelf4B.obj
    	}
    	alternateGeom Variant2
    	{
    		name Variant2
    		objFile 1002 :Runtime:libraries:Character:Variant2.obj
    	}
    	creaseAngle 80
    	subdivLevels 0 
    	subdivRenderLevels 0 
    	subdivideWithFigure 1 
    	backfaceBehavior 1 
    	channels
    		{
    		groups {...}
    		xOffsetA OriginX {...}
    		...		
    		twistX twistx{...}
    		geomChan shelf4Geom
    			{
    			uniqueInterp
    			name shelf4Variant
    			initValue 0
    			hidden 0
    			forceLimits 0
    			min 0
    			max 3
    			trackingScale 0.045
    			keys
    				{
    				static  0
    				k  0  0
    				}
    			interpStyleLocked 1
    			}
    		}
    	...
    
    

    ...despite the two 'alternateGeom' sections using identical 4-digit numbers !



  • @3dcheapskate glad you got it sorted. I'm sure a lot of those code numbers were originally designed to be meaningful, but as Poser was developed lots of early streamlining became redundant, or worked against cross-platform portability, hence the deprecation of all the GetStringRes use, which was harder for Windows users to customise than on Mac, since the ResEdit tool (now entirely obsolete) came from that platform. A nice idea to extract all the language specific text into resources that could be customised for different countries without compromising the program's code or requiring a recompile and repeat functional testing.