BallZ
Moderator: Moderators
BallZ
My experiments with 3D surfaces ended up in a small framework for dynamic visualization of surfaces in the form of small spheres; I call it BallZ. The intention was to create a generic and extensible code enabling simple specification of new shapes. Because BallZ seems to be not only useful, but also nice, it can be used as a screensaver.
I provide the source code for your fun. You can extend it by new surfaces easily: just add new update* (and maybe also init*) function(s) to the OnLoaded/ZLibrary, update the States/SceneState/OnState+OnUpdate code by adding calls of your function(s), and update the SCENES constant.
For ZGE gurus (Ville, jph, Kjell, y offs et, ...): I would really appreciate if you commented my code.
I provide the source code for your fun. You can extend it by new surfaces easily: just add new update* (and maybe also init*) function(s) to the OnLoaded/ZLibrary, update the States/SceneState/OnState+OnUpdate code by adding calls of your function(s), and update the SCENES constant.
For ZGE gurus (Ville, jph, Kjell, y offs et, ...): I would really appreciate if you commented my code.
- Attachments
-
- Ballz.zip
- screensaver
- (51.03 KiB) Downloaded 1572 times
-
- ballzscr.jpg (30.63 KiB) Viewed 43635 times
-
- Ballz.zgeproj
- source
- (9.39 KiB) Downloaded 1387 times
It's a beautiful piece of work, and a substantial contribution to the code repository.
I'm flattered to be included in a group of real gurus. I'm more the resident noob / translator.
Nevertheless, I did find a 5% FPS improvement by substituting MeshSphere into your SphereMesh / Mesh and removing your two components.
Considering I tried a multitude of other techniques without any appreciable difference, I think that little bit is significant.
I'm flattered to be included in a group of real gurus. I'm more the resident noob / translator.
Nevertheless, I did find a 5% FPS improvement by substituting MeshSphere into your SphereMesh / Mesh and removing your two components.
Considering I tried a multitude of other techniques without any appreciable difference, I think that little bit is significant.
"great expectations"
Excellent work Rado1 ~ Somehow I get the feeling you've watched some of the video tutorials The only thing I would have done different is using a single 3D array for the colors instead of three 2D arrays.
@y_offs_et - Did you set the MeshSphere to 8x7 Samples like his MeshBox? Since in that case it makes sense .. it's one of those ( slightly annoying ) inconsistencies of ZGE. A 8x7 MeshBox ( 2D ) generates 9x8 ( triangulated ) quads, while a 8x7 MeshSphere generates 7x7, hence the difference in performance.
K
I tried MeshSphere with the identical number of triangles (144) and FPS was the same on my machine (60 in average). The used SphereMesh (originally provided by Kjell) looks better in larger scales of models.y offs et wrote:Nevertheless, I did find a 5% FPS improvement by substituting MeshSphere into your SphereMesh / Mesh and removing your two components.
You're right, 3-dimensional arrays would reduce amount of variables... I used more "didactic" approach.Kjell wrote:The only thing I would have done different is using a single 3D array for the colors instead of three 2D arrays.
Actually I used a 10x10 meshSphere which looked the same to me. I based my measurement on the fourth scene only, which is the most drain on resources. At one point my FPS would drop to 7.3 as compared to 7.6 or so ( 1680x1050 ) , which seemed about 5%. I mused the increase might be due to an optimized component vs. working thru code.
"great expectations"
Sounds very strange .. the Producer components are only executed once ( upon creation of the mesh ), after that it doesn't matter anymore whether the mesh has been created using a Expression or a MeshPrimitive.
Perhaps the difference is solely caused by the fact that Rado1 accidentally enabled HasTexCoords on his SphereMesh ( unnecessary since he's not using any textures ) while a MeshSphere doesn't have any texture coordinates.
K
Since you can't take a screenshot of a screensaver, I put the zproj in a 1280x800 window for both. I waited thru three cycles on each run and grabbed the lowest num I could. The results were consistent with the shots. I'm satisfied this is fact.
- Attachments
-
- altered.gif (37.29 KiB) Viewed 43567 times
-
- stock.gif (50.52 KiB) Viewed 43567 times
"great expectations"
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
Thank you all for encouraging feedback. I updated the code according to your comments. Based on additional comments of my friends, I added clock, new fractal shape, and also the possibility to configure execution. If you put the Ballz.cfg file in the same directory as executable, you can configure switching the clock on/of and also rotating of all shapes vs. displaying just one selected. The description of config file format is contained in the attached example.
- Attachments
-
- Ballz.zip
- v2
- (56.81 KiB) Downloaded 1379 times
I like your screen saver. It was pointed out to me on DonationCoder.com.
I'd like to suggest an improvement:
Screen savers shouldn't have the same image in the same location the entire time the screen saver is running. That defeats the purpose of running a screen saver in the first place.
Could you do something about the copyright and the clock always being in the same location? (The problem with the clock is the colons, which are always on and always in the same place.) I'm not sure what would be best, as others have stated (in the DonationCoder thread) that they didn't like the copyright moving around with the balls.
Maybe the copyright could just move to another corner of the screen after 5 minutes or so? And the clock could move from bottom to top and vice versa.
I'd like to suggest an improvement:
Screen savers shouldn't have the same image in the same location the entire time the screen saver is running. That defeats the purpose of running a screen saver in the first place.
Could you do something about the copyright and the clock always being in the same location? (The problem with the clock is the colons, which are always on and always in the same place.) I'm not sure what would be best, as others have stated (in the DonationCoder thread) that they didn't like the copyright moving around with the balls.
Maybe the copyright could just move to another corner of the screen after 5 minutes or so? And the clock could move from bottom to top and vice versa.
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact: