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

gs2912

Members
  • Content count

    6
  • Joined

  • Last visited

Community Reputation

154 Neutral

About gs2912

  • Rank
    Newbie

Personal Information

  • Location
    Koblenz, Germany
  1.   That's the trick ... I used GL_RGBA before instead of GL_RGBA32F. Thank you very much, that helped :)
  2. Hey there, I'm trying to use positions in view space written to texture from a G-Buffer. Unfortunetly there are some heavy problems: Testing the view space positions by coloring the output when the position is greater than a given value results in the same pictures for every value lesser than 1.0. Beyond that, the G-Buffer renders correctly but the positions in the pass using the texture from the G-Buffer seem to not have any value.   Here are some picture - I hope they will make my problem better understandable: [attachment=14168:No_Error.png] [attachment=14169:Error.png]   Does anybody has had some similliar issues or has a clue, what it could be?
  3. Sorry for the late response, but here your are. I split the algorithm into two functions and remove some debugging stuff, I had there (e.g. a counter in the raytracing while loop for manually breaking the loop): vec4 SSR() { vec3 reflectedColor = vec3(0.0f); vec3 normal = normalize( texture(deferredNormalTex, vert_UV) ).xyz; // Depth at current fragment float currDepth = linearizeDepth( texture(deferredDepthTex, vert_UV).z ); // Eye position, camera is at (0, 0, 0), we look along negative z, add near plane to correct parallax vec3 eyePosition = normalize( vec3(0, 0, Camera.NearPlane) ); vec4 reflectionVector = ProjectionMatrix * reflect( vec4(-eyePosition, 0), vec4(normal, 0) ) ; // Call raytrace to get reflected color reflectedColor = raytrace(reflectionVector.xyz, currDepth); return vec4(reflectedColor, 1.0f); } /* * Raytracing to get reflected color */ vec3 raytrace(in vec3 reflectionVector, in float startDepth) { vec3 color = vec3(0.0f); float stepSize = rayStepSize; float size = length(reflectionVector.xy); reflectionVector = normalize(reflectionVector/size); reflectionVector = reflectionVector * stepSize; // Current sampling position is at current fragment vec2 sampledPosition = vert_UV; // Current depth at current fragment float currentDepth = startDepth; // The sampled depth at the current sampling position float sampledDepth = linearizeDepth( texture(deferredDepthTex, sampledPosition).z ); // Raytrace as long as in texture space of depth buffer (between 0 and 1) while(sampledPosition.x <= 1.0 && sampledPosition.x >= 0.0 && sampledPosition.y <= 1.0 && sampledPosition.y >= 0.0) { // Update sampling position by adding reflection vector's xy and y components sampledPosition = sampledPosition + reflectionVector.xy; // Updating depth values currentDepth = currentDepth + reflectionVector.z * startDepth; float sampledDepth = linearizeDepth( texture(deferredDepthTex, sampledPosition).z ); // If current depth is greater than sampled depth of depth buffer, intersection is found if(currentDepth > sampledDepth) { // Delta is for stop the raytracing after the first intersection is found // Not using delta will create "repeating artifacts" float delta = (currentDepth - sampledDepth); if(delta < 0.003f ) { color = texture(deferredDiffuseTex, sampledPosition).rgb; break; } } } return color; }   If you have some questions or comments, give it to me :). I'd like to get more into that whole screen space stuff and understand it more.  
  4. Okay, I got it working  , had' some space conversion problems. And adding the camera's near-plane value to the view vector helped very much:    
  5. I recently changed my code. I now calculate the reflected ray in the fragment shader of the g-Buffer using:   vec4 ReflectVec = normalize( reflect(vert_EyePosition, Normal) );   Where vert_EyePosition is the negative vertex position, which is multiplied with the model-view-matrix before in the vertex shader and Normal is the interpolated normal from the vertex shader. My resulting image of the reflected vector looks like this:     But acctually my tracing doesn't work now, so obviously my reflection vector wasn't correct before. Now I just have to get the tracing right...      
  6. Hey there gamedev people,   this is my firt post on the forums, even if I'm reading and searching here for some years now. I'm studying computer visualistics in Germany and do a lot of OpenGL programming at the moment.   I'm currently trying to implement screen space reflections, but got some issues. I first gather all informations in a G-Buffer (first pass rendering to frame buffer object) and do the lighting in a second pass. Then I have a third pass for calculating the reflections.   Unfortunatelly, my reflections seem to be dependent of a certain viewing direction. They start to appear or disappear depending on the incident angle. After implementing the approach several times and trying to understand the geometry on paper, this seems to be one of my last issues, until the reflections looks correct. I would be very happy if you'd take a lot at my code and hopefully someone can tell me my mistakes, I'd really appreciate that   Here's a short video to better show the problem: http://youtu.be/4fyVNkr4wkY   And here's my shader code:   /******************************************************************************/ // LATEST (working, with some perspective errors) /* SSR (screen space reflections) ******************************************************************************/ vec4 SSR() { // Variables vec4 fragmentColor = vec4(0.0f, 0.0f, 0.0f, 0.0f); float initalStep = 0.001f; float stepSize = 0.01f; float blurSize = 1.0f; // Current fragment vec2 fragment = gl_FragCoord.xy/vec2(Screen.Width, Screen.Height); vec2 ssfragment = 0.5f * fragment + 0.5f; vec3 ssPosition = vec3(ssfragment, 0.0f); ssPosition.z = linearizeDepth( texture(deferredDepthTex, vert_UV) ); // Normal & position vec3 vsNormal = normalize(texture(deferredNormalTex, fragment).xyz); vec3 vsPosition = texture(deferredPositionTex, fragment).xyz; // View vector vec3 vsViewVec = normalize( -ssPosition ); vsViewVec.y -= Camera.Position.y; // Reflection vector vec3 vsReflectVec = reflect(vsViewVec, vsNormal); vsReflectVec = normalize(vsReflectVec); // Initialze traced ray vec3 initialRay = vsReflectVec * initalStep; vec3 tracedRay = initialRay; // Get depth informations float fragmentDepth = linearizeDepth(texture(deferredDepthTex, fragment)); vec3 samplingPosition = ssPosition + tracedRay; float sampledDepth = linearizeDepth(texture(deferredDepthTex, samplingPosition.xy)); float rayDepth = ssPosition.z + tracedRay.z * fragmentDepth; // Ray tracing while in screen space int count = 0; while( samplingPosition.x > 0.0f && samplingPosition.x < 1.0f && samplingPosition.y > 0.0f && samplingPosition.y < 1.0f) { // Update sampling position and depth values samplingPosition.x = (2.0f * ssPosition.x - 1.0f) + tracedRay.x; samplingPosition.y = (2.0f * ssPosition.y - 1.0f) + tracedRay.y; sampledDepth = linearizeDepth( texture(deferredDepthTex, samplingPosition.xy) ); rayDepth = ssPosition.z + tracedRay.z * fragmentDepth; // intersection found if(rayDepth > sampledDepth) { if(abs(rayDepth - sampledDepth) < 0.005f) { fragmentColor = vec4( texture(deferredDiffuseTex, samplingPosition.xy).rgb, 1.0f ); break; } // Ray tracing termination break; } else fragmentColor = vec4(texture(deferredDiffuseTex, fragment).rgb, 1.0f); tracedRay += tracedRay * stepSize; count++; } // Return color from sampled fragment return fragmentColor; }