Archived

This topic is now archived and is closed to further replies.

kill

Terrain sample

Recommended Posts

Hi. I''m trying to create and render terrain based on the tiling engine. However, I had no luck. The terrain sample that comes with PR is too complicated. Can someone post something really, really simple that would be a point for takeoff?

Share this post


Link to post
Share on other sites
I want to create the terrain from the heightmap(for now I don''t want to use the tilemap and the shaders). I don''t want to create the terrain in landscape studio, or anything.

Share this post


Link to post
Share on other sites
Check to see if you have a ''Texture_gen'' directory, or something close. It contains a ''doc'' directory that tells you how to build a terrain library.

Share this post


Link to post
Share on other sites
Excuse my lazy ass , but does anyone have some really, really simple source code? Here''s my idea.(the names might not be correct, for I don''t have the docs near me)

PR_AllocTerrain();
PR_LoadTerrain();

loop
PR_TransformTerrain();
end loop

Now I have a number of questions.

1. When my current camera moves, is terrain transformed automatically?
2. Is it automatically clipped? What algorithm is used to render it? The landscape demo is pretty fast, so I''m just wondering what''s used.
3. What exactly is the radius parameter? Is it the "visibility", so the terrain is clipped at that distance, or is it the size of the map?
4. Is there a way to render the terrain without the textures? If Is it still going to be rendered if I don''t allocate any materials?

Thanx a lot for your time. These are annoying questions, but they could very well go into the FAQ.

Share this post


Link to post
Share on other sites
TestLand is the closest
1) Yes, the camera matrix is the final matrix applied to the world transform.
2) see ChrisE
3) ditto - Don''t have my docs with me. Must get 3-hole punch...
4) trying to do a throw back to the early days of flight sims?

Share this post


Link to post
Share on other sites
You sure do a good job answering questions. You answered one out of 4, and it seems like you answered all of them But thanx for one anyway

I''m making an overhead shooter that will be based on a 3D landscape.

Share this post


Link to post
Share on other sites
2) The terrain uses a regularly space grid mesh. It samples a small region off the larger heightfield to find the heights of the vertices on the grid.

3) Radius is the half the width of the terrain grid.
If the radius is 20, you have a 40x40 grid of vertices.

4) You need to create materials. You can change the rendering method inside them to draw flat shaded or wireframe or whatever you want



Share this post


Link to post
Share on other sites
Thanx a lot. Hopefully I''ll be able to get it work.

I also have a couple of different question.

1. What if the radius and the size of the bitmap don''t match? Say, the bitmap is 25x25, and the radius is 10?
2. I can pass null instead of the third file name(the shaders), right?
3. The value of the second bitmap for a tile corresponds to the number of material plus the starting material, right? How does the NULL material fit into this?

Share this post


Link to post
Share on other sites
1) Radius and size of the map don''t matter. You could even have a radius larger than the map, and it would show the entire heightfield multiple times on the screen.

2) Yes. You must change the materials to use a non shaded rendering method as well.

3) The null material was used by 3 layer heightfields, to indicate a hole. I never got around to making a decent editor for 3 layers and it''s not supported in the latest engine.

Chris

Share this post


Link to post
Share on other sites
1. If I don''t use the shaders(as far as I understand they are precalculated colors), I could still use texture mapping, smooth or flat shading, etc. Right?
2. Is it all right if I don''t use the editors at all? I am going to generate the heightfield algorithmically anyway.

Share this post


Link to post
Share on other sites