I might have this completely wrong, but I'm just starting to experiment with 2 UV coordinate sets.
Here's what I want to do: Create a square with a smaller square in its center. Texture the whole square with some texture (Woodfloor), then blend a second texture (Light) only in the smaller square.
Here's my code:
Now, two things happen that I don't understand:
1) Instead of the desired result, the two textures are blended together and then applied to both the larger and the smaller square (i.e. the smaller square is a carbon copy of the larger square)- how do I get the desired result?
2) If in the second set of AddVertex's (for the smaller square) I remove the U,V values at the end, I get a completely different result - why would this even affect my result?
Any thoughts?
Thanks in advance,
Patrick
Here's what I want to do: Create a square with a smaller square in its center. Texture the whole square with some texture (Woodfloor), then blend a second texture (Light) only in the smaller square.
Here's my code:
Graphics3D 640,480,16,2 Camera = CreateCamera() PositionEntity Camera,0,1,-5 AmbientLight 255,255,255 tex=LoadTexture("woodfloor1.jpg") tex2=LoadTexture("light.jpg") TextureCoords tex2,1 LevelMesh=CreateMesh() Surface1=CreateSurface(LevelMesh) AddVertex (Surface1,-1,1,0,0,0) AddVertex (Surface1,1,1,0,1,0) AddVertex (Surface1,-1,-1,0,0,1) AddVertex (Surface1,1,-1,0,1,1) VertexTexCoords Surface1,0,0,0,0,0 VertexTexCoords Surface1,1,1,0,0,0 VertexTexCoords Surface1,2,0,1,0,0 VertexTexCoords Surface1,3,1,1,0,0 AddTriangle (Surface1,0,1,2) AddTriangle (Surface1,1,3,2) AddVertex (Surface1,-.5,.5,0,0,0) AddVertex (Surface1,.5,.5,0,1,0) AddVertex (Surface1,-.5,-.5,0,0,1) AddVertex (Surface1,.5,-.5,0,1,1) VertexTexCoords Surface1,4,0,0,0,1 VertexTexCoords Surface1,5,1,0,0,1 VertexTexCoords Surface1,6,0,1,0,1 VertexTexCoords Surface1,7,1,1,0,1 AddTriangle (Surface1,4,5,6) AddTriangle (Surface1,5,7,6) EntityTexture LevelMesh,tex,0,0 EntityTexture LevelMesh,tex2,0,1 UpdateNormals LevelMesh Repeat UpdateWorld() RenderWorld() Flip Until KeyDown(1)
Now, two things happen that I don't understand:
1) Instead of the desired result, the two textures are blended together and then applied to both the larger and the smaller square (i.e. the smaller square is a carbon copy of the larger square)- how do I get the desired result?
2) If in the second set of AddVertex's (for the smaller square) I remove the U,V values at the end, I get a completely different result - why would this even affect my result?
Any thoughts?
Thanks in advance,
Patrick