Sign in to follow this  

Texture not mapped correctly

Recommended Posts

Hey people,
I am rendering a room mesh but the textures are getting mapped so incorrectly.


Any suggestions??

Share this post

Link to post
Share on other sites
[quote name='TiagoCosta' timestamp='1306780800' post='4817610']
What addressing mode are you using to sample the texture? Are you using WRAP mode?

Are you sure the importer works correctly?

yes, i am using WRAP.

The FX file just does a basic tex2D() call with no changes to the texture coordinates.

here is how i use it:

sampler sTex = sampler_state
texture = <gTex>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = LINEAR;
AddressU = WRAP;
AddressV = WRAP;

float3 TexColor = tex2D(sTex, TexC).rgb;

float3 Color = (Diff + Amb)*TexColor + Spec;

Share this post

Link to post
Share on other sites
It's clearly problem with texture coordinates, you've got them wrong. Question is how and why.

- Where did you get the room mesh from? Did you model it in some 3D SW like Blender or 3ds max and exported it to .x file?
- How is it supposed to look like, what does the texture represent? Is it a texture atlas with parts for separate walls?
- Is there supposed to be only one texture or will there be multi-texturing (like a diffuse map plus a lighting map or something in this meaning)?

- If there are multiple texture coordinates in the mesh (depends on the previous points), are you using the right one? How's TexC defined? Is it
float2 TexC : TEXCOORD0
float2 TexC : TEXCOORD1
Try to change between those two.

Share this post

Link to post
Share on other sites
got it working. turns out that i was only rendering the final subset with the final texture...:(
Thanks any ways guys

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this