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.

Newcomers DBPro Corner / How to load terrains/landscapes; as an object or as heightmap

Author
Message
mnemonic
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden
Posted: 11th Feb 2012 21:36
Hi

I've created a terrain in T.Ed, exported it as an x file + the heightmap along with it.

I've tried loading in the terrain as object and as heightmap in DBpro

By object I've used the load object command and by heightmap I've used the make terrain command.

When loading as an object, the terrain looks exactly like as I created it in T.Ed. But when loading it as a heightmap it looks terrible, and seems to, how should i say it,, re-scale itself depending on where the camera is.

But! With the terrain command there is a command: get terrain height, so that I can read the terrain height at a given location, this is useful because obviosly I want a guy running around, jumping and such.

But I think that maybe loading the terrain as an object is more suitable. Am I right? But the problem is that I try to find an easy way to read the height as I would with get terrain height.

What method is more preferable to load objects? As terrain or as object? Advantages, drawbacks?

www.memblockgames.com
Brendy boy
18
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 15th Feb 2012 05:27
Quote: "Am I right?"

no

Quote: "What method is more preferable to load objects? As terrain or as object? Advantages, drawbacks?"

when you create a terrain with terrain commands then the terrain object is optimized for faster rendering
Drawbacks -> there's no collision so you'll have to load your terrain once more as object and use that object (but hidden) fro collision and use previously loaded terrain (as terrain) for rendering

But: you can still load your terrain as object if you want. If terrain is small and doesn't have much details the rendering speed would be ok. For checking the height at specified point you can project a vector from one height (which is above terrain) to the other height (which is below terrain) to see whats the distance from the top of the vector to the point of collision, then subtract that distance from the heigth of the starting point of the projected vector to calculate the exact height.

GeeBee
15
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 22nd Feb 2012 17:57
I prefer the politicians answer..."it depends..."

Given the way you have designed your terrain, I suspect Brendy boy is right.

However, my large Advanced Terrain (external landscape) didn't lightmap well using Darklights. By 'chopping it up' into smaller .dbo objects and then lightmapping them, I was able to achieve the lightmap quality I was after. Once reloaded as individual objects, the framerates stayed similar to previously.

Try, try and try again !! (not something you hear about the current English rugby team however....)

Habits can get you into trouble sometimes (unless you are a nun....)
mnemonic
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden
Posted: 22nd Feb 2012 21:09
How do you 'chop it up'? Can this be done from within DBpro? By using code I mean. Or is this something that has to be done in the terrain editor?

www.memblockgames.com
GeeBee
15
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 28th Feb 2012 19:48
Mnemonic

It is done in code:
1. Load Adv Terrain.
2. Perform checklist for object limbs.
3. Save each limb as an object.
4. Destroy original terrain.
5. Manipulate the terrain objects as necessary.

For re-loading:
6. Load the saved terrain objects.

Hope this helps.

Habits can get you into trouble sometimes (unless you are a nun....)
revenant chaos
Valued Member
17
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 29th Feb 2012 10:56 Edited at: 29th Feb 2012 10:57
In addition to what GeeBee said:
When creating the advanced terrain, make sure you use a split value higher than 1. The split value defines how many individual "tiles" advanced terrain will generate for each axis (XZ) (which means: LimbQT=split*split). Because the Advanced terrain commands allow the usage of many different sized heightmaps, you must take care in selecting a proper split value (the heightmap resolution should be evenly divisible by the split value) or your terrain will be missing vertices along the far edges. The split value also seems to have a durastic impact on the frame rate, but I am not sure how much that will effect you since you intend to save the terrain's limbs as objects.

You may also want to convert the terrain's fvf format to include vertex normals before you save the limbs otherwise you may get lighting problems in your modeling program.
Ramon156
12
Years of Service
User Offline
Joined: 13th Jul 2011
Location: Netherlands
Posted: 29th Feb 2012 18:20 Edited at: 29th Feb 2012 18:23
Hi mnemonic. Here's a different way to accomplish to run around a map.

For a character running around I can strongly suggest using Sparkys Collision DLL.
Found in this thread:
http://forum.thegamecreators.com/?m=forum_view&t=74762&b=5

Direct download link :
http://forumfiles.thegamecreators.com/?i=818917

Tutorial :
http://forum.thegamecreators.com/?m=forum_view&t=114275&b=7

If you can't bother reading that tutorial go to snippet 6, copy and paste this in DB. Make sure you run it first to check for errors.



Replace load object "orbitalrelay.x",1 on line 41 with the file you're using.
Directly under it you see SC_setupcomplexobject 1,1,2
1 is the object number , 1 is the group , 2 is something .

Now you should be able to run your map. Add in your own code if you have any. Good luck !

I have build myself already a level with some weapon pickups and a gun that can shoot, running on different heights of terrain, running on slopes.
Hint : Stairs can be accomplished by laying a plane on the stairs , make it transparent and collidable using the SC_setup command and it will function as a slope, but look like stairs

Login to post a reply

Server time is: 2024-03-28 20:25:21
Your offset time is: 2024-03-28 20:25:21