Come test Spiky!

Blitz3D Forums/Blitz3D Programming/Come test Spiky!

mk2y10(Posted 2012) [#1]
Hello fellow masters of programming! ;) I need your vigilant eyes to test a little R&D project I am making for a 'create your own universe' game deal.

The good news is it works like a dream! But you can never be too careful, so I would like to see if anyone has anything to say about the project. I am trying to find flaws, possible lag errors (for older machines) and any advice that will help along down the road.



This is wire-frame capture of the test mesh (at a def of 2, be careful using 1!) Here is the code below for all testing purposes:





Last edited 2012


Nexinarus(Posted 2012) [#2]
It looks cool.


mk2y10(Posted 2012) [#3]
Thanks for the feedback Nexinarus. I hoped it worked alright on your machine.


Nexinarus(Posted 2012) [#4]
It works great


Yasha(Posted 2012) [#5]
Works beautifully.

Two feedbacks though.

1) If you want to have characters running around on the surface, you'll want to find a way to either a) integrate this with quad landscape sections so you can have a higher level of detail up close, or b) split the ball into segments on separate surfaces. This runs up against the vertex count limit very quickly, and a lot of those vertices aren't going to be necessary a lot of the time.

2) I would have gone for some kind of iso-sphere-triangular-thingy myself, to make movement easier - but this is probably only useful if you want to position and move things around on the surface again. Might make the terrain more regular though (once you start applying terrain modifications like erosion and other advanced filters, you'll possibly appreciate a grid that doesn't have bunch points).

It's very pretty and extremely fast.


Adam Novagen(Posted 2012) [#6]
Getting a good 30FPS here on my netbook, which is highly impressive since she's built with an old Atom N270 with integrated Intel GMA, 945 series.

That, however, is at detail 3 and higher; if I use 2 or 1, the program runs fine and displays the text, but the mesh is either invisible or nonexistent. I'll retest later on Flynn, where I've got a Radeon HD6850; will report back the results from details 2 and 1.


Rroff(Posted 2012) [#7]
Cool.

For spherical terrain aka planets I start with a cube and use vector maths to spherify the points - makes editing and working with things like ROAM/quads, texture mapping, etc. a lot easier (and saves using cos/sin).


Adam Novagen(Posted 2012) [#8]
For spherical terrain aka planets I start with a cube and use vector maths to spherify the points - makes editing and working with things like ROAM/quads, texture mapping, etc. a lot easier (and saves using cos/sin).
Why would you want to avoid using Cos() and Sin()?

Last edited 2012


mk2y10(Posted 2012) [#9]
Yasha, Thanks for the feedback! It sounds like a cool idea to do a spore like thing if I can get that far in this project.. shouldn't be too hard to modify the code or maybe do a 'magic trick' to make it look like your really on the planet. Would be fun to see them run as an asteroid or moon collides with the planet. >:) For now I just need it to be able to create a large crater on the 'planet' if it does. Fluid dynamics sounds out of my reach sadly.

Adam Novagen,thanks for letting me know! I will have to find out what the max amount of vertices and triangles are for different machines. Mine shows a detail of 2 (one vertex every 2 degrees) but does not show on 1. This might be a spec needed for each individual machine. Let me know how it goes :)

And I have to ask.. Rroff, how does that method work? I live by cos and sin when it comes to these things.


Yasha(Posted 2012) [#10]
I should have given details on the vertex count thing as well: it works fine on setting 2, but only half the sphere displays on 1.

On my machine the B3D vertex count limit seems to be 65535; I think it can be as low as 32768. I wouldn't expect it to go lower than that on any machine you'd reasonably expect to try to do anything interesting.

This is a per-surface limit, which is why I suggested splitting the sphere into pieces above: you can have as many vertices and polygons on screen as the renderer can handle without grinding to a halt, as long as they're delivered in separate groups. There is theoretically no upper limit to the number of surfaces you can apply to a mesh.


mk2y10(Posted 2012) [#11]
Would using HideMesh help with that? I might be able to put parts of the circle as it's own mesh as a way of messing around. I would suspect that it is how much it is drawing that would cause it to cause errors, not how many triangles/vertices are stored in memory. For an actual planet/star in the 'game,' I was going to have it create this for each body:

Body's Mesh at 1 (or the lowest it can handle) (hidden)
Body's Mesh at 10 (hidden)
Body's Mesh at 30 (hidden)
Body's Mesh at 60 (hidden)
Body's Sprite (not hidden)

(This program's basis is to create your own solar system with everything from asteroids/planets/stars to black holes and neutron stars.)

As the camera moves closer to the object in the 3D viewer, the planet will become more detailed. As it moves farther away, all meshes fade away and only the general reflective color in sprite form will be visible, making it look just like another star in the night sky. Do you think a high hidden triangle count will cause problems or is it just what blitz has to render that makes the difference? I would think the latter.

---------------------------------

Another note: To see a cool feature of this program, try replacing this part of the code:



Last edited 2012

Last edited 2012


Yasha(Posted 2012) [#12]
I would suspect that it is how much it is drawing that would cause it to cause errors, not how many triangles/vertices are stored in memory.


Yeah the limit is imposed by DirectX, nothing to do with Blitz3D (so it may well vary unpredictably by machine). Blitz3D again theoretically has no upper limit on the number of vertices or triangles within a surface, but if the count is too high DirectX might do something undefined (not render at all for Adam, render them up to the count limit for me, possibly complain on other systems).

Hiding is good for LOD as any object that is formally Hidden will never be passed to the renderer at all, speeding things up enormously. A mesh that is merely obscured behind another mesh will go through the whole process of being passed to the graphics card and tested for visibility.

I should reinforce that the triangle/vertex count in the whole scene doesn't technically matter, only within individual surfaces. Surfaces are the basic unit in which the graphical primitives (verts and tris) are passed to the graphics card. Most meshes have one, but you can add as many as you like. These are passed in order (literally, the engine just uses a For loop over the internal list), so millions of polygons shared across thousands of surfaces is supposedly no problem (just really slow in practice 'cause it has to iterate over all of them).

Because a surface is fired over to the graphics card in a single hardware operation (kinda...), the surface count is the thing to watch if you want to get excellent performance. This is why the CopyEntity command exists, so you can share instanced surface data across multiple identical objects. You might want to consider using this for distant LOD planets.

Whether to use just surfaces or submeshes for "chunks" of a planet's surface is only really relevant if 1) the detail is very high; and 2) people will be getting very close. Surfaces are more space-efficient if you can see the whole planet at once; the main advantage of using full child meshes is that the renderer can cull meshes that are out of the camera's field of view, but it can't do that independently for different surfaces of a single multi-surface mesh.

Last edited 2012


Rroff(Posted 2012) [#13]
Its not so much avoiding sin/cos tho there are some performance considerations there but the vector alternative makes heavy use of square root which is also very performance intensive its just its not needed and simpler once you get your head around the vector based approach.

The maths is simple enough - you just vector scale any point to a given distance from your spheres origin if you want to just create a simple low LOD sphere you build a cube from 6x flat grid meshes and spherify them but for instances where you want dynamic LOD its best to start with 6x quads and subdivide them relative to the camera position.