Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


xycsoscyx

Member Since 15 Aug 2005
Offline Last Active Jun 02 2014 04:44 PM

Posts I've Made

In Topic: Let's say 3 2D Textures and a TextureCube walk into a bar?

07 April 2014 - 12:44 PM

Since you're not setting textures, but instead shader resource views, it would be fine to add it as part of your array.  I assume you already create a shader resource view for all textures (2d and cube)?  If you did want to separate it then your second call isn't correct though.  The first parameter is the starting stage to set, the second is the number of resources, and the third is the array of resources.  In your second call you are setting 0 resources in the first stage.  It should really be more like this:

 

devcon->PSSetShaderResource(arraySize,1,&cubemapShaderResourceView);

 

This will set the next stage after the array, and set 1 resource.  Again though, as long as you create resources views for all textures, then you can set them all in the array and call PSSetShaderResource only once.


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.

PARTNERS