• Advertisement
Sign in to follow this  

Very bad look texture in XNA

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

Hello everyone,

So I have this cube that I made in Sketchup and I applied a 4096 X 4096 texture on it. Here how it looks in Sketchup:-
skeshup.jpg


and here is how the original texture looks:-
originaltexture.jpg


and here how it looks in my game:-
gametexture.png


I just want to know why does it look so so bad?

here is the Cube Class when it load and draw the cube.


namespace _3D_Tower_Defense
{
class CubeModel
{
Model Model;
public Vector3 Position, Rotation;
Matrix ViewMatrix, ProjectionMatrix;
Matrix[] Transforms;
public CubeModel()
{
Rotation = Vector3.Zero;
}
public void Initialize(GraphicsDeviceManager graphics, Matrix ViewMatrix, Matrix ProjectionMatrix)
{
this.ViewMatrix = ViewMatrix;
this.ProjectionMatrix = ProjectionMatrix;
}
public void LoadContent(ContentManager Content, string ModelPath)
{
Model = Content.Load<Model>(ModelPath);
}
public void Update(GameTime gameTime)
{
Position = new Vector3((int)((MouseCursor.Position.X - 400) / 14), 0.9f, ((int)(MouseCursor.Position.Y - 200) / 14));
Position = Position * 14;
}
public void Draw(SpriteBatch spriteBatch)
{
Transforms = new Matrix[Model.Bones.Count];
Model.CopyAbsoluteBoneTransformsTo(Transforms);
foreach (ModelMesh modelMesh in Model.Meshes)
{
foreach (BasicEffect Effect in modelMesh.Effects)
{
//Effect.EnableDefaultLighting();
//Effect.PreferPerPixelLighting = true;
Effect.World = Transforms[modelMesh.ParentBone.Index] *
Matrix.CreateRotationX(MathHelper.ToRadians(Rotation.X)) *
Matrix.CreateRotationY(MathHelper.ToRadians(Rotation.Y)) *
Matrix.CreateRotationZ(MathHelper.ToRadians(Rotation.Z)) *
Matrix.CreateTranslation(Position);
Effect.Projection = ProjectionMatrix;
Effect.View = ViewMatrix;
}
modelMesh.Draw();
}
}
}
}

Edited by FantasyVII

Share this post


Link to post
Share on other sites
Advertisement
Is it just me, or is it looking rather green?

A few things to check:
- Is the texture being loaded in as part of a model? If so, is the material for the model set to use some sort of coloring?
- Are you setting any other render states that could be affecting the color of the model?

Share this post


Link to post
Share on other sites
Thank guys for everything. I figured it out. The lighting was bad lol.

I just had to add this


Effect.DirectionalLight0.Enabled = true;
Effect.DirectionalLight0.Direction = new Vector3(0, -1, -1);
Effect.DirectionalLight0.DiffuseColor = Color.White.ToVector3();


thank you all :)

Share this post


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

  • Advertisement