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.

DarkBASIC Professional Discussion / Ultimate Terrain/Landscapes

Author
Message
TinTin
18
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 2nd Nov 2007 13:51
Thats the way to go GG there is even scope for further improvement although I'd use a similar method to the one you describe.
your cloud texture has a scale of 0 to 255 for each of the colours goving you access to 3 paterns. these values will need to be converted to give a value between 0 and 100% transparency.
now if yo split the 0 to 255 range into 2 you can have two layers per colour that gives six different paterns, although ther's the trade off between memory of processing required for these two methods.

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 2nd Nov 2007 21:13
Good Stuff Guys TinTin - I like the idea of using a shader for Grass 3d effects - and the various ways to avoid repeats that Van B Mentioned.

Boy add this kind of stuff onto the Satellite stuff - and WOW

Sid Sinister
19
Years of Service
User Offline
Joined: 10th Jul 2005
Location:
Posted: 3rd Nov 2007 05:45 Edited at: 3rd Nov 2007 05:53
Wow, that's some pretty amazing stuff Van B and Tin Tin. I'm pretty overwhelmed at this point about terrains. It seems like such a daunting task and it's mentally exhausting to even think about. I'm trying to make sense of what you guys are saying but it's not really coming to me.

The only thing I have done is some very basic terrain going on using AT and a regular heightmap. To combat this... crazy hardcore programming stuff, I might just do a 'area' heightmap, like pretty much all Final Fantasy games do and Kingdom Hearts. If you move to the city gates, it loads and you enter. None of this Real time stuff... it would be nice though lol.

Is it easier the way I'm thinking? Any pointers? Where to start? Micro managing connected loading areas (spider web style?)?

Here is a small screenie:

http://screencast.com/t/KDTcWlxePU
pardon the small clipping on the back of the cone, it's just too big of an object I suppose.
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 5th Nov 2007 10:53
It's a tricky one Sid, I mean the way I'm looking at it, actually designing the terrain is the real time consuming part - so right now I'm making a nice editor for it because it's gonna be used a lot by my little team. Really I'm going for smaller terrains that will represent smaller areas on a world map, these are still pretty big but manageable chunks.

The way I see it, games like Oblivion have thousands of man hours devoted to designing the terrain, yet there isn't that much memorable areas, it's all a bit overwhelming. There are lots of pretty areas but there's so much of it that you kinda disregard it, it's hard to focus on one particular area that you like.

Portal based games, like Resident Evil 4 and Fable have much more memorable terrains because they're smaller and you basically have to go through most of the areas in your quest. But I think the way these types of terrains are designed provides more memorable landscapes - I mean I could probably draw a fairly nice map of the first village in Fable, with your little house on top of the hill, the forest further up, downhill to the market area etc etc, I don't recall any part of Oblivion that I remember as well as that.

I suppose when your starting with connections to other areas you can concentrate solely on the area your working on, you know the space you have available, and make the most of it.

We're going down... in a spiral to the ground...
TinTin
18
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 5th Nov 2007 11:25
Taking the portal route allows you to create highly detailed areas, each with their own style. The only drawback with those is that they all require to be enclosed with pre-set exit points, so large open spaces need boundries, oceans, Cliff's, Forests, Walls etc. to stop the player wandering of the edge of the current map section.

I'm using a slightly different method by creating a base heightmap for my terrain then using procedural functions to add detail to the area around the player. I have a basic function that processes the player position, so when the wander off the heightmap extents they are in the surrounding ocean and prone to undefendable shark attacks. This method allows for huge terrains, althogh I'd still use a portal system for loading objects and details when entering/exiting buildings.

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 5th Nov 2007 12:02
Most terrains use the Diamond-square algorithm to generate what's known as a "plasma fractal". It then simulates credible events like volcanoes and glaciers to make the land look more realistic.

Your signature has been erased by a hyper-intelligent pan-dimensional being (a mod)
TinTin
18
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 5th Nov 2007 12:30
There are a selection of functions that can be used to generate terrain, the Diamond-square as mentioned by Calcyman.

PNoise = Perlin Noise, fBM = fractal brownian motion, RigidMultifractal, HeteroTerrain. To name just a few...

Using a combination of these can produce fantastic results, it's all down to preference and time allowed to generate a new section.

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
aqya47
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location:
Posted: 5th Nov 2007 13:20
Quote: "There are a selection of functions that can be used to generate terrain, the Diamond-square as mentioned by Calcyman.

