Skip to main content
GameDev.net gamedev.net
🔒 Locked

Higher quality skybox?

Started by Last Attacker Jul 9, 2006 at 12:47 PM 7 replies 2.3k views
Original Post
Last Attacker
Last Attacker
Hi. I have implemented a skybox in OpenGL which I have generated with Terragen. But it seems it doesn't matter where I get skybox images from I get a pretty low-res image. I use 512 x 512 24-bit TGA images. Here is a screenshot of the window with the skybox. Does anyone know what I should do to enhance its appearance? Thanks Free Image Hosting at www.ImageShack.us
"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog
ViLiO
ViLiO
Are you using a linear filter or point filtering?

From the screenie it looks like point filtering (GL_NEAREST) so you could try using linear filtering (GL_LINEAR).

All the best,
ViLiO
Richard 'ViLiO' Thomasv.net | Twitter | YouTube
Last Attacker
Last Attacker
Here is the filter source I use, my skybox textures are set on FILTER_TRILINEAR.

void SetFilterMode(const void *Data, GLsizei Width, GLsizei Height, FILTER_MODE FilterMode, PIXEL_FORMAT ColorMode){	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);		switch (FilterMode)	{	case FILTER_BILINEAR:		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);		//glTexImage2D(GL_TEXTURE_2D, 0, 4, Width, Height, 0, ColorMode, GL_UNSIGNED_BYTE, Data);		glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);		gluBuild2DMipmaps(GL_TEXTURE_2D, 4, Width, Height, ColorMode, GL_UNSIGNED_BYTE, Data);		break;	case FILTER_TRILINEAR:		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);		//glTexImage2D(GL_TEXTURE_2D, 0, 4, Width, Height, 0, ColorMode, GL_UNSIGNED_BYTE, Data);		glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);		gluBuild2DMipmaps(GL_TEXTURE_2D, 4, Width, Height, ColorMode, GL_UNSIGNED_BYTE, Data);		break;	case FILTER_NONE:	default:	//If none or wrong filter mode, then assume FILTER_NONE		glPixelStorei(GL_UNPACK_ALIGNMENT, 1);		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);		glTexImage2D(GL_TEXTURE_2D, 0, 3, Width, Height, 0, ColorMode, GL_UNSIGNED_BYTE, Data);		}}
"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog
deathkrush
deathkrush
You could try bypassing the mipmaps and always use the highest resolution image. It kind of doesn't make sense to use mipmaps with a skybox.
deathkrushPS3/Xbox360 Graphics Programmer, Mass Media.Completed Projects: Stuntman Ignition (PS3), Saints Row 2 (PS3), Darksiders(PS3, 360)
OrangyTang
OrangyTang
That looks rather like a Terragen render to me, unfortunately the rendering quality of Terragen isn't terribly good at times, and you seem to be suffering from lots of jaggies.

Try doing your terragen render at a much larger resolution (say, 2048x2048) then manually resizing that down to 512x512 in a good paint program. This will give you a quick and easy antialiasing of the edges.

Incidentally you don't need a triliner filter for skyboxes, you should have them set at the correct size so that mipmaps never get used. Regular bilinear should look just as good and be faster.

Edit: Ha! I hope your skybox textures are power-of-two sized (512x512, 256x128, etc.). Otherwise gluBuild2DMipmaps will do a (crappy) resize to the nearest power of two, which is going to make the resulting texture look horrible.
Last Attacker
Last Attacker
Ok, I'll try that.
Does my filter code look ok?
"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog
Last Attacker
Last Attacker
Thanks OrangyTang!
It looks much better.

EDIT: I made a 1280 x 968 image (the freeware version didn't allow more) and shrunk it with Paint Shop Pro 8 to 512 x 512 (boy it renders long [headshake]).
Then I used Bilinear filtering.

Free Image Hosting at www.ImageShack.us

[Edited by - Last Attacker on July 9, 2006 1:27:31 PM]
"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog
Last Attacker
Last Attacker
Unfortunately when I rendered for different directions I saw that the Terragen free-limitation caused a problem. Since the largest image won't produce a power of 2 image, it caused that the left, right, top, bottom, front and back images doesn't properly fit.
But I used PSP's Soft image effect and made it a little bit blurry like this (on the first image with the terrible quality):

Free Image Hosting at www.ImageShack.us

Atleast all edges fits and it looks better than the first one.
"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.