Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualSpa8nky

Posted 31 January 2012 - 03:44 PM

So I've been trying to implement your suggestion but it doesn't solve the problem:


				v = quadrangles[i].Vertices;

				halfTexel.X = 0.5f / quadrangles[i].Width;
				halfTexel.Y = 0.5f / quadrangles[i].Height;

				// [0] Lower Left	   [1] -- [3]	 (0,0)--(1,0)
				// [1] Upper Left		|	  |		|	  |
				// [2] Lower Right	   |	  |		|	  |
				// [3] Upper Right	  [0] -- [2]	 (0,1)--(1,1)

				v[0].TexCoordDimension.X = halfTexel.X;						 // Texture Coordinates stored in X,Y Quadrangle Dimensions stored in Z,W
				v[0].TexCoordDimension.Y = 1f - halfTexel.Y;
				v[1].TexCoordDimension.X = halfTexel.X;
				v[1].TexCoordDimension.Y = halfTexel.Y;
				v[2].TexCoordDimension.X = 1f - halfTexel.X;
				v[2].TexCoordDimension.Y = 1f - halfTexel.Y;
				v[3].TexCoordDimension.X = 1f - halfTexel.X;
				v[3].TexCoordDimension.Y = halfTexel.Y;

				// Copy the vertex data to the drawer's large vertices array
				v.CopyTo(vertices, i * 4);

or


                v[0].TexCoordDimension.X += halfTexel.X;
                v[0].TexCoordDimension.Y -= halfTexel.Y;

                v[1].TexCoordDimension.X += halfTexel.X;
                v[1].TexCoordDimension.Y += halfTexel.Y;

                v[2].TexCoordDimension.X -= halfTexel.X;
                v[2].TexCoordDimension.Y -= halfTexel.Y;

                v[3].TexCoordDimension.X -= halfTexel.X;
                v[3].TexCoordDimension.Y += halfTexel.Y;

How do I calculate one texel?

I have tried:


			halfTexel.X = 0.5f / game.GraphicsDevice.PresentationParameters.BackBufferWidth;
			halfTexel.Y = 0.5f / game.GraphicsDevice.PresentationParameters.BackBufferHeight;

and


			halfTexel.X = 0.5f / game.TextureAtlas.Texture.Width;
			halfTexel.Y = 0.5f / game.TextureAtlas.Texture.Height;

None of the above produces the correct result Posted Image

#1Spa8nky

Posted 31 January 2012 - 03:36 PM

So I've been trying to implement your suggestion but it doesn't solve the problem:


                v = quadrangles[i].Vertices;

                halfTexel.X = 0.5f / quadrangles[i].Width;
                halfTexel.Y = 0.5f / quadrangles[i].Height;

                // [0] Lower Left       [1] -- [3]     (0,0)--(1,0)
                // [1] Upper Left        |      |        |      |
                // [2] Lower Right       |      |        |      |
                // [3] Upper Right      [0] -- [2]     (0,1)--(1,1)

                v[0].TexCoordDimension.X = halfTexel.X;                         // Texture Coordinates stored in X,Y Quadrangle Dimensions stored in Z,W
                v[0].TexCoordDimension.Y = 1f - halfTexel.Y;
                v[1].TexCoordDimension.X = halfTexel.X;
                v[1].TexCoordDimension.Y = halfTexel.Y;
                v[2].TexCoordDimension.X = 1f - halfTexel.X;
                v[2].TexCoordDimension.Y = 1f - halfTexel.Y;
                v[3].TexCoordDimension.X = 1f - halfTexel.X;
                v[3].TexCoordDimension.Y = halfTexel.Y;

                // Copy the vertex data to the drawer's large vertices array
                v.CopyTo(vertices, i * 4);

How do I calculate one texel?

I have tried:


            halfTexel.X = 0.5f / game.GraphicsDevice.PresentationParameters.BackBufferWidth;
            halfTexel.Y = 0.5f / game.GraphicsDevice.PresentationParameters.BackBufferHeight;

and


            halfTexel.X = 0.5f / game.TextureAtlas.Texture.Width;
            halfTexel.Y = 0.5f / game.TextureAtlas.Texture.Height;

None of the above produces the correct result :(

PARTNERS