• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

OTClient Graphics Discussion (Anyone out there more knowledgeable than me?)

Update. I made a mesh out of all vertices from map screen, and drew it with in a batch using the same amount of sprites as before. I got HUGE performance increase. Before it was like 50-70 fps, now it revolves around 140-170. But I have to figure few things. First I need to draw this mesh properly (as you can see tile are drawn completely wrong with this approach). The main problem is with a texture array. I cannot fill it with every sprite ( I was intending to make a huge atlas) , and give a shader address to a particular sprite I want to draw at a time. I guess I will give it a shot and I will make a new texture array with graphics I need before each draw. I guess CPU will handle it easily anyway. But guys... This triple fps increase is f**king overkill. I hope this is going to work as I intend it to :D I am so excited now XD

ogl3.png
 
Update. I made a mesh out of all vertices from map screen, and drew it with in a batch using the same amount of sprites as before. I got HUGE performance increase. Before it was like 50-70 fps, now it revolves around 140-170. But I have to figure few things. First I need to draw this mesh properly (as you can see tile are drawn completely wrong with this approach). The main problem is with a texture array. I cannot fill it with every sprite ( I was intending to make a huge atlas) , and give a shader address to a particular sprite I want to draw at a time. I guess I will give it a shot and I will make a new texture array with graphics I need before each draw. I guess CPU will handle it easily anyway. But guys... This triple fps increase is f**king overkill. I hope this is going to work as I intend it to :D I am so excited now XD

ogl3.png

I think upload everything you will use before each draw can make the fps better but no much. The gpu/cpu will loose time to render from the thingtype texture into the main texture which will lead to a lot of texture binds = less performance. Then on the drawing process you may get better fps because there will be only one texture bind to render all the scene. And why you can't fill the texture array with every texture being used in the game?
 
Update. I made a mesh out of all vertices from map screen, and drew it with in a batch using the same amount of sprites as before. I got HUGE performance increase. Before it was like 50-70 fps, now it revolves around 140-170. But I have to figure few things. First I need to draw this mesh properly (as you can see tile are drawn completely wrong with this approach). The main problem is with a texture array. I cannot fill it with every sprite ( I was intending to make a huge atlas) , and give a shader address to a particular sprite I want to draw at a time. I guess I will give it a shot and I will make a new texture array with graphics I need before each draw. I guess CPU will handle it easily anyway. But guys... This triple fps increase is f**king overkill. I hope this is going to work as I intend it to :D I am so excited now XD

ogl3.png

Awesome progress :D Thanks for putting in all this work for the future of OT projects.
 
Its getting me pumped to start my new project..
 
I think upload everything you will use before each draw can make the fps better but no much. The gpu/cpu will loose time to render from the thingtype texture into the main texture which will lead to a lot of texture binds = less performance. Then on the drawing process you may get better fps because there will be only one texture bind to render all the scene. And why you can't fill the texture array with every texture being used in the game?

Drawing it with a single upload enhanced the fps 3 times, roughly so that is the way to do it ;) If it comes to texture arrays
I tried to make a use of x,y offsets (to make a page) and z offset to put those pages on diffrent layers. But to put entire sprites file we need like 8192*8192*6 * 4 of bytes to allocate all of them so its horrible wastefull. When I did that application crashed upon first draw call anyway, so I guess it simply couldn't send that much data through the pipeline to GPU or whatever. Nevertheless I have to somehow draw entire tile mesh with all items, but I still have to job to do in terms of my opengl education to make it properly :p

Awesome progress :D Thanks for putting in all this work for the future of OT projects.
Thank you :) I guess I finnaly feel capable of contributing something usefull for Otclient and its community :)

Its getting me pumped to start my new project..

That's awesome man!
 
