AC3D Forums Texture Mapping(Planar mapping)
 User Name Remember Me? Password
 Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 Thread Tools Display Modes
 25th October 2003, 07:58 PM #1 figgy Member Advanced member   Join Date: Jul 2003 Location: Hampshire UK Posts: 38 Texture Mapping(Planar mapping) Please help me, this is doing my head in!! Below is an extract from an Unreal T3D file i am trying to convert to AC3D. The geometry looks fine, but i am having touble with calculating the Texture coords for each poly. Begin Polygon Item=Cap Texture=Terminal_A01 Origin +00212.077362,+00512.000000,-00128.000000 Normal +00000.000000,+00000.000000,-00001.000000 TextureU -00000.707107,-00000.707107,+00000.000000 TextureV -00000.707107,+00000.707107,+00000.000000 Vertex +00212.077362,+00512.000000,-00128.000000 Vertex +00512.000000,+00212.077347,-00128.000000 Vertex +00512.000000,-00212.077393,-00128.000000 Vertex +00212.077255,-00512.000061,-00128.000000 Vertex -00212.077347,-00512.000000,-00128.000000 Vertex -00512.000061,-00212.077179,-00128.000000 Vertex -00511.999969,+00212.077438,-00128.000000 Vertex -00212.077347,+00512.000000,-00128.000000 End Polygon Origin is the first vertex in the poly. TextureU and V are the Vectors describing the cordinate system(Normalized) Here's my code(it doesn't work) //temp is the vertex - the origin temp.x = (vertex.x - origin.x); temp.y = (vertex.y - origin.y); temp.z = (vertex.z - origin.z); U = Dot(temp,textureU)/128;//128 is the Bitmap Width V = Dot(temp,textureV)/128;//128 is the Bitmap Height Any ideas? The internet is hopeless! Thanx Mark
 25th October 2003, 10:10 PM #2 Dennis Senior Member Professional user     Join Date: Jul 2003 Posts: 899 Re: Texture Mapping(Planar mapping) What kind of results are you getting (visually)? Your code looks solid - I plugged the verts/coords into a spreadsheet using your same values, put that into AC3D, and the results look normal. Sounds like it may just be an implementation problem in your code? Here are the texture coordinates I got for points 1 through 8 using your formula: 0 0 8.28641E-08 -3.313709408 2.343146846 -5.656856171 5.656856928 -5.656855746 8.000002592 -3.313709408 8.000002001 1.34792E-06 5.656855409 2.343146924 2.343146592 2.343146592 If the code's not that large, maybe you could post the function(s) that generates the coordinates? Dennis
 27th October 2003, 04:39 PM #3 figgy Member Advanced member   Join Date: Jul 2003 Location: Hampshire UK Posts: 38 Re: Texture Mapping(Planar mapping) Thanks Dennis, I thought the problem was with my formula. When i ran it with a textured rectangle it looked fine. When i ran it with anything else, everthing went screwy. What i'd done was to ovewrite every V index in my UV array with my U value. BrushUV[index] = U; BrushUV[index+1] = V; index++; should have been index+=2; duh!!! Thanks for putting on the right track. regards Mark

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules

All times are GMT -4. The time now is 11:50 AM.

 Archive - Top

AC3D Forum
(C) Inivis Limited 2020