   Rendering sprite in 3D World
  Hello, I had a problem rendering sprite in 3d world. Its hard to explain, so I think I shall use pictures to aids my explanation.I had set D3DXSPRITE_OBJECTSPACE. Yhe problem is that the sprite doesn't render like it is inside the world at some point.This is a screenshot of the sprite is outside the pillar. (Like as if it paste on top of the screen).http://img236.imageshack.us/my.php?image=renderingproblem13pt.jpgThis is a screenshot of part of the sprite is behind the pillar and part of it is outside the pillar.http://img236.imageshack.us/my.php?image=renderingproblem21kl.jpgThis is a screenshot of the sprite behind the pillar.http://img236.imageshack.us/my.php?image=renderingproblem32mo.jpgHow can i fix this problem? Oh, I think I should tell you this too. I attach the whole scene as one object in 3d studio max and render them as x file. The pillar is the tallest part of the world. I was guessing when part of the sprite were behind the pillar and part of the sprite is outside the pillar is the height of the second tallest in the world, causing this problem. but its all guessing.   
  I believe it has a lot to do with the NearZ, and the order that you are drawing the meshes and polygons. Even when the ZBuffer is enabled, there are sometimes problems with how some things are drawn, especially when the NearZ is in between 0 and 1, and the polygons are not drawn in the proper order. Take a look at my Mortal Kombat vs Street Fighter pics and you'll see what I mean:www.angelfire.com/fl5/memorydll/index.htmlI simply solved this problem by making the NearZ be 10, instead of .1 . Hopefully that's the solution to your problem. If not, try sorting the polygons in a back to front order from the camera. ;)   ;  Is it that you can set the ZNear at IDirect3DDevice9::Clear function? I tried changing it 10.0f but it does not work.I tried change the AutoDepthStencilFormat from D3DFMT_D16 to D3DFMT_D32 and my rendering order seems to change.How to sort the polygons in a back to front order from the camera?Thanks in advance.   ;  I still can't fix this problem. I tried render the different scene object one at a time but it still can't work... Please give me some guidiance. Thanks in advance.   ;  I think you can call  "ID3DXSprite::SetWorldViewLH or ID3DXSprite::SetWorldViewRH" before rendering your sprites.By the way ,I am also a new person studying directx.I have seen your game picture.And it seems good.I hope my advice can help you.   ;  Thanks. Anyway, What's the use of SetWorldViewLH??   ;  you can look for it in directx documents.A call to this method (or to ID3DXSprite::SetWorldViewRH) is required if the sprite will be rendered with the D3DXSPRITE_BILLBOARD, D3DXSPRITE_SORT_DEPTH_FRONTTOBACK, or D3DXSPRITE_SORT_DEPTH_BACKTOFRONT flag value in ID3DXSprite::Begin.;  Thanks man... I Fixed the problem... Its because of my Y Position (Height) of the character problem... I'm sorry for all this trouble... But thanks for the help :) Thanks...   