Let colors return a value?

For questions about using Classic.

Post » Wed Oct 07, 2009 2:07 pm

I was going to generate the map based on a depth map made in a 3d-program Im using, by first sculpting a landscape and then run a z-depth pass to extract the height into a map.

So basically terrastruct generates a polygon mesh out of my height map, and then construct can extract information out of the topology of the vertecies? Or is it more like vertex mapping, where you have a flat multi-polygon plane with every vertice given a value, and then extract the mesh for use in construct?

Not that it matter which way, as long as it works :) it sounds amazing and if I hade known construct had this ability I wouldnt have even concidered using texture maps, as I come from a background of 3d-modelling where vertex maps are preferable to texture maps :)

Thanks a lot for the help, and for the program, will check it out and post if I make something useful out of it :)

edit: Ah, my main computer is broken and the one Im using now is so slow that terrastruct was barely usable, but looking at the tutorial it seems very interesting. But basically, I could use which ever 3d-software that supports export of the .mesh format and then, depending on what method construct use for the mesh (if its height topology I just sculpt the terrain like I want, or if its vertex values, Ill just paint a vertex map over a flat poly-plane), export it for use in construct, right?

Although I must say terrastruct looks handy in this case, I dont think Ive ever encountered a feature that can generate a vertex map based on a height map in a 3d-software. But if all terrastruct does is generate a topology based on a height map I guess there are better software, like the free terragen, and also the 3d-program I use have this ability to some extent.
B
2
G
3
Posts: 15
Reputation: 880

Post » Wed Oct 07, 2009 11:55 pm

Initially it was just an engine I made up, but like most of my concepts I had no game to go with it. :D
Mind you its not true 3d, It basically works like Terragen you create a height map, and from that you can make or apply a texture to the mesh that the height map generated.
There are some limitations, you wont be able to go over 50x50 grid size, that's a hardware limitation according to Ashley, but like I said the mesh's are fairly scale-able, so your mesh, or texture, wont have to be 50x50, but the height map will. That means you have a couple options for making bigger maps, you can either string a bunch of smaller mesh's together, or just one big one, or even something in between.
There's still a bunch of stuff thats' possible that I haven't tried, like deformable/animated terrain, and even random terrain maps.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Thu Oct 08, 2009 12:16 am

You *cannot* use meshes exported from any program. the .mesh format used for construct is for construct only, its a special type of file that only the mesh editor or construct saves and exports. the name .mesh means nothing it could be .asfkjhdfkaf
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Thu Oct 08, 2009 2:10 pm

Hehe, I thought terrastruct was totally bugged, whenever I loaded a map it looked all distorted. Then after some ages I figured out that you move the scene with the middle mouse button :D Not exacly the most intuitive button, I must say ;)

Well, I got my mesh loaded and I made a simple testscene:

http://bayimg.com/jaeikaAcF

But when running debug nothing happens to the height variable. As there is no info at all in the wiki on this stuff, Im kind of confused with all the available expressions. I thought Z usually represent depth, right? So when moving about it should give some kind of value, no?


edit: Hm, I realised nwo that maybe I need something like "get closest vertex"

edit2: aha, I realised now that I misinterpreted some things, with colums and rows. Ill do some more digging :)

edit3: got it now! :) I just divided the players x/y with the number of rows/colums in the mesh.. Seems to be working, Ill do some more messing around..

edit4: hehe, it seems like it is only giving me the X/Y position of a specific place on the mesh, not actual depth values of the vertecie. Im not sure, will to some more tinkering.

edit5: okay, after puting some food in my stomach I finally figured out a formula (math aint exacly my greatest skill) to detarmain the height..

When player-object is overlapping heightmap, give private variable 'height' the following value:
Heightmap.VertexZ(Player.Y/(Heightmap.Height/Heightmap.MeshCols), Player.X/(Heightmap.Width/Heightmap.MeshRows))

Now, there is one problem: it only works when the heightmap is put in the top-left corner of the layout. I need to make it relative somehow.. Ill see if I can figure it out on my own..

Hm, I can tell that this is going to be a real drain on the system. CPU waiting for GPU went from 90% to 30% when using six objects at once. Imagine having like 20-30 + a lot of other complex calculations.. Guess I have to find a way to optimize this..

edit6: Ah, it was no problem optimizing it, I just set it to happen every 500ms and the cpu usage was barely noticable. I guess if I have a lot of units I could optimize it even further by making some kind of que system so objects never check their height on the same tick..

Many edits :)
B
2
G
3
Posts: 15
Reputation: 880

Post » Thu Oct 08, 2009 6:29 pm

The thing to remember about z is 0 is like the middle ground, with positive numbers giving foreground, and negative the background. To make things easier I just didn't use negative numbers.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Thu Oct 08, 2009 7:18 pm

Well, lucky me I guess, as that I think this is hard enought as it is :)

Anyhow, I got everything working now, thanks a lot for the help guys/gals..

Here is the finished equation as reference for eventual math-hating lurkers. You can move your mesh where ever you like and get correct results:

When player-object is overlapping heightmap, give player-owned private variable 'height' the following value:
Heightmap.VertexZ((Player.Y-Heightmap.Top)/(Heightmap.Height/Heightmap.MeshCols), (Player.X-Heightmap.Left)/(Heightmap.Width/Heightmap.MeshRows))
B
2
G
3
Posts: 15
Reputation: 880

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests