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 / Making terrains with REAL USGS data, part 2

Author
Message
Visigoth
19
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 29th Nov 2007 07:55 Edited at: 29th Nov 2007 07:58
and one more, with the one texture on all the terrain tiles. So you know, this terrain is 16 tiles, 100 squares x 100 squares for each tile, the scale is 1 unit = approx 30 feet, or 10 meters, so, one tile is 1000 meters x 1000 meters. The same texture is applied to each tile, and is stretched across the tile.

Attachments

Login to view attachments
Visigoth
19
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 29th Nov 2007 08:41 Edited at: 30th Nov 2007 09:02
Here is a demo so you can see the effects of the lighting. All tiles are textured.


edit:
added a sphere and cube to better illustrate light direction

Attachments

Login to view attachments
Hoozer
17
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bremerhaven (Germany)
Posted: 29th Nov 2007 20:42
@ Visigoth: The Demo looks really nice!
The texturing is also a good feature.
How far is your progress for your "road-digging"-feature?
How do you plan to use it?
Should it be used for "hand-made" roads (which aren't there in the REAL-Data) or to improve the look if roads (which are available in the REAL-Data)?

I'm glad that you are still improving this "product"!
(With the new graphicscard-generation (GeFo8800 GT) such a land-generation together with EVOLVED's "deferred shader" (http://forum.thegamecreators.com/?m=forum_view&t=107697&b=1) should really look nice! Well, if I ever get a new card, I will try that out! )


Keep up this good work!

Hoozer

AMD64X24800+(939);2GB;GF6800LE (@12PS, 6VS; 380 MHz, RAM: 434 MHz)
DP-Sw-Mode-Comp-Entry (updated to V. 1.4):
http://forum.thegamecreators.com/?m=forum_view&t=109846&b=5&p=0
Visigoth
19
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 30th Nov 2007 09:16 Edited at: 1st Dec 2007 11:08
@Hoozer
The road carving is pretty much done, just have to work out some minor issues (intersections, x,y shifting of verts). The idea was to move the height of the verts to level out the terrain for road placement, but to also allow the road to follow the shape of the terrain. Straight roads are no problem. Curves are a little more work; To make it look good, I have to shift the x,y positions of the verts as well as setting the height.
I still have to think about how to apply the road texture.
At this point, I really want to avoid shaders if I can, but, I'm not ruling them out either.
There is so much more I've got in the works, so stay tuned...

edit:
added a screenshot. Added skysphere, and tree placement works perfectly. Now I just need to make some more trees...

Attachments

Login to view attachments
jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 17th Dec 2007 21:41
I'm catching on .... I made my first Mesh in a memblock! Then I made a terrain object - then I made a way to just create them on the fly - but as limbed objects (for culling later) - I figured out UV somewhat - Still not sure how to normalize a normal to get 100% correct lighting (as close as one can anyway) ... and after many tests - a little support lib to manipulate things - and the USGS data (at least a height map - raw FLOAT is next.... I came up with this - its an island in Hawaii:



I just had to share this with ya Visigoth!

Oh... Full Size:
http://www.jasonpetersage.com/img/TankGame41_HomemadeTerrainEngine.png

And I will Stay tuned

Visigoth
19
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 18th Dec 2007 01:14
@Jason-
Now THAT looks like an island!
Very nice.
Yes, the reason I didn't limb everything was because of the culling. Early on, I did limb them, but Stastic() reported all polys drawn all the time, even if you weren't looking at any polys. So, I didn't explore it much, but looks like if you can figure out culling, that would be fanastic. As for normals, I just used set object normals(), but that is broken when you try to run it on more than a 100x100 grid (I loked this up, it IS a bug. Try it with a highly tessellated sphere, GG actually figured it out). If we could get a better normals function, we could make the grids much much bigger than 100x100, so that might even eliminate the need to have limbs.
Still working on roads, just can't quite get what I'm after.
Also, looking at something different for trees. I don't like the billboard method, clolse up or far away, just looks cheesy. Found some info about using a shader to do volumetric rendering, for far away trees looks great, but not close up. Doesn't add any polys, just mdifies pixels based on a vegetation map. The paper I read was dated Nov '06, so this is still pretty new tech.
But glad to see you are still working with all this. Maybe I'll post a demo tonight to show the per pixel lighting and the texture tiling LOD.

Good job.
jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 18th Dec 2007 01:34
Thanx Visigoth!

Maybe I can use the BROKEN Vertex Thingy - thhrough some sort of limb -> Object -> Normalizeobject -> Copy Normal Data back to original limb if the limb is within 100x100 Gonna try that!

TREES - Vegatation Map - thats along the lines I've bee thinking. Volumetric shader for far away stuff? Cool! I've been thinkning about modeling trees according to where they are - stand alone trees one way - where for the "Woods" I'm thinking modeling "Canopies" and doing some "Quasi Voxel" Tricks to put tree trunks around you - but in a way where they always end up in the exact spots - so if you put down you book bag near a tree - fly away - come back to same spot - your bag is still next to that tree.

Ok - back to the vertex normals and BTW - I didn't wholley figure out anything Frustrum. Lost In Thought has a DarkBasic Frustum Limb Culler routine working - he got the pseudo from a wikipedia entry - opengl example or something and got it to work in DBPro - I'm going to try to take his dbpro source and any research I can find - and try to get it working in DarkGDK. Yeah - The poly count changes ALOT depending if the limbs are on the screen or not.

Here... I don't think He'll mind.... see atached

Attachments

Login to view attachments
Visigoth
19
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 18th Dec 2007 03:14
Jason-
I'm sorry, I'm so dumb. I forgot you were working with GDK. I'm still using DBP, so, sorry for my confusion. But isn't there a Set Object Normals() command in the GDK?
Also, what kind of frame rates and poly counts are you getting with GDK? (The question we ALL want to know!)
Anyway, you doing this with the GDK is even more impressive, so keep on truckin'
jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 18th Dec 2007 04:54
Quote: "I'm sorry, I'm so dumb"
Hardly!

Quote: "I forgot you were working with GDK. I'm still using DBP, so, sorry for my confusion."
No Problem - and BTW - they are closer than you think.

Quote: "But isn't there a Set Object Normals() command in the GDK?"


Yup - and you should have seen all the DirectX Error Messages it threw at me.... Even when I tried a small MEsh - and my idea of coverting limbs back and forth - wasn't a good one - I could find a Make Mesh From Limb Command - And I think rebuilding the Whole SheBang - "Ripping out the Values" (or not if saved in a data structure) and recreating the object - and all its limbs - Well - I think bad idea once I started digging. I think trying to delete chunks/limbs and readd them would be messy under the hood too - I don't claim to know for sure though.

Quote: "
Also, what kind of frame rates and poly counts are you getting with GDK? (The question we ALL want to know!)
"

FrameRates? I don't have a whiz bang Machine - but I can Tell You its just faster all around. I mean - The Rendering is even faster - but my video card I'm sure is stiffling FPS. But - I think I can about triple poly and still have a similiar frame rate - but again - this is off the cuff guessing and I could be so far off - I know this... Everything I've done so far - I could do in DarkBasic Pro - but it would be much slower and harder.

C++ is more refined a language - and DirectX/Games/Gfx are what TGC does best - so I get the best of both worlds - OOP + "Mature" Programming Language PLUS - EZ Access to DirectX - due to nice wrapper DarkGDK.

Most Stuff Applies - Meaning Theory - commands - how to's etc in DBPro and DarkGDK - so I look at both and know what's going on - but its hard to go back - like SnowBoarding - After Skiing - Most Stick With SnowBoarding

Visigoth
19
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 18th Dec 2007 05:32
hmmm..
yes, I have the GDK, when I saw that it was free, I wasted little time getting it. Good for TGC and their alliance with Microsoft. This is a GOOD thing, for sure. BUT, I've got soo much invested in DBP, I don't want to switch just yet. I want to squeeze every nickle I can out of DBP, and share what I learned. But believe me, when I think I'm done, I WILL make the move. Of course, I'll be bugging you for answers.
I'm surprised Set Object Normals() craps on you in the GDK. I would think that it is the same code either way, just wrapped differently. I'm seriously thinking about writing my own function, based on Lee's code for normals, but make it work so it calcs the normals at the edges of the tiles (this is why I get "seams". The tiles can't know what triangles are connected, so, it can't average the edges) But, that's a job for much later.
Anyway, I think I am on the right path for terrains. And I think you are as well. But, I have some TOP SECRET stuff in the works as well, that I don't want to talk about just yet, but, lets just say, it MIGHT be an easy way to do caves, overhangs, etc....
But again, this is WAY down the road....
Visigoth
19
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 20th Dec 2007 05:35 Edited at: 20th Dec 2007 06:46
Hello all, a new demo for you to play with. And this time, you can actually have an effect on it
This one just expands a bit on the last one, but also, demonstrates a simple method to use bitmaps to place objects. In this case, some trees, billboarded plains. And don't make fun of them, I've said it many times before, I'm no artist.
Basically, this works like this. A 101x101 pixel bitmap corresponds to a tile terrain. Each pixel represents a vertice position on the tile. The code just checks for certain colors. So, if I want trees, they can be green; buildings could be red, etc. There is really no limit to the way this can be used. Simple, small, effective. If you want to try it out, just modify the trees2.bmp file. I just load it in Paint, zoom in, and turn on the grid. Make sure you have green (0,255,0) selected. Each pixel is a tree. In this demo, it will repeat this pattern across 4 terrain tiles. There are a total of 12 tiles in the demo.

Ok, this demo also uses a shader for per-pixel lighting. The vertex lighting was, well, ok, but per-pixel, looks much better. Gone are the strange "x" patterns caused by the vertices trying to shade the terrain. This is just simple directional lighting, N dot L, plus ambient. You can play with the ambient level and light direction. A sphere indicates the position of the light, but, its actually backwards on the x/z axis, I'll fix later. Also, there is a house, a crude one, with no lighting effects at all. And the trees are only affected by the ambient. So, this shows you can use a mix of lighting for your scenes. Its interesting to see the house when you turn the lights down low.

The shader performs another function, as well. I had a problem with the welded mesh..how to tile it if I wanted to. Well, the shader fixes this, and fixes it easily. I could think of no way to do this in the fixed pipeline. So, you can in real time increase or decrease the amount of texture tiles, per terrain tile. I capped it at 100x100. But it can go more.

And lastly, I put in my tried and true intersect object() walking code. Also, you can fly over the terrain as well. And, if you are in a big hurry, you can press the fly mode key AND the walk code key in the same direction to move alot faster (Nothing I did, it just happens, like walk/run).

Oh, almost forgot, I put a skysphere in. Its not the best, but, its not the worst either. You can play with the scale of it. I think a little flatter on top looks better than just round, but thats just me.

Please, don't make fun of my art, this is all just testing/learning stuff still. I'm pretty sure the .bmp object method will get used. I still have to figure out why adding 500 trees slows down so much when its really not alot of polys. I'm thinking instead of instancing them, I'll make them one object and limb them...just a thought.

Anyway, there are 2 files. The .exe, and the .bmp you can modify. Have fun, comments welcome.

Attachments

Login to view attachments
Visigoth
19
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 20th Dec 2007 05:36
and here is the .bmp
put them BOTH in the same folder

Attachments

Login to view attachments
jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 20th Dec 2007 05:58
15 Fps Look Like a Peach Orchard I couldn't get a couple things to work - or it was slow enough where I couldn't tell. I really need a FASTER machine!

Visigoth
19
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 20th Dec 2007 05:59 Edited at: 20th Dec 2007 06:04
heheh
yes, you do!
I'm getting like 160 fps. Try this. Take the .bmp and erase all the dots. See if its faster.

Edit:
There is a serious slowdown with instance object(). And I'm bummed about that as well. but, I might be doing something dumb, I'll check some more.
jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 20th Dec 2007 06:12
Toss in Object In Screen Loop - and Hide Accordingly. In Screen is ok for small stuff - just not terrain tiles etc.

BTW - The Tree2.bmp doesn't matter - I think you may have compiled it into the exe maybe... I opened it - deleted it - saved it - ran program and ... There were still a ton of trees. I closed to apps and my FPS went up to 18! Much faster I'll need an AirBag and a Seat Belt!

One thing is for sure - if I manage fast FPS with Iron Infantry - It will scream on your PC

Visigoth
19
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 20th Dec 2007 06:26 Edited at: 20th Dec 2007 06:49
ok, thanks, you were right. I fixed the .exe
Redownload, it should be ok. Sorry.

edit:
DOh..
I had to save the project, then reload, and sure enough, the trees2.bmp was in the media. Its correct now, for sure. Triple verified. Sorry

edit again!
Sorry, ok, it should be right now...
Visigoth
19
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 20th Dec 2007 06:52
hmmm, something I just noticed...the higher you get, the better the framerate. I wonder, maybe I need to provide mipmaps for the far away trees....
Visigoth
19
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 20th Dec 2007 07:03 Edited at: 20th Dec 2007 07:04
Jason-
Object in Screen? How can I do?
What if I am at the top of a mountain looking down?
I know that the more detail I put into this, the smaller the "world" is going to get. Fog is no problem, can be added to ANY shader with just a simple render state change. One of the reasons I put FOV commands in the demo, maybe using that will help make worlds appear larger.
da power pwnerer
17
Years of Service
User Offline
Joined: 28th Jul 2006
Location: Pittsburgh, PA
Posted: 20th Dec 2007 12:42
Very cool demo, and fast too. I got about 210 FPS constant.



-Dan


http://Freewebs.com/noobisoft
Come to Noobisoft's website today!
jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 20th Dec 2007 13:30
Quote: "Object in Screen? How can I do?"

Make array of trees as you parse the Tree Map.

Loop through them - and

if OBJECT IN SCREEN(LoopObjID)==1 then OBJECT SHOW LoopObjID else OBJECT HIDE LoopObjID

FOV is sweet and is the Magic that makes Iron Infantry "Scopes" Work

Visigoth
19
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 24th Dec 2007 07:28 Edited at: 24th Dec 2007 07:30
Merry Christmas all.
I have a new demo, for all that are following this thread. This one is BIG. Its about a 36meg download, most of it is terrain data. I couldn't upload it here, so I put it on my server.
The area is Yosemite, in California. The entire valley, and surrounding terrain. Its a low-res terrain, but I think good enough for game terrain. Its 663 terrain tiles, or about 280 square miles. Its pretty big, would take ALONG time to walk it in real time. But, you can speed it up, if you want.

Still one texture, I need to make some more. Also, I need to modify the shader to blend textures. Some things to note:

The shader is applied to 663 individual objects.
FOG is done by the shader.
Don't crank up your move speed too fast, you can fly right off the edges of the terrain, and the program will quit. If you go past 3.0 for move_speed#, you are probably going like 10000 miles an hour.
Did I say about 280 square miles? Its BIG.
Requires shader 2.0
This is a good one. It's MASSIVE.
Some things I still have to work out, number one, is that SEAM caused by bad normals at the tile edges, and also, better textures, but, this ran all the way down to 20fps. If your machine can handle 200k polys at one time, it'll run good.

Here is the demo:
http://st-rider.net/downloads/demo/testterrain.zip

And, as always, comments, criticism, etc welcomed
Hoozer
17
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bremerhaven (Germany)
Posted: 24th Dec 2007 15:14
@ Visigoth:
I wish you a Marry Christmas (and a happy new year), too!

I tried your new Demo and it looks fantastic! With the added road-feature this should even better!

I found a "little" bug or so it seems to me!:
When you move from one tile to another (I saw this from XCam: 17999,9667 to 18000,0175) in a very slow speed you see a short flicker of the ground! This is caused of a different (higher) y-high of the viewport/y-user-position just very close to the end/beginning of a tile! After that the user-position is placed at a lower value (the standard-value) again. If you move in a normal speed you see just a flicker, but if you move with "0.05" you see what I mean when you do just very small steps of movement! (It needs some tries but sometimes the movement stops at the right position you see the yPos is higher than before!)
I also saw that sometimes white pixels show up every now and then, maybe the vertices have very small mismatches in their values or they don't get coloured at all? (Man, I have no idea at all, but it still looks really great!)

I'm always excited to see new demos and play around with them!
Keep up this great work!


Andreas (Hoozer)

AMD64X24800+(939);2GB;GF6800LE (@12PS, 6VS; 380 MHz, RAM: 434 MHz)
DP-Sw-Mode-Comp-Entry (updated to V. 1.4):
http://forum.thegamecreators.com/?m=forum_view&t=109846&b=5&p=0

Login to post a reply

Server time is: 2024-05-30 13:56:47
Your offset time is: 2024-05-30 13:56:47