• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Paul C Skertich

Why are their bumps in my shadow mapping?

15 posts in this topic

I just started implemending Shadow Mapping in my engine and I see inside the editor there's bumps inside the shadow map. I'm wondering what they are?

 

The current set up I have is an orthographic Left Handed view for rendering depth. The depth stencil is rendered as DXGI_FORMAT_D24_UNORM_S8_UINT and is bounded both as depth stencil and shader resource. The texture format for the depth stencil is DXGI_FORMAT_R24G8_TYPELESS The shader resource view is formated as DXGI_FORMAT_R24_UNORM_X8_TYPELESS.

 

Is it a format issue?

 

[attachment=23358:Snapshot1.jpg]

 

If anyone needs to see sniplets of code I'll share.

2

Share this post


Link to post
Share on other sites

No, I double checked to see what my sampler state was set to and it was originally set to D3D11_FILTER_MIN_MAG_MIP_LINEAR_POINT I can't remember but it was point sampling. So, I thought it could be what you were mentioning about biLinear filtering - so I changed it to D3D11_FILTER_MIN_MAG_MIP_LINEAR and kept the clamp still there.

 

When I perform the projection I did :

float2 projTexCoord;
projTexCoord.x = +input.lightVector.x / input.lightVector.w / 2.0f + 0.5f;
projTexCoord.y = -input.lightVector.x / input.lightVector.w / 2.0f + 0.5f;

The lightVector is the camera orthographic video from the light into the constant buffer inside the shader.

 

At first I thought that was the issue but like you asked - no bluring or any bilinear filtering was used At least I don't think - I'm unsure what bilinear filtering is actually. The depth stencil is not MSAA and the sample count is set to 1 and the quality is set to 0.

0

Share this post


Link to post
Share on other sites

Wait I corrected my statement above - I checked what bilinear filter is and apparently the point sampling is bilinear. So yes; I did - I didn't know it. I changed it to trilinear and apparently the same result. Do you think just antsicopy filtering or perhaps point sampling will help?

0

Share this post


Link to post
Share on other sites

Now I got the stair stepping that MJP was mentioning by using point sampling. Just to make sure I was using point sampling - I changed it from clamp to border. Inside the rendering

ID3D11SamplerState *Samplers = { device->pointSampler, device->clampSampler };
device->getDeviceContext()->PSSetSamplers(0,2,Samplers);

the clampSampler is configured for the D3D11_FILTER_MIN_MAG_MIP_POINT and address modes are set to border.

0

Share this post


Link to post
Share on other sites

So, the resulting image I received is [attachment=23363:Snapshot1.jpg]

 

I looked at Crysis 3 shadowing and was completely amazed - voxel cone tracing techniques were used but I'm far away from even implementing that in my engine. A lot more to read and research.

 

Now back to reading DirectX 11 by Frank Luna because he covers the stair stepping issue and suggests to use PCF Kernels to reduce the stair stepping.

 

Are Kernels specially designed in the hardware? I kept on seeing in shader tutorials about Kernels - which through me off a bit. There was a shader tutorial of edge detection using 3x3 kernel and a simple gaussian blur using a 3x3 kernel.

0

Share this post


Link to post
Share on other sites

Most of the stuff from that website L. Spiro is able to translated to DirectX? I added the site to my home page for later reading.

 

What I understand is the hard edges are shadow artifiects from the shadow map's boundary - which is normal. The shadow acne I was getting was due to the light's camera view relative to the camera. I didn't show the shadow acne.

 

In what depth sohuld ia have the shadow map 1 - 1000 (max) or 1 - 100?

0

Share this post


Link to post
Share on other sites

The range of the depth of the shadow depends on the projection matrix you use to render into it and later to retrieve from it, and that matrix is derived from the farthest and nearest objects’ bounding boxes from the light’s point of view. He has hard-coded it for the tutorials for the sake of simplicity.

It is trivial to translate to Direct3D. Mostly, use lerp() instead of mix() and ddx()/ddy() instead of dFdx()/dFdy(). Other little things will be easy to spot and translate as you go.


