[No] Voxel things.

Moderator: GZDoom Developers

Voxel things.

Postby reikall » Thu Apr 12, 2018 8:18 pm

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
reikall
 
Joined: 15 Jun 2017

Re: Voxel things.

Postby Graf Zahl » Fri Apr 13, 2018 1:34 am

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Voxel things.

Postby Nash » Fri Apr 13, 2018 6:02 am

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
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia with Vulkan support

Re: Voxel things.

Postby Graf Zahl » Fri Apr 13, 2018 6:27 am

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Voxel things.

Postby reikall » Fri Apr 13, 2018 8:25 am

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 8:52 am, edited 1 time in total.
User avatar
reikall
 
Joined: 15 Jun 2017

Re: Voxel things.

Postby Gez » Fri Apr 13, 2018 8:50 am

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?
Gez
 
 
 
Joined: 06 Jul 2007

Re: Voxel things.

Postby reikall » Fri Apr 13, 2018 9:05 am

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
reikall
 
Joined: 15 Jun 2017

Re: Voxel things.

Postby Xaser » Fri Apr 13, 2018 11:02 am

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
Xaser
anarchivist
 
 
 
Joined: 20 Jul 2003

Re: Voxel things.

Postby Graf Zahl » Fri Apr 13, 2018 11:17 am

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Voxel things.

Postby Xaser » Fri Apr 13, 2018 11:23 am

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
Xaser
anarchivist
 
 
 
Joined: 20 Jul 2003

Re: Voxel things.

Postby m8f » Fri Apr 13, 2018 12:09 pm

Maybe there are other ways to draw outline? Warsow achieves this somehow.
User avatar
m8f
 
 
 
Joined: 29 Dec 2017
Discord: m8f#0629
Github ID: mmaulwurff

Re: Voxel things.

Postby ZZYZX » Fri Apr 13, 2018 12:14 pm

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
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine

Re: Voxel things.

Postby Graf Zahl » Fri Apr 13, 2018 12:22 pm

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Voxel things.

Postby reikall » Fri Apr 13, 2018 12:30 pm

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
reikall
 
Joined: 15 Jun 2017

Re: Voxel things.

Postby Xaser » Fri Apr 13, 2018 12:37 pm

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.
User avatar
Xaser
anarchivist
 
 
 
Joined: 20 Jul 2003

Next

Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests