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

#ActualTonyyyyyyy

Posted 09 May 2012 - 10:12 PM

I want to use textures on quads in my game instead of an actual model (for the HUD), so what I currently do is I make a quad, draw the texture on to it, and then rotate it a bit.  However, this gives the impression that the tool is flat and 2D, and doesn't have any width to it.
The best example I can think of is probably Minecraft. If you hold a tool in Minecraft (such as a pickaxe), the texture is drawn and it has an "edge".  The color of the edge isn't just a random color, but rather it is about the same color of the edge on the actual face of the tool.

Images:
Edge highlighted:
Posted Image
Full image:
Posted Image
How can I do this with XNA?
As stated before, I currently construct a quad and render an image to it.

#1Tonyyyyyyy

Posted 09 May 2012 - 10:03 PM


So, I want to use textures for weapons in my FPS game instead of actual models. However, if I just draw the texture onto a square in the game, it has the rotation and stuff, but it looks "2D". How can I make it look like it has width?

The best example I can think of is probably Minecraft. If you hold a tool in Minecraft (such as a pickaxe), the texture is drawn and it has an "edge" that shares a color with the color of the actual pixel next to it.

That was probably really confusing, so here's a picture of what I mean:

Original:

Posted Image

Edge highlighted:

Posted Image

How can I do this with XNA?

My code basically makes a square right now (four vertexpositiontexture vertices), and I use BasicEffect to attach an image to it.

PARTNERS