PNoise = Perlin Noise, fBM = fractal brownian motion, RigidMultifractal, HeteroTerrain. To name just a few...

Using a combination of these can produce fantastic results, it's all down to preference and time allowed to generate a new section."

Have you got any examples of the algorithms involved?
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 5th Nov 2007 14:53
TinTin - You have some cool stuff going on don't you!

Are you getting decent performance using these techniques dynamically?

Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 5th Nov 2007 15:12
Quote: "Have you got any examples of the algorithms involved?"


You could try the following which uses the diamond-square algorithm to make clouds (and gives a reference):

http://forum.thegamecreators.com/?m=forum_view&t=68577&b=6
aqya47
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location:
Posted: 5th Nov 2007 16:30
Thanks GG. I'll have a look a this later.
calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 5th Nov 2007 16:48
What does Green Gandalf's Blended Bump-mapping shader V4 do?

It yeilded strange results when I applied it to a sphere, with only the top being visible, the bottom was in complete shadow.

Your signature has been erased by a hyper-intelligent pan-dimensional being (a mod)
TinTin
18
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 6th Nov 2007 11:54
@ Jason, I'm getting reasonably decent results, especialy since I'm using a lot of smoke'n'mirrors

I use a base heightmap image that outlines the general shape of my island, I have a realtime noise function and several pre-renderd noise paterns that I use to tile as follows
for every 5x5 pixels of the base heighmap I divide into a 50x50 matrix and modify this with the noise function.
every 5x5 matrix is again devided into 50x50 modified with a noise pattern, this is repeated a couple of times until I have a grid size roughly 1mx1m in size.

The trick is the LOD is higher closer to the camera and lower the farther away, the noise function only copies and pastes itself when the player has moved a set distance then fills in the new edge, thats only 50 pixels, 100 is you travel at a 45 degree angle.

This method cuts down in repetative scenery and updates superfast. I'm currently trying to implement a R.O.A.M algorythm to make the terrain more detailed where required i.e. closer to cam or larger hight difference.

I'll then focus on texturing, currently a basic grass texture.
The procedural functions are also still being tweaked to give me the best effect with the smallest of overhead.

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 6th Nov 2007 11:59
Calcyman, I think that one automatically textures the terrain based on the vertice normals, so it would do strange things when the normals are pointing down, like the lower half of a sphere. If you apply it to a terrain it should put the relevant textures where they should be. Might need some tweaking of the values to get it working - but it is a good way to get normal mapping onto terrains - personally I'm doing without normal mapping as I'm using 6 terrain textures (no way to allow more than 8 textures).

We're going down... in a spiral to the ground...
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th Nov 2007 12:30
Quote: "What does Green Gandalf's Blended Bump-mapping shader V4 do?

It yeilded strange results when I applied it to a sphere, with only the top being visible, the bottom was in complete shadow.
"


It would behave strangely for the reason Van B gives.

I'll have to check when I get home, but I think it's the shader which blends four textures according to the vertex position's "y" coordinate (i.e. altitude) and the vertex normal's "y" coordinate (i.e. slope). It may be possible to tweak the constants and/or shader code so the whole sphere shows the blending - i.e. including the bits where the vertex normal is pointing down (negative "y" component). But the shader looks best on a terrain (as in my original demo) where you can see steep slopes textured as rock or gravel and gentle slopes as grass or sand.

I did post a version which included bump mapping but I think that was over-kill.

Good to see this thread still alive and well - I hope to get back to it myself one day.
aqya47
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location:
Posted: 6th Nov 2007 12:52
Thanks to GG's random heightmap generator which he put me on to, I might get around now to looking at sorting one of the many projects I'd like to tackle in DBPro.

Of course, now I need to figure out what's being discussed in this thread so I can actually go away and implement it rather than just reading about what folks are doing.
Sid Sinister
19
Years of Service
User Offline
Joined: 10th Jul 2005
Location:
Posted: 6th Nov 2007 21:30
Thanks, VanB and TinTin. I think I will opt for the portal bases system. Like you said though, the hardest part will be getting the predefined exit areas programmed. I just have to think of some ways to load that in as the maps are loaded. Maybe I can do a raycast of some sort to invisible objects near that are near the exit zone. I'll have to think of some other methods too. And then I also needed to figure out a way for the program to know which maps are connected to each other... lol.

