• ### Announcements

#### Archived

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

# OpenGL OpenGL Terrain Engine

## Recommended Posts

I thought I would show some screenshots of my terrain engine. I''d like honest feedback. My question is, When water is in area and I draw the polygon representing it, the fps drop to 20 from 45. The water is just a gigantic pair of polygons. Is it actually better to draw a lot of smaller ones than 1 really big one? http://www.planetquake.com/tdk/index3.html

##### Share on other sites
First: Please add to that image a link to a large 800x600 or something sized screenshot. I cant stand gettn teased by thumbnails!!

A) Do you use LOD of the terrain mesh? Like a roam, or adaptive quadtree to allow for high detail up close, less detail far away?
B) Do you "tile" your textures or is it 1 large texture for the area? Do you use mipmaps?
c) What did you use to create your terrain? (a grayscale height-value bitmap?)

Third(comments): Like i said, thumbnails suck, but from what I can see, it looks very very nice. It looks like you have a "campfire" light near that tent. If that was the intention, very nice touch. Your grass texturing looks good and so does the down-slope of your hill. I cant really see what the water looks like(that thumbnail again). Because the scene has low-lighting, i suggest having 2 pics: 1 in daytime, 1 at night. Why, because the textures seem a little dark so to get a real sense of them, daytime lighting would benifit in reviews!!!

Hope you dont mind all the questions. I have been gathering info on terrain engines myself. Any resources you can recommend??

Edited by - GalaxyQuest on January 2, 2002 2:31:54 PM

##### Share on other sites
Click on the link dude, its right below the picture
:D

oops.

##### Share on other sites
A) It is not LOD at all.
B) Textures are tiled
C) I created a terrain editor where i can select the amount of earth to drag, then drag the height of the terrain up and down as a cube, spherical, inverted funnel or conical and soon will have a Sinc function. You can also smooth it out and erase it, and then you also draw the textures and place the models with adjustible sizes.

I must have the brightness on my monitor set too high because i considered the ss's as daylight :/

Edited by - Xanthen on January 2, 2002 3:52:07 PM

##### Share on other sites
I, like GQ even, have tried to make a terrain engine/level maker and have failed. I''m currently learning to render v38 IBSP''s because of it. Yes, they''re not nearly as good as a custom terrain engine but hey, gotta have some levels.

My point, how about writing up some info? A tutorial?
From what I can see, it looks very good and I know a lot of people would be interested in learning how you did it.

Just take your code, and comment the hell out of it making it a tutorial. =)

Just an idea.

Once again, it looks great!

- Mike

##### Share on other sites
Wow that is really cool . Of course, I could just be impressed beacuse im a beginner.

##### Share on other sites
It''s not just because you''re a newbie; that looks really nice, especially for using tiled textures. Nice work Xanthen.

Later,
ZE.

##### Share on other sites
This will have to do.

Some plain ground with my earth modifier

selected size then clicked and draged up.

Moved selector clicked and dragged down.

Sphere lifter selected now, clicked and dragged up.

Inverted funnel selected, made a bunch of em.

I now selected the smoother, heres some shots of it in progress

Now i''m satisfied so i draw on the ground with my texture applicator.

simple as that. Started on the terrain editor this past saturday.

##### Share on other sites
Your lil editor seems really neat. Nice job.

Would you be willing to answer a few more questions, that way I can try to figure this stuff out on my own without looking at code...i got a lot of questions!!

First:
What kind of method do you use to smooth?

Next(texture generation):
A) How large of an area does each texture cover?
B) When you are "spray painting" texture colors to a tile, how do you figure out which pixel color goes on which texture tile?

Next:
Do you use triangle strips/vertex arrays?

Last:
The map editing pics...is the map the size of what is on screen? What I am getting at is maps of very large size and whether you have thought of breaking them up. This way map chunks can be "paged" in on demand as you move around.

##### Share on other sites
To smooth I just took some height from one vertex and put it in the vertices all around it. Nothing special but it works well enough.

Texture covers whatever area you specify.

That next question has no bearing whatsoever on anything I do. In fact I can''t even understand what you were trying to ask

I use triangle strips.

The map is actually gigantic.
I mean really really gigantic. 1000 tiles wide 1000 tiles tall. A flat piece of ground you see about 20x20 tiles so thats 2500 DIFFERENT SCREEN FULLS. Actually its so absurdly large that it would take a level designer a year to fill it up. So obviously I will want to reduce its size tremendously but until It starts to slow down the processor theres no need. I get 45 fps running at 1280x1024 resolution with no objects loaded in the game and no water. But obviously if I have 4000 monsters then the map is gonna have to be smaller to perform the ai for that many things. So map size is only going to be limited to the amount of creatures in game.

##### Share on other sites
Ok, sorry if you didnt understand my question about "spraying".

What I was refering to is this, you said:
quote:
by Xanthen
Now i''m satisfied so i draw on the ground with my texture applicator.

To me, this can mean 2 different things. First is if you simply select a premade texture to be applied to that tile from file. The second idea, which is what I asked you about, would be to actually CREATE the texture right there by applying a type of "spray effect" similar to the spray can in paint programs. So, as you spray around the map, some of that color would be placed on adjacent tiles. This is where my question comes in. Sorry. Maybe I should just have asked if you simply select from a bunch of loaded textures the one you wish to place on a single tile...hehe...oh well.

I tend to make things a lil tuff on myself.

##### Share on other sites
I use a premade texture and apply it to the tile

Actually constructive feedback would be prefered.
not just oh it looks nice or what not.

Edited by - Xanthen on January 2, 2002 9:18:16 PM

##### Share on other sites
Ok. Your water looks very tiled. It is also too transparent. Even in the blown up screenshot i cant tell how deep the water is suppose to be, so I can only guess as to the deepness. So, unless it is a shallow stream, you normally dont see the bottom.

