SlideShare a Scribd company logo
Mohammad Shaker
mohammadshaker.com
@ZGTRShaker
2011, 2012, 2013, 2014
XNA Game Development
L05 – Texturing
that appears in a video game needs to be textured; this includes everything from plants
to people. If things aren’t textured well, your game just won’t look right.
Texturing
• What’s it?!
Textures are images applied to surfaces that are created using primitive objects
Texturing
• What’s it?!
Textures are images applied to surfaces that are created using primitive objects
XNA is Perfect at Texturing
textures can be colored, filtered, blended,
and transformed at run time!
Texturing
• What’s it?!
Textures are images applied to surfaces that are created using primitive objects
textures can be colored, filtered, blended,
and transformed at run time!
XNA is Perfect at Texturing
XNA supports:
.bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga image formats for textures
Texturing
• UV Coordinates
– 2D World
• a texture is a two-dimensional object that is mapped onto a 2D polygon
– 3D World
• a texture is a two-dimensional object that is mapped onto a 3D polygon
Texturing
• UV Coordinates
Texturing
• Vertex Types for Textures
Texturing
• Vertex Types for Textures
– VertexPositionColorTexture
– VertexPositionNormalTexture
– VertexPositionTexture
Texturing
• VertexPositionColorTexture
– This format allows you to apply image textures to your primitive shapes, and you can even
shade your images with color.
– For example, with this vertex type you could draw a rectangle with an image texture and then
you could show it again with a different shade of color!
VertexPositionColorTexture vertex = new
VertexPositionColorTexture(Vector3 position, Color color, Vector2 uv);
Texturing
• VertexPositionNormalTexture
– This format allows you to add textures to your primitive objects. The normal data enables
lighting for this textured format.
VertexPositionNormalTexture vertex = new
VertexPositionNormalTexture(Vector3 position, Vector3 normal, Vector2 uv);
Texturing
• VertexPositionTexture
– This format only permits storage of position and texture data.
– It may be useful if you don’t need lighting and were concerned about saving space or
improving performance for large amounts of vertices.
VertexPositionTexture vertex = new
VertexPositionTexture(Vector3 position, Vector2 uv);
Texturing
• TRANSPARENT TEXTURES
Texturing
• TRANSPARENT TEXTURES
Texturing
• TRANSPARENT TEXTURES
Texturing
• TRANSPARENT TEXTURES
Texturing
• TRANSPARENT TEXTURES
An alpha channel can be used to “mask” all pixels of a specific color in an image. Alpha
data is stored in the last color byte of a pixel after the red, green, and blue bytes.
When alpha blending is enabled in your XNA code and the alpha channel is active,
transparency is achieved for the pixels where the alpha setting is set to 0.
New “Alpha” Channel!
Texturing
• TRANSPARENT TEXTURES
An alpha channel can be used to “mask” all pixels of a specific color in an image. Alpha
data is stored in the last color byte of a pixel after the red, green, and blue bytes.
When alpha blending is enabled in your XNA code and the alpha channel is active,
transparency is achieved for the pixels where the alpha setting is set to 0.
New “Alpha” Channel!
Texturing
• Texture Coloring “Shaders”
– Microsoft Book, Chapter 9, Page 119
• Texture Example (Learning XNA 3.0 “O’Riley” , P:205)
A Simple Texture Sample
Texturing
• Loading Textures through content manager
Texture2D texture = Content.Load<Texture2D>("ImagesimageName");
Texturing
• Let’s make a texture in a 3D world!
VertexPositionTexture[] verts;
Texturing
• LoadContent()
verts[0] = new VertexPositionTexture(new Vector3(-1, 1, 0), new Vector2(0, 0));
verts[1] = new VertexPositionTexture(new Vector3(1, 1, 0), new Vector2(1, 0));
verts[2] = new VertexPositionTexture(new Vector3(-1, -1, 0), new Vector2(0, 1));
verts[3] = new VertexPositionTexture(new Vector3(1, -1, 0), new Vector2(1, 1));
Texturing
• LoadContent()
verts[0] = new VertexPositionTexture(new Vector3(-1, 1, 0), new Vector2(0, 0));
verts[1] = new VertexPositionTexture(new Vector3(1, 1, 0), new Vector2(1, 0));
verts[2] = new VertexPositionTexture(new Vector3(-1, -1, 0), new Vector2(0, 1));
verts[3] = new VertexPositionTexture(new Vector3(1, -1, 0), new Vector2(1, 1));
Texturing
• LoadContent()
verts[0] = new VertexPositionTexture(new Vector3(-1, 1, 0), new Vector2(0, 0));
verts[1] = new VertexPositionTexture(new Vector3(1, 1, 0), new Vector2(1, 0));
verts[2] = new VertexPositionTexture(new Vector3(-1, -1, 0), new Vector2(0, 1));
verts[3] = new VertexPositionTexture(new Vector3(1, -1, 0), new Vector2(1, 1));
0,0 1,0
0,1 1,1
texture = Content.Load<Texture2D>(@"arrow");
Texturing
• Draw()
GraphicsDevice.Clear(Color.CornflowerBlue);
BasicEffect effect = new BasicEffect(GraphicsDevice);
effect.World = world;
effect.View = view;
effect.Projection = projection;
effect.Texture = texture;
effect.TextureEnabled = true;
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>
(PrimitiveType.TriangleStrip, verts, 0, 2);
}
0,0 1,0
0,1 1,1
Texturing
• Draw()
GraphicsDevice.Clear(Color.CornflowerBlue);
BasicEffect effect = new BasicEffect(GraphicsDevice);
effect.World = world;
effect.View = view;
effect.Projection = projection;
effect.Texture = texture;
effect.TextureEnabled = true;
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>
(PrimitiveType.TriangleStrip, verts, 0, 2);
}
0,0 1,0
0,1 1,1
Texturing
• Draw()
GraphicsDevice.Clear(Color.CornflowerBlue);
BasicEffect effect = new BasicEffect(GraphicsDevice);
effect.World = world;
effect.View = view;
effect.Projection = projection;
effect.Texture = texture;
effect.TextureEnabled = true;
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>
(PrimitiveType.TriangleStrip, verts, 0, 2);
}
Texturing
Texturing
• Draw()
GraphicsDevice.Clear(Color.CornflowerBlue);
BasicEffect effect = new BasicEffect(GraphicsDevice);
effect.World = world;
effect.View = view;
effect.Projection = projection;
effect.Texture = texture;
effect.TextureEnabled = true;
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>
(PrimitiveType.TriangleStrip, verts, 0, 1);
}
Texturing
Texturing
• Now, How can we fix the black area?!
Texturing
• Now, How can we fix the black area?!
Texturing
• Now, How can we fix the black area?!
Texturing
• 1st , Make sure that the image supports transperancy “.png”
Texturing
• 2nd, We should tell the GraphicsDevice to blend the image for us
Texturing
• Alpha Channel!
Texturing
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
BasicEffect effect = new BasicEffect(GraphicsDevice);
effect.World = world; effect.View = view; effect.Projection = projection;
effect.Texture = texture;
effect.TextureEnabled = true;
BlendState originalState = GraphicsDevice.BlendState;
GraphicsDevice.BlendState = BlendState.AlphaBlend;
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>
(PrimitiveType.TriangleStrip, verts, 0, 2);
}
GraphicsDevice.BlendState = originalState;
base.Draw(gameTime);
}
Texturing
• Cool!
• “App1-Texturing”
Texturing
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
BasicEffect effect = new BasicEffect(GraphicsDevice);
effect.World = world; effect.View = view; effect.Projection = projection;
effect.Texture = texture;
effect.TextureEnabled = true;
BlendState originalState = GraphicsDevice.BlendState;
GraphicsDevice.BlendState = BlendState.AlphaBlend;
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>
(PrimitiveType.TriangleStrip, verts, 0, 2);
}
GraphicsDevice.BlendState = originalState;
base.Draw(gameTime);
}
Texturing
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
BasicEffect effect = new BasicEffect(GraphicsDevice);
effect.World = world; effect.View = view; effect.Projection = projection;
effect.Texture = texture;
effect.TextureEnabled = true;
BlendState originalState = GraphicsDevice.BlendState;
GraphicsDevice.BlendState = BlendState.AlphaBlend;
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>
(PrimitiveType.TriangleStrip, verts, 0, 2);
}
GraphicsDevice.BlendState = originalState;
base.Draw(gameTime);
}
Texturing
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
BasicEffect effect = new BasicEffect(GraphicsDevice);
effect.World = world; effect.View = view; effect.Projection = projection;
effect.Texture = texture;
effect.TextureEnabled = true;
BlendState originalState = GraphicsDevice.BlendState;
GraphicsDevice.BlendState = BlendState.AlphaBlend;
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>
(PrimitiveType.TriangleStrip, verts, 0, 2);
}
GraphicsDevice.BlendState = originalState;
base.Draw(gameTime);
}
Texturing
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
BasicEffect effect = new BasicEffect(GraphicsDevice);
effect.World = world; effect.View = view; effect.Projection = projection;
effect.Texture = texture;
effect.TextureEnabled = true;
BlendState originalState = GraphicsDevice.BlendState;
GraphicsDevice.BlendState = BlendState.AlphaBlend;
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>
(PrimitiveType.TriangleStrip, verts, 0, 2);
}
GraphicsDevice.BlendState = originalState;
base.Draw(gameTime);
}
Texturing
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
BasicEffect effect = new BasicEffect(GraphicsDevice);
effect.World = world; effect.View = view; effect.Projection = projection;
effect.Texture = texture;
effect.TextureEnabled = true;
BlendState originalState = GraphicsDevice.BlendState;
GraphicsDevice.BlendState = BlendState.AlphaBlend;
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>
(PrimitiveType.TriangleStrip, verts, 0, 2);
}
GraphicsDevice.BlendState = originalState;
base.Draw(gameTime);
}
Texturing
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
BasicEffect effect = new BasicEffect(GraphicsDevice);
effect.World = world; effect.View = view; effect.Projection = projection;
effect.Texture = texture;
effect.TextureEnabled = true;
BlendState originalState = GraphicsDevice.BlendState;
GraphicsDevice.BlendState = BlendState.AlphaBlend;
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>
(PrimitiveType.TriangleStrip, verts, 0, 2);
}
GraphicsDevice.BlendState = originalState;
base.Draw(gameTime);
}
Texturing
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
BasicEffect effect = new BasicEffect(GraphicsDevice);
effect.World = world; effect.View = view; effect.Projection = projection;
effect.Texture = texture;
effect.TextureEnabled = true;
BlendState originalState = GraphicsDevice.BlendState;
GraphicsDevice.BlendState = BlendState.AlphaBlend;
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>
(PrimitiveType.TriangleStrip, verts, 0, 2);
}
GraphicsDevice.BlendState = originalState;
base.Draw(gameTime);
}
Texture Tiling
Texturing
• TEXTURE TILING
Texturing
Tiling is a very simple effect that creates a
repeating pattern of an image on the
surface of a primitive object.
Texturing
• TEXTURE TILING
Texturing
• TEXTURE TILING
Using a small image to cover a large surface makes tiling a useful way
to increase the performance of your textures and decrease the size of
your image files.
Texture Tiling
• In Load Content
// Right Top
verts[0] = new VertexPositionTexture(
new Vector3(-1, 1, 0), new Vector2(10, 0));
// Left Top
verts[1] = new VertexPositionTexture(
new Vector3(1, 1, 0), new Vector2(1, 0));
// Right Bottom
verts[2] = new VertexPositionTexture(
new Vector3(-1, -1, 0), new Vector2(10, 10));
// Left Bottom
verts[3] = new VertexPositionTexture(
new Vector3(1, -1, 0), new Vector2(1, 10));
Texture Tiling
Texture Tiling
Still something wrong!
If the texture rotates, the back of the texture is not drawn!
Why?! And how to fix this?
Texture Tiling
• Fixing the culling
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
RasterizerState currentRasterizerState =
GraphicsDevice.RasterizerState;
GraphicsDevice.RasterizerState = RasterizerState.CullNone;
// … our code
GraphicsDevice.RasterizerState = currentRasterizerState;
base.Draw(gameTime);
}
Texture Tiling
• Fixing the culling
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
RasterizerState currentRasterizerState =
GraphicsDevice.RasterizerState;
GraphicsDevice.RasterizerState = RasterizerState.CullNone;
// … our code
GraphicsDevice.RasterizerState = currentRasterizerState;
base.Draw(gameTime);
}
Billboarding
Billboarding
• Billboarding “Microsoft Book – Page 129”
Billboarding
Billboarding
float GetViewerAngle()
{
// use camera look direction to get
// rotation angle about Y
float x = cam.view.X - cam.position.X;
float z = cam.view.Z - cam.position.Z;
return (float)Math.Atan2(x, z) + MathHelper.Pi;
}
Billboarding
float GetViewerAngle()
{
// use camera look direction to get
// rotation angle about Y
float x = cam.view.X - cam.position.X;
float z = cam.view.Z - cam.position.Z;
return (float)Math.Atan2(x, z) + MathHelper.Pi;
}
Billboarding
float GetViewerAngle()
{
// use camera look direction to get
// rotation angle about Y
float x = cam.view.X - cam.position.X;
float z = cam.view.Z - cam.position.Z;
return (float)Math.Atan2(x, z) + MathHelper.Pi;
}
Billboarding
float GetViewerAngle()
{
// use camera look direction to get
// rotation angle about Y
float x = cam.view.X - cam.position.X;
float z = cam.view.Z - cam.position.Z;
return (float)Math.Atan2(x, z) + MathHelper.Pi;
}
Billboarding
float GetViewerAngle()
{
// use camera look direction to get
// rotation angle about Y
float x = cam.view.X - cam.position.X;
float z = cam.view.Z - cam.position.Z;
return (float)Math.Atan2(x, z) + MathHelper.Pi;
}
Billboarding
• The math
Billboarding
• Atan2(y,x) Vs Atan(y/x)
Billboarding
• Atan2(y,x) Vs Atan(y/x)
Read more at http://en.wikipedia.org/wiki/Atan2/
Billboarding
float GetViewerAngle()
{
// use camera look direction to get
// rotation angle about Y
float x = cam.view.X - cam.position.X;
float z = cam.view.Z - cam.position.Z;
return (float)Math.Atan2(x, z) + MathHelper.Pi;
}
rotationY = Matrix.CreateRotationY(GetViewerAngle());
Billboarding
float GetViewerAngle()
{
// use camera look direction to get
// rotation angle about Y
float x = cam.view.X - cam.position.X;
float z = cam.view.Z - cam.position.Z;
return (float)Math.Atan2(x, z) + MathHelper.Pi;
}
rotationY = Matrix.CreateRotationY(GetViewerAngle());