Sometimes, theory is harder than actually programming it. In my case, it's both haha
david w
19
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 8th Jan 2008 01:16 Edited at: 8th Jan 2008 01:17
Well I have been hard at work along with alot of others here and I think I may have finally come up with a solid terrain system. I have alot of optimizations to do still. Anyways, I am posting a small demo of it.
This is a shaderless terrain similar to AT. It looks just like it. one problem is that I use blend mapping for the detail layer and for some reason this does not let the hardware lights affect it. Maybe someone out there knows why. I read something about after so may layers it wont so I am only using 2 layers like at.

Anyways, The ground height function threw me off for a few days before I finally figured it out. This is all based off a 256 greyscale heightmap. I have the default terrain size at 1000x1000 units. I will add scalablitly later.

Basically I am interested in how it runs compared to AT, If it sucks I will just drop this project and move onto shaders.

Thank you.

Attachments

Login to view attachments
Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 8th Jan 2008 01:30
I get the old "Display is not supposed by hardware" issue. My monitor maxes out at 1024x768.
david w
19
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 8th Jan 2008 01:35 Edited at: 8th Jan 2008 01:38
sorry let me fix that
I'll set it so it detects the dispaly resolution

here is the fixed file

Attachments

Login to view attachments
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 8th Jan 2008 01:47 Edited at: 8th Jan 2008 14:45
I think blendmapping is also a shader and as such needs its own lighting and I believe its the same with Fog: This is one reason I'm leaning towards textures, however I'm still researching, the jury is still out, and I have been looking into this for days!

I've been spending a lot of time with Frustrum Limb Occlusion Culling, LOD, and some texture blending code, though not enough time on texture blending yet.

My current focus has been frame rates with terrain I can walk and/or fly over and have a decent presentation. Possibly to tall an order. Hmm.

[edit] Grammer[/edit]

Visigoth
20
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 8th Jan 2008 07:54
@david w
It ran no problems for me. I got about 300 fps on average. I noticed the polys dropped off as I moved around, not sure how you built your mesh, but that is a good thing. With 1000 polys, about 425fps, which is about as fast as my PC goes in full screen windowed mode. Whatever you are doing, its working fine. You may still want to look at shaders, though. You can strip down your mesh to pretty much just position data, and do the blending in the gpu. Looks like its just weighted by height value, which isn't a big calculation in a shader.
Visigoth
20
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 8th Jan 2008 08:02
@GG
I wrote a shader weighted on normals, and something occurred to me after I did it. For a terrain, there is no reason to check or calculate for a -y normal. That would be underneath most terrains. (Unless you have a cave or something.) If you were using it on a sphere, though, you need it, and I'd expect it to be slower. If you are bump mapping, then of course one half the sphere is going to be in shadow, because there is no way for the light source to point at it.

Maybe you could break it down into two different shaders. One for terrains, no check or calc for -y normals, and one for worlds.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 8th Jan 2008 13:57
@Visigoth

Not sure you can gain anything with the "y" thing - but I'll have a quick look at my shaders when I get home later. Do you have an example I can look at so I don't go barking up the wrong tree? It certainly makes sense to write different techniques for the shader if the code can be simplified in certain situations.

What you can do for terrains is to use a different kind of normal map - i.e. one which uses the usual object space rather than texture space coordinates. The downside is that the normal maps won't be usable by other objects - the plus-side is that the shader calculations can be simplified and hence speeded up which could be useful for high poly/resolution terrains.
Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 10th Jan 2008 00:51
Works great here, but I'd be interested in seeing a more realistic (IE game-wise - large terrain, something that might be used in a game map). Is this something you'll be releasing the source to, by chance? I'm assuming we're not that lucky . Either way, good job.
Visigoth
20
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 10th Jan 2008 05:20 Edited at: 10th Jan 2008 05:32
@GG
sorry, I guess I was misinformed about your shader, but if I am wrong, let me know, ok?
Here is what I was looking at:



which is a very nice shader, indeed. I was told it determined blending "weights" based on altitude AND normal position. I looked at it, and don't really see how it could come up with a normal solution, but maybe I missed something, I'm still learning. I see how you did height. And when I say a normal solution, I mean the shader can tell which way a poly is facing, and texture accordingly. So, say a poly is facing north, you could put a moss texture on it, south, a drier looking texture. The only way I could come up with a solution to this was to check for the y normal at each vertice, and texture accordingly. And IF statements cost a little bit. so, my point was, if your shader did some test or check for normal y, and it was a terrain, unless you have an overhang or cave or something, there won't ever be a vertice normal with a -y postion. In my case, it would get rid of 4 IF statements, and a big savings on total PS instructions. Just my thoughts, keep up the great work!

