(April 2020) Monthly WIP Screenshot Thread

@Samfucious Nice. Was that mesh procedurally generated?

@decoyhiding

Yes! Yes it was! Using the CSG libraries at jMonkey CSG - Constructive Solid Geometry (shapes)

1 Like

A gift of source code (resubmitted for cleaner formatting).

    private static CSGGeonode createYinYangCSGGeonode(int radialSamples, float radius, float thickness) {    
        CSGGeonode cutaway = new CSGGeonode();        
        {      
            CSGShape cutawayBox = new CSGShape("box", new Box(radius, radius , thickness));
            cutawayBox.setLocalTranslation(radius, 0.0f, 0.0f);
            cutaway.addShape(cutawayBox);
            CSGShape polarityDisk1 = new CSGShape("semidisk", new Cylinder(2, radialSamples, radius * 0.5f, thickness, true));
            polarityDisk1.setLocalTranslation(0.0f, radius * 0.5f, 0.0f);
            cutaway.addShape(polarityDisk1);
        
            CSGShape polarityDisk2 = new CSGShape("semidisk", new Cylinder(2, radialSamples, radius * 0.5f, thickness, true));
            polarityDisk2.setLocalTranslation(0.0f, -radius * 0.5f, 0.0f);
            cutaway.subtractShape(polarityDisk2);
        
            CSGShape spot = new CSGShape("semidisk", new Cylinder(2, radialSamples, radius * 0.125f, thickness, true));
            spot.setLocalTranslation(0.0f, -radius * 0.5f, 0.0f);
            cutaway.addShape(spot);
        }
        CSGShape cutawayFinal = cutaway.regenerate();
    
        CSGGeonode geometry = new CSGGeonode();
        CSGShape semiDisk = new CSGShape("semidisk", new Cylinder(2, radialSamples, radius, thickness, true));
        geometry.addShape(semiDisk);
        geometry.subtractShape(cutawayFinal);
    
        geometry.regenerate();
        return geometry;
    }
4 Likes

And this time working on a collision shape editor :slightly_smiling_face:

10 Likes

i wonder how much faster it is using compound shapes like this than just use V-HACD by Ricc. (already in Minie as i remember)

Hmm…, not sure, have not tested.

V-HACD also generates compound shapes. The compound shape constructed in the video (for the house) is far simpler than the shape V-HACD would generate, so I’d expect it to be more efficient in simulation.

2 Likes

To me, hand constructed is always going to be better… it will just take longer to make it, ie: not automatic.

The easy way to see it will be better is because you can simply ignore parts of the geometry you don’t care about that. An algorithm can’t really make that determination.

2 Likes

@zissis - I don’t suppose your code is available such that I could look at how you did the solar systems?

The animated sun is just a shader I created a while back. I am pretty sure I posted it on here somewhere. As for the scene, I create a scene in the SDK with custom properies on the key objects describing what they are … Planet, sun, etc. Each object is an asset link to it’s raw j3o file. When the server starts up, it loads the scenes, iterates through the objects and builds the appropriate entities then throws the scene away since it’s just a template. I have custom systems for drawing the orbits based on the distance a platen has from it’s orbiting sun. I also have a custom system for the orbit movement of planets around the sun. At runtime I use Zay-Es for the entity management and SimEthereal for the networking … although I modified SymEtherial to have a concept of “scene” so I can easily switch from one scene to the next.