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.

Work in Progress / new terrain functions

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 17th Jun 2004 04:55 Edited at: 19th Jun 2004 13:45
Coming soon.
Built upon my matrix functions I posted about a week ago. I changed model formats from 274 ro 338(adds diffuse). Basically the same thing, except now you'll be able to color the terrain. It's just like in Van-B's holiday vacation. And, if i'm able to, I'll make a dll for the functions. Here's a little picture. Shadows and cheap-looking water are created through the set_matrix_diffuse() command. Functions I'll be adding soon are: set_matrix_colormap() and set_matrix_heightmap()

Any thoughts for additional features welcome.

[update]
heightmap function added
colormap function added
alphamap function added
randomize height function added



"eureka" - Archimedes
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 17th Jun 2004 07:33
For those that don't understand what the diffuse color means, here's an explanation. A color is set for each vertex in the model. That color is then multiplied with the texture over it. The different colors between multiple vertices are interpolated, or blended, together. Here's a better example showing this effect. I set it to give each vertex a random color. There is only 1 plain texture used for the ground.



"eureka" - Archimedes
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 17th Jun 2004 10:38
Using Van-B's images for color, height, and ground texture, here's what results I got with my code.





"eureka" - Archimedes
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 17th Jun 2004 12:04
Now that's looking nice. Very nice. You may jsut haev me converted to memblock matrices

Two strings walk into a bar. I'll have a pint says the first$%ASLDJ09920D"$"$D. Excuse my friend says the second, he isn't null terminated.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 17th Jun 2004 14:09
Here's an update. New command for scaling the texture over multiple tiles. So if you matrix has 50x50 tiles, you can scale it so the texture only tiles 10x10 times. Reduces that "pattern" look. I also threw in the skybox for the heck of it. Fixed a bug in the set matrix alpha command. (whatever that does, but it's there)
I think I'm ready now to make that dll, unless I get a suggestion for more features.



"eureka" - Archimedes
French gui
20
Years of Service
User Offline
Joined: 11th May 2004
Location: France
Posted: 17th Jun 2004 15:19
Is it possible to make a function that set the normals or the vertexs colors of the whole terrain according to a light position ?(sun...) for making shadows. It could be like:
Calculate_shadows(ID,ligth posX,Light posY,light posZ,Light color)

My English is not so good I'm just French
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 17th Jun 2004 18:51
Yes, it is. , but probably not in realtime.

Kevil
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 17th Jun 2004 18:57
Lightmapping verts is quite straightforward, but it would be pretty slow right now - probably best to wait for more direct vert access commands - I have said that about 50 times this year so far though...


Van-B


The nature of Monkey was irrepressible!.
French gui
20
Years of Service
User Offline
Joined: 11th May 2004
Location: France
Posted: 17th Jun 2004 21:03
I was not talking about real time shadowing. This function would be used to improve graphical apparence of the terrain before the main loop.

My English is not so good I'm just French
eat much pie
20
Years of Service
User Offline
Joined: 9th Apr 2004
Location: Within the mind of a lowly mortal...
Posted: 17th Jun 2004 21:59
How would we use collision with these "memblock matrices"?

Also, what are the commands you've done so far? Please give explanations (short ones).

Looking good!

Checkpoint Router: my very own AI routing program: http://www.angelfire.com/theforce/eatmuchpie
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 17th Jun 2004 22:19
Quote: "How would we use collision with these "memblock matrices"?"


The usual way - a versoin of get ground hegiht

Quote: "Also, what are the commands you've done so far? Please give explanations (short ones)."


In code snippets there's a list.

Two strings walk into a bar. I'll have a pint says the first$%ASLDJ09920D"$"$D. Excuse my friend says the second, he isn't null terminated.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 18th Jun 2004 04:44
If you had a lightmap of the terrain, it'd be quite easy. Probably just include the shadowing on the colormap.

"eureka" - Archimedes
Vues3d on Kalimee
20
Years of Service
User Offline
Joined: 12th May 2004
Location: NYON (SWITZERLAND)
Posted: 18th Jun 2004 15:48
GREAT, VERY GREAT WORK.
Awaiting to have the functions to play with!!!

