The world seed will still have an influence on this item placement later on, so things may not even be 100% the same then. I don't think it's an issue for now, as that's a very far distance to travel and repeated object placement will likely go unnoticed if you are moving around the world for that long. You might notice that if you walk 65536 blocks in one direction (maybe if you're a voxel granddad) the same seeds will be produced again.
The chunk's 2D location creates a 32 bit int that then is XOR'ed with the seed that is used everywhere for generating the surface of the world. Here is how I determined the seed:ĬhunkSeed = ((chunkOffsetX << 16) + chunkOffsetY) ^ worldSeed
Each chunk can be identified by its location in the world, and I can use a pseudo-random number generator that will have a different seed for each chunk. The placement now needs to be randomized. Leaf cubes are placed anywhere it's in the sphere. For the leaves, a function to determine whether a location is inside a sphere is used. My tree generation code consists of finding a surface voxel to "plant" it, and then use some loops to place cubes near the bottom for the trunk. But trees don't naturally occur in such an orderly fashion, so it's time to mix it up. The only condition for the tree-generation code is that they are to be placed where the elevation is lower than 80. Here are some screenshots of Grayscale Land.
So for now, everything is colored white with AO and directional lighting. Voxel color of natural features will probably be controlled by Biome classes or something similar. All the code for coloring voxels was hard-coded into the Chunk class, and this had to be moved sooner or later. This helped me just look at the details of the landscape and not think of how repetitive it looks with everything being grass green. Here are a bunch of spheres casting shadows on the ground.Įnjoy that green while it lasts, because I soon removed it. Then I added a square pillar for the stump. The first step I took was making a function that can produce a voxel sphere. There are no trees, boulders or other clutter filling up the place. But then I remembered that the environment was far from complete. But the more I looked and moved around it, the more it looked the same.
I know how to make a landscape that can alternate between long, mostly flat plains and rolling hills and mountain ranges. It's simple, but with some shadow smoothing the effect will look even better. The first solid voxel blocks sunlight and the rest of the voxels are darkened. All it does is, for every X, Z coordinate on the surface, start from the topmost voxel and move down, checking if a voxel is solid or empty. I added some basic voxel shadow casting code.
It's been a ton of trial and error to get a landscape that I was happy with, but I think I needed a new perspective in order to not burn myself out on it. Last week has been mostly occupied with tweaking stuff- tweaking noise outputs, heightmap parameters, and color gradients. Here's some more progress on the SeedWorld voxel engine.