TransWikia.com

How can I create hemisphere worlds (floating islands?) with 3d (or 2d)? Noise (Perlin/OpenSimplex)

Game Development Asked on December 3, 2021

I’ve been experimenting with noise for a while and I’ve gotten some terrain up: It looks like this:

What I’d like instead is to have planets like this (currently mine is in a cube shape)
enter image description here

My generation code actually skews the values so the top is not solid and the bottom is. I tried to reverse this but I got a giant mess, with the top being completely solid up to the worldheight and the bottom having holes caved into it. Here is my generation code:


                    float value = noise.GetPerlinFractal(worldLoc.x, worldLoc.y, worldLoc.z);
                  
                    
                    
                    if (y <= waterHeight) {
                        for (int i = y; i <= waterHeight; i++) {
                            chunk.addBlock(x, i + 1, z, BlocksConfig.getInstance().getBlockRegistry().get(BlockIds.WATER));
                        }
                    }

                    if (value - ((y - 128) * 0.01) >= 0) {
                        if ((y > waterHeight && y < waterHeight + 2)) {
                            chunk.addBlock(x, y, z, BlocksConfig.getInstance().getBlockRegistry().get(BlockIds.SAND));
                        } else {
                            chunk.addBlock(x, y, z, BlocksConfig.getInstance().getBlockRegistry().get(BlockIds.GRASS));
                        }

                    }
                    if (y < 105) {
                        if ((Math.pow(noise2.GetNoise(worldLoc.x, worldLoc.y, worldLoc.z), 2) + Math.pow(noise3.GetNoise(worldLoc.x, worldLoc.y, worldLoc.z), 2)) < 0.02) {
                            if (!(chunk.getBlock(x, y + 1, z) == (BlocksConfig.getInstance().getBlockRegistry().get(BlockIds.WATER)))) {
                                chunk.addBlock(x, y, z, null);
                            }
                        }
                    }

This is done for every block in every chunk.
I’m a bit confused here and saw other ancient posts about this. However, I don’t exactly understand and was wondering if someone could explain such for me. Thanks so much in advance!

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP