2
\$\begingroup\$

I'm trying to render giant procedurally generated trees in Minecraft. I have code that generates a tree model and represents it parametrically as a collection of cones and spheres using vectors and scalar values. As a final step I'd like to rasterize the parametric model into Minecraft blocks.

So far I've only found resources for rendering 3d parametric solids onto the 2d viewport. Does anybody have any recommended resources or algorithms I can use to rasterize my tree model into Minecraft's 3d voxel space?

\$\endgroup\$
2
  • \$\begingroup\$ I think raytracing is often used to project arbitrary solids onto a video grid, though that's often more for hermite data \$\endgroup\$
    – ThorinII
    Mar 18 '14 at 23:08
  • 1
    \$\begingroup\$ You must be over thinking it, do a triple nested loop and test each possible voxel. \$\endgroup\$
    – MickLH
    Mar 19 '14 at 20:24
1
\$\begingroup\$

I'm aware of three basic methods for rasterizing arbitrary solid volumes (from finite differencing approximation):

  • midpoint occupancy: If the cell (cube) centre is inside the object, it's solid.

  • Volume fraction: If the majority (or some other cutoff value) of the cell volume is filled by the object, it's a solid space. [requires calculating the volume of an intersection cube-parametric surface]

  • Point occupancy fraction: Choose a representative (or random) set of points inside the cube, test if they are inside the parametric object, on cutoff percentage declare occupied or not.

The central point method has high aliasing, so is suitable only for small voxels (which Minecraft(c) does not have). The fractional occupancy varieties can have intermediate cases linked to other cutoff values as an anti-aliasing technique. For example, one could actually consider binary Marching Cubes to be a version of point occupancy that chooses the 8 corners as its test points and has anti-aliasing.

As I've personally not gotten to rasterizing trees (and will probably go with cellular automata inside the grid confines, as an aesthetic choice) for my own project, I have no specific guides or commentary to recommend.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.