Home » Community » Forums » OpenGL » Large object in OpenGL look ugly???
  search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 Large object in OpenGL look ugly???
Post New Topic  Post Reply 
I finally started the development of a 3D space game, I can move around the spaceship with real Newtonion acceleration/velocity physics already

But of course a space game will require large planets, and I took an OpenGL unit of "1" to be 1 meter. So a realistic planet will have to be around the 20.000.000 OGL units. But just to test I made some cube-planets, and even if they're only 1000 units they're uglier than the EXACT same scene 1000 times smaller! This picture shows the difference: note the pink pixels on the right picture, that is another side of the cube that should be invisible. But for bigger scenes with more cubes at larger distances, it looks even worse that this.



What can I do against that?

EDIT: this pic shows it when I made the cubes 1.000.000 OGL units



[edited by - Lode on July 30, 2002 7:24:44 AM]

 User Rating: 1430   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Do backface culling - what you are seeing is a classic symptom of no backface culling. This is (probably) compounded by the fact that your near and far clipping planes will have to be displaced to a much greater degree in the larger scene, leading to a lower resolution in the zbuffer at greater distances and showing the effect of not backface culling.


 User Rating: 1000   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Hmm, better for size 1000 already but still not good for size 1.000.000

I use

glCullFace(GL_BACK);

glEnable(GL_CULL_FACE);

And the sides of the cubes are oriented correctly, and if the cubes have size 1.000.000 it looks like this (two times a screenie of the same):



Am I doing something totally stupid here?

 User Rating: 1430   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

You're overflowing the precision of the Z-buffer. What bit depth do you have it set at?


 User Rating: 1562   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Hmm I don't know :/
I use basecode from nehe to initialize OpenGL, so probably the same as nehe's basecode...
Is it even possible to use extremely big worlds or is that at the cost of small details? I mean, even if I'd use a LOD system so that detailed spaceships are only drawn if they're close to me and only big undetailed planets are drawn far away, would it be possible?

 User Rating: 1430   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Check your pixelformat structure (PIXELFORMATDESCRIPTOR), and check the cDepthBits member. Try setting it to 32 if it's not, and see if that improves your problem.

 User Rating: 1562   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

the way it works in spacegames is: without z buffer

you have to sort your scene and polys, maybe you can draw the nearest highdetail objects with a zbuffer (and a near farclipping plane).

there are some algorithms which might help you.
BSP - to sort the polys inside a object
multiple indexlist- make at leats 6 indexlist which have different polygone order, so depending on the view of the camera you can use the best matching one.

of course, first you have to sort the objects.

rapso->greets();

[edited by - rapso on July 30, 2002 9:23:01 AM]

 User Rating: 936   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Hmm 32 bits depth buffer didn't seem to help

I guess I'll have to look into it further and try BSP...

 User Rating: 1430   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

BTW what I want to achieve is that there's no skybox at all, all stars, planets, ... should be real 3D objects (well I'll turn them into a simple point if they're far away but you can fly to it if you want to and then they become spheres), and at the same time relatively detailed ships, spacestations, ... should be visible.
Does there exist an open source project like this somewhere that I can take a look at maybe?

 User Rating: 1430   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

You're trying to be too ambitious. You can't accurately represent the size of astronomical units seamlessly. Check out gamasutras three articles on rendering a procedural universe. It talks about pitfalls and solutions of trying to render planets, systems, and galaxies to scale.

Ut

 User Rating: 1000   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

You might run into floating precision problems doing so.. not only for z-buffer errors, but also for object detail.. polys might start jumping around at far distance from the origin. you might wanna try doubles instead of floats.
ok,
hope that helped,
cya,
Phil

Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states )


 User Rating: 1000   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: