Voxel things.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Voxel things.

Re: Voxel things.

by GFD » Sat Apr 14, 2018 12:31 pm

I've used this overlapping effect on voxel models in the software renderer before to accomplish some really cool effects. Notable were some 3D fire effects, using three+ overlapping voxel models with different colours. This isn't something that could be accomplished with outline shaders. I haven't yet gotten far enough with the project to warrant a feature suggestion though, and then suddenly this one came and went when I wasn't looking. Gez's suggestion to allow inverted voxel faces would let this work with specially-crafted convex shapes in both software and hardware renderers, so I'm not sure why it isn't a viable option.

Re: Voxel things.

by Graf Zahl » Sat Apr 14, 2018 8:24 am

No, you cannot do it *purely* with models. You always need some hackery and need to be extremely careful about avoiding glitches.
There's also the issue of maintainability. Not everything that gets a 'no' does so purely because it's not doable. Sometimes it also gets done because nobody wants to care about the code later.

Re: Voxel things.

by ZZYZX » Sat Apr 14, 2018 7:41 am

Outline is done here:
https://github.com/Warsow/glsl/blob/mas ... .vert.glsl
Specifically by this line:

Code: Select all

	Position += vec4(Normal * u_OutlineHeight, 0.0);
Which is essentially the variant where model is rendered twice, but one of the passes with vertices pushed a bit out, in another color and with back faces only.
This is essentially noticeable in frames/positions like this: https://i.imgur.com/Z9OMLp2.png (screenshot from the vid)

LOL'd at Graf's "cannot be achieved purely by models". If I make a second mesh (with larger boundaries) manually, then flip it's faces and use it with an engine that actually displays only front face (not like GZDoom which always displays both) then it will be done purely with models. Magic, right?

I wouldn't care much, but this misbelief might lead to erroneous [No]'s in the future :roll:

Re: Voxel things.

by Xaser » Fri Apr 13, 2018 11:37 am

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.

Re: Voxel things.

by reikall » Fri Apr 13, 2018 11:30 am

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.

Re: Voxel things.

by Graf Zahl » Fri Apr 13, 2018 11:22 am

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.

Re: Voxel things.

by ZZYZX » Fri Apr 13, 2018 11:14 am

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?

Re: Voxel things.

by m8f » Fri Apr 13, 2018 11:09 am

Maybe there are other ways to draw outline? Warsow achieves this somehow.

Re: Voxel things.

by Xaser » Fri Apr 13, 2018 10: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.

Re: Voxel things.

by Graf Zahl » Fri Apr 13, 2018 10: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!

Re: Voxel things.

by Xaser » Fri Apr 13, 2018 10: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.

Re: Voxel things.

by reikall » Fri Apr 13, 2018 8: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?

Re: Voxel things.

by Gez » Fri Apr 13, 2018 7: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?

Re: Voxel things.

by reikall » Fri Apr 13, 2018 7: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.

Re: Voxel things.

by Graf Zahl » Fri Apr 13, 2018 5: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.

Top