• Create Account

# Tispe

Member Since 02 Oct 2010
Offline Last Active Yesterday, 04:40 AM

### Rectilinear Texture Warping - Building Warp Maps

13 December 2013 - 06:12 AM

Hi

I have read Paul Rosens white paper on RTW shadow mapping many times but I have a hard time understanding how exactly the warp maps are converted from 1-D blurred importance maps to the 1-D warp maps. The source code is confusing to me aswell.

Key terms: Shadow map, warp maps, super cells, importance map, output frame.

http://www.cspaul.com/wiki/doku.php?id=publications:Rosen.2012.I3D

The paper does not suggest the importance map resolution the demo uses, only that "resolution only needs to be large enough to detect the existence of the smallest features of interest" to shadow properly. It also states that "The warping maps are composed of a set of super-cells at equal or lower resolution than the base texture."

Questions:

Is the importance map in the demo the same or lower resolution than the shadow map?

When collapsing the importance maps to 1-D, does it keep the same width (i.e 512x512 becomes 512)?

What resolution does the warp map have (looks like 28 super cells), does this mean that it is a 32 pixel long 1D texture?

How do you then collapse a 512px importance map down to a 32px warp map?

The warp map is colored red, blue and black. Is the Red channel displacing in the positive direction and blue displacing in the negative direction?

The "GetWarp(k)" formula to produce the 32 super cell values is kinda tricky to get the picture of. It sums upto the k'th super cell and divides by the total importance. Do we do this sum over the 512px importance map? Do we sum every 16 pixels in the 1-D importance map to create a super cell and divide by the total importance? Kinda hard to follow where and what we sum up.

### Multiple shaders in the same HLSL file (no effect framework)

06 November 2013 - 03:54 PM

Hi again

Currently I have one .hlsl file for the vertex shader and one .hlsl file for my pixel shader as resources. I do not use the effect framework. I am going to add more shaders to my game and instead of creating more files I thought I could just place new shaders into the same files I already use. But then if that is possible, the globals/constants would then be the same for both shaders. And if then, do I use more then one constant table, or just one per .hlsl file?

```D3DXCompileShaderFromResource(
NULL,
NULL,				//macro's
NULL,				//includes
"vs_main",			//main function
&code,				//compiled operations
&debugcode,			//errors
&VSConstantTable);
```

Is this possible, and how many Constant Tables should I need?

Later on when I am happy with the shaders, I will compile them offline and pack the shader binary as a resource. Any things I need to consider at this stage aswell?

### Render-To-Texture and Z-buffer issues

05 November 2013 - 01:43 PM

Hello

I have followed the this guide http://www.two-kings.de/tutorials/dxgraphics/dxgraphics16.html to render to a texture.

I have no trouble rendering to the backbuffer. But when I swap out the backbuffer with a surface from a texture the z buffer does not work. I keep everything else the same except the render target. I can draw the colors, view/perspective just fine, but there are no depth test going on even though all states are the same.

The clear function returns with no errors and every draw is within a begin() and end(), just like with the backbuffer as target.

```device->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(255, 255, 255), 1.0f, 0);
```
```device->CreateTexture(512, 512,
1, D3DUSAGE_RENDERTARGET, D3DFMT_X8R8G8B8,	//D3DFMT_R32F
```

What could cause this?

### Shadow mapping: D3DUSAGE_DEPTHSTENCIL or D3DUSAGE_RENDERTARGET?

01 November 2013 - 07:03 AM

Hi

```pD3DDev->CreateTexture(texWidth, texHeight, 1,
D3DUSAGE_DEPTHSTENCIL, D3DFMT_D24S8, D3DPOOL_DEFAULT,
&pTex);```
Note that you must create a corresponding color surface to go along with your
depth surface since Direct3D requires you to set a color surface / z surface pair
when doing a SetRenderTarget(). If you’re not using the color buffer for
anything, it’s best to turn off color writes when rendering to it using the
D3DRS_COLORWRITEENABLE renderstate to save bandwidth.

```g_pd3dDevice->CreateTexture( SHADOW_MAP_SIZE, SHADOW_MAP_SIZE, 1,
D3DUSAGE_RENDERTARGET, D3DFMT_R32F,
NULL )```

What is appropiate to use?

Seems like the first alternative you need a color surface but you turn off color renderstate to save bandwidth.

But the second alternative you don't???

### Windowed mode beyond desktop resolution issue

29 October 2013 - 05:05 PM

Hello

If I set my game to a windowed resolution (1920x1080) which makes the window(client area + border area) larger than the monitor resolution(1920x1080) then Windows will automatically "crop" down the window size to fit inside the desktop. This causes the client area to be compressed causing image distortions and positioning errors.

Is there a way to allow "larger then desktop" resolution windows without this client area compression?

PARTNERS