Sprite Flicker
BlitzMax Forums/MiniB3D Module/Sprite Flicker
| ||
How can I avoid sprites flickering? The shadow below the player is a sprite but if I pull the camera out some distance it starts to flicker. |
| ||
It's not a solid colour? |
| ||
In that shot, no. It's an alpha png. However, I've tried it as a solid colour, masked and so on, but it's always the same. Actually, this isn't a sprite issue. The same problem occurs to the player models feet if I get rid of the sprite. Time to update drivers... |
| ||
Add about 0.01 to the Y position of the sprite and player. That should fix it. |
| ||
Ok, drivers didn't fix it but check this... The green ground is a cube stretched out flat with a grass texture. ground = CreateCube() ScaleMesh(ground, 1000,0,1000) PositionEntity(ground, 0, 0, 0) For this example I have made the ground smaller than it should be. The blue behind is nothingness. The tennis court lines are a single sprite placed at 0, 1, 0. As you can see, where the sprite is floating in space it appears fine but when the ground is beneath it the lines flicker and disappear completely. This only happens from a high camera viewpoint (in fact it gets progressively worse the higher the camera). Any ideas? |
| ||
Add about 0.01 to the Y position of the sprite and player. That should fix it. I've tried adding as much as 10 to the court sprite but it still occurs when the camera is high. |
| ||
I've tried adding as much as 10 to the court sprite but it still occurs when the camera is high. Sounds like a rounding issue -- add more when the camera gets higher? |
| ||
EntityOrder? How about that? |
| ||
seconded Khomy's suggestion. I would drop the entity order of the court so it shows behind everything no matter what, that should preserve your depth with the net, players, shadows, etc. properly and force them all to get drawn above the court. also agreeing with xlsior, sounds like a rounding issue with the depth calculation, but the entitiy order should make that a non issue. |
| ||
Does this still happen if you use a quad instead of a sprite? I.e. lines=Mesh::CreateQuad() Also try reducing your camera range ratio - i.e. making the near range bigger or the far range smaller. |
| ||
Instead of using 2 objects for the ground, wouldn't it be better to use a single object with 2 layers of texture? |
| ||
http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html |
| ||
Using EntityOrder solves the issue. Will check quads as well. Instead of using 2 objects for the ground, wouldn't it be better to use a single object with 2 layers of texture? Yes, that's the plan. Just waiting on the artist for a stadium model. :) |