Jump to content
  • Advertisement
Sign in to follow this  
Feadur

How do I adjust UV for textures?

This topic is 4225 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

Hi all, I have a simple plane (it's actually a mesh on the XZ plane) made with Okino NuGraf. I apply it a texture, render it...and ok, it looks great. What happens is what I use the .X exporter and import it into XNA, the texture fills all the mesh. I mean 1 single repetition is filling the whole mesh. That's the code I use for rendering tant plane: public void Draw(GraphicsDevice device, Matrix matrizVista,Matrix matrizProyeccion) { foreach (ModelMesh mesh in this.model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.World = Matrix.CreateRotationX((float)Math.PI ) * Matrix.CreateScale(new Vector3(1,1,1)); effect.View = matrizVista; effect.Projection = matrizProyeccion; } mesh.Draw(); } } Any idea?? Thank's!

Share this post


Link to post
Share on other sites
Advertisement
Actually the problem is how to tell to my GraphicsDevice how to repeat the texture over the mesh, or maybe, edit the .X file so that it's done correctly.

Share this post


Link to post
Share on other sites
Quote:
Original post by Feadur
Actually the problem is how to tell to my GraphicsDevice how to repeat the texture over the mesh, or maybe, edit the .X file so that it's done correctly.


I guess you have to change the SamplerState.Address{U,V,W} of your technique (but I don't know XNA that much. I'm learning...). Maybe you can edit the effect file to do this.

Share this post


Link to post
Share on other sites
Thanks Emmanuel,

Does "SamplerState" applies to DirectX? If so, you can just tell where it's found, and I'll look for the equivalence in XNA :)

I mean, is this one of the device properties? Or maybe it must be in the HLSL .fx file?

Share this post


Link to post
Share on other sites
Quote:
Original post by Feadur
Thanks Emmanuel,

Does "SamplerState" applies to DirectX? If so, you can just tell where it's found, and I'll look for the equivalence in XNA :)

I mean, is this one of the device properties? Or maybe it must be in the HLSL .fx file?


It's a XNA thing (GraphicDevice.SamplerStates is a collection of SampleState) (I though it was a per-technique thing, I am obviously wrong).

Of course, it comes from DirectX (IDirect3DDevice9::SetSamplerState()).

You can also change the sample states in the effect file (check the effect file documentation in the DX SDK).

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!