Last edited:
Drawing it with a single upload enhanced the fps 3 times, roughly so that is the way to do it ;) If it comes to texture arrays
I tried to make a use of x,y offsets (to make a page) and z offset to put those pages on diffrent layers. But to put entire sprites file we need like 8192*8192*6 * 4 of bytes to allocate all of them so its horrible wastefull. When I did that application crashed upon first draw call anyway, so I guess it simply couldn't send that much data through the pipeline to GPU or whatever. Nevertheless I have to somehow draw entire tile mesh with all items, but I still have to job to do in terms of my opengl education to make it properly :p
Trying to upload the whole spr file to the texture array is insane LOL. Obviously it will be a waste of memory. But i think uploading every sprite that will be used to draw before actually drawing it may have better performance because of two things: As there is multiple objects in the scene there is too many texture binds and because there may be duplicated objects in the same scene we will save a lot of texture binds. I think cipsoft have solved this issue in flash client and new tibia 11 client with the depth buffer. They have removed the possibility of transparent sprites and then they draw objects in groups: they draw all objects with the same sprites to reduce texture binds. How? Using the dept buffer so they can set which sprite will be above the other, organizing the scene as we know it.
 
Hello again guys! :D
I wanted to give you some update, I am not done yet, but its getting preety close. Bascily this approach that I made, gives me 2x more fps even in areas I there are a lot of images beeing drawn. But there also are areas where my fps jumps up to insane amount I never saw ingame on my laptop -> Thats for sure beacouse there are a lot of the same graphics are drawn on a screen. The graphics are yet not drawn properly beacouse I miscalculated some stuff most likely, but those are textures form a texture array I used as a buffer :
Area where my fps was around 30-50 :
ogl3_lower.png
[/url][/IMG]
ogl3_lower.png

Here I had maybe 50 when I opened client only:
ogl3_big.png



And here is an insane fps with lowest variety of graphics (somewhere on water)
ogl3_insane.png


Once I make sprite calculation properly I will start commiting to otclient repo :)
 
The trees on first picture suit quite well with the ground border. +1 for the mapper.
 
FPS doubled? That sounds very nice.
idk if we will get that insane perfomance with things which is a problem in OTC (like lights), but surely will be a very good boost overall. Thank you bro!
 
Hello again, I made some improvements since last time :D Basically I have still some work todo, cleaning code etc. What I wanted to show you is an improvement when you spam with magic effects on a screen and a beach area comparison between OGL2 and OGL3 :
OpenGL2:
Span_OGL2.png

opengl2_Area.png


OpenGL3
opengl3spam.png


opengl3_Area.png
 
Last edited:
@tarjei so did you build the big atlas with the needed sprites before each draw? Maybe some of the performance gain is caused by newer opengl(opengl 3)?
 
Amazing work Tarjei, that massive increase in FPS will go a long way to get the OT client more usable.

However, I have to say, that with OpenGL3, the graphics look a little bit fuzzy. It's really noticeable if you look at the flowers on the beach, or the seashells, or the barrel.

Unless there was something done differently when taking the screenshots, OpenGl3 is a bit fuzzy.
 
@tarjei so did you build the big atlas with the needed sprites before each draw? Maybe some of the performance gain is caused by newer opengl(opengl 3)?

No, it was waste of memory too much (calculation above). I draw entire mesh of vertices, and I am uploading only unique images to texture array. so if there is a lot of the same images, it uploads them once to gpu. @edit Haha now I realise that I've just denied and then confirmed xD I guess I wont reply at 1 am again :p

Amazing work Tarjei, that massive increase in FPS will go a long way to get the OT client more usable.

However, I have to say, that with OpenGL3, the graphics look a little bit fuzzy. It's really noticeable if you look at the flowers on the beach, or the seashells, or the barrel.

Unless there was something done differently when taking the screenshots, OpenGl3 is a bit fuzzy.

The text is big bommer in terms of performance aswell - switching tabs can cause a nice drop of fps :< Thing for later to solve.

About graphisc, I guess I need to adjust tile calculation and probably some option/filter is not enabled on texture array. Its mostlikely beacosue of implementation diffrences, I will try to equalize this as I process.
 
Last edited:
Back
Top