[OpenGL] Voxel rendering bool property DisableGLmethod

Moderator: GZDoom Developers

Post Reply
Uberkreatur
Posts: 27
Joined: Fri Dec 26, 2014 10:54 am
Location: Russia

[OpenGL] Voxel rendering bool property DisableGLmethod

Post by Uberkreatur »

Reason:
Voxel rendering method in OpenGL mode is excess and overcomplicated. Yes, it perfectly defines the boundaries of the object, but requires a lot of separate 3d-models for each voxel, so even simple voxel model requires over 9000 polygons. This worsens FPS, if there are many voxel objects on the map.
In many cases this is not needed. For example, for most voxel props standard software renderer method is enough, when voxel is just a 3d-sprite, and order of drawing is defined by XY-coordinates like for simple sprites. This method is fast and economical, but еhe only way to use it in Gzdoom is to disable GL renderer at all.


Solution:
Add in VOXELDEF lump a bool property "DisableGLmethod" for OpenGL mode. If property is "TRUE", specific model would be drawn as 3d-sprite, without creating polygonal cubes for each voxel. Yes, this can cause an incorrect display of intersecting objects (as in software renderer), but in this case it is the best compromise.

This would be very convenient and would save a bunch of computer resources. This would save voxel-oriented mods from extinction after the death of the Zdoom.
Hope for understanding.
User avatar
Chris
Posts: 2942
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: [OpenGL] Voxel rendering bool property DisableGLmethod

Post by Chris »

Voxel rendering method in OpenGL mode is excess and overcomplicated. Yes, it perfectly defines the boundaries of the object, but requires a lot of separate 3d-models for each voxel, so even simple voxel model requires over 9000 polygons.
I don't believe this is the case. AFAIK, in OpenGL mode a voxel is turned into a model hull, so only the visible outer faces of the cubes are turned into polygons. And I'd be surprised if the engine doesn't cull voxels from rendering if they're not on screen. Besides which, the performance impact would be system-dependent and different users have different thresholds about what's bad performance. So it doesn't seem to me like specifying it in VOXELDEF is appropriate.
User avatar
Rachael
Posts: 13557
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: [OpenGL] Voxel rendering bool property DisableGLmethod

Post by Rachael »

1) First of all, it would take someone with a very sharp mind to work out all the trigonometry to make a straight 3d voxel to 2d projection into a 3d world work.

2) It would be very difficult, since a voxel would still be a 3d model being rendered to a 2d sprite, to ensure that the voxel does not incorrectly clip into the floor or nearby geometry inappropriately.

3) And leading from the second reason - it would get even more complicated because you would have to fudge the sprite's Z-depth in order to prevent floor clipping, which would lead to all sorts of other problems including with the lighting.

4) It would also be next to impossible, since OpenGL allows for full 90-degree pitch panning, to completely draw the voxels convincingly so that they would appear to have actual volume at extreme angles. I believe that each voxel slab is drawn as a line, which means at extreme angles the insides of the voxel can bleed through, which is far more likely to happen at more extreme angles. (Not 100% sure about this, though, since it's nearly impossible to completely understand the voxel code as written)
Chris wrote:And I'd be surprised if the engine doesn't cull voxels from rendering if they're not on screen.
This is correct. Nothing renders if the requirements for RenderRadius or the visible subsector being rendered on the screen are not met.

For these reasons, this suggestion is not feasible to be implemented.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [OpenGL] Voxel rendering bool property DisableGLmethod

Post by Graf Zahl »

Just a small note:

Modern graphics hardware doesn't break a sweat with high polygon count - they are made for it. The major metric is draw calls and each voxel is a single vertex buffer being rendered with a single draw call. So voxels are actually one of the few items in the game that can fully exploit how modern hardware works.

This all suggests that the OP is using a significantly underpowered graphics card. Aside from the issues already listed this is another one for nixing the suggestion. It is far more likely to drop support for this hardware entirely than accomodating the render process for it, especially if the 'solution' being proposed is as unworkable as here.

The suggestion is unwrkable anyway, because in order to do this, the amount of textures being required far exceeds the available resources. Texture uploads are magnitudes more expensive than rendering lots of polygons, even doing as little as a single 512x512 texture can slow down older hardware to a crawl and with multiple voxels you'll need a lot more.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”