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

Model got no depth?

8 posts in this topic

Hi guys,
I'm quite new to Directx 11 and tried to load my model.
However, I got a problem with its rendering. It looks like my model got no depth(look at his hands, feet, head), even though I got a depth/stencil buffer.


[img]http://s14.directupload.net/images/120521/jk8j6ur8.png[/img]
My importer works with less complex models.

Am i missing something?
What could cause this?

I hope you guys can help me ;)
0

Share this post


Link to post
Share on other sites
If you post your device & swap chain creation code it would help.

Specifically, post your depth/stencil and backbuffer configuration structures and the call to create them.

It also appears to me you have some wind-ordering issue with your model. Have you tried setting the rasterizer state to not cull back/front faces?
1

Share this post


Link to post
Share on other sites
Ty for your answer.
This is the D3dInit code(based on Frank Lunas Dx11 Book)
[CODE]
bool Dx11Base::Init(HINSTANCE hInstance, HWND hwnd)
{
hInstance_ = hInstance;
hwnd_ = hwnd;
RECT dimensions;
GetClientRect(hwnd, &dimensions);
unsigned int width = dimensions.right - dimensions.left;
unsigned int height = dimensions.bottom - dimensions.top;
D3D_DRIVER_TYPE driverTypes[] =
{
D3D_DRIVER_TYPE_HARDWARE, D3D_DRIVER_TYPE_WARP,
D3D_DRIVER_TYPE_SOFTWARE, D3D_DRIVER_TYPE_REFERENCE,
};
unsigned int totalDriverTypes = ARRAYSIZE(driverTypes);
D3D_FEATURE_LEVEL featureLevels[] =
{
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0
};
unsigned int totalFeatureLevels = ARRAYSIZE(featureLevels);
DXGI_SWAP_CHAIN_DESC swapChainDesc;
ZeroMemory(&swapChainDesc, sizeof(swapChainDesc));
swapChainDesc.BufferCount = 1;
swapChainDesc.BufferDesc.Width = width;
swapChainDesc.BufferDesc.Height = height;
swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
swapChainDesc.BufferDesc.RefreshRate.Numerator = 60;
swapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.OutputWindow = hwnd;
swapChainDesc.Windowed = true;
swapChainDesc.SampleDesc.Count = 1;
swapChainDesc.SampleDesc.Quality = 0;
unsigned int creationFlags = 0;
#ifdef _DEBUG
creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
HRESULT result;
unsigned int driver = 0;
for(driver = 0; driver < totalDriverTypes; ++driver)
{
result = D3D11CreateDeviceAndSwapChain(0, driverTypes[driver], 0,
creationFlags, featureLevels, totalFeatureLevels,
D3D11_SDK_VERSION, &swapChainDesc, &swapChain_,
&d3dDevice_, &featureLevel_, &d3dContext_);

if(SUCCEEDED(result))
{
driverType_=driverTypes[driver];
break;
}
}
if(FAILED(result))
{
DXTRACE_MSG("Failes to create the Direct3D device!");
return false;
}
ID3D11Texture2D* backBufferTexture;
result = swapChain_->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBufferTexture);
if(FAILED(result))
{
DXTRACE_MSG("Failed to get the swap chain back buffer!");
return false;
}
result = d3dDevice_->CreateRenderTargetView(backBufferTexture, 0, &backBufferTarget_);
if(backBufferTexture)
backBufferTexture->Release();
if(FAILED(result))
{
DXTRACE_MSG("Failed to create the renderTargetView!");
return false;
}
D3D11_TEXTURE2D_DESC depthTexDesc;
ZeroMemory(&depthTexDesc, sizeof(depthTexDesc));
depthTexDesc.Width = width;
depthTexDesc.Height = height;
depthTexDesc.MipLevels = 1;
depthTexDesc.ArraySize = 1;
depthTexDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
depthTexDesc.SampleDesc.Count = 1;
depthTexDesc.SampleDesc.Quality = 0;
depthTexDesc.Usage = D3D11_USAGE_DEFAULT;
depthTexDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
depthTexDesc.CPUAccessFlags = 0;
depthTexDesc.MiscFlags = 0;
result = d3dDevice_->CreateTexture2D(&depthTexDesc, NULL, &depthTexture_);
if(FAILED(result))
{
DXTRACE_MSG("Failed to create the depth texture!");
return false;
}
//depth stencil view
D3D11_DEPTH_STENCIL_VIEW_DESC descDSV;
ZeroMemory(&descDSV, sizeof(descDSV));
descDSV.Format = depthTexDesc.Format;
descDSV.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
descDSV.Texture2D.MipSlice = 0;
result = d3dDevice_->CreateDepthStencilView(depthTexture_, &descDSV, &depthStencilView_);
if(FAILED(result))
{
DXTRACE_MSG("Failed to create the depth stencil target view!");
return false;
}

