Voxel things.

Moderator: GZDoom Developers

User avatar
reikall
Posts: 51
Joined: Thu Jun 15, 2017 12:34 pm

Voxel things.

Post by reikall »

I realize I'm kind of a noob, so I'm sorry if I don't really understand how these things work.

I think it would be extremely useful to be able to replace a single sprite with multiple voxel models, especially if you can specify a render style, alpha level, and fullbright/brightness for each model (and being able to render them inside-out would be useful in a few situations). It's the only way I've found to make one thing look like it has both solid and translucent parts, simulate Strife's bright pixel thing, and more. Currently, I have to spawn more actors for each 'layer' and that's obviously a performance hit, plus anything that bobs (and some that moves) doesn't seem to stay in sync. It also severely complicates compatibility with other mods because I have to make replacement actors for everything that gets these effects.

I know other mods like to use things like flare sprites by spawning other actors, so maybe the solution could be something that could be used for both purposes, like being able to layer sprites in some def file, and then I could have voxels for each of those sprites.

It could be useful to have a version of brightmaps and alpha masks for voxels, but kvx format rips out anything it thinks would be invisible, which could defeat the purpose in some cases.

Marching cube rendering of voxels would be pretty neat if you like smoother edges.

Thanks for listening.
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: Voxel things.

Post by Graf Zahl »

You can already do voxel replacement like that. Just name the voxel like the sprite without the rotation frame characters and put it in a voxels/ directory of the PK3.

Regarding Marching Cubes, if someone can point me to some ready-to-use code and not just a theoretical overview of the algorithm it surely can be added.
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Voxel things.

Post by Nash »

Whoever wants to improve the voxel rendering for OpenGL, I'd like to suggest an optional billboard voxel drawer as that's how it looks like in software-rendered BUILD.
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: Voxel things.

Post by Graf Zahl »

That's not going to happen because a) it's un-3D-ifying something that is real 3D and b) nobody understands how the voxel projection works to begin with and c) most importantly, that implementing that for hardware rendering is not going to be cheap. You'd need a different texture for every angle you look at such a thing.
User avatar
reikall
Posts: 51
Joined: Thu Jun 15, 2017 12:34 pm

Re: Voxel things.

Post by reikall »

Graf Zahl wrote:You can already do voxel replacement like that. Just name the voxel like the sprite without the rotation frame characters and put it in a voxels/ directory of the PK3.
As far as I can tell, that's still just one model per sprite. I'm looking for a way to attach multiple voxel models to a single frame name, so that those multiple models appear simultaneously.

There's no way to have translucent and solid voxels in the same (kvx format) model, so different parts of the same model have to be cut up and spawned as separate actors with different render styles. There are also no brightmaps for voxels, so you have to do the same thing to accurately recreate Strife sprites in GL. And I'm not much of a programmer, but I have a very hard time trying to keep those actors together while bobbing or with interpolation.

I would also like to see the billboarding, but I understand if the point is moot.
Last edited by reikall on Fri Apr 13, 2018 7:52 am, edited 1 time in total.
Gez
 
 
Posts: 17835
Joined: Fri Jul 06, 2007 3:22 pm

Re: Voxel things.

Post by Gez »

This thread was inspired by this over in the Adventures of Square thread:



The pseudo cell shading effect works by superposing two voxels one over the other. The outline is created by a larger, full-black model, and then the colored model is drawn over it. When things are drawn according to the sprite renderer logic, it works. Obviously, in OpenGL rendering, it doesn't work, the outline voxel being larger, it hides the smaller colored model. A possible way to get that to work in OpenGL would probably be to have a VOXELDEF keyword to "invert" the voxel faces, so that the inner sides are rendered but not the outer sides as normal. Would it be possible?
User avatar
reikall
Posts: 51
Joined: Thu Jun 15, 2017 12:34 pm

Re: Voxel things.

Post by reikall »

Thank you, I feel out of my depth here.

Would it also be possible to use a cvar to control spin in voxeldef? And be able to set pitch and roll offsets/spin?
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: Voxel things.

Post by Xaser »

Gez hit it on the head. There's basically two feature suggestions that are relevant to the Square vid:
  • A flag to invert the voxel faces.
  • The ability to replace a single sprite with multiple voxel models.
The second bullet has additional uses beyond the Square vid, like doing brightmaps and translucency (as mentioned in the OP). Though obviously the onus is on the modder to make sure they two overlaid voxel models render correctly in both GL and Software, that goes for spawning multiple actors anyway so it's already a thing.

Marching Cubes is kinda a distinct request that warrants its own thread, IMO.
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: Voxel things.

Post by Graf Zahl »

Gez wrote:The pseudo cell shading effect works by superposing two voxels one over the other. The outline is created by a larger, full-black model, and then the colored model is drawn over it. When things are drawn according to the sprite renderer logic, it works. Obviously, in OpenGL rendering, it doesn't work, the outline voxel being larger, it hides the smaller colored model. A possible way to get that to work in OpenGL would probably be to have a VOXELDEF keyword to "invert" the voxel faces, so that the inner sides are rendered but not the outer sides as normal. Would it be possible?
No, that'd look very, very strange. It'd also draw some inner faces so it probably won't replicate the desired effect.
Let's be clear about this: Abusing software rendering quirks for voxels is not something I'll ever guarantee to work forever. Maybe some day the Build-derived code gets tossed and replaced by something else. And maybe that code works differently. Then the effect will break and no amount complaining will ever be able to make me reconsider.

In short: DO NOT OVERLAP VOXELS!
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: Voxel things.

Post by Xaser »

The entire point of this feature suggestion set was to remove that unreliable behavior and replace it with something that works. See my post above.
User avatar
m8f
 
 
Posts: 1445
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Manjaro Linux
Location: Siberia (UTC+7)
Contact:

Re: Voxel things.

Post by m8f »

Maybe there are other ways to draw outline? Warsow achieves this somehow.
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine
Contact:

Re: Voxel things.

Post by ZZYZX »

It uses models. Do we have models in software yet? And if we do, do they have ZBuffer or are just sorted semi-randomly like voxels?
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: Voxel things.

Post by Graf Zahl »

This effect cannot achieved purely with models either. My guess would be that this game uses some postprocessing to detect edges and add black outlines where needed.
User avatar
reikall
Posts: 51
Joined: Thu Jun 15, 2017 12:34 pm

Re: Voxel things.

Post by reikall »

Graf Zahl wrote:No, that'd look very, very strange. It'd also draw some inner faces so it probably won't replicate the desired effect.
Let's be clear about this: Abusing software rendering quirks for voxels is not something I'll ever guarantee to work forever. Maybe some day the Build-derived code gets tossed and replaced by something else. And maybe that code works differently. Then the effect will break and no amount complaining will ever be able to make me reconsider.

In short: DO NOT OVERLAP VOXELS!
I recognize that I'm abusing software rendering quirks in that video, but most of my reasons for requesting this had nothing to do with the software renderer at all.
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: Voxel things.

Post by Xaser »

Borderlands does outlines with a shader, and I'd hazard a guess that Warsow does the same. Some quick googlin' yielded an example implementation of something like this. Warsow also has this repo -- I can't read GLSL to save my life, but there's a shader pair in there named "defaultOutline", so perhaps that's relevant.

It still achieves different results than inverted-normals would (e.g. line thickness), and it's kinda a different use case anyway.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”