Skip to main content
Bumped by Community user
Bumped by Community user
added 253 characters in body
Source Link

With Metal, I need to pass in an array of primitives to the GPU to be rendered. I'm making a terrain-based voxel game like Minecraft, but I have a problem.

foring through all of the visible voxels, and in each processing the list of block IDs and Metadata into a list of primitives for rendering is asinine, because I imagine obtaining primitives from raw block data being an expensive process. Surely there's a better way.

Given that you cannot duplicate or cull vertices and planes on the fly on the GPU, doing this in the vertex shader is out of the question. My problem is when or how translate raw block data into a list of primitives ready for the GPU to apply 3D projections to it.

It would definitely be a good idea to maintain the already-processed primitive lists, and only update them when a block updates. However, maintaining these is tricky. Maintaining them one block at a time is very messy, but one voxel at a time would require stitching them together prior to rendering.

This is the foundation of a block sandbox game like Minecraft. Without it I can't progress to gameplay mechanics. My game manages voxel data with a C++ style map, of 3 dimensional arrays of 16 by 16 by 16 4-byte blocks. I simply need to know where, when, and how the process of obtaining primitives from raw block data should take place. How do most games do it?

It's also worth noting that I'm using Metal, a game framework, rather than a game engine, so if game engines generally abstract away this process and therefore this question seems nonsensical, I'm not using a game engine, I'm using a game framework.

With Metal, I need to pass in an array of primitives to the GPU to be rendered. I'm making a terrain-based voxel game like Minecraft, but I have a problem.

foring through all of the visible voxels, and in each processing the list of block IDs and Metadata into a list of primitives for rendering is asinine, because I imagine obtaining primitives from raw block data being an expensive process. Surely there's a better way.

Given that you cannot duplicate or cull vertices and planes on the fly on the GPU, doing this in the vertex shader is out of the question. My problem is when or how translate raw block data into a list of primitives ready for the GPU to apply 3D projections to it.

It would definitely be a good idea to maintain the already-processed primitive lists, and only update them when a block updates. However, maintaining these is tricky. Maintaining them one block at a time is very messy, but one voxel at a time would require stitching them together prior to rendering.

This is the foundation of a block sandbox game like Minecraft. Without it I can't progress to gameplay mechanics. My game manages voxel data with a C++ style map, of 3 dimensional arrays of 16 by 16 by 16 4-byte blocks. I simply need to know where, when, and how the process of obtaining primitives from raw block data should take place. How do most games do it?

With Metal, I need to pass in an array of primitives to the GPU to be rendered. I'm making a terrain-based voxel game like Minecraft, but I have a problem.

foring through all of the visible voxels, and in each processing the list of block IDs and Metadata into a list of primitives for rendering is asinine, because I imagine obtaining primitives from raw block data being an expensive process. Surely there's a better way.

Given that you cannot duplicate or cull vertices and planes on the fly on the GPU, doing this in the vertex shader is out of the question. My problem is when or how translate raw block data into a list of primitives ready for the GPU to apply 3D projections to it.

It would definitely be a good idea to maintain the already-processed primitive lists, and only update them when a block updates. However, maintaining these is tricky. Maintaining them one block at a time is very messy, but one voxel at a time would require stitching them together prior to rendering.

This is the foundation of a block sandbox game like Minecraft. Without it I can't progress to gameplay mechanics. My game manages voxel data with a C++ style map, of 3 dimensional arrays of 16 by 16 by 16 4-byte blocks. I simply need to know where, when, and how the process of obtaining primitives from raw block data should take place. How do most games do it?

It's also worth noting that I'm using Metal, a game framework, rather than a game engine, so if game engines generally abstract away this process and therefore this question seems nonsensical, I'm not using a game engine, I'm using a game framework.

deleted 499 characters in body
Source Link

With Metal, I need to pass in an array of primitives to the GPU to be rendered. I'm making a terrain-based voxel game like Minecraft, but I have a problem. In the rendering code, that updates every frame, it would seem inefficient to have to recalculate all of the vertices' positions based on raw block data each frame.  

foring through all of the visible voxels, and in each translatingprocessing the list of block IDs and Metadata into a list of vertices with textures, lighting, and color associated with them. foring through all of them every frame on the CPU would seemprimitives for rendering is asinine, so surelybecause I imagine obtaining primitives from raw block data being an expensive process. Surely there's a better way. 

Given that you cannot duplicate or cull vertices and planes on the fly on the GPU, doing this there isn't an option, though I'm planning on managing 3D projections insidein the vertex shader functionis out of the question. My problem is when or how translate raw block data into a renderable list of vertices, in a way that won't kill performace. Is it possible to use a kernelprimitives ready for the GPU function to help out?apply 3D projections to it.

