SexFlip v0.2
Using the default makehuman settings, I’ve created a new model for SexFlip Pro v0.2.
I created three models; one with androgynous features, one with a penis and one with breasts. The extra bits were removed from the latter two meshes, leaving floating private parts, the scale of which can be controlled separately as in SexFlip v0.1.
The boobs and willy can still be scaled to ridiculous proportions, but they don’t float away so much any more. The seams of the breasts are awful, though.
Again, Java and Java3D are needed, and program source and models can be found in the jar.
The only bit of programming that had me scratching my head was figuring out how to scale a Shape3D in java from a specific point, rather than scaling the model around point 0,0,0 as is the default behaviour. In blender for example, you can choose to scale around the cursor rather than around 0,0,0. A brief google search didn’t yield any tips on how to do this, and I’m sure the functionality must exist in the API, but it’s eluded me. So instead I did as follows:
- Create a vector representing the centre point of the scale transform, let’s call it C.
- Multiply this vector by the scale factor, S, resulting in a vector D.
- Apply the scale transformation (S) to your shape as normal.
- Subtract vector D from C, giving E.
- Apply a translation transformation to your shape, using the vector E to specify the translation.
In other words, subtract the distance that the shape gets displaced, from its starting point. Or in Javanese:
Transform3D t = new Transform3D(); // Making the shape 10 times bigger double scale = 10.0; t.setScale( scale ); // Scaling around the point 0, 0.085, -0.41 Vector3f center = new Vector3f( 0.0f, 0.085f, -0.41f ); // Duplicate the centre vector and scale it Vector3f scaledCenter = new Vector3f( center ); scaledCenter.scale( (float) scale ); // Subtract one from the other center.sub( scaledCenter ); // Combine the translation and scaling into one transform operation t.setTranslation( center ); // Finally, apply the transform to the shape willy.setTransform( t );
My code’s a little different so that might not work without tweaking. Feel free to share a better way of scaling around a point in Java3D if you know it.