Quad placement
Blitz3D Forums/Blitz3D Programming/Quad placement
| ||
Hi. I've created a sprite made of a quad and I'm trying to place it with in the camera so that it's at a 1:1 ration and then the texture image should look just like the regular image. The problem I have is I can't figure out how to do it. I've looked through the LoadPixie command in the code archives but that is commented enought for me to understand why the author does what he does. Can someone post any ideas on how I could solve this problem or just a simple explination on how Blitz handles depth so I can try and fix the quad to be perfect. Thanks. |
| ||
try this:WIDTH = 800 HEIGHT = 600 halfWIDTH = WIDTH/2 halfHEIGHT = HEIGHT/2 Graphics3D WIDTH,HEIGHT,16,2 SetBuffer BackBuffer() camera = CreateCamera() camzoom#=1.0 ; this is default. Other values work as well. CameraZoom camera,camzoom# CameraRange camera,1,(halfWIDTH * camzoom#)+1000 sprite=CreateSprite() ; if you want the sprite to be 32*32 Pixels: ScaleSprite sprite,32/2,32/2 EntityColor sprite,255,0,0 While KeyDown(1)=0 PositionEntity sprite,MouseX()-halfWIDTH,halfHEIGHT-MouseY(),halfWIDTH * camzoom# UpdateWorld RenderWorld Flip Wend |
| ||
Thanks for the code JFK, but I meant a quad created with the CreateMesh command. How does one get that pixel perfect. |
| ||
take a look in the code archives, there are several things that should help you out with this. (including Rob's Single Surface Stuff). |
| ||
At the default CameraZoom value: If you create a quad which is placed 400 units in front of the camera, then it needs to be precisely 800 units wide in order to fill the screen. Assuming you are using a 4:3 graphics ratio, it will need to be 600 units high. So if you place something at 200 units in front of the camera, it needs to be 400 units wide, and so on. |
| ||
you can use my code (I like it cause it's so compact) and replace the sprite with a quad. Use th FitMesh Command to resize the quad correctly |
| ||
Hi Folks, I want to see the loadpixie function in operation. Aww, go on, please.... Is it the same as loadsprite, but with jollier clothes? Later, Jes |
| ||
I've been looking at the pixie code recently and it works very well but it'd be good if Skidracer gave a bit more of an explanation of what he's doing. I always prefer to write my own version as it's easier to integrate into your own code. :) @ Jfk - that sort of works but you'll notice that the texture seems slightly fuzzy. I'm not sure what Pixies does that your not doing here?! |
| ||
first of all you need to turn off mipmapping: cleartexturefilters ; wipe out mipmapping load texture texturefilter "",9 ; reset to default then, additionally you need to use 1 Texel per Pixel if you want pixelperfect textures. For TFT Screens thiy may be only original Resolution or half the original Resolution. Since you hardly know what resolution a Screen has, you never exactly know if you gonna get pixelperfect texels or not. However, turning off Mipmapping may help a lot. |
| ||
Tried that - it's still the same - using your code above that is ... :( Surely, in full screen the resolution would never change, then again, I'm not sure what TFT screens are? |
| ||
Ahhh . just realised that the trick with Pixies is the second pixot attached to the first which is offset -.5,-.5,0 - this resolves the blurring!!! |
| ||
Ah, I see. But this also means you need to round the positions to something integer plus .5. So probably you need to use floating point position variables to move something smoothly, and only round a copy of it to integer+.5 for the positioning. |
| ||
PS: TFT is a liquid cristal display, LCD thing. Such a LCD Screen has a fixed number of physical LED Pixels. You can set the resolution to say 800*600 on a physical resolution of 1024*768, but then some pixels/lines are interpolated. |