Follow

I know enough about 3D graphics to understand the difference between polygons and voxels, but at the same time I know enough that I realize I don't actually understand how voxels work, how they actually get drawn in the end.

So a voxel is a point/cube in 3D space, akin to how a pixel is a point/square in 2D space. But how does the computer draw it on screen? How does the logic work to put the thing on screen?

For a polygon cube, it uses 8 points and 12 triangle polygons, passes the info to the GPU, and tells it to draw a triangle from A to B to C a bunch of times.

How would this work for a cube represented by a voxel? Does the voxel coordinates represent the center of the cube? Lets keep it simple and say it represents a corner, and the size represents the length of each edge. How does the computer process this info to draw your 1 voxel cube? Does it figure out where all the corners of the cube are and plays connect the dots? Or am I fundamentally misunderstanding this, cause whenever I try to think about it, it always feels like at some point it must do something similar to how polygons are drawn.

· · Web · 5 · 0 · 0

@alyx I always assumed voxels were displayed the same way that oscilloscope displays work since they look similar but I really don't know

@alyx Nvm I have now learned voxels are not necessarily involved with those kind of displays, sorry :3

@alyx
I always assumed, that voxels are as a concept connected only to the simulation part of the problem, where you can represent any item by describing its volume, but you have to convert them to polygons in order to draw them.

@LukeAlmighty
So only relevant as a way to build/construct your things in memory, but when it comes to drawing on screen you go back to the same old process? Pretty much the same conclusion I always manage to arrive at too, but with how people treat voxels, it always gives me the impression that there's something special when it comes to drawing them.

@LukeAlmighty @alyx I believe that's the case. You ray cast which voxels are visible, then you calculate the visible vectors, then you somehow check if any of those vectors can form a bigger plane, turn those into triangles and finally rasterize those.
However I've programmed a renderer so I have no idea if I'm correct.

@alyx I always thought that the advantage of voxels is that you can approximate them when rendering - as pixels, small circles, whatever. If "voxel games" render them as exact cubes, that's cool retro aesthetic but it's missing the point of why voxels exist. IMHO.

@fuxoft
That's the thing that always confuses me, how are they rendered? Let's say I have 1 voxel on my screen, and let's say it occupies roughly a tenth of the screen. What would or could I see, and how is it drawn in the end? Would it be a cube that I could spin around? Would it be a sphere? If it were a 2d shape like a square or circle, would it behave like a sprite?

And for any approximation, how is the final step of drawing it to the screen different from having a 3D model of those approximations made from polygons?

@alyx
I'd say that if your object is represented by a single voxel, your scale is way off. Single voxel should be ignored as an unimportant noise. Voxels are used for objects with complex shapes (at least 100s of voxels per object), mainly when it's important to represent their volume.

@alyx
There are many, many, many ways to render voxels. It's entirely up to you how to render them, there is no "official way". However, voxels exist in order to store information about volumetric shapes composed of hundreds or millions of voxels. If your scene consists of one single voxel, you are not using voxels correctly. It's similar to asking "How do I render my scene in Unreal Engine if it contains only one single infinitely small object?" You can do it but why?

Do I understand you?

@fuxoft
Take this as feedback, and nothing else.
You would make a horrible teacher. In this thread, you were the only person that gave off the feeling that maybe you have worked with this or that you know the technology in depth, but at the same time you were the most unhelpful, to the point that it honest to god feels like you are intentionally skirting around the problem to be an ass.
You give off the impression of being a pretentious, condescending douchebag.

I tried to make the problem as simple and straightforward as possible. I used the example of 1 voxel because I want to understand what happens to the individual voxels.
You gave the most unhelpful and stupid answer. Obviously an aplication wouldn't have a single voxel on screen, just like you wouldn't have a model made up of a single triangle. But to understand now a complex model works, I first need to understand what happens to an individual polygon.

Then you mention "many, many, many ways to render voxels". That was what I was looking for, but you give 0 examples. That was what I was basically begging for, and you repeatedly missed the point. Give a few examples and explain what happens. That's what I managed to get from everyone else in this thread, and managed to better comprehend the problem I was searching a solution to.

But then you continue to be condescending when it was simply not necessary. I understand what voxels are used for. In my literal first post I state I understand how voxels are different than polygons, but I don't understand the final part of how they get drawn on screen. You ONLY went on tangents, and at no point did you touch my actual question.

