• 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
laztrezort

Framebuffer Artifacts

2 posts in this topic

I am getting odd artifacts when displaying scaled-up textured quads, see attached for screenshot. The vertical bars are good, the small horizontal "ticks" are the artifacts.

What you are looking at is just a single 8x8 textured quad drawn multiple times on a non-overlapping grid, the original texture source is a 2 pixel wide vertical line. The artifacts only appear when scaling up (resizing the render target), and each time I resize the ticks sort of randomly appear and disappear. Perhaps significant, the artifacts seem to always appear at where the quads adjoin each other.

Multisampling is off, not using depth or alpha blending. Vertices in the Pre-vs mesh look correct.

The strangeness starts when I debug one of the culprit pixels with PIX - it reports the pixel shader ouput and framebuffer as 1,1,1,1 which is what I am seeing on the screen. But, when I debug pixel & step through the actual shader, the output shows 0,0,0,1 (which would be what I [i]want [/i]to see on the screen). I do not understand what could happen between the pixel shader output and the framebuffer that can change the color of the pixel.

To add to the strangeness, I cannot reproduce the issue on a different computer. I've updated my drivers on my development machine to the latest, no change. My best guess at this point is that I am doing something a bit off that is compounded by a particular quirk of my GPU (Nvidia, btw).

Here is some code (using SharpDX, Direct3D11):

Swapchain and Rasterizer options:
[code]
swapDesc = new SwapChainDescription()
{
ModeDescription = new ModeDescription(ParentForm.ClientSize.Width,
ParentForm.ClientSize.Height,
new Rational(60, 1), Format.R8G8B8A8_UNorm),
SampleDescription = MultiSampling,
Usage = Usage.RenderTargetOutput,
BufferCount = 1,
OutputHandle = ParentForm.Handle,
IsWindowed = true,
SwapEffect = SwapEffect.Discard,
Flags = SwapChainFlags.None
};

var rasterDesc = new RasterizerStateDescription()
{
IsAntialiasedLineEnabled = false,
CullMode = CullMode.None,
DepthBias = 0,
DepthBiasClamp = 0.0f,
IsDepthClipEnabled = false,
FillMode = FillMode.Solid,
IsFrontCounterClockwise = false,
IsMultisampleEnabled = enableMultiSample,
IsScissorEnabled = false,
SlopeScaledDepthBias = 0.0f
};
[/code]

This gets called when the window is resized, width and height are directly from Form.ClientSize:

[code]
renderTargetView.Dispose();
swapChain.ResizeBuffers(1, width,
height,
Format.R8G8B8A8_UNorm, SwapChainFlags.None);
using (Texture2D backBuffer = swapChain.GetBackBuffer<Texture2D>(0))
{
renderTargetView = ToDispose(new RenderTargetView(device, backBuffer));
}
device.ImmediateContext.OutputMerger.SetTargets(renderTargetView);
device.ImmediateContext.Rasterizer.SetViewport(0, 0, width, height, 0, 1);
[/code]

The sampler state used by the pixel shader, (which btw I have tried randomly tweaking settings out of desperation):
[code]
SamplerStateDescription samplerDesc = new SamplerStateDescription()
{
AddressU = TextureAddressMode.Border,
AddressV = TextureAddressMode.Border,
AddressW = TextureAddressMode.Border,
MipLodBias = 0,
MaximumAnisotropy = 1,
Filter = Filter.MinMagMipPoint,
ComparisonFunction = Comparison.NotEqual,
BorderColor = new Color4(0,0,0,0),
MinimumLod = 0,
MaximumLod = float.MaxValue
};
[/code]

Finally, here is the pixel shader. This is maybe a bit unusual, but basically it is just using the alpha from a texture to lerp between 2 colors:

[code]
Texture2D shaderTexture;
SamplerState sampleType;
struct PixelIn
{
float4 PosH : SV_POSITION;
float3 BColor : COLOR0;
float3 FColor : COLOR1;
float2 Tex : TEXCOORD;
};
float4 PS(PixelIn pin) : SV_TARGET
{
float4 textureColor;
float3 finalColor;
textureColor = shaderTexture.Sample(sampleType, pin.Tex);

finalColor = lerp(pin.BColor, pin.FColor, textureColor.a);
return float4(finalColor, 1.0f);
}
[/code]

Anyone have any ideas, even a longshot, or has anyone seen anything like this before?
0

Share this post


Link to post
Share on other sites
What are the 2 images. One may have some odd pixel colour on the edge. Like gray stray pixels at the bottom. Long shot.
0

Share this post


Link to post
Share on other sites
[quote name='ankhd' timestamp='1346380767' post='4975008']
What are the 2 images. One may have some odd pixel colour on the edge. Like gray stray pixels at the bottom. Long shot.
[/quote]

Thanks, that triggered something in my brain about floating-point innacuracies... The texture is part of an atlas, and it certainly could be a piece of the neighboring texture is bleeding through.

I suppose I can theorize why different GPU hardware would produce different results in this case (floating point wierdness etc.) - but I still don't understand how the pixel shader/sampler can output the correct color yet the framebuffer if off?

I suppose the obvious solution (if this is the case) would be to post-process the image so it has a 1 pixel border around each sub-texture? Are the other viable options, like somehow forcing the PS to clamp to the boundary?
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