• 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

102 Neutral

About painofangels

  • Rank
  1. My guess is that you don't use floating-point textures to store the position in, so the value will be clamped to [0..1] for every component in the shader. Try to define the texture-format in application-code with glTexImage2D( .., .., RGB_32F, .., .., .., .., GL_FLOAT, .. );
  2. Hi, I've been using VBOs to render my meshes for quite some time now... And recently I've been wondering what happens to VBOs [i]internally.[/i] Is it really safe to just import vertex-data, build and upload VBOs to GPU-memory and just use the location-handle provided by OpenGL to adress and render the meshes? What happens when all those VBOs exceed the GPU memory? Does the driver automatically save them to the slower system-RAM? If so: is there any feedback where the VBOs are actually stored? Do you get a GL_OUT_OF_MEMORY exception? (or something alike)? I would love to hear how you guys handle that and what you'r experiences are with many big VBOs.
  3. Hi, I recently found a snippet of (GLSL) code in a CG-paper I was studying: [code] mat3 baseTransform( vec3 v3Normal ) { vec3 up = vec3( 0.01, 0.99, 0.0 ); vec3 tangent = normalize( cross( up, v3Normal ) ); vec3 cotangent = normalize( cross( v3Normal, tangent ) ); return mat3( tangent, cotangent, v3Normal ); } [/code] This function builds a rotation matrix to change coordinate-bases by taking one vector as the z-axis of the new coordinate basis. What I wonder about is the "liberal" use of the up-vector. Normally, you'd have to rely on having two vectors of the desired coordinate base defined and these two can be used to construct the remaining one. Or you'd at least ensure that the "helper" vector you use to construct the first orthonormal vector lies on one of the planes of the coordinate base together with the first orthogonal vector (like its the case with the "user-up" vector used in View-matrix construction" ). but this above method seems pretty "optimistic" to me. And it also should fail whenever v3Normal = up... Am I missing something? Is this a valid approach to change coordinate-bases?
  4. Hmm, I already checked all that unfortunately. The Framebuffers are complete, the blitting-operation runs without any GL_INVALID_OPERATION -kind of error. And they are also of the same size. Just to be sure, here is the creation-code for both framebuffer objects: [code] //This is the FBO and the texture drawn into glGenFramebuffers( 1, &m_uImportanceSampleFBO ); glBindFramebuffer( GL_FRAMEBUFFER, m_uImportanceSampleFBO ); glGenTextures( 1, &m_uImportanceSampledSIIsampleTexture ); glBindTexture( GL_TEXTURE_2D, m_uImportanceSampledSIIsampleTexture ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB32F, NUMSIISAMPLES, NUMSIISAMPLES, 0, GL_RGB, GL_FLOAT, NULL ); glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_uImportanceSampledSIIsampleTexture, 0 ); //This is the FBO read from glGenFramebuffers( 1, &m_uSIIsampleFBO ); glBindFramebuffer( GL_FRAMEBUFFER, m_uSIIsampleFBO ); glGenTextures( 1, &m_uSIIsampleTexture ); glBindTexture( GL_TEXTURE_2D, m_uSIIsampleTexture ); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB32F, NUMSIISAMPLES, NUMSIISAMPLES, 0, GL_RGB, GL_FLOAT, samples ); glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_uSIIsampleTexture, 0 ); [/code] The constant "NUMSIISAMPLES" is just the "20" from by first post. As you can see the only difference between both FBOs is the fact that the attatched texture of the second one (the FBO which gets read) is initialized by a NUMSIISAMPLESxNUMSIISAMPLES-sized 2D-array of sampling positions which were generated just before the creation of the FBO. I've already checked if the problem changes, if I also initialize the other FBO with these samples -> no change But now I tried to actually draw these textures on screen to see whats happening. And the results are... well... "interesting": This is the original source image, wich is read during the blitting operation. Since the texture size is 20x20 and is now stretched to fullscreen, it is pretty blurry --> as expected. [img]http://img.ly/system/uploads/000/679/531/original_correct.png[/img] And here's the one that is drawn during the blitting operation. And here it gets interesting.... it seems as if my target texture is indeed much too big. It looks like the size exactly matches my viewport, because if the texture were also 20x20, it would be just as blurry as the above one... [img]http://img.ly/system/uploads/000/679/534/original_false.png[/img] So I tried to do glViewport(0, 0, 20, 20 ) just before the blitting.... no effect AHHHHH! I just saw in my own post, that I forgot to set the GL_MAG_FILTER but instead set GL_MIN_FILTER two times!!! daaamn. Now the textures look just alike! Thanks!
  5. Hi all, I'm currently facing a really weird problem: When I blit from one FBO to another using glBlitFramebuffer(...), somehow a large bunch of pixels are missing in the drawed-to texture.... Both FBOs have an RGB32F - Texture of the same size ( "only" 20x20 pixels, since it is a sample-lookup texture I need in one of my shaders ) attatched in COLOR_ATTATCHMENT0. the code I use for blitting is then: [code] glBindFramebuffer( GL_READ_FRAMEBUFFER, m_uSIIsampleFBO ); glBindFramebuffer( GL_DRAW_FRAMEBUFFER, m_uImportanceSampleFBO ); glReadBuffer( GL_COLOR_ATTACHMENT0 ); glDrawBuffer( GL_COLOR_ATTACHMENT0 ); glBlitFramebuffer( 0, 0, 20, 20, 0, 0, 20, 20, GL_COLOR_BUFFER_BIT, GL_NEAREST ); glBindFramebuffer( GL_READ_FRAMEBUFFER, 0 ); glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ); [/code] I have other blitting-operations working fine in my engine. This is the only time I'm having troubles with it what's really weird is the fact that whenever I raise the texture-sizes (and of course the size of the blitting-regions accordingly ), the resulting texture contains exactly the same amount of pixels as with the lower-sized versions. And NO, the texture blittet into is big enough, I checked that 1000 times Has anyone had similar problems? Thanks in advance!
  6. OpenGL

    whooops - you're right^^ But actually I already had this correct initially - must have accidently changed a "1024" to a "1" in the argument list... Good, now I'm getting the error information I used to get earlier: ERROR: 0:1: '' : Version number not supported by GL2 ERROR: 0:3: 'Transformation' : syntax error syntax error ERROR: Parser found no code to compile in source strings. I assumed that I had something wrong with glShaderSource() - since the last error "found no code to compile.." and the first error " "" : Version number not..." but the char array I pass to the procedure definitively contains my entire sourcecode - even terminated by a "\0" ( I read a missing null-termination also causes problems with glShaderSource() )
  7. I'm currently having trouble to get my GLSL vertex shader code to compile within my OpenGL program. My Vertex shader is pretty basic for testing purposes: #version 140 uniform Transformation { mat4 projection_matrix; mat4 modelview_matrix; }; in vec3 vertex; void main() { gl_Position = projection_matrix * modelview_matrix * vec4(vertex, 1.0); } and now I try to set the shader source and compile it with OpenGL: m_uVertexShader = glCreateShader( GL_VERTEX_SHADER ); std::string szShaderCode = FileReader::ReadTextFile( szVertexShaderPath ); const char* szTemp = szShaderCode.c_str(); glShaderSource(m_uVertexShader, 1, &szTemp, NULL); glCompileShader( m_uVertexShader ); after that I query the success of the compile with glGetShaderiv( m_uVertexShader, GL_COMPILE_STATUS, &iResult ) which returns GL_FALSE :( But when I want to retrieve the log information of the shader with glGetShaderInfoLog(m_uVertexShader, 1, &iLength, szInfo) then iLength is 0 - so my log is empty... what I know for certain is that the file is read correctly with ReadTextFile(). I also tried switching to the ARB-methods - same result... I hope someone has some hints for me on how to proceed in my error-investigation from here on... P.S.: I'm on a MacBook (Late 2008 ) with a GeForce 9400M and OSX 10.6. I use OpenGL with XCode in an SDL-created window.
  8. I'm in no ways a professional concerning D3D, but I would guess your way of doing this is efficient enough. As long as you just set the technique and don't create any new stuff with D3DXCreate or device->CreateXYZ. I had the same question with Vertex layouts which also have to be specific for every technique(-pass) that use different vertex-packings. Also: If you ever want to have different shaders for meshes in your engine there is no way of doing it differently than you do afaik.
  9. Hi, I'm currently implementing a small bloom-effect. The way I do this is: 1) Render the scene to a Full-Screen Texture 2) Render the Texture (horizontally) blurred to another Texture //for debugging-reasons I currently do only one blur-direction 3) Add both Textures together to create the bloom effect. In all steps I'm using Fullscreen quads for rendering (not sure if there are even other choices...) Now this is all working well as long as I keep my RenderTarget - textures the same size as my BackBuffer. But since I want to make a bloom-effect, smaller render-textures which even occupy less memory then are more desireable. So what I did is to render the blur (step 2) to a texture half the size of the backbuffer (The depth/Stencil Texture is also half the size). The color-Texture (from step 1) is still the original size. Step 3 doesn't change. But what I get now are wierd-looking ghost-images as shown in the screenshot. What I also noticed is that the ghost-Image (the content of the downsampled image) seems to move slightly different than the original image when moving the camera. It's as if the downsampled texture is actually bigger and I'm seeing only a portion of that texture - mimiking the effect of wrong movement-vectors (hard to describe...) And now I'm stuck! I already spent the entire day on figuring out why I'm getting these wierd results :-( here the screenshots: correct behavior using fullscreen-Buffers wrong ghost-images I get when using downsampled Texture and here a bit if code: Texture-, and DSView-Creation: UINT width = pBackBufferSurfaceDesc->Width; UINT height = pBackBufferSurfaceDesc->Height; D3D10_TEXTURE2D_DESC texDesc; texDesc.ArraySize = 1; texDesc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; texDesc.CPUAccessFlags = 0; texDesc.Format = pBackBufferSurfaceDesc->Format; texDesc.Height = height; texDesc.MipLevels = 1; texDesc.MiscFlags = 0; texDesc.SampleDesc.Count = 1; texDesc.SampleDesc.Quality = 0; texDesc.Usage = D3D10_USAGE_DEFAULT; texDesc.Width = width; hr = pd3dDevice->CreateTexture2D(&texDesc, NULL, &m_pColorTX); V_RETURN(hr); texDesc.Width /= 2; texDesc.Height /= 2; hr = pd3dDevice->CreateTexture2D(&texDesc, NULL, &m_pColorTX_horBlurred); V_RETURN(hr); //Create the depth/stencil Textures and DSViews texDesc.Format = DXGI_FORMAT_R16_TYPELESS; texDesc.BindFlags = D3D10_BIND_DEPTH_STENCIL; texDesc.Width = width; texDesc.Height = height; hr = pd3dDevice->CreateTexture2D(&texDesc, NULL, &m_pColorDSTX); V_RETURN(hr); texDesc.Width /= 2; texDesc.Height /= 2; hr = pd3dDevice->CreateTexture2D(&texDesc, NULL, &m_pColor_horBlurredDSTX); V_RETURN(hr); D3D10_DEPTH_STENCIL_VIEW_DESC dsDesc; dsDesc.Format = DXGI_FORMAT_D16_UNORM; dsDesc.ViewDimension = D3D10_DSV_DIMENSION_TEXTURE2D; dsDesc.Texture2D.MipSlice = 0; hr = pd3dDevice->CreateDepthStencilView(m_pColorDSTX, &dsDesc, &m_pColorDSV); V_RETURN(hr); hr = pd3dDevice->CreateDepthStencilView(m_pColor_horBlurredDSTX, &dsDesc, &m_pColor_horBlurredDSV); V_RETURN(hr); Shader-code, which blurs the scene: float4 horizontalBlur(float x, float y) { //return 1 / (sqrt(2* PI * pow(omega, 2))) * exp(-pow(x, 2) / (2 * pow(omega, 2))); float4 colorSum = float4(0, 0, 0, 0); colorSum += colorTX.Sample( g_samLinear, float2( x - 4 * sampleSize, y )) * 0.05; colorSum += colorTX.Sample( g_samLinear, float2( x - 3 * sampleSize, y )) * 0.09; colorSum += colorTX.Sample( g_samLinear, float2( x - 2* sampleSize, y )) * 0.12; colorSum += colorTX.Sample( g_samLinear, float2( x - 1 * sampleSize, y )) * 0.15; colorSum += colorTX.Sample( g_samLinear, float2( x, y )) * 0.16; //original Pixel colorSum += colorTX.Sample( g_samLinear, float2( x + 1 * sampleSize, y )) * 0.15; colorSum += colorTX.Sample( g_samLinear, float2( x + 2 * sampleSize, y )) * 0.12; colorSum += colorTX.Sample( g_samLinear, float2( x + 3 * sampleSize, y )) * 0.09; colorSum += colorTX.Sample( g_samLinear, float2( x + 4 * sampleSize, y )) * 0.05; //colorSum = colorSum / 9; return colorSum; } PSSceneIn VSQuad( VSSceneIn input ) { PSSceneIn output; output.pos = float4(input.pos, 1); output.tex = input.tex; return output; } float4 PSQuadHorizontal(PSSceneIn input, uniform bool bSampleMSAA ) : SV_Target { float4 outputColor; outputColor = horizontalBlur(input.tex.x, input.tex.y); return outputColor; } //PS doing the upsampling and blending float4 PSQuadVertical(PSSceneIn input, uniform bool bSampleMSAA ) : SV_Target { float4 outputColor; float4 originalColor = colorTX.Sample( g_samLinear, input.tex); //original Fullscreen-texture float4 blurredColor = colorBlurredHorizontalTX.Sample( g_samLinear, input.tex); //blurred (smaller) texture outputColor = originalColor + blurredColor; return outputColor; } and finally the interesting part of my draw-code //Blur pass 1: Horizontal Blur to small texture pd3dDevice->OMSetRenderTargets(1, &m_pColorRTV_horBlurred, m_pColor_horBlurredDSV); m_pShader_QuadColor->SetResource(m_pColorSRV); pd3dDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); UINT stride = sizeof(VertexposNormTexStruct); UINT offset = 0; pd3dDevice->IASetVertexBuffers(0, 1, &fsQuad.pQuadVB, &stride, &offset); m_pTechnique_Quad->GetPassByIndex(0)->Apply(0); //apply horizontal Blur- Pass pd3dDevice->Draw(4, 0); //Blur pass 2: Upsampling and blending pd3dDevice->OMSetRenderTargets(1, &pBackBufferRTView, pBackBufferDSView); m_pShader_QuadColor_horBlurred->SetResource(m_pColorSRV_horBlurred); m_pTechnique_Quad->GetPassByIndex(1)->Apply(0); pd3dDevice->Draw(4, 0);