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

xycsoscyx

Member Since 15 Aug 2005
Offline Last Active Mar 11 2013 06:19 PM
-----

Posts I've Made

In Topic: Why do it the easy way?

26 February 2013 - 04:09 PM

How about something akin to what I find in some of my companies legacy code:

 

 

ASSERT(isActive); // We should never be inactive so lets just assert in debug, it'll be fine in release

return TRUE;


In Topic: Reflection and Clipping Plane

20 June 2012 - 06:59 PM

I'm not sure the specifics with XNA, but here's a good tutorial which explains stencil shadows in XNA.  The operations are the same and the tutorial seems to explain some of the general stencil ideas and what it does.

http://msdn.microsoft.com/en-us/library/bb464050(v=xnagamestudio.30).aspx

The basic idea is that the stencil buffer is part of your depth buffer, when you create your device and specify a depth buffer format, you specify one that includes a stencil channel.  You can then render into that just like you do the depth/color buffers, but you can also do tests against the values as well.  When you render the stencil, you basically just render your water to create it's shape in the stencil buffer.  Then when you render your reflections, you test against that shape to see if you should render a pixel or not, only pixels inside your stencil (inside the water shape) will pass the test and be drawn.

In Topic: [SharpDX] Textures are rendered blurry

20 June 2012 - 06:46 PM

Standard texture sizes are usually going to be power of two in size (because of hacks to speed up the math if I recall), so it will always end up 128x256.  The only real exception to that is render targets, which can be any size (but I believe there's a lot of internal things going on to do that).  When you're loading a regular texture, it will get the size and then find the next power of two size greater than that, and then scale accordingly using whatever settings you're specified, there isn't a way to actually disable this.  If you want full control over the result, you'll need to either manually stretch the image (to handle scaling artifacts yourself), or make the image 128x256 and fill in the extra area with whatever.  If you just fill in the rest, then when rendering you'll need to offset the texture coordinates to account for the difference, so instead of 0-1, it's 0-(192/256).

In Topic: Reflection and Clipping Plane

20 June 2012 - 06:42 PM

One simple way would be to use the stencil buffer.  Before you draw your reflections, make a stencil of the water (so render the water plane like you normally would, only writing to the stencil buffer), then when you render your reflections, only draw in the stencil area.

In Topic: Demo levels for engine development

06 March 2012 - 06:31 PM

There's also a ton of info about Doom3/Quake4 levels and they are relatively easy to load.  The format is a pure text based one which requires a little extra work (calculating normals/tangents/etc) but work well for a demo.  There are also a ton of resources with free levels/textures from different map makers and modders.  If you're just looking for some raw data to test out, I'd recommend that.

PARTNERS