More Related Content

What's hot

Super Resolution in Digital Image processing
Super Resolution in Digital Image processingSuper Resolution in Digital Image processing
Super Resolution in Digital Image processing
Ramrao Desai
 
F0533134
F0533134F0533134
F0533134
IOSR Journals
 
Adaptive Median Filters
Adaptive Median FiltersAdaptive Median Filters
Adaptive Median Filters
Amnaakhaan
 
Digital image processing short quesstion answers
Digital image processing short quesstion answersDigital image processing short quesstion answers
Digital image processing short quesstion answers
Ateeq Zada
 
SinGAN for Image Denoising
SinGAN for Image DenoisingSinGAN for Image Denoising
SinGAN for Image Denoising
KhalilBergaoui
 
Image Degradation & Resoration
Image Degradation & ResorationImage Degradation & Resoration
Image Degradation & Resoration
Sanjay Saha
 
Image Acquisition and Representation
Image Acquisition and RepresentationImage Acquisition and Representation
Image Acquisition and Representation
Amnaakhaan
 
Bh044365368
Bh044365368Bh044365368
Bh044365368
IJERA Editor
 
Image restoration
Image restorationImage restoration
Image restoration
Upendra Pratap Singh
 
Labview with dwt for denoising the blurred biometric images
Labview with dwt for denoising the blurred biometric imagesLabview with dwt for denoising the blurred biometric images
Labview with dwt for denoising the blurred biometric images
ijcsa
 
