سؤال

I'm looking to create a simple voxel engine in C#. I know a lot of XNA but heard it would be better to do it in OpenGL / DirectX. Anybody know how I would accomplish such a thing? I do not want a library as I want to learn how to do it from scratch.

هل كانت مفيدة؟

المحلول

OpenGL and Direct3D are both "triangle" APIs - they aren't volumetric renderers. We need more information about what you want your voxel engine to do.

If you want to render voxels directly, then your best bet is to avoid OpenGL and Direct3D and write your own OpenCL or CUDA renderer (or even be 100% software on the CPU).

Rendering voxels to OpenGL or Direct3D would require converting the voxel world to triangles - using something like marching cubes. This technique can be efficient if the voxel world is fairly static and the voxels are large (like Minecraft). However this technique wouldn't work in massively-deformable worlds, for example, as you'd have to re-generate the triangle scene on a regular basis, which will be expensive.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top