edit:
also, if when you say normal maps, you mean embedded in the vertex data, that is what I use. But if you mean a seperate texture for normals, like bump mapping, then, no, I don't think I would ever use that method. I read that "certain" semantics passed from the vertex shader to the pixel shader are interpolted. I know for a fact texture coordinates are, so, if I have a normal for a vert in my FVF, and assign it to a texture coord, I'm pretty darn sure it gets interpolated when it gets to the pixel shader. That means, to me, anyway, no need to run a lerp() function call in the pixel shader. For directional light, just a normal N dot L calc. Again, just my thoughts.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 10th Jan 2008 15:38 Edited at: 10th Jan 2008 15:45
Quote: "I was told it determined blending "weights" based on altitude AND normal position"


It does. But it only uses the normal as a means of getting at the slope (which only needs the "y" component of the normal). It doesn't take account of directions like North and South. The relevant line is:



It should be a simple matter to change that line so it depends on a different feature of the normal. If you want the texturing to depend on the prevailing wind direction, for example, you could use



which might correspond to wind blowing in a North-East direction (the coords are the world XZ direction coords). To get the blending factor you could replace the earlier line of code with something like



Youll need to declare "wind" as a float2 and pass its value to the shader in the usual way of course.

Quote: "And IF statements cost a little bit. so, my point was, if your shader did some test or check for normal y, and it was a terrain, unless you have an overhang or cave or something, there won't ever be a vertice normal with a -y postion. In my case, it would get rid of 4 IF statements"


There are no "if" statements in the shader - I try to avoid them because they are costly as you say.

Quote: "I read that "certain" semantics passed from the vertex shader to the pixel shader are interpolted"


Everything passed from the vertex shader to the pixel shader is interpolated - which means you need to think carefully about what you are interpolating. Things like N.L should be calculated in the pixel shader because the value of N.L won't interpolate correctly. Also, if you are passing N to the pixel shader you will need to renormalize it again in the pixel shader (ideally).

Quote: "That means, to me, anyway, no need to run a lerp() function call in the pixel shader"


Not sure what you mean. If you are referring to these lines in the shader:



then no. It can't be done anywhere else because "base" and "roadtex" are the two things that are being "lerped" - and these are only available in the pixel shader. (As is the amount of "lerping", i.e. "roadPos".) These all depend on the texture lookups in the pixel shader (which all involve further interpolating - but that goes on "behind the scenes" and is another story).

[Edited typos]
Visigoth
20
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 10th Jan 2008 21:21
@GG
Thanks for the details. It makes so much more sense to me now. Like I said, I'm still learning the shader thing, and your work and explanations are top notch. I'm going to study your shader so I can get these concepts down pat. Good job, and thanks again. Keep up the good work.
david w
19
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 10th Jan 2008 22:57
@Ian T. I dont see any reason not to realease the full source. I didnt post it with that example because it still needs optimized and I need to comment it so it can be easily understood. I was working on the normal's generation code some. It seems that when I applied a shader to it the normals were not smooth. So I made a function that generates the normals and then smooths them. Also, I am trying to get the load time under 2 seconds on my machine. I need to write a scale command so it gets scaled properly. Also, I need to figure out a way to save it as a .x file with all limbs attached.

I also dropped fvf 338 in favor of fvf 215. Faster mesh creation (less data) and faster render times. I optional convert back to fvf 274 when using blend mappping.

Anyways I want this to work for people with and without shaders. I am also considering the way I am building my land chunks and possibly moving away from a square format.

Thank you.

also I can post the entire project I have if anyone here is interested. (keep in mind its not done yet).
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 10th Jan 2008 23:02
Did you decide or thinking about triangle strips some how? Maybe Tesselated triangles? Maybe some hexagonish? Why you thinking about changing from effectively squares? Culling Reasons? LOD reasons? Poly optimization routines that dynamically delete/add polys? (Can we do that real time in DBPro?)

david w
19
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 10th Jan 2008 23:17
I have been encountering a number of limitations/problems with using squares that are just subdivided with triangles. This method while easy to work with and very popular around these boards, is a soild method. I feel that this is not the best way to do this.

What I need is a scalable terrain that is fast/detailed/smooth.

Anyways, I know that the best way to speed is less polys. With the "square" method. Every "Limb" have the same amount of polys regardless of what shape it is. A mountain have say 100 poly, but so does an open plain. So now we have 200 polys right. This just does not make sense.

