• 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
Gavin Williams

MSAA issues.

5 posts in this topic

Hi,

I'm trying to setup MSAA to remove jittering at the edges of primitives/geometry.

I have set the following :

[CODE]
rsd.IsMultisampleEnabled = true;
...
SampleDescription = new SampleDescription(8, 0),
[/CODE]

on my G-Buffer textures and on my depth buffer. But I get the following errors :

D3D11 ERROR: ID3D11Device::CreateDepthStencilView: The base resource was created as a multisample resource. You must specify D3D11_DSV_DIMENSION_TEXTURE2DMS instead of D3D11_DSV_DIMENSION_TEXTURE2D. [ STATE_CREATION ERROR #143: CREATEDEPTHSTENCILVIEW_INVALIDDESC]

D3D11 ERROR: ID3D11Device::CreateDepthStencilView: Returning E_INVALIDARG, meaning invalid parameters were passed. [ STATE_CREATION ERROR #148: CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN]

This doesn't make sense to me, because i don't want to use Texture2DMS, I'm not using the sampling results, nor making my own sampler, I'm just trying to use the built in MSAA. And so for the sake of resolving the error I change my DSV :

[CODE]
DepthStencilViewDescription dsViewDesc = new DepthStencilViewDescription
{
ArraySize = 0,
Format = depthFormat,
Dimension = DepthStencilViewDimension.Texture2DMultisampled,
MipSlice = 0,
Flags = DepthStencilViewFlags.None,
FirstArraySlice = 0,
};
[/CODE]

Then I get this error :

D3D11 ERROR: ID3D11DeviceContext::Draw: The Shader Resource View dimension declared in the shader code (TEXTURE2D) does not match the view type bound to slot 1 of the Pixel Shader unit (TEXTURE2DMS). This mismatch is invalid if the shader actually uses the view (e.g. it is not skipped due to shader code branching). [ EXECUTION ERROR #354: DEVICE_DRAW_VIEW_DIMENSION_MISMATCH]

That doesn't make sense to me, because the depth stencil view isn't in shader code ?

Am I doing something wrong here ?

Do I have to use Texture2DMS to use MSAA ?

Should I just use super-sampling ?

Thanks for any help.
0

Share this post


Link to post
Share on other sites
I don't yet do any MSAA resolve, could that be the cause of this last error ?

Yes I'm using deferred rendering (lighting). MJP, I'm reading your Quick Overview of MSAA and looking over some other posts about the subject, I think I have seriously avoided this topic in the past, but I'll need to work it out, because the edge jittering is terrible. I'm going to start with a 2x2 super-sampling approach. That seems easiest and my graphics isn't too demanding at the moment so it seems like a good reference technique. I'm looking for a DirectX11 resolve function but all I've found so far are custom shaders to resolve the Texture2DMS by accumulating the sub-samples. (I'm trying to use the language, sry if I'm not spot on with terms).
0

Share this post


Link to post
Share on other sites
The built-in resolve function is ResolveSubresource. However you can't resolve a depth buffer, and it wouldn't be useful anyway even if you could.

The simplest way to implement MSAA with deferred rendering to have a separate MSAA version of your lighting shader(s), and in that version use Texture2DMS. Then in the shader just loop over all subsamples for a given pixel, calculate the lighting, and average the result. This will be much more expensive than it could be, but it will work. Edited by MJP
1

Share this post


Link to post
Share on other sites

Hmm, I have decided not to worry about the 2x2 supersampling. MSAA seems to be more efficient in accomplishing the same result. I understand how it works and I understand how to resolve (a color map). But when I start thinking about depth maps and normal maps and why you have suggested using MSAA in the lighting shader, I start getting confused. For instance, in the simple case where my wall edges are against the floor or where the wall top-edge is against the top of the wall section (which is visible, ala Gauntlet / Desktop Dungeons) then the normals and position maps, and depth maps can easily be resolved, because there is continuity from one triangle to the next. But what about when I add a wall section with a passage / doorway, then the top of the doorway is no longer next to the ground so their is a discontinuity from the wall triangle to the ground triangle next to it. Likewise for any geometry that is adjacent but separate from the ground in screen space. At the moment, that's a real puzzle for me. And i suspect that this is getting into fairly advanced territory. My best guess at an approach is to do the following :

 

Add an extra step to my wall rendering ... that being to render the walls' color output into a Texture2DMS then resolve to a Texture2D and just pass that back into my regular pipeline for the lights and final composition to use. And leave the wall shaders normal and position output as it is. So there will be a slight misalignment between my color map and my normal / depth maps. Any wall edge that connects with the ground will be handled ok, but edges of elevated objects will be smooth (in color), but the lighting shaders will use the ground normals to light the edge. It doesn't sound perfect, but if it gets rid of the jittering, that might be ok.

 

Here's a video of the problem ..

 

https://www.youtube.com/watch?v=90Ax7kCtZTk

 

I suspect that there may be a couple of ways to actually implement MSAA and so I might see it being used one way, quite different to how it's often used. I am going to have to just implement something and see the results and work from there I'd say. I'll talk about it more after I've at least implemented one version.

 

Thanks.

Edited by Gavin Williams
1

Share this post


Link to post
Share on other sites

Super-sampling 2x2 improved things, particularly around the ground-wall interface, where there is similar lighting. But edges that had moderate/strong lighting adjacent to zero lighting didn't improve that much, which breaks my idea of ignoring the normals. I also reworked the textures to remove hi-lighting at the edges, which I think helps a little as well, but I don't think that's a good thing to start doing, because really it's about contrast between textures, not the textures themselves, and I would then have to create many more textures to handle all the wall shapes if i was to darken around the edges, as I'm currently using a single texture for all walls. A lot of work compared to just employing MSAA. Performance is fine using 2x2 SSAA.

 

Super-sampling 4x4 further reduced the edge aliasing to almost being unnoticeable, but it produced severe texture aliasing, I assume because the linear sampler only samples from 2x2 pixels, not 4x4. I'll have to check this. That would explain why I've seen code for manual texture filtering. Also with 4x4, the 5 buffers (color,normal,position,depth,final-light-map) are 7680x4068 each, so 625MB. I don't think that's very good, and the performance is bad, with a noticeably low frame rate.

 

Next, onto MSAA.

Edited by Gavin Williams
1

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