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


  • Content count

  • Joined

  • Last visited

Community Reputation

106 Neutral

About PavelB

  • Rank
  1. I would like to revive DirectX application that originally used DirectDraw7 and transfer it to DirectX 11. I have never worked before with DirectDraw.   Does anyone know any resources that would allow me to convert it as close as possible to DirectDraw, still using full power of DirectX 11?
  2. I have created the application that shows on the screen flat simple terrain 100 * 100. It works and camera flies around on the laptop. However, when I connect my laptop to the external monitor, it doesn't show anything. Does anyone experianced this kind of strange behaviour?
  3. I don't know. Something wrong with my understanding of what you are saying. Below I show the logic I am using and it works for the triangle, but it doesn't work for square. As you see below I commented a lot of code and it still consistant. It works, but show only one of the triangles of the square. depends on which one of them are 0,1,2. When I replace the order it shows one triangle or another. [CODE] ID3DBlob* pVSBlob = NULL; hr = CompileShaderFromFile( L"Tutorial02.fx", "vshader", "vs_4_0", &pVSBlob ); if( FAILED( hr ) ) { MessageBox( NULL, L"The FX file cannot be compiled. Please run this executable from the directory that contains the FX file.", L"Error", MB_OK ); return hr; } // Create the vertex shader hr = g_pd3dDevice->CreateVertexShader( pVSBlob->GetBufferPointer(), pVSBlob->GetBufferSize(), NULL, &g_pVertexShader ); if( FAILED( hr ) ) { pVSBlob->Release(); return hr; } //// Define the input layout //D3D11_INPUT_ELEMENT_DESC layout[] = //{ // { "SV_VertexId", 0, DXGI_FORMAT_R32G32B32_UINT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, //}; //UINT numElements = ARRAYSIZE( layout ); //// Create the input layout //hr = g_pd3dDevice->CreateInputLayout( layout, numElements, pVSBlob->GetBufferPointer(), // pVSBlob->GetBufferSize(), &g_pVertexLayout ); //pVSBlob->Release(); //if( FAILED( hr ) ) // return hr; // Set the input layout //g_pImmediateContext->IASetInputLayout( NULL ); // Compile the pixel shader ID3DBlob* pPSBlob = NULL; hr = CompileShaderFromFile( L"Tutorial02.fx", "PS", "ps_4_0", &pPSBlob ); if( FAILED( hr ) ) { MessageBox( NULL, L"The FX file cannot be compiled. Please run this executable from the directory that contains the FX file.", L"Error", MB_OK ); return hr; } // Create the pixel shader hr = g_pd3dDevice->CreatePixelShader( pPSBlob->GetBufferPointer(), pPSBlob->GetBufferSize(), NULL, &g_pPixelShader ); pPSBlob->Release(); if( FAILED( hr ) ) return hr; //// Create vertex buffer //SimpleVertex vertices[] = //{ // XMFLOAT3( 0.0f, 0.5f, 0.5f ), // XMFLOAT3( 0.5f, -0.5f, 0.5f ), // XMFLOAT3( -0.5f, -0.5f, 0.5f ), //}; //D3D11_BUFFER_DESC bd; //ZeroMemory( &bd, sizeof(bd) ); //bd.Usage = D3D11_USAGE_DEFAULT; //bd.ByteWidth = sizeof( SimpleVertex ) * 3; //bd.BindFlags = D3D11_BIND_VERTEX_BUFFER; //bd.CPUAccessFlags = 0; //D3D11_SUBRESOURCE_DATA InitData; //ZeroMemory( &InitData, sizeof(InitData) ); //InitData.pSysMem = vertices; //hr = g_pd3dDevice->CreateBuffer( &bd, &InitData, &g_pVertexBuffer ); //if( FAILED( hr ) ) // return hr; //// Set vertex buffer //UINT stride = sizeof( SimpleVertex ); //UINT offset = 0; //g_pImmediateContext->IASetVertexBuffers( 0, 1, &g_pVertexBuffer, &stride, &offset ); // Set primitive topology g_pImmediateContext->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST ); [/CODE] [CODE] //-------------------------------------------------------------------------------------- // File: Tutorial02.fx // // Copyright (c) Microsoft Corporation. All rights reserved. //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- // Vertex Shader //-------------------------------------------------------------------------------------- float4 VS( float4 Pos : POSITION ) : SV_POSITION { return Pos; } //-------------------------------------------------------------------------------------- // Pixel Shader //-------------------------------------------------------------------------------------- float4 PS( float4 Pos : SV_POSITION ) : SV_Target { return float4( 1.0f, 1.0f, 0.0f, 1.0f ); // Yellow, with Alpha = 1 } struct VS_OUT { float4 pos : SV_Position; // insert other vs output fields here as needed }; // vertex shader that draws a triangle without vbuffers VS_OUT vshader(uint idx : SV_VertexId) { VS_OUT ret = (VS_OUT)0; switch (idx) { case 3: ret.pos = float4(-0.1,-0.1,1,1); break; case 4: ret.pos = float4(0.1,0.1,1,1); break; case 5: ret.pos = float4(0.1,-0.1,1,1); break; case 0: ret.pos = float4(-0.1,-0.1,1,1); break; case 1: ret.pos = float4(-0.1,0.1,1,1); break; case 2: ret.pos = float4(0.1,0.1,1,1); break; } return ret; } [/CODE]
  4. But how does it know how many vertices in model - 3 or 300000. is it Draw(300000, 0) tell about it?
  5. This is what I try to understand, how do I give the indices to the shader. In regulat way it works this way: Initialize Buffer: [CODE] ......................... Code // Load the vertex array with data. vertices[0].position = ... // Bottom left. vertices[1].position = ... // Bottom Right vertices[2].position = ... // Top Right vertices[3].position = ... // Top Left // Load the index array with data. indices[0] = 0; // Bottom left. indices[1] = 1; // Bottom Right. indices[2] = 2; // Top right. indices[3] = 0; // Bottom left. indices[4] = 2; // Top Right. indices[5] = 3; // Top Left. ......... Code [/CODE] Render Buffer: [CODE] [size="2"]deviceContext->IASetVertexBuffers(0, 1, &m_vertexBuffer, &stride, &offset);[/size] [size="2"]deviceContext->IASetIndexBuffer(m_indexBuffer, DXGI_FORMAT_R32_UINT, 0); [/size] [size="2"]deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); [/size] [/CODE] Now, what am I doing? From the samples that I found, at least the simpliest one I should do something like this: [CODE] m_pD3D11Device->IASetInputLayout( NULL ); m_pD3D11Device->IASetPrimitiveTopology( D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST ); ID3DX11EffectTechnique * pTech = NULL; pTech = m_pEffect->GetTechniqueByIndex(0); pTech->GetPassByIndex(iPass)->Apply(0); m_pD3D11Device->Draw( 3, 0 ); [/CODE] Where do I set the order of the indices for the triangles? How do I know in shader about it?
  6. Thanks. It is what I found on SDK, too. Again It has permanent coordinates. However, I cannot figure out, how I can do complex shader, which includes 2 triangles, as in Square or 400 triangles as for Circle, by sending in only center of those shapes. For instant, here is what I hope to achieve. [CODE] struct VS_OUT { float4 pos: SV_Position; }; struct VS_IN { float4 origin; float4 radius; uint idx : SV_VertexId; }; VS_OUT vsshader(VS_IN in) { VS_OUT ret = (VS_OUT)0; float4 inRightTop; ... // Calculation of the Right Top corner float4 inLeftTop; .... float4 inRightBottom; .... float4 inLeftBottom; switch (idx) { case 0: ret.pos = inLeftBottom; break; case 1: ret.pos = inRightBottom; break; case 2: ret.pos = inRightTop; break; case 3: ret.pos = inLeftBottom; break; case 4: ret.pos = inRightTop; break; case 5: ret.pos = inLeftTop; break; } } [/CODE]
  7. I am new at shaders. I can find a lot of examples that would help me with the traditional ways of computing and very little with what I describe above. Could you give me some tutorials to read about this technique or even small working small sample of the example above and I will try using that for what I really want to try (see below) In ideal variant for the square I'd like to do something like this: I will send 3 parameters: - Polar System Coordinate vector from "World Space" origin to the origin of the square's Object Polar Coordinate System; - Quadrion of the orientation for the origin "unit" vector of the square's Object Polar Coordinate System; - Polar System Coordinate vector to the point of one of the corners of the square within Object Polar Coordinate System. [b]It is it and then shader create the vertice buffer by itself.[/b] P.S. As bonus, I'd like to keep the third vector in GPU as long as possible during the time my application is running. Only 2 first parameters will be changed between frames to do some animation.
  8. Hi, I have the question regarding HLSL. When I create new model I have to give all vertices to the HLSL. The question is if it is possible to create all vertices within the shader itself. Here small example of what I am asking about. I'd like to send for instant the coordinates of the centre of the square and half diagonal length. And program I will create in shader will calculate all 6 coordinate by itself and "in the loop somehow" will execute it. In this case, my CPU won't work on this, but GPU itself. Is it possible to do something like this?
  9. I have created small egine that put the results of the RawInput on the screen. I am using my own font texture. While I am not moving the mouse it is OK, the text moves and screen is cleaned. When I am starting to move it, see the attached video files from here [url="http://sharpdx.googlecode.com/issues/attachment?aid=1660013001&name=Tutorial13.swf&token=z7gF4C9esP1t9dokxgpKlt2L8OY%3A1335867800863"]http://sharpdx.googl...Y:1335867800863[/url] [url="http://sharpdx.googlecode.com/issues/attachment?aid=1660013002&name=Tutorial13.swf.html&token=PjvgZADqnpYPWE9j5znnUB0j_bM%3A1335867800863"]http://sharpdx.googl...M:1335867800863[/url]
  10. I am learning DirectX from this site [url="http://www.rastertek.com/"]http://www.rastertek.com/[/url] and also SharpDX. I decided to do is simulteneously. It means, every tutorial I develop using SharpDX. Until tutorial 13 I have succeded to implement the code similatr to the original. However, I am stuck with DirectInput, related to the mouse. Below I attached the original tutorial written in C++ and my implementation of it. In original when I move the mouse it shows me right coordinates of the window. In mine only relative or absolute. The issue is I don't understand why it works there and in mine.