Archived

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

Xanthen

OpenGL OpenGL Terrain Engine

Recommended Posts

Xanthen    115
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 this post


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

Second: Please describe your terrain for me...
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 this post


Link to post
Share on other sites
Xanthen    115
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 this post


Link to post
Share on other sites
mkaltner    122
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 this post


Link to post
Share on other sites
Xanthen    115
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 this post


Link to post
Share on other sites
GalaxyQuest    122
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 this post


Link to post
Share on other sites
Xanthen    115
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 this post


Link to post
Share on other sites
GalaxyQuest    122
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 this post


Link to post
Share on other sites
Xanthen    115
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 this post


Link to post
Share on other sites
GalaxyQuest    122
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 this post


Link to post
Share on other sites
Xanthen    115
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 this post


Link to post
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

Here's the link: www.geocities.com/cgamedude/Vista.zip

~CGameProgrammer( );



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

Share this post


Link to post
Share on other sites
ANSI2000    122
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 this post


Link to post
Share on other sites
quarnin    122
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 this post


Link to post
Share on other sites
mkaltner    122
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 this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites

  • Similar Content

    • By markshaw001
      Hi i am new to this forum  i wanted to ask for help from all of you i want to generate real time terrain using a 32 bit heightmap i am good at c++ and have started learning Opengl as i am very interested in making landscapes in opengl i have looked around the internet for help about this topic but i am not getting the hang of the concepts and what they are doing can some here suggests me some good resources for making terrain engine please for example like tutorials,books etc so that i can understand the whole concept of terrain generation.
       
    • By KarimIO
      Hey guys. I'm trying to get my application to work on my Nvidia GTX 970 desktop. It currently works on my Intel HD 3000 laptop, but on the desktop, every bind textures specifically from framebuffers, I get half a second of lag. This is done 4 times as I have three RGBA textures and one depth 32F buffer. I tried to use debugging software for the first time - RenderDoc only shows SwapBuffers() and no OGL calls, while Nvidia Nsight crashes upon execution, so neither are helpful. Without binding it runs regularly. This does not happen with non-framebuffer binds.
      GLFramebuffer::GLFramebuffer(FramebufferCreateInfo createInfo) { glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo); textures = new GLuint[createInfo.numColorTargets]; glGenTextures(createInfo.numColorTargets, textures); GLenum *DrawBuffers = new GLenum[createInfo.numColorTargets]; for (uint32_t i = 0; i < createInfo.numColorTargets; i++) { glBindTexture(GL_TEXTURE_2D, textures[i]); GLint internalFormat; GLenum format; TranslateFormats(createInfo.colorFormats[i], format, internalFormat); // returns GL_RGBA and GL_RGBA glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, createInfo.width, createInfo.height, 0, format, GL_FLOAT, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); DrawBuffers[i] = GL_COLOR_ATTACHMENT0 + i; glBindTexture(GL_TEXTURE_2D, 0); glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, textures[i], 0); } if (createInfo.depthFormat != FORMAT_DEPTH_NONE) { GLenum depthFormat; switch (createInfo.depthFormat) { case FORMAT_DEPTH_16: depthFormat = GL_DEPTH_COMPONENT16; break; case FORMAT_DEPTH_24: depthFormat = GL_DEPTH_COMPONENT24; break; case FORMAT_DEPTH_32: depthFormat = GL_DEPTH_COMPONENT32; break; case FORMAT_DEPTH_24_STENCIL_8: depthFormat = GL_DEPTH24_STENCIL8; break; case FORMAT_DEPTH_32_STENCIL_8: depthFormat = GL_DEPTH32F_STENCIL8; break; } glGenTextures(1, &depthrenderbuffer); glBindTexture(GL_TEXTURE_2D, depthrenderbuffer); glTexImage2D(GL_TEXTURE_2D, 0, depthFormat, createInfo.width, createInfo.height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glBindTexture(GL_TEXTURE_2D, 0); glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthrenderbuffer, 0); } if (createInfo.numColorTargets > 0) glDrawBuffers(createInfo.numColorTargets, DrawBuffers); else glDrawBuffer(GL_NONE); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) std::cout << "Framebuffer Incomplete\n"; glBindFramebuffer(GL_FRAMEBUFFER, 0); width = createInfo.width; height = createInfo.height; } // ... // FBO Creation FramebufferCreateInfo gbufferCI; gbufferCI.colorFormats = gbufferCFs.data(); gbufferCI.depthFormat = FORMAT_DEPTH_32; gbufferCI.numColorTargets = gbufferCFs.size(); gbufferCI.width = engine.settings.resolutionX; gbufferCI.height = engine.settings.resolutionY; gbufferCI.renderPass = nullptr; gbuffer = graphicsWrapper->CreateFramebuffer(gbufferCI); // Bind glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo); // Draw here... // Bind to textures glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, textures[0]); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, textures[1]); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, textures[2]); glActiveTexture(GL_TEXTURE3); glBindTexture(GL_TEXTURE_2D, depthrenderbuffer); Here is an extract of my code. I can't think of anything else to include. I've really been butting my head into a wall trying to think of a reason but I can think of none and all my research yields nothing. Thanks in advance!
    • By Adrianensis
      Hi everyone, I've shared my 2D Game Engine source code. It's the result of 4 years working on it (and I still continue improving features ) and I want to share with the community. You can see some videos on youtube and some demo gifs on my twitter account.
      This Engine has been developed as End-of-Degree Project and it is coded in Javascript, WebGL and GLSL. The engine is written from scratch.
      This is not a professional engine but it's for learning purposes, so anyone can review the code an learn basis about graphics, physics or game engine architecture. Source code on this GitHub repository.
      I'm available for a good conversation about Game Engine / Graphics Programming
    • By C0dR
      I would like to introduce the first version of my physically based camera rendering library, written in C++, called PhysiCam.
      Physicam is an open source OpenGL C++ library, which provides physically based camera rendering and parameters. It is based on OpenGL and designed to be used as either static library or dynamic library and can be integrated in existing applications.
       
      The following features are implemented:
      Physically based sensor and focal length calculation Autoexposure Manual exposure Lense distortion Bloom (influenced by ISO, Shutter Speed, Sensor type etc.) Bokeh (influenced by Aperture, Sensor type and focal length) Tonemapping  
      You can find the repository at https://github.com/0x2A/physicam
       
      I would be happy about feedback, suggestions or contributions.

    • By altay
      Hi folks,
      Imagine we have 8 different light sources in our scene and want dynamic shadow map for each of them. The question is how do we generate shadow maps? Do we render the scene for each to get the depth data? If so, how about performance? Do we deal with the performance issues just by applying general methods (e.g. frustum culling)?
      Thanks,
       
  • Popular Now