Jump to content

View more

Image of the Day

#ld38 #screenshotsaturday Mimosa Fizz action gif #2 https://t.co/TUzdppvfUL
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Very bad look texture in XNA

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1 FantasyVII   Members   

1073
Like
0Likes
Like

Posted 15 October 2012 - 03:54 PM

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:-
Posted Image


and here is how the original texture looks:-
Posted Image


and here how it looks in my game:-
Posted Image


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, 15 October 2012 - 04:46 PM.


#2 Moe   Members   

1256
Like
1Likes
Like

Posted 15 October 2012 - 09:48 PM

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?

#3 Muzzy A   Members   

737
Like
1Likes
Like

Posted 15 October 2012 - 11:36 PM

maybe you're wrapping to many times?

#4 FantasyVII   Members   

1073
Like
0Likes
Like

Posted 16 October 2012 - 04:47 AM

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 :)




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.