Texture mapping problem
Blitz3D Forums/Blitz3D Beginners Area/Texture mapping problem
| ||
I have problem to map texture onto mesh or rectangle in lots of cases. If I move camera the texture disappears for some poison of camera. Even more it happens also for some examples that there was mesh with texture but if I added the new object to the scene the mesh become untextured. Is necessary to set up anything in Blitz3D or is it bug? |
| ||
I don't know what's wrong, try setting up a light on the other side of the shape. |
| ||
Post some example code. |
| ||
Already said that elsewhere: sounds like a bug in the graphics card driver to me. DirectX7 Support is lousy in initial release drivers, esp. on vista. Update the card driver. |
| ||
Thanks for advice. I must find case which I mentioned. Here I have something what I also do not understand. The light makes me really problems. If I use CreateLight(1) there is cube and plane textured however wall is not. If I use CreateLight(3) all objects are textured. Why? Graphics3D 1024,760,32,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,1,-7 CameraClsColor camera,0,0,255; light=CreateLight(1);if you put 3 instead of 1 wall is textured PositionEntity light,0,1,-10 ;load texture tex = LoadTexture("Water-2_mip.bmp");put arbitrary texture ;create wall size = 45 dist= 20 ground = CreateMesh() ScaleTexture tex,0.5,0.5 surf = CreateSurface(ground,b) v0 = AddVertex (surf, size,size,dist,1,1) v1 = AddVertex (surf, -size,0,dist,0,0) v2 = AddVertex (surf, -size,size,dist,1,0) v3 = AddVertex (surf, size,0,dist,0,1) tri1 = AddTriangle (surf,v0,v1,v2) tri2 = AddTriangle (surf,v3,v1,v0) EntityTexture ground ,tex ;create plane plane=CreatePlane() EntityTexture plane,tex ;create object obj = CreateCube() PositionEntity obj,2,2,0 EntityTexture obj,tex ;loop While Not KeyHit(28) If KeyDown(205)=True Then TurnEntity camera,0,-1,0 If KeyDown(203)=True Then TurnEntity camera,0,1,0 If KeyDown(208)=True Then MoveEntity camera,0,0,-0.05 If KeyDown(200)=True Then MoveEntity camera,0,0,0.05 UpdateWorld RenderWorld Flip Wend End |
| ||
That seems to be a machine-dependant problem. Here, with all three lights, everything is textured. When a texture is missing, the object turns white. If they turn black, it is a lighting problem. After creating the object, try using "UpdateNormals ground" to generate normals for the object. You could also set the normals yourself with the "VertexNormal" command, or use Stevies "MeshUnweld" and "MeshNormals" routines in this topic: (ctrl+F) http://www.blitzmax.com/Community/posts.php?topic=64797 |