Jump to content
  • Advertisement
Sign in to follow this  
NiteLordz

Issue with Vector Texture Coordinates

This topic is 2520 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am having an issue with vector texture coordinates. I understand the theory, and i have it working, about 90%. My issue is as follows. i am parsing a t3d file. and i have all the geometry loaded in and showing correctly. i also have the textures working properly... kinda.

my texture coordinate code is as follows

for(unsigned k = 0; k < poly->vertices_.Size(); k++){
Vector2 texCoord;
// Subtract the origin to align the texture graphic
Vector3 temp = poly->vertices_[k] - poly->origin_;

// Dot the vertex by the given s, t vectors, and divide by the texture width
texCoord.x_ = temp.DotProduct(poly->sVector_) / 128.0f;
texCoord.y_ = temp.DotProduct(poly->tVector_) / 128.0f;

poly->texCoords_.Push(texCoord);

// Move the vertices into the correct location
poly->vertices_[k] += brush->location_;
}

what happens is i have different sized textures. some are 256 x 256, 1024 x 1024 and one is 512 x 128. so when i change the texture width/height in the algorithm my textures do not scale properly. if i use the magic number of 128, all my textures are aligned and the proper size. however, this should not be correct, as my wall texture is 1024 x 1024 which is much larger then my floor tile of 256 x 256. even the 256 doesn't make sense, since the 128 is not the right dimensions. the one that looks the worst, is the 512 x 128 texture.

i am using udk to create/layout the level and texture and export to t3d file for me to import.

thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!