From the look of it, you seem to tile your graphics well(i dont see really apparent edges), except for the water, which looks bad.

The lighting isnt too great either. Is it daytime? Im not sure if you mentioned if you had lighting in it or not. If not, that is somethin you can work twiddled.

Also, I think your asking for deeper critism that is simply hard to just give out after just looking at a few screenshots. Not to mention that I have been the one who has to ask you many questions just to get the info on what is going on. Make a webpage describing how you made this, what techniques you use for texturing, the height mesh, lighing, shadow effects, blah blah blah...we could have gone straight into critism if you had this stuff, so there you have it. :/

Edited by - GalaxyQuest on January 2, 2002 11:36:09 PM

##### Share on other sites
Typically you don''t need to know how an engine works to know what looks good and what doesn''t. But yes I know the water sucks, I just got it in yesterday and the artist guy is finishing up a different project before he starts helpin me so all the artwork is just temporary stuff. And the transparency on it is temporary as well.
But yes now that you mention it, My lightning does need some serious attention. For some reason I hadn''t noticed how.... far off it is.

Hahah, looking at the editor shots I showed I see how truely horrible it is. I was just doing a vertex normal and doing a crossproduct with a verticle for sun, but I guess thats not the way to do it.

##### Share on other sites
What is a good way to do lighting on terrain?

##### Share on other sites
The water appears to be the only transparent texture, so it seems clear to me that the transparency is what's slowing you down. Make it opaque and you should see the framerate increase.

As for lightning, I found gouraud shading to work very well. I just calculate the light color for each vertex in software, and have OpenGL use gouraud shading.

You can download mine to see it, I have a sun and moon that rise and set... they're not drawn but the lighting for them is calculated.

The controls are W/S to walk forward/backwards, A/D to strafe left/right, and the mouse to look around. F5 toggles wireframe on/off, F6 switches between gouraud and flat shading, and F7 toggles on/off texture linear interpolation.

There are optional command line parameters. Here they are:
/size 640x480
/size 800x600
/size 1024x768
/size 1280x960
/bitdepth 16
/bitdepth 32
/zbitdepth 16
/zbitdepth 24
/mode window
/mode fullscreen

~CGameProgrammer( );

Edited by - CGameProgrammer on January 3, 2002 1:57:31 PM

##### Share on other sites
Also logically speaking. For the polygon count of your water...

A quad/2 triangles should work, unless you wish to animate it with waves etc... Then you will have to break it down to smaller polys to make smoothe waves...

##### Share on other sites
Hey CGameProgrammer, the lighting you do seems pretty cool.

I couldnt watch long because the change from day-night/night-day WAS SO FAST it gave me a headache!!

##### Share on other sites
CGameProgrammer:

Loaded your example, but, oddly, polygons kept popping up and down... some sort of bug? (a couple times I saw large pyramids taller than the hills rising from the valleys and falling again with a subtle change of direction...)

##### Share on other sites
quote:
Original post by quarnin
CGameProgrammer:

Loaded your example, but, oddly, polygons kept popping up and down... some sort of bug? (a couple times I saw large pyramids taller than the hills rising from the valleys and falling again with a subtle change of direction...)

I didn''t have that problem at all.
It runs very smooth and the terrain is the same.

Athlon 900, Radeon64 DDR, 256MB RAM. *shrugs*

- Mike

##### Share on other sites
I''m guessing it has something to do with his LOD technique and your computer. I get the same problem, though not as severe as you are describing it.

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627682
• Total Posts
2978614
• ### Similar Content

• Both functions are available since 3.0, and I'm currently using glMapBuffer(), which works fine.
But, I was wondering if anyone has experienced advantage in using glMapBufferRange(), which allows to specify the range of the mapped buffer. Could this be only a safety measure or does it improve performance?
Note: I'm not asking about glBufferSubData()/glBufferData. Those two are irrelevant in this case.
• By xhcao
Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness.
• By cebugdev
hi guys,
are there any books, link online or any other resources that discusses on how to build special effects such as magic, lightning, etc. in OpenGL? i mean, yeah most of them are using particles but im looking for resources specifically on how to manipulate the particles to look like an effect that can be use for games,. i did fire particle before, and I want to learn how to do the other 'magic' as well.
Like are there one book or link(cant find in google) that atleast featured how to make different particle effects in OpenGL (or DirectX)? If there is no one stop shop for it, maybe ill just look for some tips on how to make a particle engine that is flexible enough to enable me to design different effects/magic
let me know if you guys have recommendations.
• By dud3
How do we rotate the camera around x axis 360 degrees, without having the strange effect as in my video below?
Mine behaves exactly the same way spherical coordinates would, I'm using euler angles.
Tried googling, but couldn't find a proper answer, guessing I don't know what exactly to google for, googled 'rotate 360 around x axis', got no proper answers.

References:
Code: https://pastebin.com/Hcshj3FQ
The video shows the difference between blender and my rotation:

• By Defend
I've had a Google around for this but haven't yet found some solid advice. There is a lot of "it depends", but I'm not sure on what.
My question is what's a good rule of thumb to follow when it comes to creating/using VBOs & VAOs? As in, when should I use multiple or when should I not? My understanding so far is that if I need a new VBO, then I need a new VAO. So when it comes to rendering multiple objects I can either:
* make lots of VAO/VBO pairs and flip through them to render different objects, or
* make one big VBO and jump around its memory to render different objects.
I also understand that if I need to render objects with different vertex attributes, then a new VAO is necessary in this case.
If that "it depends" really is quite variable, what's best for a beginner with OpenGL, assuming that better approaches can be learnt later with better understanding?

• 13
• 12
• 10
• 12
• 22