Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Most efficient way to create a track from meshes

Author
Message
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 28th Nov 2015 16:56
I am going to make a track from many planes. Each plane will represent a section of track and I will "bolt" them together one plane at a time. But I don't know what is most efficient from a technical perspective.

I start with a template track as a memblock. I then manipulate the vertices to create the curves in the track. I then have a few options. Should I:

1. Create individual objects at 0,0,0 and position them after creation
2. Create individual objects and set the vertices to the exact position I need them for the track.
3. Create an object and then keep adding meshes to the single object.
4. Create the track from, for example, objects of 10 meshes each.

Any help form the 3D gurus is appreciated.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 29th Nov 2015 00:03 Edited at: 29th Nov 2015 00:06
i thinks its better if u use prebuild 3d objects and build the scene with it.
once in my live i made a track editor for a glider game with generated meshes but it was very time expensive.
other game was a roller coaster with a generated track long ago.
AGK (Steam) V2.0.15c : Windows 10 Pro 64 Bit : AMD (15.201.1151.0) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)

Attachments

Login to view attachments
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 29th Nov 2015 17:16 Edited at: 29th Nov 2015 17:17
I'd probably use a Bezier curve to create a path, then for each point on the curve, generate two points either side, then connect them as a triangle/quad. Create one object by adding points along a curve, uv mapping as I go. This would give you the ability to create tracks which can turn left/right, as well as slope up/down. If you add a third dimension to the Bezier curve, you could tilt the tracks as well to give camber.

Look at a program called Bob's track builder for inspiration.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 29th Nov 2015 20:22
Nice looking tracks Markus

Mobiius, that's exactly what I'm doing. I'm just not sure what the most efficient way is.
I already did it in DBPro many years ago, and I'm recreating in AGK. You can see the neverending track in this video from about 40 seconds. I plan to take it much further this time.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 29th Nov 2015 21:54
hmm, one surface with only one texture is very fast. mio. of polygons in realtime at pc.
i thinks its also fast if u just generate the visible part of the track for this neverending track. add 100 meters, sub 100 meters.
u just rember me i began a gps racer long ago.
i used recorded track points from gps, then i make a grid below in the near of track (similar lego) , i moved the grid vertex data to this track and the track was generated and the other objects was places with a simple editor.
AGK (Steam) V2.0.15d : Windows 10 Pro 64 Bit : AMD (15.201.1151.0) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)

Attachments

Login to view attachments
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 29th Nov 2015 22:38
I like the GPS idea. I have already have a test program to record GPS. As you can see at the end of my video I drop the track onto a landscape.

Now I have too many ideas! I need to start simple, and work up to all these other features.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 29th Nov 2015 23:28 Edited at: 29th Nov 2015 23:30
As I do something similar to tracks: Trails for my WIP.... I know your problem.


I would sort it like this:
3. Create individual objects and set the vertices to the exact position I need them for the track.
2. Create individual objects at 0,0,0 and position them after creation
1. Create an object and then keep adding meshes to the single object.

Adding meshes to your object should be most efficient, I think, as long as the engine can batch the objects.. but Paul mentioned somewhere that Batching isn't in yet.
If you go with creating objects for each segment I recommend you to set the position and then manipulate the vertices as you need,
because you can get trouble if the object "center" is outside of your view range but your Vertex is inside.

Let me know if you get it working with adding meshes.

Using AGKv2 Tier1
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 30th Nov 2015 17:56
Quote: "1. Create individual objects at 0,0,0 and position them after creation
2. Create individual objects and set the vertices to the exact position I need them for the track.
3. Create an object and then keep adding meshes to the single object.
4. Create the track from, for example, objects of 10 meshes each."


1. and 2. will be equivalent, AppGameKit doesn't mind if the vertices are far away from the object center and the mesh bounding box for frustum culling is close fitting.
3. will be faster up to a point but I'm not sure by how much. Meshes in the same object share the object and shader setup but adding a mesh results in rebuilding the collision data for the entire object. However if we're talking 100 polygons then that's nothing compared to rebuilding a 10,000 polygon object.
4. is probably a good compromise between the two, if you get into the thousands of polygons per object then split it into several objects to mitigate the collision rebuilding problem.

Probably the biggest impact on performance will be how many vertices you have in each mesh. If you have a separate mesh for every plane then it will result in a lot of draw calls which will hurt performance, although on desktop platforms you could probably get away with thousands of draw calls.

I haven't benchmarked any of this, so these numbers are off the top of my head, but as a starting point I would say keep objects below 1000 polygons in a single mesh, or as few meshes as possible.
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 30th Nov 2015 22:03 Edited at: 30th Nov 2015 22:05
Quote: "AGK doesn't mind if the vertices are far away from the object center and the mesh bounding box"
..ok ..good to know.. then I had the problems elsewhere (maybe DBpro)
So Adding to the mesh is better for the draw calls and creating separate objects is better for the collision mesh calculations.

Using AGKv2 Tier1
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 30th Nov 2015 23:05
Thank again to everyone chipping in.

My mesh will effectively be a string of planes (12 vertices to a plane). So based on all of the above, I will create strings of n planes. By doing it this way I can just use the default plane.
n will vary, depending on the resolution I request. Each string will represent one C-spline, and the track will be lots of C-splines bolted together.

Looking forward to this! I have plans for adding bump and normal maps to make a 3D track out of 2D planes. That will be yet another challenge, I have never delved into the realms of shaders before
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 1st Dec 2015 18:56
@BatVink, this looks like a great project and one that might end up being quite complex. Look forward to seeing more of this.
Thought of putting this in the showcase section as you work through it?
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 1st Dec 2015 23:32
I guess I could post it. You may have noticed I don't post much of what I do, think I must be afraid of commitment!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 1st Dec 2015 23:49
Well it's a good way of keeping you interested in your projects when it starts getting to a monotonous part!
Seriously though this is a great project and would love to see how it grows!
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 12th Dec 2015 09:40
Quote: "You may have noticed I don't post much of what I do, think I must be afraid of commitment!"

Or maybe it's the George McFly effect?
Quote: "What if they didn't like me, what if they said I was no good I just don't think I could take that kind of rejection"
AGK V2 user - Tier 1 (mostly)

Login to post a reply

Server time is: 2024-11-25 13:23:02
Your offset time is: 2024-11-25 13:23:02