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: 3616
Joined: Sat May 13, 2006 10:30

Re: The amazing triangle drawer!

Post by Rachael » Sun Oct 30, 2016 13:09

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. ;)
Spoiler: Zen Sarcasm

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 » Sun Oct 30, 2016 16:23

@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 » Sun Oct 30, 2016 17:41

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: 3616
Joined: Sat May 13, 2006 10:30

Re: The amazing triangle drawer!

Post by Rachael » Sun Oct 30, 2016 23:39

I understand.
Spoiler: Zen Sarcasm

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

Re: The amazing triangle drawer!

Post by dpJudas » Mon Oct 31, 2016 8:28

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 » Mon Oct 31, 2016 9:20

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 » Mon Oct 31, 2016 9:30

That's a screenshot from ZDoom, actually. :)

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

Re: The amazing triangle drawer!

Post by Rachael » Mon Oct 31, 2016 13:33

That's amazing, dpJudas. :)
Spoiler: Zen Sarcasm

User avatar
NeuralStunner
O'Neill with it.
Posts: 252
Joined: Tue Dec 29, 2009 3:46
Location: IN SPACE
Contact:

Re: The amazing triangle drawer!

Post by NeuralStunner » Mon Oct 31, 2016 19:44

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 » Mon Oct 31, 2016 22:05

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: 3616
Joined: Sat May 13, 2006 10:30

Re: The amazing triangle drawer!

Post by Rachael » Mon Oct 31, 2016 23:52

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?
Spoiler: Zen Sarcasm

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

Re: The amazing triangle drawer!

Post by dpJudas » Tue Nov 01, 2016 1:39

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 » Tue Nov 01, 2016 9:47

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 » Tue Nov 01, 2016 10:46

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
O'Neill with it.
Posts: 252
Joined: Tue Dec 29, 2009 3:46
Location: IN SPACE
Contact:

Re: The amazing triangle drawer!

Post by NeuralStunner » Sun Nov 06, 2016 17:20

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”