Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MazeXXX (OpenGL)
#21
OpenGL Test !!

Drawing more than 5,000,000 triangles ....!!!!!?????
(that's 45,000,000 numbers (vertex) + 45,000,000 numbers (normal) + 30,000,000 numbers (texture coordinates) processing, which you have to 'deal' with every rendering...
So 120,000,000 numbers to deal with!
And calculating them very very very much!

And.....all this almost 60x per second (!!!!!!!!!!!!!!!!!!!!!!), on a slow computer ???????
And all this under QB64 !!!!!! OMG !!!!
This is Crazy !!!

Reply
#22
Lol, I do love the enthusiasm but I think you still don't quite grasp it. 

As your using face culling and a perspective view with clipping, GL only renders what you CAN SEE! 

Yes your world maybe in the massive numbers of triangles but it doesn't actually render them all! Thats what GLdepthTest, gluperspective and culling do, they remove the invisible vertices. 

VBO's and IBO's are round the corner though mate so soon youll be able to render 10-100* times faster!

John
Reply
#23
(11-20-2025, 02:18 AM)Unseen Machine Wrote: Lol, I do love the enthusiasm but I think you still don't quite grasp it. 

As your using face culling and a perspective view with clipping, GL only renders what you CAN SEE! 

Yes your world maybe in the massive numbers of triangles but it doesn't actually render them all! Thats what GLdepthTest, gluperspective and culling do, they remove the invisible vertices. 

VBO's and IBO's are round the corner though mate so soon youll be able to render 10-100* times faster!

John
I think I understand. In fact!

Of course, not every detail is drawn. What is behind us, and what we cannot see, is not. But that is not how I understood it.

If I have 5,000,000 triangles, then a calculation must be performed on 15,000,000 pieces (5,000,000 pieces of x,y,z) to find out whether it is visible on the screen.

So it is inevitable that you do not have to deal with every vertex every time you render.

The cullface helps so that if the order of the vertices differs from the given view when creating triangles, you know that it is the back face and you do not have to deal with it.

Since the order cannot be known when drawing, and if there are several thousand triangles covering each other but the drawing starts from the backmost one, then it will draw them all and write them to the z-buffer. Do you think I could use it if I didn't understand it?

The point is, of course, you don't draw everything, but you have to deal with every vertex!
Reply
#24
The gldepthtest sets what is visible (so cull face can determine what to cull) and with that your fov and near/far planes GL can DIRECTLY tell what not to draw so no, it doesnt deal with every vertex, and if your using lists then it defo 1000% doesn't. 

Also  10,000,000 Triangles is nowadays considered kinda low poly for a model...often >100,000,000 triangles is common nowadays so Qb64 rendering that (especially via GL) isnt to mind blowing.

Love your code though and the enthusiasm!


John

Oh and with still some rendering on the qb64 side ive got up to 575 fps (One color blended triangle) so far with my new GL method...Qb64 CANNOT match that!
Reply
#25
The depth buffer does not improve performance. Maybe a little. Try it, render a lot of triangles. Try turning off depth buffer writing and checking. It will not be faster.
I made an autostereogram program. I showed it here, but I can't find anywhere where it is. If you stare at the screen and look at it properly, the image will bulge. You will see the depth. This program needed depth data. Therefore, I made it 'software' on the same principle as the opengl depth buffer works.
Writing triangles to the depth buffer:
Get a triangle.
1. Rotate, translate, scale . After the transformation operations, it calculates the 2d projection of all three points of the triangle. (3d x,y,z --> 2d x,y). If !!! All three points are outside the screen, it is discarded. If we consider the front/side face (cullface), then it discards if the direction is opposite. That's all the filtering! No more! From here it actually draws, even if the given pixel of the triangle is later covered.

2. The x-y size of the depth buffer is the same as the screen resolution. If all three points are out. Scan the area (2D). The perspective area of the triangle. The given depth point is a linear interpolation resulting from the depth of the 3 points of the triangle. It continuously checks whether the depth buffer value at the given point is smaller than where the current triangle point is during the scan.

3. If the value in the depth buffer is smaller than itself, then it draws. If it is larger, then the pixel is covered, and that's it. So far the story has lasted. If we render? then the thing continues.
4.pixel (fragment) calculation based on light, texture, color, many aspects, and actually draws the pixel on the 2d image, which we will see at the end of the rendering. The complete, rendered image.

Now! the first 2 points are computationally intensive. But these must be done anyway. Depthtest, depthmask will be an abandoned decision.

And then let's take a case when everything is visible. Exactly like in my autostereogram program. We look at the entire model and see everything. Let's assume the clipping planes are set so that the backmost parts are also included. Then what happens is that every pixel of every triangle will be drawn. Actually. in the process. Then if it encounters a pixel of a triangle that is closer, then that too! Because it doesn't know if it will be in the cover later. OpenGL will not put it in order before it.

The depth test will only save on point 4. But you have to perform point 1.2.3 before it. They say that it is worth drawing what is in front of us first and working backwards in the drawing, because then you have to calculate fewer fragments. But don't say that no calculations are made with those that are not visible. Of course! Point 1.2.3. It has to go through every triangle, point by point. And the program I attached shows how many calculations the scan requires. And in a given view (if everything is visible), it will go through all existing triangles point by point.



Attached Files
.zip   autostereogram.zip (Size: 52.49 KB / Downloads: 13)
Reply
#26
soon...you will be afraid Smile

Reply
#27
Try It ! Smile run BAS !

Reply
#28
Hello!

I merged "MazeXXX" and "Openworld2". There are several mazes in a large area. There are 4 labyrinths present at once.
The package contains everything. I didn't have the patience to select. It's full of (for you) garbage. If you want to try it, don't bother with anything! Just "v24_22.bas" in the "STEP7_GAME(no_obj_viewer)" folder! start it and you can play.



https://drive.google.com/file/d/16Fh4PKX...sp=sharing
Reply
#29
Not a gamer, but as a coder it's nice to see what can be accomplished using OpenGL for 3-D effects. I think Rob (Galleon) made a Zaxon knockoff some years ago, which looked an awful lot like the original video game.

+2

Pete
Reply
#30
zombie apocalypse

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)