What I think needs to be done is to build the terrain dynamically, and not structuraly. (does that make sense)? Anways it seems to me that the mountain should have 100 polys and the plain should have 2 polys. You see the savings already. A thing to consider is how to make these "limbs" match up. Good question right.

I have been thinking along the lines of a hexagon chunk, but not sure. I have alot of ideas in my head but the one I like the most is a dynamic chunk that can be the shape that I need it to be based on the total amount of verts I am going to have based on a size + verts equation that I have yet to come up with.

I'm not to worried about LOD at this point. Culling is fairly easy in any case.

I dont see why you cant dynamically delete and add polys. Its not that hard. Though I did post once on how this was done and got alot of crap.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 10th Jan 2008 23:39
Dude - good thinking.

1: I'm using Squares
2: They are easier - though a bit more "twisted" using the pattern Visigoth uses...more dimond'y in squares... basically alternating poly orientation
3: I tried Lod - seams horrid unless you either manhandle the heights to match, or a technique I heard about is "Skirt'n" or placing strips under the holes, and making verts/normals in such a way they adapt enough to avoid huge DARK/NOTICABLE areas with them lighting weird.
4: The dynamic poly stuff - is cool - but why bother trying to create them that way when there are poly optimization algorythms that do that? I think I know! DarkGDK/DarkBasic don't let you add/delete verts to my knowledge in a mesh like that while its an object - giving you ability for realtime poly optimization.


- in fact, I have such a program, bought here, that I intend to use on finished meshs to get that benefit of lower poly. You can change certain parameters in it for keeping detail etc. I'm HOPING I can make it do this while not killing my gloriously SQUARE shaped limbs/objects

Actually - Visigoth pointed me to a site that had tessalated triangles...for making 3d "Planets" though, but it looked pretty neat... but it seems even though that article said the trick to no seams is don't make em (They were making a fixed sphere, so they woul just be careful which poly they moved etc to not create rips... etc... I suspect welded verts etc etc.

Now you said you posted how this was done and WHY did you get a lot of crap? I'm interested in THAT and your project! Got Source will trade!

david w
19
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 11th Jan 2008 00:52
You want an example of removing and adding a poly? I'll have to write one up first if you want.
david w
19
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 11th Jan 2008 01:50
ok here you go its not totally complete but it will give you a reference to go by.





If you have any questions just ask ok.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 11th Jan 2008 03:21
Thank you, snagged, pasted, saved, studying next ...thank you!

I always got impression that you had to really work with memblock first then copy memblock->mesh->object .. and I thought this kind of thing would lead to the "object add/delete to frequent causes unsolved bugs" thing!

