# SuperPixel

Member Since 19 Jul 2010
Offline Last Active Jan 17 2013 03:27 PM

### In Topic: Depth Stencil Texture array to render cube depth map in one pass

05 September 2012 - 09:43 AM

Alienizer, on 05 September 2012 - 02:51 AM, said:

Sorry, but I am not an expect at this at all. I too ask questions on this board and there are a few very knowledgeable guys who answer, but I think they are not around right now, back to school etc. you know! I just thought to reply since nobody else did so you don't think you are getting ignored!

Hi,

no probs, the thing is that I made a mistake myself . When we use a cubemap we output radial distance from the light not depth (which we could if we decide to not to go for cubemaps but for 6 spot lights to approximate the environment surrounding the point light).

So, my question was wrong in the first place.

Since I decided to use cubemaps for spot light then I MUST use render target in order to write color along with depthstencil to have depth test.

So sorry for my question

### In Topic: Depth Stencil Texture array to render cube depth map in one pass

04 September 2012 - 09:49 AM

From "Programming Vertex, Geometry and Pixel shaders":

There are some things to keep in mind though: As of Direct3D 10, you can
only set one depth stencil surface to the device at any given time. This
means that you need to store the depth values in the color data of the
render targets. Fortunately, D3D10 pixel shaders let us to handle
arbitrary values (including colors) as depth via views to typeless
resources, so this isn’t a problem.

I'm actually using DX10.1 so I think that might depend on that.

If that is the problem: Isn't slower generating the shadow map with color writes on ? Maybe in dx11 I can bound more than one depth stencil view ...

tbh on the internet I've found some people outputting linear depth in world space or view space to get more precision out of it and in that case a color buffer was compulsory if you don't want z/w hiperbolic falloff

Any thoughts on this ?

### In Topic: Depth Stencil Texture array to render cube depth map in one pass

04 September 2012 - 07:20 AM

Alienizer, on 03 September 2012 - 04:18 PM, said:

Well, either nobody knows, or they are on vacation! I sure don't know the answer.

It's quite a simple question, I guess there is just some messiness concerning the parameters setting somewhere. In general I just wanted to verify that the basic creation process was correct.

The question is: Is it possible to create depthStencilView created as an array resource to render into its array element using SV_RenderTargetArrayIndex, without the need of a render target view (so render target view is set to null).
I need this to render a simple shadow cube map and I need obviously just depth (so color writes are disabled -> faster rendering ).

### In Topic: Depth Stencil Texture array to render cube depth map in one pass

03 September 2012 - 02:21 PM

Any hint ? I can't think that I need a render target array of color along with the depth stencil one if I have to just render shadow data...

### In Topic: Depth Stencil Texture array to render cube depth map in one pass

30 August 2012 - 05:51 PM

Obviously I need to disable color writes on all the 6 depth stencil buffer (I bind one depthstencilview created as a texture2Darray resource, I assume that will be mapped on the first 6 slot like if I was setting 6 render targets ... am I correct in assuming this ?) ...

should I create a blend state with color writes disabled on all the 6 render target ? currently I do somehting like:

fdkGfxSetRenderTarget(device,NULL,mDeferredData->mPointLightShadowMapBufferId);



and the blend state created like:

//additive blend state desc
FdkGfxBlendStateDesc bsDesc;
ZeroMemory(&bsDesc,sizeof(FdkGfxBlendStateDesc));
bsDesc.independentBlendEnable				= false;
bsDesc.alphaToCoverageEnable				 = false;
bsDesc.renderTarget[0].blendEnable		   = true;
bsDesc.renderTarget[0].srcBlend			  = FDK_BLEND_ONE;
bsDesc.renderTarget[0].destBlend			 = FDK_BLEND_ONE;
bsDesc.renderTarget[0].srcBlendAlpha		 = FDK_BLEND_ONE;
bsDesc.renderTarget[0].destBlendAlpha		= FDK_BLEND_ZERO;