FP32 Textures with 3D Textures

Started by
1 comment, last by MARS_999 18 years, 6 months ago
I am using this code to make a 3D FP32 Texture and its SLOW when it comes to render the scene... Its a smaller texture so size shouldn't be killing my performance?

const int NOISETEXTURE = 32;
float Noise3DTexPtr[NOISETEXTURE][NOISETEXTURE][NOISETEXTURE][4];

for(int x = 0; x < NOISETEXTURE; x++)
	{
        for(int y = 0; y < NOISETEXTURE; y++)
		{
			for(int z = 0; z < NOISETEXTURE; z++)
			{
				Noise3DTexPtr[x][y][z][0] = PerlinNoise3D(x, y, z, .01, .5, 2);
				Noise3DTexPtr[x][y][z][1] = PerlinNoise3D(x, y, z, .005, .5, 2);
				Noise3DTexPtr[x][y][z][2] = PerlinNoise3D(x, y, z, .01, .25, 2);
				Noise3DTexPtr[x][y][z][3] = PerlinNoise3D(x, y, z, .001, .15, 2);
			}
		}
	}

glGenTextures(1, &skyplane.textureObjectSkyNoise3D);
	glBindTexture(GL_TEXTURE_3D, skyplane.textureObjectSkyNoise3D);

	glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
	glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
	glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);
	glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA_FLOAT32_ATI, NOISETEXTURE, NOISETEXTURE, NOISETEXTURE, 0, GL_RGBA, GL_FLOAT, Noise3DTexPtr);

Advertisement
Change the LINEAR filter to NEAREST since there is no hardware capable of that just yet :)
Quote:Original post by JavaCoolDude
Change the LINEAR filter to NEAREST since there is no hardware capable of that just yet :)


Yeah, I already did that and it worked... Just haven't posted the results yet. ;) What format is everyone using? .dds or the OpenEXR??

This topic is closed to new replies.

Advertisement