It would definitely be a good idea to maintain the already-processed primitive lists, and only update them when a block updates. However, when/where do I processmaintaining these primitives upon a block update? Could that be done on the GPU? Or does that have to be done on the CPU? Should I keep track of primitives for each 16x16x16 block voxel, or should I track and maintain eachis tricky. Maintaining them one block individually? If I maintainedat a list of primitives for each voxeltime is very messy, I'd need to stitchbut one voxel at a time would require stitching them each frame beforetogether prior to rendering.

What general approach shouldThis is the foundation of a block sandbox game like Minecraft. Without it I takecan't progress to renderinggameplay mechanics. My game manages voxel data? Where/how do I cull invisible faces/voxels? Where do with a C++ style map, of 3 dimensional arrays of 16 by 16 by 16 4-byte blocks. I generatesimply need to know where, when, and how the primative listprocess of obtaining primitives from raw block/voxel data?

I'm using a game framework, not a game engine. Sorry if this sounds only semi-coherant, but are there any ideas for a general approach one could should take to efficiently render voxel dataplace. How do most games do it?

With Metal, I need to pass in an array of primitives to the GPU to be rendered. I'm making a terrain-based voxel game like Minecraft, but I have a problem. In the rendering code, that updates every frame, it would seem inefficient to have to recalculate all of the vertices' positions based on raw block data each frame. foring through all of the visible voxels, and in each translating the list of block IDs and Metadata into a list of vertices with textures, lighting, and color associated with them. foring through all of them every frame on the CPU would seem asinine, so surely there's a better way. Given that you cannot duplicate or cull vertices and planes on the fly on the GPU, doing this there isn't an option, though I'm planning on managing 3D projections inside the vertex shader function. My problem is when or how translate raw block data into a renderable list of vertices, in a way that won't kill performace. Is it possible to use a kernel GPU function to help out?

It would definitely be a good idea to maintain the already-processed primitive lists, and only update them when a block updates. However, when/where do I process these primitives upon a block update? Could that be done on the GPU? Or does that have to be done on the CPU? Should I keep track of primitives for each 16x16x16 block voxel, or should I track and maintain each block individually? If I maintained a list of primitives for each voxel, I'd need to stitch them each frame before rendering.

What general approach should I take to rendering voxel data? Where/how do I cull invisible faces/voxels? Where do I generate the primative list from raw block/voxel data?

I'm using a game framework, not a game engine. Sorry if this sounds only semi-coherant, but are there any ideas for a general approach one could take to efficiently render voxel data?

With Metal, I need to pass in an array of primitives to the GPU to be rendered. I'm making a terrain-based voxel game like Minecraft, but I have a problem. 

foring through all of the visible voxels, and in each processing the list of block IDs and Metadata into a list of primitives for rendering is asinine, because I imagine obtaining primitives from raw block data being an expensive process. Surely there's a better way. 

Given that you cannot duplicate or cull vertices and planes on the fly on the GPU, doing this in the vertex shader is out of the question. My problem is when or how translate raw block data into a list of primitives ready for the GPU to apply 3D projections to it.

It would definitely be a good idea to maintain the already-processed primitive lists, and only update them when a block updates. However, maintaining these is tricky. Maintaining them one block at a time is very messy, but one voxel at a time would require stitching them together prior to rendering.

This is the foundation of a block sandbox game like Minecraft. Without it I can't progress to gameplay mechanics. My game manages voxel data with a C++ style map, of 3 dimensional arrays of 16 by 16 by 16 4-byte blocks. I simply need to know where, when, and how the process of obtaining primitives from raw block data should take place. How do most games do it?

Source Link

Rendering voxel data efficiently

With Metal, I need to pass in an array of primitives to the GPU to be rendered. I'm making a terrain-based voxel game like Minecraft, but I have a problem. In the rendering code, that updates every frame, it would seem inefficient to have to recalculate all of the vertices' positions based on raw block data each frame. foring through all of the visible voxels, and in each translating the list of block IDs and Metadata into a list of vertices with textures, lighting, and color associated with them. foring through all of them every frame on the CPU would seem asinine, so surely there's a better way. Given that you cannot duplicate or cull vertices and planes on the fly on the GPU, doing this there isn't an option, though I'm planning on managing 3D projections inside the vertex shader function. My problem is when or how translate raw block data into a renderable list of vertices, in a way that won't kill performace. Is it possible to use a kernel GPU function to help out?

It would definitely be a good idea to maintain the already-processed primitive lists, and only update them when a block updates. However, when/where do I process these primitives upon a block update? Could that be done on the GPU? Or does that have to be done on the CPU? Should I keep track of primitives for each 16x16x16 block voxel, or should I track and maintain each block individually? If I maintained a list of primitives for each voxel, I'd need to stitch them each frame before rendering.

What general approach should I take to rendering voxel data? Where/how do I cull invisible faces/voxels? Where do I generate the primative list from raw block/voxel data?

I'm using a game framework, not a game engine. Sorry if this sounds only semi-coherant, but are there any ideas for a general approach one could take to efficiently render voxel data?