Chapter 1 introduction (Image Processing)
Chapter 1 introduction (Image Processing)Chapter 1 introduction (Image Processing)
Chapter 1 introduction (Image Processing)
Varun Ojha
 
3 intensity transformations and spatial filtering slides
3 intensity transformations and spatial filtering slides3 intensity transformations and spatial filtering slides
3 intensity transformations and spatial filtering slides
BHAGYAPRASADBUGGE
 
Fractal Image Compression By Range Block Classification
Fractal Image Compression By Range Block ClassificationFractal Image Compression By Range Block Classification
Fractal Image Compression By Range Block Classification
IRJET Journal
 
Tensorflow London 13: Zbigniew Wojna 'Deep Learning for Big Scale 2D Imagery'
Tensorflow London 13: Zbigniew Wojna 'Deep Learning for Big Scale 2D Imagery'Tensorflow London 13: Zbigniew Wojna 'Deep Learning for Big Scale 2D Imagery'
Tensorflow London 13: Zbigniew Wojna 'Deep Learning for Big Scale 2D Imagery'
Seldon
 
SinGAN - Learning a Generative Model from a Single Natural Image
SinGAN - Learning a Generative Model from a Single Natural ImageSinGAN - Learning a Generative Model from a Single Natural Image
SinGAN - Learning a Generative Model from a Single Natural Image
Jishnu P
 
Digital image processing img smoothning
Digital image processing img smoothningDigital image processing img smoothning
Digital image processing img smoothningVinay Gupta
 
