Comments (5)
Hi, so this voxel engine doesn't impose any particular rules on what voxels can go where - so the task of making "plausible" voxel worlds, like where trees don't grow out of water, is entirely up to the game logic above the engine.
One common approach is to pick a y value for the world's water level, then have a general height-map function that defines a value for terrain height everywhere in the world, and then assign land/water/tree blocks depending on whether each voxel is above or below the terrain or water heights. That's what the stress-test code above is doing, so for example if you wanted to not have "pillars" spawn on top of water, you'd want to skip that bit (or set the pillar height to 0
) wherever the terrain height ht
is below the water line (which here is 0
).
But it's a big topic and there are lots of possible ways to go - you might like to check out r/procedural/
or similar communities for ideas.
from noa.
Thanks for that. How would I go about making trees?
from noa.
Making large structures is a bit thorny, because if a tree is at the edge of a chunk then parts of it will need to be generated at different times. In my own content I went through several iterations. One relatively easy approach is to just only generate trees on the "internal" parts of a chunk, not at the edges. If you don't have very many trees this winds up not being that noticeable.
But the more robust thing to do is something like:
- have one function that, given a world (x,z) coordinate, returns the terrain height at that position
- have a second function that, given a world (x,z) coord, returns a list of all tree positions nearby.
- have a third function which, given a world data chunk and a tree position, draws that tree into the chunk wherever they overlap. E.g. if the tree is slightly outside of the chunk then this function wouldn't set any voxels for the trunk, but it might set voxels for leaves.
Then at runtime, for each chunk you'd get a list of nearby trees (2), and for each tree you draw it (3) into the current chunk, relative to the terrain height (1) at the tree center (which is where the trunk starts). But note that all of the logic involved needs to be deterministic - if tree locations are random then you'll have half-trees at chunk borders.
Or at least, that's what I wound up doing. There may be better ways!
from noa.
Ok. I'm a beginner trying to make sense of this lol.
from noa.
My main problem is actually adding leaves on the pillars
from noa.
Related Issues (20)
- Is there any way to use this as an es6 module? HOT 10
- Support gamepad input
- Outdated comment + note on blockMesh registration HOT 2
- Alpha blended mesh ordering issue HOT 2
- Terrain remeshing bug when block is neither solid nor opaque HOT 3
- Custom voxel occasionally leaves one side after removal. HOT 4
- UV offsets wrapping at edges of blocks HOT 2
- object meshing bug HOT 6
- Meshing with non-opaque blocks is incredibly slow + block textures with alpha dont work HOT 4
- custom renderMaterial performance (for animated textures) HOT 2
- Supporting noa HOT 2
- Does NOA support child meshes? HOT 3
- webgpu? HOT 2
- Optimal octreeBlockSize
- What is the best way to manually build worlds? HOT 2
- render all blocks even if covered HOT 1
- How to import an obj model?
- refresh the registry on the go HOT 2
- Making a set world.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from noa.