L. Spiro

2

Share this post


Link to post
Share on other sites

And Tada!

 

[attachment=23401:Snapshot1.jpg]

 

A couple of things I've changed. When creating the depth stencil view - I also created a depth stencil state with stencil enabled and depth enabled.

 

My program would constantly crash like a mad man - found out it was the XMVECTOR and XMMATRIX inside a 32 bit Dynamic Library. The engine will be brough into the x64 bit later on. So as far as setting up the view and projection matrixes from the light source - I multiplied them both and stored them into a XMFLOAT4x4 inside the ShadowMap class.

 

Now this isn't multisampled - I could multisample it then blur it a bit with gaussian blur. I just don't like the dark area way above on the plane floor. Is this another depth buffer issue when it starts to self shadow or is this normal?

 

The jagged lines got better with perspective set instead of orthographic view. I read perspective is good for spot lights and point lights and Orthrographic is good for Directional Lights.

 

Another issue I noticed is sometimes the shadow map will detatch from the box when I move it around make it float. The bais is set to 0.001f - would I have to perhaps configure the DepthBias inside the Rasterization State?

 

Another thing I changed was the shadow map resolution from whatever the scene height and width was to 2048. The program crashes when I try to use 4096x4096.

 

I believe changing the resolution higher made the shadow map turn out nicer; also changing the near plane and far plane to be 1.0f to 1000.0f.

 

I read on MSDN that a depth texel sampled too big will cause shadow acne. Also depth texel that sampled to close to the light cameras view port will cause sharp and changed lines. Shadow map resolution will also cause jagged shapes inside the shadow map. I may have got some of this confused what MSDN - I'm trying to remember it all.

 

Instead of the camera position being (100, -100, 100) I changed it to (-10,50,-50) which helped as well.

 

On the DepthStencilView I thought the higher the depth stencil resolution DXGI_FORMAT_D32_FLOAT would be better but I couldn't notice any differience. So I changed it back to DXGI_FORMAT_D24_UNORM_S8_UINT;

 

 

0

Share this post


Link to post
Share on other sites

The comment above asking about the self projection of the shadow map on the cube - was because of depth bias in the shadowmap.

 

So I changed a few things - I made the sampler state to be BiLinear with multisample and this is how it looks:

 

[attachment=23402:Snapshot1.jpg]

 

Now, I'll get around to blurring it to a nice soft blur.

0

Share this post


Link to post
Share on other sites

I would suspect the dark area behind the cube is beyond the edge of your shadow map. I had an issue like that, I simply did a range test for the edge and didn't render the shadow beyond that. Later on I will go back and see if it's possible to adjust texture clipping to nullify the need for the range test. Just an idea of what it may be...

2

Share this post


Link to post
Share on other sites

Nicely done.  As your scene gets larger and more complicated, you will find back-face issues, and the "peter-panning" (shadow separation from base of caster).

 

I moved from PCF filtering to Variance shadow maps; they were faster and solved many of the problems.

 

I then tried Exponential shadow maps, and perform a gaussian blur.  This is what I settled on.

1

Share this post


Link to post
Share on other sites

I don't plan on sticking to one technique when it comes to shadow mapping. I'm going to try and understand various of ways. I like shadow volumes but which will come later. I want to try sparse voxel global illumination as well as well as the shadow voxelization used in CryEngine 3. What's sad about the shadow mapping - I've gone from 60 frames per second and when I place three objects in a screne it drops down to 30 frames per second. Hopefully, when I rework the rendering system and the deferred rendering system - the frame drops won't be so drastic.

 

I've been doing research about shadows in deferred shading - what I can tell it's not lighting per pixel par say - it's more light volumes than what forward pass rendering does. For point lights one can draw a sphere or a billboard of a circle and blend them together. Which again - the rendering system needs to be reworked a lot for performance and quality.

 

I'm pretty sure there'll be some issues if I stick with this type of shadow mapping. I'm going to look up some of your suggestion HScott like Exponential shadow map. What caught my eye is sub-pixel shadow mapping. I really like that.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0