d3dContext_->OMSetRenderTargets(1, &backBufferTarget_, 0);
D3D11_VIEWPORT viewport;
viewport.Width = static_cast<float>(width);
viewport.Height = static_cast<float>(height);
viewport.MinDepth = 0.0f;
viewport.MaxDepth = 1.0f;
viewport.TopLeftX = 0.0f;
viewport.TopLeftY = 0.0f;
d3dContext_->RSSetViewports(1, &viewport);
return LoadContent();
}
[/CODE]

And here is my Draw Method:
[CODE]
void Modeldemo::Render()
{
if( d3dContext_ == 0 )
return;
float clearColor[4] = { 0.0f, 0.0f, 0.25f, 1.0f };
d3dContext_->ClearRenderTargetView( backBufferTarget_, clearColor );
d3dContext_->ClearDepthStencilView( depthStencilView_, D3D11_CLEAR_DEPTH, 1.0f, 0 );

unsigned int stride = sizeof( VertexPos );
unsigned int offset = 0;
d3dContext_->IASetInputLayout( inputLayout_ );
d3dContext_->IASetVertexBuffers( 0, 1, &vertexBuffer_, &stride, &offset );
d3dContext_->IASetIndexBuffer( indexBuffer_, DXGI_FORMAT_R16_UINT, 0 );
d3dContext_->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
d3dContext_->VSSetShader( colorMapVS_, 0, 0 );
d3dContext_->PSSetShader( colorMapPS_, 0, 0 );
d3dContext_->PSSetShaderResources( 0, 1, &colorMap_ );
d3dContext_->PSSetSamplers( 0, 1, &colorMapSampler_ );
XMMATRIX worldMat = XMMatrixIdentity( );
worldMat = XMMatrixTranspose( worldMat );
XMMATRIX viewMat = cam_.GetViewMatrix( );
viewMat = XMMatrixTranspose( viewMat );
d3dContext_->UpdateSubresource( worldCB_, 0, 0, &worldMat, 0, 0 );
d3dContext_->UpdateSubresource( viewCB_, 0, 0, &viewMat, 0, 0 );
d3dContext_->UpdateSubresource( projCB_, 0, 0, &projMatrix_, 0, 0 );
d3dContext_->VSSetConstantBuffers( 0, 1, &worldCB_ );
d3dContext_->VSSetConstantBuffers( 1, 1, &viewCB_ );
d3dContext_->VSSetConstantBuffers( 2, 1, &projCB_ );
int size = model->indicesCount;
d3dContext_->Draw( size, 0);
swapChain_->Present( 0, 0 );
}
[/CODE]

[quote name='Hornsj3' timestamp='1337635629' post='4942014']
It also appears to me you have some wind-ordering issue with your model. Have you tried setting the rasterizer state to not cull back/front faces?
[/quote]

Yes, but no changes to the model.
0

Share this post


Link to post
Share on other sites
Maybe the issue is with your shaders, an inccorect matrices transformation.
It would be a Direct3D version's independent problem.
1

Share this post


Link to post
Share on other sites
Here is my ShaderCode
[CODE]
Texture2D colorMap_ : register( t0 );
SamplerState colorSampler_ : register( s0 );

cbuffer cbChangesEveryFrame : register( b0 )
{
matrix worldMatrix;
};
cbuffer cbNeverChanges : register( b1 )
{
matrix viewMatrix;
};
cbuffer cbChangeOnResize : register( b2 )
{
matrix projMatrix;
};

struct VS_Input
{
float4 pos : POSITION;
float2 tex0 : TEXCOORD0;
};
struct PS_Input
{
float4 pos : SV_POSITION;
float2 tex0 : TEXCOORD0;
};

PS_Input VS_Main( VS_Input vertex )
{
PS_Input vsOut = ( PS_Input )0;
vsOut.pos = mul( vertex.pos, worldMatrix );
vsOut.pos = mul( vsOut.pos, viewMatrix );
vsOut.pos = mul( vsOut.pos, projMatrix );
vsOut.tex0 = vertex.tex0;
return vsOut;
}

float4 PS_Main( PS_Input frag ) : SV_TARGET
{
return colorMap_.Sample( colorSampler_, frag.tex0 );
}
[/CODE]
0

Share this post


Link to post
Share on other sites
sure.
[CODE]
projMatrix_ = XMMatrixPerspectiveFovLH(XM_PIDIV4, 800.0f / 600.0f, 0.01f, 1000.0f);
projMatrix_ = XMMatrixTranspose(projMatrix_);
[/CODE]
0

Share this post


Link to post
Share on other sites
Seems that you pass NULL as 3rd parameter to the OMSetRenderTargets method.


void OMSetRenderTargets(
[in] UINT NumViews,
[in] ID3D11RenderTargetView *const **ppRenderTargetViews,
[in] ID3D11DepthStencilView *pDepthStencilView
);

3rd parameter should be your DepthStencilView.

Cheers!
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