pixel perfect 3d GUI?
Blitz3D Forums/Blitz3D Programming/pixel perfect 3d GUI?
| ||
hello there! i am currently working on a 3d gui, but i have got a problem: the edges of the gadgets are looking strange... that's because i am using textures on sprites/quads... i have tries to resize the texture with the factor 5, but this isn't a solution :( what shell i do? would be thankful for help :) |
| ||
Which are you using .. sprites or quads? Are you using non-square texture sizes? Remember that you should offset the UV's by +.5/TextureWidth() so that the texel is positioned in the centre. Obviously this would only be possible to do with quads. Stevie |
| ||
i am using quadsFunction XGui2_CreateQuad() quad.XGui2_Quad = New XGui2_Quad quad\ent = CreateMesh() surf = CreateSurface(quad\ent) z = GraphicsWidth() / 2 v1 = AddVertex(surf, 0, 0, z, 0, 0) v2 = AddVertex(surf, 0, -1, z, 0, 1) v3 = AddVertex(surf, 1, 0, z, 1, 0) v4 = AddVertex(surf, 1, -1, z, 1, 1) AddTriangle surf, v1, v2, v3 AddTriangle surf, v3, v2, v4 EntityFX quad\ent, 17 Return Handle(quad) End Function but to offset the texture wouldn't change a thing! ah and by the way: what if i dont want to have the texture centered? |
| ||
.... edit: i am using texture sizes which are NOT square sized like 32,64,128 and so on... they have sizes like 7x20... and if i center the texels, there are still pixel failures... :( |
| ||
centre your image on a 32x32 texture and place it like 7x20.. |
| ||
but how can i get the real texture width? any idea, instead of programming a texture lib? |
| ||
Blitz will round the textures up to the nearest power of 2 so 7 x 20 will be 8 x 32. Check this using texturewidth( mytexture ) once loaded. Stevie |
| ||
it is still 32x8 at all the times :(... edit: i have tested to move the texture with .5/texturewidth(), .5/textureheight().... and the result is the same... |
| ||
Look at the Pixie code in the code archives posted by Skidracer. I can't remember but it may handle odd texture sizes. Failing that you'll need to post a simple demo of your code that we can look at. Stevie |
| ||
i will post a demo as soon as i get back from school... but i can look for the code now :) edit: found it http://www.blitzbasic.com/Community/posts.php?topic=44678 , but it isnt really pixel perfect :(... |
| ||
Turn off mipmapping with the EntityFX command....? |
| ||
@Devils Child .. that's not the code I was talking about. Here it is ... http://www.blitzbasic.com/codearcs/codearcs.php?code=773 Don't us it myself as I think it's overcomplex but I can show you an example of pixel perfect quads using square textures if you like but not until later. Stevie |
| ||
thx... will chekck it out when i get back from school... |
| ||
this isnt pixel perfect, too. it should be pixelperfect, when i am using non square textures...is this possible in blitz? |
| ||
ah, i have tried to make it pixelperfect, and now it is:) many thx to u all!!! |
| ||
Hmm, i doubt pixel perfect, non power of 2 textures are possible, because as stevie says, blitz automatically scales up to the next power of two size. And blitz uses a fairly basic and crappy scaling method. |