I'm not quite there yet... but just to be clear before I get there... how do you correctly choose a size for a 2D image to be used as a texture? The examples just have saved binary files for graphics...
Also, as a side question, is there any issue I should be weary of with intersecting poly's? There doesn't appear to be any rendering issues, but in case there's something I'm unaware of I figured I should ask.
Sizes for images to be used as 3D textures..
Re: Sizes for images to be used as 3D textures..
Textures range from sizes that are powers of 2, starting with 8 and ending with 1024 (8, 16, 32, 64, 128, 256, 512, 1024). The binary files in the examples are basically raw data that match the format used within the program, like RGB16 (16 color palette = 4 bits) and RGB8_A5 (8 color palette + 5 bits of alpha = 8 bits), and because it is raw data, the binary's file size match the product of the 2 texture sizes used in the program (a 16KByte file is roughly equivalent to a 128x128 8-bit, 256x128 4-bit, 128x256 4-bit, or even a 128x64 16-bit raw texture).
Because the 3D hardware works with a z-buffer, there shouldn't be any major problems with intersecting polygons afaik.
Because the 3D hardware works with a z-buffer, there shouldn't be any major problems with intersecting polygons afaik.
Re: Sizes for images to be used as 3D textures..
3d texture sizes
intersecting polys are not a problem. the only issues that I have encountered are that parallel polys (or nearly so) that are very close together/overlapping can cause the back poly to pop through sporatically. The other issue is that poly seams (ie gaps) can be very evident under certain circumstances. particularly if the polys intersect the near view plane. the projection and modelview matrix setup may have some effect on the severity of this issue - I was never able to completely remove the gaps.
Code: Select all
/*! \brief Enums for size of a texture, specify one for horizontal and one for vertical
related functions: glTexImage2d(), glTexParameter() */
enum GL_TEXTURE_SIZE_ENUM {
TEXTURE_SIZE_8 = 0, /*!< 8 texels */
TEXTURE_SIZE_16 = 1, /*!< 16 texels */
TEXTURE_SIZE_32 = 2, /*!< 32 texels */
TEXTURE_SIZE_64 = 3, /*!< 64 texels */
TEXTURE_SIZE_128 = 4, /*!< 128 texels */
TEXTURE_SIZE_256 = 5, /*!< 256 texels */
TEXTURE_SIZE_512 = 6, /*!< 512 texels */
TEXTURE_SIZE_1024 = 7 /*!< 1024 texels */
};
Re: Sizes for images to be used as 3D textures..
Thanks to both of you on the intersection answers.
I saw those texel sizes, but I think where my confusion really lies is the conversion between pixel dimensions and 3D space.
I made the switch to using the fixed point functions right away, so assume I'm using those. Does a quad created that is 128 x 128 x 0 need an image that is 128 x 128 pixels if I were trying to fit it on evenly? Or is texel size not measure the same as pixel size...
I saw those texel sizes, but I think where my confusion really lies is the conversion between pixel dimensions and 3D space.
I made the switch to using the fixed point functions right away, so assume I'm using those. Does a quad created that is 128 x 128 x 0 need an image that is 128 x 128 pixels if I were trying to fit it on evenly? Or is texel size not measure the same as pixel size...
Re: Sizes for images to be used as 3D textures..
It depends on what you want. There is no requirement that texture space match world space. Though it certainly can. You could stretch a texture across a world space that is twice as big- for instance to save VRAM . The ds screens are pretty low resolution so it might not make a difference.
Re: Sizes for images to be used as 3D textures..
All I know about 3D rendering is this:
Texels are messured in the range 0 - 1
Pixels are in 0 - ??? (what ever size the image is)
If your quad of 128x128 used the texel values of 0,0 - 0.25,0.25 of a texture of size 8x8 then the texture that is put on the quad would be the 4 pixels at pixel positions (0,0) - (1,1).
Best thing to do to learn about pixels, texels and how they relate to poly's is to load up blender, or another 3D rendering package and play around with the UV mapping features.
Texels are messured in the range 0 - 1
Pixels are in 0 - ??? (what ever size the image is)
If your quad of 128x128 used the texel values of 0,0 - 0.25,0.25 of a texture of size 8x8 then the texture that is put on the quad would be the 4 pixels at pixel positions (0,0) - (1,1).
Best thing to do to learn about pixels, texels and how they relate to poly's is to load up blender, or another 3D rendering package and play around with the UV mapping features.
-
- Site Admin
- Posts: 2003
- Joined: Tue Aug 09, 2005 3:21 am
- Location: UK
- Contact:
Re: Sizes for images to be used as 3D textures..
Actually a texel is merely a pixel in the image used for texture data, nothing more. Generally texture co-ordinates are given in the range 0 - 1 but, in the case of the DS, where the co-ordinate is a 1.12 fixed point number you could equally say that the range is 0 - 4096.
There's no real point in worrying about pixel size in 3D space, it's largely irrelevant. Having said that, you probably don't want to use a 128x128 pixel texture if the polygon on screen never exceeds 10 pixels square.
There's no real point in worrying about pixel size in 3D space, it's largely irrelevant. Having said that, you probably don't want to use a 128x128 pixel texture if the polygon on screen never exceeds 10 pixels square.
Who is online
Users browsing this forum: Ahrefs [Bot] and 9 guests