Optimising a voxel engine

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Optimising a voxel engine

deardanielxd
Hi. I am new to OpenGL4. I am currently writing my own Voxel engine using lwjgl. My final goal is to make a small simulator to simulate a small ecosystem. I implemented the entity renderer and light inside my engine. At the beginning, I followed a youtube channel, called ThinMatrix. I changed the structure and some details of the engine to make it easier to implement my simulator. Currently, I added about 1K objects and each with about 3-4K vertices.  I implemented textured mapping and lighting effects. I added two point lights. One is static and one is controlled by the mouse. Overall, I think the whole program is quite simple, but the fps is just only 20-30. And here is my questions.

1. What can I do to improve my engine? Or, how do you optimise your engines?
2. What are the most common bottlenecks in OpenGL 4?
3. I have heard of buffer of batch data. According to my understandings, it is about combining several buffers into one single buffer to speed up the rendering. Am i correct? Currently, I separated the buffers into normals, vertices and texture buffers. Is that a bad practise? If I apply the "buffer of batch data" technique. How much will it improve?

Any advice will be very helpful. Thanks 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Optimising a voxel engine

Xerxes Rånby
You should lower your vertex count.

As a rule of thumb,
entry level GPU can only process 1 vertex per clock cycle a high end GPU can process up to 5 vertex each clock cycle.
If you want to rendering 1k objects * 4k vertives * 60 fps then you will hit the above limit.

You requiring at least a 2.4ghz entry level GPU for full frame-rate while most entry level GPU's are clocked at 800Mhz.
Some high end GPU's may handle your workload, still your vertex count is high!

A good engine also know which objects are out of view. The fastest vertex to render is the vertex never rendered.
A good engine uses shades to make things look good without increasing the vertex count.

You should consider posting a compilable example based on JogAmp if you want more specific help (we do not offer support for lwjgl in this forum).


2017-01-22 8:51 GMT+01:00 deardanielxd [via jogamp] <[hidden email]>:
Hi. I am new to OpenGL4. I am currently writing my own Voxel engine using lwjgl. My final goal is to make a small simulator to simulate a small ecosystem. I implemented the entity renderer and light inside my engine. At the beginning, I followed a youtube channel, called ThinMatrix. I changed the structure and some details of the engine to make it easier to implement my simulator. Currently, I added about 1K objects and each with about 3-4K vertices.  I implemented textured mapping and lighting effects. I added two point lights. One is static and one is controlled by the mouse. Overall, I think the whole program is quite simple, but the fps is just only 20-30. And here is my questions.

1. What can I do to improve my engine? Or, how do you optimise your engines?
2. What are the most common bottlenecks in OpenGL 4?
3. I have heard of buffer of batch data. According to my understandings, it is about combining several buffers into one single buffer to speed up the rendering. Am i correct? Currently, I separated the buffers into normals, vertices and texture buffers. Is that a bad practise? If I apply the "buffer of batch data" technique. How much will it improve?

Any advice will be very helpful. Thanks 


If you reply to this email, your message will be added to the discussion below:
http://forum.jogamp.org/Optimising-a-voxel-engine-tp4037587.html
To start a new topic under jogl, email [hidden email]
To unsubscribe from jogamp, click here.
NAML

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Optimising a voxel engine

Xerxes Rånby
In reply to this post by deardanielxd
You may have run out of GPU's memory bandwidth as well
http://www.openglsuperbible.com/2014/01/24/memory-bandwidth-and-vertices/

2017-01-22 10:50 GMT+01:00 Xerxes Rånby <[hidden email]>:
You should lower your vertex count.

As a rule of thumb,
entry level GPU can only process 1 vertex per clock cycle a high end GPU can process up to 5 vertex each clock cycle.
If you want to rendering 1k objects * 4k vertives * 60 fps then you will hit the above limit.

You requiring at least a 2.4ghz entry level GPU for full frame-rate while most entry level GPU's are clocked at 800Mhz.
Some high end GPU's may handle your workload, still your vertex count is high!

A good engine also know which objects are out of view. The fastest vertex to render is the vertex never rendered.
A good engine uses shades to make things look good without increasing the vertex count.

You should consider posting a compilable example based on JogAmp if you want more specific help (we do not offer support for lwjgl in this forum).


2017-01-22 8:51 GMT+01:00 deardanielxd [via jogamp] <[hidden email]>:
Hi. I am new to OpenGL4. I am currently writing my own Voxel engine using lwjgl. My final goal is to make a small simulator to simulate a small ecosystem. I implemented the entity renderer and light inside my engine. At the beginning, I followed a youtube channel, called ThinMatrix. I changed the structure and some details of the engine to make it easier to implement my simulator. Currently, I added about 1K objects and each with about 3-4K vertices.  I implemented textured mapping and lighting effects. I added two point lights. One is static and one is controlled by the mouse. Overall, I think the whole program is quite simple, but the fps is just only 20-30. And here is my questions.

1. What can I do to improve my engine? Or, how do you optimise your engines?
2. What are the most common bottlenecks in OpenGL 4?
3. I have heard of buffer of batch data. According to my understandings, it is about combining several buffers into one single buffer to speed up the rendering. Am i correct? Currently, I separated the buffers into normals, vertices and texture buffers. Is that a bad practise? If I apply the "buffer of batch data" technique. How much will it improve?

Any advice will be very helpful. Thanks 


If you reply to this email, your message will be added to the discussion below:
http://forum.jogamp.org/Optimising-a-voxel-engine-tp4037587.html
To start a new topic under jogl, email [hidden email]
To unsubscribe from jogamp, click here.
NAML


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Optimising a voxel engine

gouessej
Administrator
In reply to this post by deardanielxd
Hi

Actually, Xerxes mentioned the frustum culling. There are other kinds of culling, for example the contribution culling (use different levels of details or just hide an object depending on how far it is located from the viewer), the occlusion culling... Of course, spatial subdivisions help. You can use VAOs/VBOs and mesh instancing too. I advise you to convert quads into triangles; if you have much more complicated polygons, convert them into monotone polygons and then into triangles. I advise you to look at Voxel.js too, at least to understand which algorithms are implemented.

ArdorCraft API is an excellent example of APIs for voxels based on a general purpose engine (JogAmp's Ardor3D Continuation).

By the way, as you are on the official JogAmp forum, don't expect any help on the very first API you mentioned...
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Optimising a voxel engine

deardanielxd
Thank you guys. I appreciated your help. I understand that I could't ask questions about lwjgl. Since I think that the bottleneck is not in the library and I knew that you are experts in OpenGL, so I hope that you can help me. Anyway, the advices are very nice. Thank you!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Optimising a voxel engine

elect
deardanielxd wrote
Thank you guys. I appreciated your help. I understand that I could't ask questions about lwjgl. Since I think that the bottleneck is not in the library and I knew that you are experts in OpenGL, so I hope that you can help me. Anyway, the advices are very nice. Thank you!

However, I ran some tests in the past (https://github.com/elect86/glTest), very roughly I must say, and I found out that jogl was around 5% faster than lwjgl. This should come from the design, https://jogamp.org/wiki/index.php/Why_Instance_Design

Now, if you are not opengl call bottlenecked, you won't see that improve by switching to jogl, but you should be able to squeeze out some additional frames from your engine.
Loading...