Let me make myself VERY clear. At this point, I DO NOT WANT any more answers from you. This is ONLY for feedback purposes. You have been nothing but unhelpful and VERY annoying.

@alyx
Once more (whether you want it or not): Voxels are not something that's "drawn on screen". Voxels represent volume. A single voxel cannot do that very well. You can render voxels as polygons, cubes, points, circles or smiley faces. If you play a game with "cube graphics", those are not voxels in the original sense of the term. I tried explaining this to you and non ironically asked if I understand your question correctly. You got angry so I probably still don't.

@fuxoft
I told you I don't want an answer from you anymore. This is to let you know you're now muted.

@alyx Hopefully other people will still find this conversation informative, concerning both voxels and you.

@alyx from what I can ascertain, they are rendered entirely differently from polygons so perhaps looking at it through that lens is a mistake. There may very well be an entirely different algorithm that decides where they are placed when thinking of 3d space. As I understand it, polygons have the illusion of depth whereas volumetric pixels have actual depth. I don't know exactly how they are rendered, but it seems that they require the CPU to do so rather than the GPU so my immediate thought is that they require a higher degree of accuracy to render properly.

They're cool though, insanely good for physics simulations (like Teardown) and not needing to be textured. Instead of tricking the player into thinking they're looking at depth, it is what it says on the can, actual depth.

Then you get into weird fucking stuff like Dreams which is neither voxels nor polygons but something called "signed distance fields" which I am entirely in the dark on.

@beardalaxy
>As I understand it, polygons have the illusion of depth whereas volumetric pixels have actual depth.
That doesn't really make sense. Maybe you're thinking about volume. How a polygon model of a cube is empty on the inside, while a voxel cube would have volume inside it.

Something that I'm considering now, is that maybe they're using mathematical formulas for objects, like spheres, to draw the voxels. If you just applied the formula, you could get a far more precise and round sphere than any reasonable polygon model. But what usually confuses me is the case of "retro" games, with cubic voxels, cause as far as I can tell, you're back to defining the cube as a series of triangles. And considering voxels are presented as a way to get rid of polygons, it confuses me when I realize you're probably going back to polygons at some point in the render process.

@alyx i guess it depends on the engine, some use hybrids. a lot probably use voxels for things like physics calculations (particularly destruction) but then display it as polygons. there are engines that are capable of just rendering voxels, though.

another good reason to use them is for the whole not-needing-textures thing. since the voxels can be colored individually, there is no need for texturing. to get to that level of detail would require a lot more tris for polygon rendering.

and then there's something like that doom voxel mod, where the models still look like sprites but they actually have depth to them, which is a pretty unique way of doing it. although i'm unsure if the doom engine is actually rendering those voxels or if the creator just made the models out of voxels and converted it to polygons afterward or something.

@beardalaxy
The Doom mod is what brought the question back to my attention. I just managed to find again a video presenting the mod, and the guy explains it quite well.

The mod has 2 render paths possible:
- hardware rendering, in which the voxel object gets turned into a normal polygon mesh, that then the GPU draws like usual.
- software rendering, in which the individual voxels are displayed like square sprites.

So I guess in a way this kinda answers my question. You either turn your voxel objects into normal polygon models during rendering, and draw those using GPU; or have a software renderer draw them as a different shape, which might result in the individual voxel not even being 3D if you go the sprite route.

@beardalaxy
The whole voxel thing has fascinated me for a while, but I never fully grasped the rendering part. Everything else makes perfect sense to me.

I used to wonder how come a 1998 shooter called Delta Force somehow managed to have a much more detailed landscape than even newer games. Then I found out it had a hybrid engine, using both voxels and polygons. Ever since I'm still dumbfounded that people didn't invest more in this technology.

@beardalaxy
It's hard to see from a single picture, but it's unbelievable how many bumps and dips there are in the ground, and how smooth it looks overall. To this day I still don't think I've seen something quite like it without the usage of tricks like bumps maps.

@alyx There's not really a standardized way of drawing voxels because they never got hardware support to enforce one. Some common methods include converting the voxels to polygon cubes, converting them to sprites, and ray marching. Ray marching probably preserves the spirit of voxels the most, but it means you can't take advantage of the fixed function pipelines in the GPU.
Sign in to participate in the conversation
Game Liberty Mastodon

Mainly gaming/nerd instance for people who value free speech. Everyone is welcome.