Very bad look texture in XNA

Started by
2 comments, last by FantasyVII 11 years, 6 months ago
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();
}
}
}
}

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?
maybe you're wrapping to many times?
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 :)

This topic is closed to new replies.

Advertisement