Again... thank you. (People don't make me custom snippet all to often!)

Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 14th Jan 2008 23:34
Yeah, I'd definately love the full project, knowing that there's no guarantee / support / whatever with it. I always love tinkering with new code. So whatever state you're happy posting it in, I'd appreciate it anyway.
david w
19
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 17th Jan 2008 02:21
@ Ian T I have the source but it has been converted to gdk. I no longer have the dbp source as I have pretty much scrapped that project in favor of a different terrain system anyways you can salvage the project for this code. Just convert it back to dbp code and it will work great for you.

Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 19th Jan 2008 14:15
Thanks David W! Greatly appreciated.
Hayer
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 19th Jan 2008 15:51
Mh-m... Done some searching now, but didn't find what I was lookin' for, so now I'm here

How does a memblock matrix work?
How do I make one, do I store all the positions into one memblock then
memblock -> mesh -> object?
But if I make it a object, then I got to use the
Lock vertexData for blah blah
again?
How do I edit the positions/heights of the matrix(memblock matrix)?

Sid Sinister
19
Years of Service
User Offline
Joined: 10th Jul 2005
Location:
Posted: 19th Jan 2008 20:00 Edited at: 19th Jan 2008 20:02
Required Reading for Memblock Mesh's/Terrain


http://forum.thegamecreators.com/?m=forum_view&t=87105&b=7
http://forum.thegamecreators.com/?m=forum_view&t=118418&b=1
http://forum.thegamecreators.com/?m=forum_view&t=120618&b=1
http://forum.thegamecreators.com/?m=forum_view&t=121427&b=1
http://forum.thegamecreators.com/?m=forum_view&t=100645&b=1
http://darkbasicpro.thegamecreators.com/?m=codebase_view&i=ff622260deaf05fa7890237516f9147f
(Don't forget to download the media with the above link)
http://forum.thegamecreators.com/?m=forum_view&t=108704&b=1


See how far you can get with these threads. Try and make a welded 32x32 tile memblock matrix and apply a simple texture to the tiles. If you need help, just ask. Once you get this done, we'll talk raising vert heights.

"If I have seen a little further it is by standing on the shoulders of Giants" -Isaac Newton
Zorek
17
Years of Service
User Offline
Joined: 9th Jan 2008
Location:
Posted: 20th Jan 2008 08:04
hey sweet stuff but will you be able to give us a download of your program. and if you did i probably missed it.

nice stuff,
Zorek

all for me and non for all!!!
Deagle
19
Years of Service
User Offline
Joined: 28th Aug 2005
Location: Finland
Posted: 25th Jan 2008 13:47
Could this be modified to someting like this: You have two images, a height map and a color map. In colormap you may have a lot of different colors, like: Green for grass texture, purple for dirt texture, yellow for sand texture, red for lava, gray for stone, dark gray for cobblestones etc?

Deagle aka D-Eagle
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 25th Jan 2008 14:05
Well really I think that would be quite difficult to digest in the terrain shader, the shader I use for example needs 2 mask images.

I know what you mean though, it would be cool to be able to break that down to 1 mask image and free up a texture, but having each Red, Green, and Blue element in each mask image represent a unique texture is pretty handy - for one thing automatically generating masks is nice and easy. I store byte values for each texture in an array then create the mask images from that via memblocks.

I plan to upload my 6 texture terrain editor tonight or tomorrow, it's like an open source thing so people can adapt it to their own needs if they want.


less is more, but if less is more how you keeping score?
TinTin
18
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 25th Jan 2008 15:27
At the begining of this forum I suggested storing values in a 2D 9X9 array representing "Tile Height' and 'Slope Angle'.
The height starts at below sea level (sand) to mountain top (snow) in 9 steps.
The angle in 10 degree steps, would be a modification of the height with flat being the (base) texture and vertical being a (cliff) texture.

GG thought it was a good idea, but I think development went A.W.O.L.

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Jan 2008 20:55
Quote: "Could this be modified to someting like this: You have two images, a height map and a color map. In colormap you may have a lot of different colors, like: Green for grass texture, purple for dirt texture, yellow for sand texture, red for lava, gray for stone, dark gray for cobblestones etc?"


I'm sure I've already posted a shader along those lines on this thread (except for the heightmap bit - how were you going to use that?).

Quote: "GG thought it was a good idea, but I think development went A.W.O.L."


I'm sure GG posted a shader on this thread which did exactly that?

(But it might benefit from some refinement.)
david w
19
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 25th Jan 2008 21:14
@gg. thats the shader that I use. I like it cause it works great. Its easy to use and also to setup.
Deagle
19
Years of Service
User Offline
Joined: 28th Aug 2005
Location: Finland
Posted: 26th Jan 2008 00:45
Quote: "I'm sure I've already posted a shader along those lines on this thread (except for the heightmap bit - how were you going to use that?)."

Isn't your shader more like.. for 3 different textures? I'd need a shader where you can define a texture for each different color.
like RGB 20,50,100 would be a puke texture and RGB 22,55,105 would be a snow texture and so on. And for heightmap, i'd like to make same kind of terrain that Ultima Online has. There are some map editors for UO private servers and they use a height map and a color map to generate the world.

Deagle aka D-Eagle
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 26th Jan 2008 01:07
Quote: "I'd need a shader where you can define a texture for each different color."


That's a lot of textures - even ignoring the floats that shaders use!
Deagle
19
Years of Service
User Offline
Joined: 28th Aug 2005
Location: Finland
Posted: 26th Jan 2008 01:11 Edited at: 26th Jan 2008 14:52
Well i dont mean EVERY color must have its own texture, i mean, if you need a snow texture to your terrain, you pick a free color and assign the snow texture to that color, and then pain that color to the color map, where you want the snow texture to be.

Edit: here's an example:

1 pixel is 1 tile in game. A pixel, where is, for example, that specific green color, it textures a tile in the 3d terrain with a grass texture that is assigned to that specific green color. And the tile textures should be nicely blended so that it does not look like this: http://img223.imageshack.us/my.php?image=uoandgamenq2.jpg (the window under the example window is the target quality) (and that example window is a very old test crated with darkbasic pro).

Deagle aka D-Eagle

Login to post a reply

Server time is: 2025-05-12 10:46:27
Your offset time is: 2025-05-12 10:46:27