The amazing triangle drawer!

Truecolor ZDoom with extra features and some unofficial/beta GZDoom features.
[Home] [Download] [Git builds (Win)] [Git builds (Mac)] [Libs (Win)] [Repo] [Bugs&Suggestions]

Moderators: Rachael, dpJudas

User avatar
Rachael
Developer
Developer
Posts: 3639
Joined: Sat May 13, 2006 10:30

Re: The amazing triangle drawer!

Post by Rachael »

dpJudas wrote:Wasn't a cube sky supposed to look horrible? This looks quite alright to me.
E2M1. E3M1. Map12. Map21.

If those all look alright to you, you don't have the same OCD that I do. :P

But I'll take this feature for the potential that it provides, over something as simple as texture mapping the existing skies onto the cube. ;)
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: The amazing triangle drawer!

Post by Graf Zahl »

@Nash: Not without a depth buffer.
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: The amazing triangle drawer!

Post by dpJudas »

Eruanna wrote:E2M1. E3M1. Map12. Map21.

If those all look alright to you, you don't have the same OCD that I do. :P
E2M1 and E3M1 looked okay to me. But Graf is probably right that doing a gradient (which it would have to do to close off the top and bottom with a solid color) will not work as well as it does with a dome. Still, it looked better overall than I expected. :)

About the zbuffer and modeldef thing - making it use its own depth buffer for triangle stuff shouldn't be too hard to add. I have no idea how many triangles this thing can process at the moment though. Whatever the number is, don't expect it to get close to what a real GPU can do. They kind of rule this game.
User avatar
Rachael
Developer
Developer
Posts: 3639
Joined: Sat May 13, 2006 10:30

Re: The amazing triangle drawer!

Post by Rachael »

I understand.
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: The amazing triangle drawer!

Post by dpJudas »

Image
Got the dome rendering now. :D
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: The amazing triangle drawer!

Post by Graf Zahl »

Cool, will this be backported to ZDoom, too?
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: The amazing triangle drawer!

Post by dpJudas »

That's a screenshot from ZDoom, actually. :)
User avatar
Rachael
Developer
Developer
Posts: 3639
Joined: Sat May 13, 2006 10:30

Re: The amazing triangle drawer!

Post by Rachael »

That's amazing, dpJudas. :)
User avatar
NeuralStunner
Posts: 253
Joined: Tue Dec 29, 2009 3:46
Location: IN SPACE
Contact:

Re: The amazing triangle drawer!

Post by NeuralStunner »

dpJudas wrote:About the zbuffer and modeldef thing - making it use its own depth buffer for triangle stuff shouldn't be too hard to add. I have no idea how many triangles this thing can process at the moment though. Whatever the number is, don't expect it to get close to what a real GPU can do. They kind of rule this game.
I suppose this means it wouldn't be suitable for a polygonal renderer. (Yet?) Of course, by that point you've basically remade the Quake renderer. :P
Dean Koontz wrote:Human beings can always be relied upon to exert, with vigor, their God-given right to be stupid.
Spoiler: System Specs
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: The amazing triangle drawer!

Post by dpJudas »

It is a fully featured perspective-correct triangle drawer, so it can render Quake. :D

Right now my goal is just to have it render a sky dome, as I personally prefer the GZDoom sky over any of the software variants we have currently. But the drawer is written in such a way that, theoretically, someone could add modeldef info to a vissprite_t and then call the triangle drawer with the usual sprite clipping arrays and it would render 3d models in zdoom, like voxels work today.
User avatar
Rachael
Developer
Developer
Posts: 3639
Joined: Sat May 13, 2006 10:30

Re: The amazing triangle drawer!

Post by Rachael »

One step ahead of me, like usual. I was going to write one of these myself and then plug in GZDoom's model code. :P I don't know what my week looks like, this week, but I might be able to do that with the present triangle drawer.

However, I do need to know its interface. How does it accept vertexes and how does it accept textures, and how do I access its output?
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: The amazing triangle drawer!

Post by dpJudas »

Right now it's API looks like this: https://github.com/dpjudas/dpDoom/blob/ ... triangle.h, although I might still make some minor adjustments that makes it more flexible.

Shortly explained, you call TriangleDrawer::draw with a "object to world" transform matrix (TriMatrix), a list of vertices (TriVertex, position, texcoord, light level), a draw mode controlling if its triangles, fans or strips, a cull mode (clockwise vs counter-clockwise), the sprite/plane/wall clip buffers and a texture. And that's it! - it renders those vertices like if you had called glDrawArrays in OpenGL.

You can find a simple example of how to call it at https://github.com/dpjudas/dpDoom/blob/ ... e.cpp#L904, where it draws a cube. Top and bottom uses a cap color fill, the rest texturing. Just below that function you can see a more complex example where it draws a dome.

I'm probably going to make it a little bit more flexible with the vertices so that you can use different input than TriVertex. This is mostly because I could imagine that the modeldef stuff got its own vertex struct and converting all that to a TriVertex would be a pain.
Edward-san
Developer
Developer
Posts: 197
Joined: Sun Nov 29, 2009 16:36

Re: The amazing triangle drawer!

Post by Edward-san »

Does it make possible to implement properly the 3d floors (and hence also sloped 3d floors) in zdoom?
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: The amazing triangle drawer!

Post by Graf Zahl »

The problem with sloped 3D floors is not the drawing but the clipping. The current implementation solves this by splitting the map into horizontal slices (note the term 'horizontal'!)
User avatar
NeuralStunner
Posts: 253
Joined: Tue Dec 29, 2009 3:46
Location: IN SPACE
Contact:

Re: The amazing triangle drawer!

Post by NeuralStunner »

dpJudas wrote:It is a fully featured perspective-correct triangle drawer, so it can render Quake. :D
Think you could make it work smoothly with GL BSP nodes? That would solve the shearing problem. Maybe could even be backported to the 8BPP renderer as an option. (For those who still mourn the departure of alpha polymost. :P )

Also, It'd be great if you could render models with it, even if they do end up working like sprites for now. (Voxels are the same way, after all.) It'd be better than nothing. :D
Dean Koontz wrote:Human beings can always be relied upon to exert, with vigor, their God-given right to be stupid.
Spoiler: System Specs
Locked

Return to “QZDoom”