Guido
http://www.vues3d.com
Marthik
20
Years of Service
User Offline
Joined: 25th Jan 2004
Location: Washington State, USA
Posted: 19th Jun 2004 03:03
could u add a radomize matrix command? it would make it nicer, but not necerry, since it's not difficult to add it...
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 19th Jun 2004 20:24
Lol, I believe we've had this conversation before

It's probably easier to add it ourselves

Two strings walk into a bar. I'll have a pint says the first$%ASLDJ09920D"$"$D. Excuse my friend says the second, he isn't null terminated.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 20th Jun 2004 02:16
Look at the updates list. It's added. I added it a minute after I saw the request. I also still have to write all those "get" functions.

"eureka" - Archimedes
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 20th Jun 2004 14:21
Cool, keep us posted

Two strings walk into a bar. I'll have a pint says the first$%ASLDJ09920D"$"$D. Excuse my friend says the second, he isn't null terminated.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 20th Jun 2004 15:24
Well, the dll is nearly complete. It shoulda been down by now, but there's a few problems with it.

"eureka" - Archimedes
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Jun 2004 09:08
Well here's an Alpha version. I say alpha cause not all the commands are in it yet.

Current "working" commands are:

PREPARE LANDSCAPE DATA landscape_id, obj, memblock, mesh
CREATE LANDSCAPE id, width#, depth#, xsegments, zsegments
SET LANDSCAPE FROM HEIGHTMAP id, img
SET LANDSCAPE FROM COLORMAP id, img
SET LANDSCAPE LIGHT id, flag
SET LANDSCAPE SPECULAR id, flag
SET LANDSCAPE CULL id, flag
SET LANDSCAPE HEIGHT id, x, z, height#
RANDOMIZE LANDSCAPE id, height
UPDATE LANDSCAPE id
GET LANDSCAPE GROUND HEIGHT(id, x#, z#)
GET LANDSCAPE HEIGHT(id, x, z)

Right now, the prepare texture and scale texture isn't working. You'll have to texture it by the old way.
TEXTURE OBJECT obj, img

http://www.dannywartnaby.co.uk/rgt/attachments/terraindll1.zip

"eureka" - Archimedes
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Jun 2004 09:14
By default, the landscape is in wireframe form until prepare landscape texture has been called.(which aint working)

So here's a test code. Requires the images from Van-B's demo, or make your own.



"eureka" - Archimedes
wh1sp3r
21
Years of Service
User Offline
Joined: 28th Sep 2003
Location: Czech republic
Posted: 22nd Jun 2004 14:58
shifting landscapes ? It could be good.

PS: Real programmers aren't afraid of math!.

☺☺ AthlonXP 2500+, Ati Radeon 9600 128MB, dualDDR 512MB 400Mhz CL3.0, SB LIVE!, monitor 19" ☺☺
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 22nd Jun 2004 19:30
Wow, those commands look *so* enticing! Can't wait for a completed version, this is bound to be in my next game.

Two strings walk into a bar. I'll have a pint says the first$%ASLDJ09920D"$"$D. Excuse my friend says the second, he isn't null terminated.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Jun 2004 20:54
shifting landscapes? hmmm. Didn't even think of that one.

"eureka" - Archimedes
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 22nd Jun 2004 21:15
Does the landscape reform every time you use set landscape from heightmap, or does it just work the once?
It'd be cool to have a sort of shifting landscape - you have a whole heightmap and the landscape only uses a small part of that heightmap.
When told to, it could move further up the heightmap, thus creating the impression that the landscape is shifting.

It could be done by adding two parameters to the command:

SET LANDSCAPE FROM HEIGHTMAP obj,image,x1,y2,x2,y2

I know it can be done using pasting / get imageing / memblocking but it's a bit fiddly

Two strings walk into a bar. I'll have a pint says the first$%ASLDJ09920D"$"$D. Excuse my friend says the second, he isn't null terminated.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 23rd Jun 2004 04:19
Right now, the landscape is not recommended for real time updating, its way to slow. You'd be better off using normal a normal matrix for that, as its update function is much quicker. These commands are recommended for static terrain.

"eureka" - Archimedes
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 23rd Jun 2004 14:14
Until vert access arrives at least .


Van-B


The nature of Monkey was irrepressible!.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 4th Jul 2004 08:48 Edited at: 4th Jul 2004 08:51
[update]
Added a save heightmap function. If you create a random terrain that you'd like to keep, it'll save the heightmap data as an image file for you to load later in the future.
Here's an example output. Image size will be Xsegments+1 by Zsegments+1. So if you have "make matrix 1,1000,1000,48,48", image size will be 49x49.


Also added is a new randomize matrix routine. Using fault formation, you specify number of iteration to get a nice looking terrain.

And a smooth matrix command. By averaging surrounding points, the heights are smoothed out for an even more realistic look. Again, you specifity number of iterations for smoothing effect.

And finally, with thanks to Kevil, a new version of "get ground height" has been added. Before, the height was found by using "intersect object". That command alone made my program go from 450fps to about 150fps. Now there is no slow at all.

Oh, and I also fixed a bug with texturing. prepare matrix texture now works as well.

"eureka" - Archimedes
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 4th Jul 2004 08:53
Quote: "Does the landscape reform every time you use set landscape from heightmap, or does it just work the once?"


I didn't really answer your question before. Yes, you can set the terrain height from a heightmap as often as you like. No need having to delete everything when you wanna start a new level.

"eureka" - Archimedes
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 7th Jul 2004 06:40
Nice

Do you have an ETA yet?
I can't wait to get my hands on this - I'm going to be needing many matrices on screen for my next project, and it seems your plugin has the fast routines needed

Get 15 new commands, all the date / time commands left out of DBPro for free!
DOWNLOAD PLUGINS HERE: http://www.davidtattersall.me.uk/ and select "DarkBasic"
Lampton Worm
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 7th Jul 2004 08:37
Hi,

I downloaded the dll from http://www.dannywartnaby.co.uk/rgt/attachments/terraindll1.zip but I get a DBP compiler crash when trying to compile the demo code - any thoughts?

I tried the DLL in the user plugins folder, then in the project folder that I'm working from.

Sys=

Windows 98 SE
AMD Athlon, MMX, 1.2Ghz
256MB RAM
DX 9.0b
NVIDIA GeForce3 Ti200
DBP 5.4

I really want to see this in action, nice screens.

Cheers in advance!
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 7th Jul 2004 11:32
I'm using 5.2, maybe that could cause a problem. What code are you using to test it?

"eureka" - Archimedes
Lampton Worm
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 7th Jul 2004 18:13
Hi,

I'm using Van-B's snippet from above...



Cheers.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 8th Jul 2004 17:46
Actually, that's my snippet, just van-b's textures. Do all those textures exist in the correct folder? Not sure what else to tell ya. Maybe the final version will work for ya.

"eureka" - Archimedes
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 11th Jul 2004 02:06
I don't think I'm going to finish this now. The new terrain dll was released, so there's not much use for mine anymore. If anyone really wants it, I'll post my latest version.

"eureka" - Archimedes
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 11th Jul 2004 22:42
Please do post your latest version! I really would like this plugin

Its similarity to the matrix command set is a big plus.

Get 15 new commands, all the date / time commands left out of DBPro for free!
DOWNLOAD PLUGINS HERE: http://www.davidtattersall.me.uk/ and select "DarkBasic"
Vues3d on Kalimee
20
Years of Service
User Offline
Joined: 12th May 2004
Location: NYON (SWITZERLAND)
Posted: 12th Jul 2004 19:15
YES! YES! YES! Post it... I think it will be really helpful!!!!!

Guido
http://www.vues3d.com
Bob 3456
20
Years of Service
User Offline
Joined: 1st Jun 2004
Location: In my computer chair
Posted: 3rd Aug 2004 10:33
dose anyone have a link to van-b's demo?
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 3rd Aug 2004 19:35
Search "holiday" in teh Program announcments. I think I recall that being part of the title.

Get 15 new commands, all the date / time commands left out of DBPro for free!
DOWNLOAD PLUGINS HERE: http://www.davidtattersall.me.uk/ and select "DarkBasic"

Login to post a reply

Server time is: 2024-11-22 13:27:07
Your offset time is: 2024-11-22 13:27:07