• 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

166 Neutral

About davepl1968

  • Rank
  1. Thanks!  On some systems the are "resolve" steps wherein you can apply the threshold bias in that resolve step; since I'm on DX9 my closest is StretchRect, but it cannot apply any biasing or adjustment during the copy.  Would it make sense to have my pixel shader apply the threshold division, since I cannot do it in a resolve step?
  2. I'm doing the good old "HDR Bloom like an old Atari vector monitor" effect, and have a couple of questions:   1) For my initial draw surface, I am using D3DFMT_A16B16G16R16 and want to make sure that's an appropriate choice.   2) I'd like to confirm that my intermediate textures (where you step down to half size and gaussian blur) do not need extra bits; or do they?  For the set of 4 or 5 bloom textures, what pixel format should I use for them?   3) And perhaps most important, how do you actually -draw- at "higher than 1.0" intensities?  Do you really return RGB color components > 1.0, or do the extra HDR bits only get used from combined blending and so forth?   Thanks! Dave
  3. Thanks, that's what I've been working on since I posted it (a 'Combine' shader that takes the two blur stages and combines their outputs to the screen).  I'm not familiar with the blend() function, so thanks!  I had just been adding them with a scale factor.
  4. I have a scene that I render to a texture (works fine).  I keep a copy of that texture, which I use to create a blur in the X and Y direction so now I have:   a) The original texture of the scene b) A blurred copy of the scene on the device's default rendertarget   I now want to draw the original texture on top, giving it the "blur" around the original scene data.  When I do this, however, it just completely replaces everything; my blurred scene is wiped out and the original replaces it entirely, as if StretchRect can do no combining or blending.   I turn on Alpha blending and set the blending mode to Additive (also tried AlphaAdditive): pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); BlendMode::Set(pd3dDevice, BlendMode::Additive); pd3dDevice->StretchRect(ptrDrawSurface, NULL, ptrOriginalDeviceRenderTarget, NULL, D3DTEXF_POINT); So what am I missing?  How do I get the original version of the scene to be placed on top of the blurred version of the scene without it just completely replacing it?   Thanks!    
  5. I have a nice little fireworks demo running, and I thought for the heck of it I'd spin the "ball of particles" that comprises the fireworks.  To do this, I assumed that the steps were:   - Translate back to origin from where it lives in space - Apply rotation matrices for X, Y, Z - Translate back to where object lived in space - Set that as the World matrix before drawing the object (leaving projection and view completely alone)   It does not work as I would expect (or at all, really).  It just jumps around a bunch but largely stays put (no rotation).  I'm placing that new world matrix into the shader before drawing the instance.  I know all that works, as it draws them without rotation exactly as I'd hoped.  It's just my application of rotation that has broken everything...   Either I've got a really ugly bug or a very poor grasp of how to compose such a matrix.  A prod in either direction would be very much appreciated! D3DXMATRIX matrixTranslateBefore; D3DXMATRIX matrixRotationX; D3DXMATRIX matrixRotationY; D3DXMATRIX matrixRotationZ; D3DXMATRIX matrixTranslateAfter; float rads = fElapsedTime * 50.0f; D3DXMatrixTranslation(&matrixTranslateBefore,  -pExplosion->_centerPosition.x, -pExplosion->_centerPosition.y, -pExplosion->_centerPosition.z); D3DXMatrixRotationX(&matrixRotationX, rads); D3DXMatrixRotationY(&matrixRotationY, rads); D3DXMatrixRotationZ(&matrixRotationZ, rads); D3DXMatrixTranslation(&matrixTranslateAfter, pExplosion->_centerPosition.x, pExplosion->_centerPosition.y, pExplosion->_centerPosition.z); pCameraManager->_worldMatrix = matrixTranslateBefore * matrixRotationX * matrixRotationY * matrixRotationZ * matrixTranslateAfter;  
  6. My issue turned out to be a pretty basic one - not calling effect->Begin(...) on the effect itself, although I had called Begin on the scene and on the pass.
  7. I'm having trouble setting shader variables, as in I'm unable to.  In the FX file, I have:   //cbuffer ExplosionData : register(b0) // BUGBUG consistent casing //{ float    secondsLifetime; float    secondsRemaining; float    explosionSpeed;    float4x4 worldViewProjection;    Texture  particleTexture; float3   startPosition; //}   I get the D3DXHANDLEs to them by name, and they come back with valid handles.  As you can see I originally had them in a cbuffer but moved them out just to see if it made a difference, which it did not.  This is all vs3_0 and ps3_0 stuff.   _hSecondsLiftime       = _ptrEffect->GetParameterByName(0, "secondsLifetime"); _hSecondsRemaining     = _ptrEffect->GetParameterByName(0, "secondsRemaining"); _hExplosionSpeed       = _ptrEffect->GetParameterByName(0, "explosionSpeed"); _hWorldViewProjection  = _ptrEffect->GetParameterByName(0, "worldViewProjection"); _hParticleTexture      = _ptrEffect->GetParameterByName(0, "particleTexture"); _hStartPosition        = _ptrEffect->GetParameterByName(0, "startPosition"); In my render code I do BeginScene, SetTechnique, abd BeginPass.  Then I SetVertexDeclaration, SetVertexShader, SetPixel shader, all good so far.  Then I start to set my shader variables.   In PIX, however, I can see this: IDIRECT3DDevice9::SetFloat(0xFEFE5B7B, 0.000f); IDIRECT3DDevice9::SetFloat(0xFEFE5B23, 0.000f); ... IDIRECT3DDevice9::SetMatrix(0xFEFE5A73, 0x3FE7C3B5) The problem, as you can see, is that no matter values (and I've walked it and verified they are non-zero at the call) get passed through as zero, and my worldViewProjection winds up as an empty matrix.   The question, then, is:  "What could I be doing wrong based on the above to cause setting my shader variables to do nothing?"   I've stuck a RAR of the PIX file at the end, for what that's worth!  Many thanks for any tips!  
  8. I'm working on a "2.5D" game where everything is still proper 3D but everything lives at 0 depth.  Think of any standard side-scroller, Geometry Wars, or so on.   If I know I'm running at 1024x768 (just for example) resolution and I know that my "world" is constrained to x {-1.0, 1.0} and y {-1.0, 1.0) how do I go about creating my perspective and transform matrices other than trial and error?   I probably have to pick a camera depth, and because I do not want a lot of distortion, let's say z=1000 for the camera.  But how do I go about getting my matrices so that the 1024x768 pixels I have map to a 4:3 region of game world?   Since the screen space in a side-scroller may be 1/20th or so of the actual 2D world, the camera will have to move horizontally as well.  And similarly, I need to know when to start and stop the camera so that you do not run off either end.   As I said, I could probably guess and fine-tune until I got it right, but I have to imagine there's a more rigorous way to go about it.     Thanks for any tips! Dave   PS: I'm not even entirely sure I'll need a projection matrix, but I would like to be able to zoom in and out.
  9. My solution was to compile them to .cso and then do this:   V_RETURN( D3DXCreateEffectFromFile(pd3dDevice, strPath.c_str(), 0, 0, D3DXSHADER_DEBUG, 0, &_ptrEffect, &pBuffer) ); V_RETURN( pd3dDevice->CreateVertexDeclaration(particleVertexDeclarations, &_ptrVertexDeclaration) );   // Get the technique, pass, and shaders we need   D3DXHANDLE hTechnique = _ptrEffect->GetTechniqueByName("ExplosionTechnique"); if (!hTechnique) return E_FAIL;   D3DXHANDLE hPass = _ptrEffect->GetPassByName(hTechnique, "Pass0"); if (!hPass) return E_FAIL;   // Get the vertex and pixel shaders    D3DXPASS_DESC desc; V_RETURN( _ptrEffect->GetPassDesc(hPass, &desc) ); V_RETURN( pd3dDevice->CreateVertexShader(desc.pVertexShaderFunction, &_ptrVertexShader) ); V_RETURN( pd3dDevice->CreatePixelShader (desc.pPixelShaderFunction,  &_ptrPixelShader) );
  10. I'll answer my own question since I've seen it asked a number of times but never answered:  this appears to work.       D3DXPASS_DESC desc; V_RETURN( _pEffect->GetPassDesc(hPass, &desc) ); V_RETURN( pd3dDevice->CreateVertexShader(desc.pVertexShaderFunction, &_pVertexShader) ); V_RETURN( pd3dDevice->CreatePixelShader (desc.pPixelShaderFunction, &_pPixelShader) );
  11. According to an MSDN page, I found this:   What is the correct way to get shaders from an Effect? Use D3DXCreateEffect to create an ID3DXEffect and then use GetPassDesc to retrieve a D3DXPASS_DESC. This structure contains pointers to vertex and pixel shaders So I wrote this code: D3DXPASS_DESC desc; V_RETURN( _pEffect->GetPassDesc(hPass, &desc) ); _pPixelShader  = (D3DPixelShader *)  desc.pPixelShaderFunction; _pVertexShader = (D3DVertexShader *) desc.pVertexShaderFunction;   However, while there are raw pointers available, they're certainly not IDirect3DPixelShader9 objects; you can see that the v-table of the IUnknown are garbage.  Am I perhaps supposed to treat them like opaque (DWORD *) values rather than proper objects?  If that were the case, then calling SetVertexShader on the device wouldn't be possible with them, since pd3d->SetVertexShader requires a true IDirect3DVertexShader9.   So, still hooped.
  12.   I'm in the same boat.  I've tried passing both the Technique and the Pass handle, but both generate the D3DERR_INVALIDCALL and the debug runtime says its an invalid handle.  Yet they're non-zero and the "GetPassByName" that I use to get the handle succeeds. Anyone come up with a solution to this yet?
  13. My code below is intended to do a few things in order: - Load the effect file  - Get the main technique in the FX file - Get the first pass of that technique - Get the vertex and pixel shaders from that pass   All works fine up until the GetVertexShader() call.  I wind up with hr=D3DERR_INVALIDCALL (0x8876086c).   I've verified that I'm getting back values for hTechnique and hPass.  For completeness I've included the relevant snippet from the .fx file as well.   So, my question boils down to:  give a handle to a shader pass, how do you get the vertex and pixel shaders from it? ID3DXBuffer * pBuffer = NULL; V_RETURN( D3DXCreateEffectFromFile(pd3dDevice, strPath.c_str(), 0, 0, D3DXSHADER_DEBUG, 0, &_pEffect, &pBuffer) ); V_RETURN( pd3dDevice->CreateVertexDeclaration(particleVertexDeclarations, &_pVertexDeclaration) ); // Get the technique, pass, and shaders we need D3DXHANDLE hTechnique = _pEffect->GetTechniqueByName("ExplosionTechnique"); if (!hTechnique) return E_FAIL; D3DXHANDLE hPass = _pEffect->GetPassByName(hTechnique, "Pass0"); if (!hPass) return E_FAIL; V_RETURN( _pEffect->GetVertexShader(hPass, &_pVertexShader) ); // FAILS! V_RETURN( _pEffect->GetPixelShader(hPass, &_pPixelShader) ); technique ExplosionTechnique { pass Pass0 { VertexShader = compile vs_3_0 ExplosionVertexShaderFunction( ); PixelShader  = compile ps_3_0 ExplosionPixelShaderFunction( ); } }  
  14. But how do you call release on it?  It's not a COM object or pointer, it's an opaque handle.  Is there a special release function for D3DXHANDLEs that I'm not seeing?   Thanks! Dave
  15. If I have a piece of code such as this:       D3DXHANDLE hTechnique = _pEffect->GetTechniqueByName("ExplosionTechnique");   When I'm done, or exiting, or an error occurs, what do I do with hTechnique?     I'm -guessing- that the handles don't increase a ref count on the effect and that it's just up to me to make sure i use the handles within the lifetime of the effect itself.  But I can't really find any docs on it, and no sample code shows them being released.   Still, I'm one of those folks who doesn't like my code to leak anything under any reasonable scenario, so I'd like to make sure I'm doing the right thing!   Thanks, Dave