-
1 Attachment(s)
PixelArt - Clouds
Hi friends,
playing through the Kingdom: New lands, I was in continous awe how much dynamic detail the authors managed to squeeze to their pixel art.
I was thinking about it a lot and came up with approach to achieve similar goal in thinBasic.
Pixel art is typically based on little bitmaps, but I thought it would be more interesting to design pixel art with vector shapes (via TBGL), and then post process it to get the granular look.
Approach taken
In order to do this, I first modified my library for offScreenRendering, then prepared framework for pixelArt demos and finally, did a simple cloud demo I would like to share with you here.
Get the code
If you are advanced user (command line is your second home), get it from git and initialize submodules.
If you just want to try it on your PC, get the complete zip package.
Petr
-
1 Attachment(s)
Just by playing with the example, you can get completely different results.
The elArt framework allows you to set virtual resolution independently for vertical and horizontal dimension, allowing anamorphic effect like the one on the image below.
Petr
-
That's a great idea and great code.
When I executed I didn't get at first that clouds were changing, wow.
Also the way you organize and write code is a pleasure to see: well written, great variables name self describing the code.
A suggestion: CPU usage is high due to no time given to the OS to manage events.
But if you add DoEvents command inside For/Next loop of drawCloud function in cloud.tBasic, CPU will always stay under 5%
Thank you for this great example to study.
-
Hi Eros,
thank you very much for your kind words. ThinBASIC TYPEs make it easy to organize code to reusable units, which is great :drink:
And also - thanks a ton for the advice! I was thinking about the CPU footprint, I think I will try to come up with general solution as part of the elArt framework (maybe timer based, not sure now) to address the CPU usage.
Because on my PC, the DoEvents did kicked the framerate from 60 FPS to 4 FPS, which is sadly not acceptable.
Petr
-
Can you please add FrameRate somewhere on screen so I can make some tests?
Maybe an option in TBGL to automatically show frame rate on screen if a certain option is ON, so we can avoid to add lines on script.
TBGL_FrameRateAutoShow(position, color) with position Upper left/right or bottom left/right
Thanks
Eros
-
1 Attachment(s)
Hi Eros,
like in FRAPS? That would be cool, I will work on it :)
In the meantime, I attach version with framerate being written to window title - just for debugging purposes.
Petr
-
Thank you Petr , certainly this is a scientific subject.
your last program gives 61 fps on i5 desktop with Geforce GT 640 , windows xp /32
but in a slow laptop Asus X553MA with windows 10 it is only 21 fps. its graphics card is built intel HD.
regards
-
Hi Primo,
thanks for testing - the low framerate could be caused by multiple factors, one of them could be alpha blending.
To verify this theory, try to comment out "tbgl_pushState %TBGL_BLEND" and "tbgl_popState" in drawCloud,and run the demo again on your ASUS.
Petr
-
1 Attachment(s)
Hi Petr
i have commented out "tbgl_pushState %TBGL_BLEND" and "tbgl_popState" , but the 21 fps stay the same as before. with ugly shaped clouds. i have opened the tool OpenGL_GetInfo.tbasic , it works but can't save the info when we click on the button (save report) in the latest thinbasic version 1.9.16.17 so i have tried it with TB version 1.8.9 and it can save the report. i attach the report for asus.
i am happy more with my i5 desktop because of the big monitor and it is relatively speedy machine.
-
Hi Primo,
thank you for your reply - I checked why OpenGL_GetInfo does not work and I was ashamed to see my old codebase :oops:
So I recoded the tool from the scratch, and published the source code at GitHub. Check the clean code, huhuhuuu.
You can grab ZIP with the latest version here as opengl_report.zip:
https://github.com/petrSchreiber/opengl_report/releases
My apologies for the trouble with the tool, now please let me think what could be the main performance issue with the demo.
Petr