[PDF] Automatic Image Co-segmentation Using Geometric Mean Saliency (Top 10% ...
[PDF] Automatic Image Co-segmentation Using Geometric Mean Saliency (Top 10% ...[PDF] Automatic Image Co-segmentation Using Geometric Mean Saliency (Top 10% ...
[PDF] Automatic Image Co-segmentation Using Geometric Mean Saliency (Top 10% ...
Koteswar Rao Jerripothula
 

What's hot (20)

1873 1878
1873 18781873 1878
1873 1878
 
Super Resolution in Digital Image processing
Super Resolution in Digital Image processingSuper Resolution in Digital Image processing
Super Resolution in Digital Image processing
 
F0533134
F0533134F0533134
F0533134
 
Adaptive Median Filters
Adaptive Median FiltersAdaptive Median Filters
Adaptive Median Filters
 
Digital image processing short quesstion answers
Digital image processing short quesstion answersDigital image processing short quesstion answers
Digital image processing short quesstion answers
 
SinGAN for Image Denoising
SinGAN for Image DenoisingSinGAN for Image Denoising
SinGAN for Image Denoising
 
Image Degradation & Resoration
Image Degradation & ResorationImage Degradation & Resoration
Image Degradation & Resoration
 
Ijebea14 283
Ijebea14 283Ijebea14 283
Ijebea14 283
 
Image Acquisition and Representation
Image Acquisition and RepresentationImage Acquisition and Representation
Image Acquisition and Representation
 
Bh044365368
Bh044365368Bh044365368
Bh044365368
 
Image restoration
Image restorationImage restoration
Image restoration
 
Labview with dwt for denoising the blurred biometric images
Labview with dwt for denoising the blurred biometric imagesLabview with dwt for denoising the blurred biometric images
Labview with dwt for denoising the blurred biometric images
 
Chapter 1 introduction (Image Processing)
Chapter 1 introduction (Image Processing)Chapter 1 introduction (Image Processing)
Chapter 1 introduction (Image Processing)
 
3 intensity transformations and spatial filtering slides
3 intensity transformations and spatial filtering slides3 intensity transformations and spatial filtering slides
3 intensity transformations and spatial filtering slides
 
Fractal Image Compression By Range Block Classification
Fractal Image Compression By Range Block ClassificationFractal Image Compression By Range Block Classification
Fractal Image Compression By Range Block Classification
 
Tensorflow London 13: Zbigniew Wojna 'Deep Learning for Big Scale 2D Imagery'
Tensorflow London 13: Zbigniew Wojna 'Deep Learning for Big Scale 2D Imagery'Tensorflow London 13: Zbigniew Wojna 'Deep Learning for Big Scale 2D Imagery'
Tensorflow London 13: Zbigniew Wojna 'Deep Learning for Big Scale 2D Imagery'
 
SinGAN - Learning a Generative Model from a Single Natural Image
SinGAN - Learning a Generative Model from a Single Natural ImageSinGAN - Learning a Generative Model from a Single Natural Image
SinGAN - Learning a Generative Model from a Single Natural Image
 
Digital image processing img smoothning
Digital image processing img smoothningDigital image processing img smoothning
Digital image processing img smoothning
 
[PDF] Automatic Image Co-segmentation Using Geometric Mean Saliency (Top 10% ...
[PDF] Automatic Image Co-segmentation Using Geometric Mean Saliency (Top 10% ...[PDF] Automatic Image Co-segmentation Using Geometric Mean Saliency (Top 10% ...
[PDF] Automatic Image Co-segmentation Using Geometric Mean Saliency (Top 10% ...
 
20100822 computervision veksler
20100822 computervision veksler20100822 computervision veksler
20100822 computervision veksler
 

Similar to XNA L05–Texturing

CS 354 Texture Mapping
CS 354 Texture MappingCS 354 Texture Mapping
CS 354 Texture Mapping
Mark Kilgard
 
Anatomy of a Texture Fetch
Anatomy of a Texture FetchAnatomy of a Texture Fetch
Anatomy of a Texture Fetch
Mark Kilgard
 
8thlightu3
8thlightu38thlightu3
8thlightu3
Eric Smith
 
Demystifying Neural Style Transfer
Demystifying Neural Style TransferDemystifying Neural Style Transfer
Demystifying Neural Style Transfer
SEMINARGROOT
 
3D Math Primer: CocoaConf Atlanta
3D Math Primer: CocoaConf Atlanta3D Math Primer: CocoaConf Atlanta
3D Math Primer: CocoaConf Atlanta
Janie Clayton
 
Generating super resolution images using transformers
Generating super resolution images using transformersGenerating super resolution images using transformers
Generating super resolution images using transformers
NEERAJ BAGHEL
 
GFX Part 4 - Introduction to Texturing in OpenGL ES
GFX Part 4 - Introduction to Texturing in OpenGL ESGFX Part 4 - Introduction to Texturing in OpenGL ES
GFX Part 4 - Introduction to Texturing in OpenGL ES
Prabindh Sundareson
 
Realtime Per Face Texture Mapping (PTEX)
Realtime Per Face Texture Mapping (PTEX)Realtime Per Face Texture Mapping (PTEX)
Realtime Per Face Texture Mapping (PTEX)
basisspace
 
DPI 1 and DPI 2 Texture Mapping
DPI 1 and DPI 2 Texture MappingDPI 1 and DPI 2 Texture Mapping
DPI 1 and DPI 2 Texture Mapping
MrLawler
 
Introduction to convolutional networks .pptx
Introduction to convolutional networks .pptxIntroduction to convolutional networks .pptx
Introduction to convolutional networks .pptx
ArunNegi37
 
Opengl texturing
Opengl texturingOpengl texturing
Opengl texturing
Sardar Alam
 
3D Math Without Presenter Notes
3D Math Without Presenter Notes3D Math Without Presenter Notes
3D Math Without Presenter Notes
Janie Clayton
 
Benoit fouletier guillaume martin unity day- modern 2 d techniques-gce2014
Benoit fouletier guillaume martin   unity day- modern 2 d techniques-gce2014Benoit fouletier guillaume martin   unity day- modern 2 d techniques-gce2014
Benoit fouletier guillaume martin unity day- modern 2 d techniques-gce2014
Mary Chan
 
Texture mapping in_opengl
Texture mapping in_openglTexture mapping in_opengl
Texture mapping in_opengl
Manas Nayak
 
The Technology behind Shadow Warrior, ZTG 2014
The Technology behind Shadow Warrior, ZTG 2014The Technology behind Shadow Warrior, ZTG 2014
The Technology behind Shadow Warrior, ZTG 2014
Jarosław Pleskot
 
Texture By Priyanka Chauhan
Texture By Priyanka ChauhanTexture By Priyanka Chauhan
Texture By Priyanka Chauhan
Priyanka Chauhan
 
Improved Alpha-Tested Magnification for Vector Textures and Special Effects
Improved Alpha-Tested Magnification for Vector Textures and Special EffectsImproved Alpha-Tested Magnification for Vector Textures and Special Effects
Improved Alpha-Tested Magnification for Vector Textures and Special Effects
ナム-Nam Nguyễn
 
OpenGL L05-Texturing
OpenGL L05-TexturingOpenGL L05-Texturing
OpenGL L05-Texturing
Mohammad Shaker
 

Similar to XNA L05–Texturing (20)

CS 354 Texture Mapping
CS 354 Texture MappingCS 354 Texture Mapping
CS 354 Texture Mapping
 
Anatomy of a Texture Fetch
Anatomy of a Texture FetchAnatomy of a Texture Fetch
Anatomy of a Texture Fetch
 
8thlightu3
8thlightu38thlightu3
8thlightu3
 
Demystifying Neural Style Transfer
Demystifying Neural Style TransferDemystifying Neural Style Transfer
Demystifying Neural Style Transfer
 
3D Math Primer: CocoaConf Atlanta
3D Math Primer: CocoaConf Atlanta3D Math Primer: CocoaConf Atlanta
3D Math Primer: CocoaConf Atlanta
 
Extreme dxt compression
Extreme dxt compressionExtreme dxt compression
Extreme dxt compression
 
Generating super resolution images using transformers
Generating super resolution images using transformersGenerating super resolution images using transformers
Generating super resolution images using transformers
 
GFX Part 4 - Introduction to Texturing in OpenGL ES
GFX Part 4 - Introduction to Texturing in OpenGL ESGFX Part 4 - Introduction to Texturing in OpenGL ES
GFX Part 4 - Introduction to Texturing in OpenGL ES
 
Realtime Per Face Texture Mapping (PTEX)
Realtime Per Face Texture Mapping (PTEX)Realtime Per Face Texture Mapping (PTEX)
Realtime Per Face Texture Mapping (PTEX)
 
DPI 1 and DPI 2 Texture Mapping
DPI 1 and DPI 2 Texture MappingDPI 1 and DPI 2 Texture Mapping
DPI 1 and DPI 2 Texture Mapping
 
Introduction to convolutional networks .pptx
Introduction to convolutional networks .pptxIntroduction to convolutional networks .pptx
Introduction to convolutional networks .pptx
 
Texturemapping
TexturemappingTexturemapping
Texturemapping
 
Opengl texturing
Opengl texturingOpengl texturing
Opengl texturing
 
3D Math Without Presenter Notes
3D Math Without Presenter Notes3D Math Without Presenter Notes
3D Math Without Presenter Notes
 
Benoit fouletier guillaume martin unity day- modern 2 d techniques-gce2014
Benoit fouletier guillaume martin   unity day- modern 2 d techniques-gce2014Benoit fouletier guillaume martin   unity day- modern 2 d techniques-gce2014
Benoit fouletier guillaume martin unity day- modern 2 d techniques-gce2014
 
Texture mapping in_opengl
Texture mapping in_openglTexture mapping in_opengl
Texture mapping in_opengl
 
The Technology behind Shadow Warrior, ZTG 2014
The Technology behind Shadow Warrior, ZTG 2014The Technology behind Shadow Warrior, ZTG 2014
The Technology behind Shadow Warrior, ZTG 2014
 
Texture By Priyanka Chauhan
Texture By Priyanka ChauhanTexture By Priyanka Chauhan
Texture By Priyanka Chauhan
 
Improved Alpha-Tested Magnification for Vector Textures and Special Effects
Improved Alpha-Tested Magnification for Vector Textures and Special EffectsImproved Alpha-Tested Magnification for Vector Textures and Special Effects
Improved Alpha-Tested Magnification for Vector Textures and Special Effects
 
OpenGL L05-Texturing
OpenGL L05-TexturingOpenGL L05-Texturing
OpenGL L05-Texturing
 

More from Mohammad Shaker

12 Rules You Should to Know as a Syrian Graduate
12 Rules You Should to Know as a Syrian Graduate12 Rules You Should to Know as a Syrian Graduate
12 Rules You Should to Know as a Syrian Graduate
Mohammad Shaker
 
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
Mohammad Shaker
 
Interaction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with PsychologyInteraction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with Psychology
Mohammad Shaker
 
Short, Matters, Love - Passioneers Event 2015
Short, Matters, Love -  Passioneers Event 2015Short, Matters, Love -  Passioneers Event 2015
Short, Matters, Love - Passioneers Event 2015
Mohammad Shaker
 
Unity L01 - Game Development
Unity L01 - Game DevelopmentUnity L01 - Game Development
Unity L01 - Game Development
Mohammad Shaker
 
Android L07 - Touch, Screen and Wearables
Android L07 - Touch, Screen and WearablesAndroid L07 - Touch, Screen and Wearables
Android L07 - Touch, Screen and Wearables
Mohammad Shaker
 
Interaction Design L03 - Color
Interaction Design L03 - ColorInteraction Design L03 - Color
Interaction Design L03 - Color
Mohammad Shaker
 
Interaction Design L05 - Typography
Interaction Design L05 - TypographyInteraction Design L05 - Typography
Interaction Design L05 - Typography
Mohammad Shaker
 
Interaction Design L04 - Materialise and Coupling
Interaction Design L04 - Materialise and CouplingInteraction Design L04 - Materialise and Coupling
Interaction Design L04 - Materialise and Coupling
Mohammad Shaker
 
Android L05 - Storage
Android L05 - StorageAndroid L05 - Storage
Android L05 - Storage
Mohammad Shaker
 
Android L04 - Notifications and Threading
Android L04 - Notifications and ThreadingAndroid L04 - Notifications and Threading
Android L04 - Notifications and Threading
Mohammad Shaker
 
Android L09 - Windows Phone and iOS
Android L09 - Windows Phone and iOSAndroid L09 - Windows Phone and iOS
Android L09 - Windows Phone and iOS
Mohammad Shaker
 
Interaction Design L01 - Mobile Constraints
Interaction Design L01 - Mobile ConstraintsInteraction Design L01 - Mobile Constraints
Interaction Design L01 - Mobile Constraints
Mohammad Shaker
 
Interaction Design L02 - Pragnanz and Grids
Interaction Design L02 - Pragnanz and GridsInteraction Design L02 - Pragnanz and Grids
Interaction Design L02 - Pragnanz and Grids
Mohammad Shaker
 
Android L10 - Stores and Gaming
Android L10 - Stores and GamingAndroid L10 - Stores and Gaming
Android L10 - Stores and Gaming
Mohammad Shaker
 
Android L06 - Cloud / Parse
Android L06 - Cloud / ParseAndroid L06 - Cloud / Parse
Android L06 - Cloud / Parse
Mohammad Shaker
 
Android L08 - Google Maps and Utilities
Android L08 - Google Maps and UtilitiesAndroid L08 - Google Maps and Utilities
Android L08 - Google Maps and Utilities
Mohammad Shaker
 
Android L03 - Styles and Themes
Android L03 - Styles and Themes Android L03 - Styles and Themes
Android L03 - Styles and Themes
Mohammad Shaker
 
Android L02 - Activities and Adapters
Android L02 - Activities and AdaptersAndroid L02 - Activities and Adapters
Android L02 - Activities and Adapters
Mohammad Shaker
 
Android L01 - Warm Up
Android L01 - Warm UpAndroid L01 - Warm Up
Android L01 - Warm Up
Mohammad Shaker
 

More from Mohammad Shaker (20)

12 Rules You Should to Know as a Syrian Graduate
12 Rules You Should to Know as a Syrian Graduate12 Rules You Should to Know as a Syrian Graduate
12 Rules You Should to Know as a Syrian Graduate
 
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
 
Interaction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with PsychologyInteraction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with Psychology
 
Short, Matters, Love - Passioneers Event 2015
Short, Matters, Love -  Passioneers Event 2015Short, Matters, Love -  Passioneers Event 2015
Short, Matters, Love - Passioneers Event 2015
 
Unity L01 - Game Development
Unity L01 - Game DevelopmentUnity L01 - Game Development
Unity L01 - Game Development
 
Android L07 - Touch, Screen and Wearables
Android L07 - Touch, Screen and WearablesAndroid L07 - Touch, Screen and Wearables
Android L07 - Touch, Screen and Wearables
 
Interaction Design L03 - Color
Interaction Design L03 - ColorInteraction Design L03 - Color
Interaction Design L03 - Color
 
Interaction Design L05 - Typography
Interaction Design L05 - TypographyInteraction Design L05 - Typography
Interaction Design L05 - Typography
 
Interaction Design L04 - Materialise and Coupling
Interaction Design L04 - Materialise and CouplingInteraction Design L04 - Materialise and Coupling
Interaction Design L04 - Materialise and Coupling
 
Android L05 - Storage
Android L05 - StorageAndroid L05 - Storage
Android L05 - Storage
 
Android L04 - Notifications and Threading
Android L04 - Notifications and ThreadingAndroid L04 - Notifications and Threading
Android L04 - Notifications and Threading
 
Android L09 - Windows Phone and iOS
Android L09 - Windows Phone and iOSAndroid L09 - Windows Phone and iOS
Android L09 - Windows Phone and iOS
 
Interaction Design L01 - Mobile Constraints
Interaction Design L01 - Mobile ConstraintsInteraction Design L01 - Mobile Constraints
Interaction Design L01 - Mobile Constraints
 
Interaction Design L02 - Pragnanz and Grids
Interaction Design L02 - Pragnanz and GridsInteraction Design L02 - Pragnanz and Grids
Interaction Design L02 - Pragnanz and Grids
 
Android L10 - Stores and Gaming
Android L10 - Stores and GamingAndroid L10 - Stores and Gaming
Android L10 - Stores and Gaming
 
Android L06 - Cloud / Parse
Android L06 - Cloud / ParseAndroid L06 - Cloud / Parse
Android L06 - Cloud / Parse
 
Android L08 - Google Maps and Utilities
Android L08 - Google Maps and UtilitiesAndroid L08 - Google Maps and Utilities
Android L08 - Google Maps and Utilities
 
Android L03 - Styles and Themes
Android L03 - Styles and Themes Android L03 - Styles and Themes
Android L03 - Styles and Themes
 
Android L02 - Activities and Adapters
Android L02 - Activities and AdaptersAndroid L02 - Activities and Adapters
Android L02 - Activities and Adapters
 
Android L01 - Warm Up
Android L01 - Warm UpAndroid L01 - Warm Up
Android L01 - Warm Up
 

Recently uploaded

FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 

XNA L05–Texturing

  • 1. Mohammad Shaker mohammadshaker.com @ZGTRShaker 2011, 2012, 2013, 2014 XNA Game Development L05 – Texturing
  • 2. that appears in a video game needs to be textured; this includes everything from plants to people. If things aren’t textured well, your game just won’t look right.
  • 3. Texturing • What’s it?! Textures are images applied to surfaces that are created using primitive objects
  • 4. Texturing • What’s it?! Textures are images applied to surfaces that are created using primitive objects XNA is Perfect at Texturing textures can be colored, filtered, blended, and transformed at run time!
  • 5. Texturing • What’s it?! Textures are images applied to surfaces that are created using primitive objects textures can be colored, filtered, blended, and transformed at run time! XNA is Perfect at Texturing XNA supports: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga image formats for textures
  • 6. Texturing • UV Coordinates – 2D World • a texture is a two-dimensional object that is mapped onto a 2D polygon – 3D World • a texture is a two-dimensional object that is mapped onto a 3D polygon
  • 9. Texturing • Vertex Types for Textures – VertexPositionColorTexture – VertexPositionNormalTexture – VertexPositionTexture
  • 10. Texturing • VertexPositionColorTexture – This format allows you to apply image textures to your primitive shapes, and you can even shade your images with color. – For example, with this vertex type you could draw a rectangle with an image texture and then you could show it again with a different shade of color! VertexPositionColorTexture vertex = new VertexPositionColorTexture(Vector3 position, Color color, Vector2 uv);
  • 11. Texturing • VertexPositionNormalTexture – This format allows you to add textures to your primitive objects. The normal data enables lighting for this textured format. VertexPositionNormalTexture vertex = new VertexPositionNormalTexture(Vector3 position, Vector3 normal, Vector2 uv);
  • 12. Texturing • VertexPositionTexture – This format only permits storage of position and texture data. – It may be useful if you don’t need lighting and were concerned about saving space or improving performance for large amounts of vertices. VertexPositionTexture vertex = new VertexPositionTexture(Vector3 position, Vector2 uv);
  • 17. Texturing • TRANSPARENT TEXTURES An alpha channel can be used to “mask” all pixels of a specific color in an image. Alpha data is stored in the last color byte of a pixel after the red, green, and blue bytes. When alpha blending is enabled in your XNA code and the alpha channel is active, transparency is achieved for the pixels where the alpha setting is set to 0. New “Alpha” Channel!
  • 18. Texturing • TRANSPARENT TEXTURES An alpha channel can be used to “mask” all pixels of a specific color in an image. Alpha data is stored in the last color byte of a pixel after the red, green, and blue bytes. When alpha blending is enabled in your XNA code and the alpha channel is active, transparency is achieved for the pixels where the alpha setting is set to 0. New “Alpha” Channel!
  • 19. Texturing • Texture Coloring “Shaders” – Microsoft Book, Chapter 9, Page 119 • Texture Example (Learning XNA 3.0 “O’Riley” , P:205)
  • 21. Texturing • Loading Textures through content manager Texture2D texture = Content.Load<Texture2D>("ImagesimageName");
  • 22. Texturing • Let’s make a texture in a 3D world! VertexPositionTexture[] verts;
  • 23. Texturing • LoadContent() verts[0] = new VertexPositionTexture(new Vector3(-1, 1, 0), new Vector2(0, 0)); verts[1] = new VertexPositionTexture(new Vector3(1, 1, 0), new Vector2(1, 0)); verts[2] = new VertexPositionTexture(new Vector3(-1, -1, 0), new Vector2(0, 1)); verts[3] = new VertexPositionTexture(new Vector3(1, -1, 0), new Vector2(1, 1));
  • 24. Texturing • LoadContent() verts[0] = new VertexPositionTexture(new Vector3(-1, 1, 0), new Vector2(0, 0)); verts[1] = new VertexPositionTexture(new Vector3(1, 1, 0), new Vector2(1, 0)); verts[2] = new VertexPositionTexture(new Vector3(-1, -1, 0), new Vector2(0, 1)); verts[3] = new VertexPositionTexture(new Vector3(1, -1, 0), new Vector2(1, 1));
  • 25. Texturing • LoadContent() verts[0] = new VertexPositionTexture(new Vector3(-1, 1, 0), new Vector2(0, 0)); verts[1] = new VertexPositionTexture(new Vector3(1, 1, 0), new Vector2(1, 0)); verts[2] = new VertexPositionTexture(new Vector3(-1, -1, 0), new Vector2(0, 1)); verts[3] = new VertexPositionTexture(new Vector3(1, -1, 0), new Vector2(1, 1)); 0,0 1,0 0,1 1,1 texture = Content.Load<Texture2D>(@"arrow");
  • 26. Texturing • Draw() GraphicsDevice.Clear(Color.CornflowerBlue); BasicEffect effect = new BasicEffect(GraphicsDevice); effect.World = world; effect.View = view; effect.Projection = projection; effect.Texture = texture; effect.TextureEnabled = true; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawUserPrimitives<VertexPositionTexture> (PrimitiveType.TriangleStrip, verts, 0, 2); } 0,0 1,0 0,1 1,1
  • 27. Texturing • Draw() GraphicsDevice.Clear(Color.CornflowerBlue); BasicEffect effect = new BasicEffect(GraphicsDevice); effect.World = world; effect.View = view; effect.Projection = projection; effect.Texture = texture; effect.TextureEnabled = true; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawUserPrimitives<VertexPositionTexture> (PrimitiveType.TriangleStrip, verts, 0, 2); } 0,0 1,0 0,1 1,1
  • 28.
  • 29. Texturing • Draw() GraphicsDevice.Clear(Color.CornflowerBlue); BasicEffect effect = new BasicEffect(GraphicsDevice); effect.World = world; effect.View = view; effect.Projection = projection; effect.Texture = texture; effect.TextureEnabled = true; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawUserPrimitives<VertexPositionTexture> (PrimitiveType.TriangleStrip, verts, 0, 2); }
  • 31. Texturing • Draw() GraphicsDevice.Clear(Color.CornflowerBlue); BasicEffect effect = new BasicEffect(GraphicsDevice); effect.World = world; effect.View = view; effect.Projection = projection; effect.Texture = texture; effect.TextureEnabled = true; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawUserPrimitives<VertexPositionTexture> (PrimitiveType.TriangleStrip, verts, 0, 1); }
  • 33. Texturing • Now, How can we fix the black area?!
  • 34. Texturing • Now, How can we fix the black area?!
  • 35. Texturing • Now, How can we fix the black area?!
  • 36. Texturing • 1st , Make sure that the image supports transperancy “.png”
  • 37. Texturing • 2nd, We should tell the GraphicsDevice to blend the image for us
  • 39. Texturing protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); BasicEffect effect = new BasicEffect(GraphicsDevice); effect.World = world; effect.View = view; effect.Projection = projection; effect.Texture = texture; effect.TextureEnabled = true; BlendState originalState = GraphicsDevice.BlendState; GraphicsDevice.BlendState = BlendState.AlphaBlend; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawUserPrimitives<VertexPositionTexture> (PrimitiveType.TriangleStrip, verts, 0, 2); } GraphicsDevice.BlendState = originalState; base.Draw(gameTime); }
  • 41. Texturing protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); BasicEffect effect = new BasicEffect(GraphicsDevice); effect.World = world; effect.View = view; effect.Projection = projection; effect.Texture = texture; effect.TextureEnabled = true; BlendState originalState = GraphicsDevice.BlendState; GraphicsDevice.BlendState = BlendState.AlphaBlend; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawUserPrimitives<VertexPositionTexture> (PrimitiveType.TriangleStrip, verts, 0, 2); } GraphicsDevice.BlendState = originalState; base.Draw(gameTime); }
  • 42. Texturing protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); BasicEffect effect = new BasicEffect(GraphicsDevice); effect.World = world; effect.View = view; effect.Projection = projection; effect.Texture = texture; effect.TextureEnabled = true; BlendState originalState = GraphicsDevice.BlendState; GraphicsDevice.BlendState = BlendState.AlphaBlend; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawUserPrimitives<VertexPositionTexture> (PrimitiveType.TriangleStrip, verts, 0, 2); } GraphicsDevice.BlendState = originalState; base.Draw(gameTime); }
  • 43. Texturing protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); BasicEffect effect = new BasicEffect(GraphicsDevice); effect.World = world; effect.View = view; effect.Projection = projection; effect.Texture = texture; effect.TextureEnabled = true; BlendState originalState = GraphicsDevice.BlendState; GraphicsDevice.BlendState = BlendState.AlphaBlend; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawUserPrimitives<VertexPositionTexture> (PrimitiveType.TriangleStrip, verts, 0, 2); } GraphicsDevice.BlendState = originalState; base.Draw(gameTime); }
  • 44. Texturing protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); BasicEffect effect = new BasicEffect(GraphicsDevice); effect.World = world; effect.View = view; effect.Projection = projection; effect.Texture = texture; effect.TextureEnabled = true; BlendState originalState = GraphicsDevice.BlendState; GraphicsDevice.BlendState = BlendState.AlphaBlend; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawUserPrimitives<VertexPositionTexture> (PrimitiveType.TriangleStrip, verts, 0, 2); } GraphicsDevice.BlendState = originalState; base.Draw(gameTime); }
  • 45. Texturing protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); BasicEffect effect = new BasicEffect(GraphicsDevice); effect.World = world; effect.View = view; effect.Projection = projection; effect.Texture = texture; effect.TextureEnabled = true; BlendState originalState = GraphicsDevice.BlendState; GraphicsDevice.BlendState = BlendState.AlphaBlend; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawUserPrimitives<VertexPositionTexture> (PrimitiveType.TriangleStrip, verts, 0, 2); } GraphicsDevice.BlendState = originalState; base.Draw(gameTime); }
  • 46. Texturing protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); BasicEffect effect = new BasicEffect(GraphicsDevice); effect.World = world; effect.View = view; effect.Projection = projection; effect.Texture = texture; effect.TextureEnabled = true; BlendState originalState = GraphicsDevice.BlendState; GraphicsDevice.BlendState = BlendState.AlphaBlend; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawUserPrimitives<VertexPositionTexture> (PrimitiveType.TriangleStrip, verts, 0, 2); } GraphicsDevice.BlendState = originalState; base.Draw(gameTime); }
  • 47. Texturing protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); BasicEffect effect = new BasicEffect(GraphicsDevice); effect.World = world; effect.View = view; effect.Projection = projection; effect.Texture = texture; effect.TextureEnabled = true; BlendState originalState = GraphicsDevice.BlendState; GraphicsDevice.BlendState = BlendState.AlphaBlend; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawUserPrimitives<VertexPositionTexture> (PrimitiveType.TriangleStrip, verts, 0, 2); } GraphicsDevice.BlendState = originalState; base.Draw(gameTime); }
  • 50. Texturing Tiling is a very simple effect that creates a repeating pattern of an image on the surface of a primitive object.
  • 52. Texturing • TEXTURE TILING Using a small image to cover a large surface makes tiling a useful way to increase the performance of your textures and decrease the size of your image files.
  • 53. Texture Tiling • In Load Content // Right Top verts[0] = new VertexPositionTexture( new Vector3(-1, 1, 0), new Vector2(10, 0)); // Left Top verts[1] = new VertexPositionTexture( new Vector3(1, 1, 0), new Vector2(1, 0)); // Right Bottom verts[2] = new VertexPositionTexture( new Vector3(-1, -1, 0), new Vector2(10, 10)); // Left Bottom verts[3] = new VertexPositionTexture( new Vector3(1, -1, 0), new Vector2(1, 10));
  • 55. Texture Tiling Still something wrong! If the texture rotates, the back of the texture is not drawn! Why?! And how to fix this?
  • 56. Texture Tiling • Fixing the culling protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); RasterizerState currentRasterizerState = GraphicsDevice.RasterizerState; GraphicsDevice.RasterizerState = RasterizerState.CullNone; // … our code GraphicsDevice.RasterizerState = currentRasterizerState; base.Draw(gameTime); }
  • 57. Texture Tiling • Fixing the culling protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); RasterizerState currentRasterizerState = GraphicsDevice.RasterizerState; GraphicsDevice.RasterizerState = RasterizerState.CullNone; // … our code GraphicsDevice.RasterizerState = currentRasterizerState; base.Draw(gameTime); }
  • 61. Billboarding float GetViewerAngle() { // use camera look direction to get // rotation angle about Y float x = cam.view.X - cam.position.X; float z = cam.view.Z - cam.position.Z; return (float)Math.Atan2(x, z) + MathHelper.Pi; }
  • 62. Billboarding float GetViewerAngle() { // use camera look direction to get // rotation angle about Y float x = cam.view.X - cam.position.X; float z = cam.view.Z - cam.position.Z; return (float)Math.Atan2(x, z) + MathHelper.Pi; }
  • 63. Billboarding float GetViewerAngle() { // use camera look direction to get // rotation angle about Y float x = cam.view.X - cam.position.X; float z = cam.view.Z - cam.position.Z; return (float)Math.Atan2(x, z) + MathHelper.Pi; }
  • 64. Billboarding float GetViewerAngle() { // use camera look direction to get // rotation angle about Y float x = cam.view.X - cam.position.X; float z = cam.view.Z - cam.position.Z; return (float)Math.Atan2(x, z) + MathHelper.Pi; }
  • 65. Billboarding float GetViewerAngle() { // use camera look direction to get // rotation angle about Y float x = cam.view.X - cam.position.X; float z = cam.view.Z - cam.position.Z; return (float)Math.Atan2(x, z) + MathHelper.Pi; }
  • 68. Billboarding • Atan2(y,x) Vs Atan(y/x) Read more at http://en.wikipedia.org/wiki/Atan2/
  • 69. Billboarding float GetViewerAngle() { // use camera look direction to get // rotation angle about Y float x = cam.view.X - cam.position.X; float z = cam.view.Z - cam.position.Z; return (float)Math.Atan2(x, z) + MathHelper.Pi; } rotationY = Matrix.CreateRotationY(GetViewerAngle());
  • 70. Billboarding float GetViewerAngle() { // use camera look direction to get // rotation angle about Y float x = cam.view.X - cam.position.X; float z = cam.view.Z - cam.position.Z; return (float)Math.Atan2(x, z) + MathHelper.Pi; } rotationY = Matrix.CreateRotationY(GetViewerAngle());