pixel perfect 3d GUI?

Blitz3D Forums/Blitz3D Programming/pixel perfect 3d GUI?

bytecode77(Posted 2006) [#1]
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 :)


Stevie G(Posted 2006) [#2]
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


bytecode77(Posted 2006) [#3]
i am using quads

Function 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?


bytecode77(Posted 2006) [#4]
....

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...
:(


ShadowTurtle(Posted 2006) [#5]
centre your image on a 32x32 texture and place it like 7x20..


bytecode77(Posted 2006) [#6]
but how can i get the real texture width? any idea, instead of programming a texture lib?


Stevie G(Posted 2006) [#7]
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


bytecode77(Posted 2006) [#8]
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...


Stevie G(Posted 2006) [#9]
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


bytecode77(Posted 2006) [#10]
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 :(...


Barliesque(Posted 2006) [#11]
Turn off mipmapping with the EntityFX command....?


Stevie G(Posted 2006) [#12]
@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


bytecode77(Posted 2006) [#13]
thx... will chekck it out when i get back from school...


bytecode77(Posted 2006) [#14]
this isnt pixel perfect, too. it should be pixelperfect, when i am using non square textures...is this possible in blitz?


bytecode77(Posted 2006) [#15]
ah, i have tried to make it pixelperfect, and now it is:)
many thx to u all!!!


Ross C(Posted 2006) [#16]
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.