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

Debug pixel shader

2 posts in this topic

Hi,

I want draw a model, but nothing displayed on the screen, just background color.
I use the PIX to find the problem. but it's hard for me to detect what's wrong with it.

I look at the mesh in PIX, the Pre-Vertex shader and Post-Vertex Shader are drew well. but nothing in viewport.(I'm not use the Geomethry shader)

I guess there is someting wrong in the Pixel shader.

Here is the code in HLSL:

Texture2D DefaultTexture : register( t0 );
SamplerState DefaultSampler : register( s0 );
cbuffer cbChangesEveryFrame : register( b0 )
{
matrix WorldMatrix;
};
cbuffer cbNeverChanges : register( b1 )
{
matrix ViewMatrix;
};
cbuffer cbChangeOnResize : register( b2 )
{
matrix PerspMatrix;
};

struct VSInputTexture
{
float4 pos : POSITION;
float2 tex0 : TEXCOORD0;
};
struct PSInputTexture
{
float4 pos : SV_POSITION;
float2 tex0 : TEXCOORD0;
};

PSInputTexture VSWithCameraWithTexture(VSInputTexture vertex)
{
PSInputTexture vsOut = ( PSInputTexture )0;
vsOut.pos = mul( vertex.pos, WorldMatrix );
vsOut.pos = mul( vsOut.pos, ViewMatrix );
vsOut.pos = mul( vsOut.pos, PerspMatrix );
vsOut.tex0 = vertex.tex0;
return vsOut;
}

float4 PSWithTexture(PSInputTexture frag) : SV_TARGET
{
float4 col = DefaultTexture.Sample( DefaultSampler, frag.tex0 );
return col;
}

technique11 DefaultTechniqueWithCameraWithTexture
{
pass P0
{
SetVertexShader( CompileShader( vs_5_0, VSWithCameraWithTexture()));
SetGeometryShader( NULL);
SetPixelShader( CompileShader( ps_5_0, PSWithTexture()));
}
}

No compile error about this HLSL.

In Rasterizer:

Viewports
Slot TopLeftX TopLeftY Width Height MinDepth MaxDepth
0 0.000f 0.000f 800.000f 600.000f 0.000f 1.000f
(1-15) N/A N/A N/A N/A N/A N/A

Rasterizer
Rasterizer 0x066294A0
Fill Mode D3D11_FILL_SOLID
Cull Mode D3D11_CULL_BACK
Front Counter-clockwise FALSE
Depth Bias 0
Depth Bias Clamp 0.000f
Slope Scaled Depth Bias 0.000f
Depth Clip Enable FALSE
Scissor Enable FALSE
Multisample Enable FALSE
Antialiased Line Enable FALSE

In Pixel Shader:

Slot Sampler Filter AddressU AddressV AddressW MipMapLODBias MaxAnisotropy ComparisonFunc BorderColorRGBA MinLOD MaxLOD
0 0x06627010 D3D11_FILTER_MIN_MAG_MIP_LINEAR D3D11_TEXTURE_ADDRESS_WRAP D3D11_TEXTURE_ADDRESS_WRAP D3D11_TEXTURE_ADDRESS_WRAP 0.000f 0 D3D11_COMPARISON_NEVER (0.000f, 0.000f, 0.000f, 0.000f) 0.000f 340282346638528860000000000000000000000.000f


I have checked every thing but still don't know why nothing displayed.

Could you help me?
0

Share this post


Link to post
Share on other sites
Actually, there are a lot of things that can go wrong in your code and i don't see any explicit error here. In pixel shader try
[CODE]
return float4(1.0f, 1.0f, 1.0f, 1.0f);
[/CODE]

If you see your object white, probably problem lies in binding texture resource (DefaultTexture in your shader code). If still nothing appears, check that you update constant buffers with matrices correctly for the vertex shader and bind right render target for your pixel shader. Or maybe you placed vertices in the wrong order and rasterizer culls your geometry, try [b]D3D11_CULL_NONE.[/b]
1

Share this post


Link to post
Share on other sites
[quote name='DgekGD' timestamp='1355660066' post='5011237']
[CODE]
return float4(1.0f, 1.0f, 1.0f, 1.0f);
[/CODE]
[/quote]

I don't see the white object.

And i try to use "D3D11_CULL_NONE", it's still not work.

so I think the problem seem in the render target because I can see the object in Post-Vertex Shader in the PIX,
It can prove the matrix work, isn't it?

Here is the code about the render target:

[source lang="cpp"] hr = m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBufferPtr);
CHECK_FAILED(hr)

hr = m_device->CreateRenderTargetView(backBufferPtr, NULL, &defaultRenderTargetView);

CHECK_FAILED(hr)

backBufferPtr->Release();
backBufferPtr = 0;

deviceContext->OMSetRenderTargets(1, &defaultRenderTargetView, NULL);[/source]

The code is simple. but I only use OMSetRenderTargets at the beginning of the porgram. Shall I use It pre-frame?

And I still dont know what's wrong in my code.
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