• 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

184 Neutral

About harshman_chris

  • Rank
  1.   Yes I use various tools to check this, I believe the issue is because I am using 4 frames that are too close together so the effect is not noticeable.
  2.   None of those are the issue, what I need is how to blend the 4 frames together properly so it appears blurred, rather than just making the scene lighter or darker.
  3.   The current frame and the previous three frames
  4. So I am trying to come up with a way to do a motion blur effect without using the velocity vector method, this is not because I cannot do it with that, but a section of work I am working on where the requirement is to store each frame in an FBO then motion blur them.   Right now I pass my 4 FBO's into my shader. Then I run this fragment shader with them and output the result, I cannot seem to get this to produce any effect other than darkening or lighting the engine depending on changes to the code below. I have also tried mixing the frames together and applying weights. I think is is an issue on how many FBO frames I am holding.   #version 330 in vec2 uv0; uniform sampler2D Blur1; uniform sampler2D Blur2; uniform sampler2D Blur3; uniform sampler2D Blur4; out vec4 colour; void main() { vec3 colorA = texture2D(Blur1,uv0).rgb; vec3 colorB = texture2D(Blur2,uv0).rgb; vec3 colorC = texture2D(Blur3,uv0).rgb; vec3 colorD = texture2D(Blur4,uv0).rgb; colour.rgb = colorA + colorB + colorC + colorD; colour.rgb /= 4; }     How can I get a passable motion blur with 4 frames? I can also go up to 8 FBO frames.
  5. I am working on a project where I can take Papagayo 's lip sync output and use it on a Face Gen head in Maya through a mel script.   The only thing I am stuck on is Papagayo uses the  Preston Blair phoneme series, and I cannot find out what phoneme series Face Gen uses.   If anyone could help me out figuring out how to convert from one to the other that would be great.    
  6. So I am looking for a way to pass a Matrix4 from my program into my shader as an attribute.   As for the reason why, I am working on a particle system and every particle requires its own Model matrix so I can do things like per particle rotation.   I know you cannot just do this, because you can only used 1,2,3,4 where the 16 is. I do know I could split this into 4 vectors, but then I have to reassemble on the other side so I would rather not do that. glVertexAttribPointer(3, 16, GL_FLOAT, GL_FALSE, sizeof(ParticleData), (const GLvoid*)36);     Is there a way to pass this into the shader some way that doesn't involve me adding code to disassemble and reassemble my matrix?   Edit: I should add I have a struct that holds the information for each particle so I am using interleaving to pass data.   I also found a code sample that works for non interleaving:   for (unsigned int i = 0; i < 4 ; i++) { glEnableVertexAttribArray(WVP_LOCATION + i); glVertexAttribPointer(WVP_LOCATION + i, 4, GL_FLOAT, GL_FALSE, sizeof(Matrix4f), (const GLvoid*)(sizeof(GLfloat) * i * 4)); glVertexAttribDivisor(WVP_LOCATION + i, 1); }       As a side note, I am applying my ModelView to a GL_POINT which then gets passed into a Geometry shader, if I apply a rotation to that GL_POINT will it be reflected on the textured triangle strip that comes out the other side.     Edit:   Just my luck, I spend hours searching for an answer, decide to post and find it within 5 minutes after posting...   I just need to add the offset of 36 to the code above.
  7. I was going to post more info, but then I solved it. There was an issue with my game that was messing up my delta.
  8.   I use QueryPerformanceCounter and QueryPerformanceFrequency and delta is calulated like this:   delta = (float)((currentTime.QuadPart-lastTime.QuadPart) / PCFreq); I am also using OpenGL, and not DirectX   I am pretty sure it has to do something with the float values being 'messed up' when they are so small.
  9. So I am working on fixing an issue with my game loop and my particle systems which run fine on my average power laptop, but run really fast on my home desktop which is on the upper end of powerful for home PC's   I have the issue narrowed down on the fast computers to being delta when multiplied with my force then added to my velocity (which before this was 0). I get this happening (see attached)   My Final Velocity Value [attachment=14654:velocityvalues.png]   My Input Force [attachment=14653:Forcevalues.png]   My Input Delta [attachment=14652:Deltavalue.png]     So the question is how do I solve this so that this doesn't happen?
  10.   Tried it and I like I seem, it is still hard to understand what some of the leaks mean though.
  11. I am trying to debug memory leaks in my game application, which consists of a executable and a dynamic-link library.   This is the code I have added following some msdn pages.    #define _CRTDBG_MAP_ALLOC #include <stdlib.h> #include <crtdbg.h> #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) #define new DEBUG_NEW int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG ); init(); int result = loop(); deInit(); return result; }     My Output looks like this though:   Detected memory leaks! Dumping objects -> {298045} normal block at 0x0B0AB5F0, 32 bytes long. Data: <Threshold: 0.800> 54 68 72 65 73 68 6F 6C 64 3A 20 30 2E 38 30 30 {298037} normal block at 0x0B0A3B30, 8 bytes long. Data: < > 10 B3 0A 0B 00 00 00 00 {298020} normal block at 0x0B0AB0E8, 32 bytes long. Data: <Middle Grey: 0.1> 4D 69 64 64 6C 65 20 47 72 65 79 3A 20 30 2E 31 {298012} normal block at 0x0B0A3C60, 8 bytes long. Data: < > C0 AF 0A 0B 00 00 00 00     As far as I know I should be getting file and line numbers at this point, I did fine something earlier on gamedev that talked about this, but it didn't seem to resolve my issue and the post was quite old.   So how can I get better information about debugging these memory leaks?
  12.   Thank you that fixed it.
  13. So I am working on Gaussian Blurring of my scene, both with a single pass and a 2 pass, the problem is they look very different and they shouldn't because it is computationally the same.   I have attached sample images of the two blur's and the 3 fragment shaders. The images are normally more blurred but I made them full screen up from 1/4 screen size so you can see them.   Screenshots:   One Pass Blur [attachment=14369:OnePassBlur.png]   Two Pass Blur [attachment=14370:TwoPassBlur.png]   Shaders:   One Pass: #version 330 in vec2 uv1; out vec4 colour; uniform sampler2D brightpassInput; uniform vec2 pixelSize; vec2 uv0[25]; float weights[25]; vec3 GuassianBlur() { vec3 result = vec3(0.0); for(int i = 0; i < 25; i++) { result += texture2D(brightpassInput,uv0[i]).rgb * weights[i]; } return result; } void CalculateUvs_Weights() { // Top Row uv0[0] = uv1 + vec2(-pixelSize.x*2,pixelSize.y*2); uv0[1] = uv1 + vec2(-pixelSize.x,pixelSize.y*2); uv0[2] = uv1 + vec2(0,pixelSize.y*2); uv0[3] = uv1 + vec2(pixelSize.x,pixelSize.y*2); uv0[4] = uv1 + vec2(pixelSize.x*2,pixelSize.y*2); // Mid Top Row uv0[5] = uv1 + vec2(-pixelSize.x*2,pixelSize.y); uv0[6] = uv1 + vec2(-pixelSize.x,pixelSize.y); uv0[7] = uv1 + vec2(0,pixelSize.y); uv0[8] = uv1 + vec2(pixelSize.x,pixelSize.y); uv0[9] = uv1 + vec2(pixelSize.x*2,pixelSize.y); //Mid Row uv0[10] = uv1 + vec2(-pixelSize.x*2,0); uv0[11] = uv1 + vec2(-pixelSize.x,0); uv0[12] = uv1 + vec2(0,0); uv0[13] = uv1 + vec2(pixelSize.x,0); uv0[14] = uv1 + vec2(pixelSize.x*2,0); //Mid Bottom Row uv0[15] = uv1 + vec2(-pixelSize.x*2,-pixelSize.y); uv0[16] = uv1 + vec2(-pixelSize.x,-pixelSize.y); uv0[17] = uv1 + vec2(0,-pixelSize.y); uv0[18] = uv1 + vec2(pixelSize.x,-pixelSize.y); uv0[19] = uv1 + vec2(pixelSize.x*2,-pixelSize.y); //Bottom Row uv0[20] = uv1 + vec2(-pixelSize.x*2,-pixelSize.y*2); uv0[21] = uv1 + vec2(-pixelSize.x,-pixelSize.y*2); uv0[22] = uv1 + vec2(0,-pixelSize.y*2); uv0[23] = uv1 + vec2(pixelSize.x,-pixelSize.y*2); uv0[24] = uv1 + vec2(pixelSize.x*2,-pixelSize.y*2); weights[0] = 0.00078633; weights[1] = 0.00655965; weights[2] = 0.01330373; weights[3] = 0.00655965; weights[4] = 0.00078633; // Mid To weights[5] = 0.00655965; weights[6] = 0.05472157; weights[7] = 0.11098164; weights[8] = 0.05472157; weights[9] = 0.00655965; //Mid Row weights[10] = 0.01330373; weights[11] = 0.11098164; weights[12] = 0.22508352; weights[13] = 0.11098164; weights[14] = 0.01330373; //Mid Bot weights[15] = 0.00655965; weights[16] = 0.05472157; weights[17] = 0.11098164; weights[18] = 0.05472157; weights[19] = 0.00655965; //Bottom weights[20] = 0.00078633; weights[21] = 0.00655965; weights[22] = 0.01330373; weights[23] = 0.00655965; weights[24] = 0.00078633; } void main() { CalculateUvs_Weights(); colour.rgb = GuassianBlur(); }     Two Pass X: #version 330 vec2 uv0[5]; float weights[5]; in vec2 uv1; out vec4 colour; uniform sampler2D brightpassInput; uniform vec2 pixelSize; vec3 GuassianBlur() { vec3 result = vec3(0.0); for(int i = 0; i < 5; i++) { result += texture2D(brightpassInput,uv0[i]).rgb * weights[i]; } return result; } void CalculateUvs_Weights() { uv0[0] = uv1 + vec2(-pixelSize.x*2,0); uv0[1] = uv1 + vec2(-pixelSize.x,0); uv0[2] = uv1 + vec2(0,0); uv0[3] = uv1 + vec2(pixelSize.x,0); uv0[4] = uv1 + vec2(pixelSize.x*2,0); weights[0] = 0.01330373; weights[1] = 0.11098164; weights[2] = 0.22508352; weights[3] = 0.11098164; weights[4] = 0.01330373; } void main() { CalculateUvs_Weights(); colour.rgb = GuassianBlur(); }       Two Pass Y: #version 330 vec2 uv0[5]; float weights[5]; in vec2 uv1; out vec4 colour; uniform sampler2D brightpassInput; uniform vec2 pixelSize; vec3 GuassianBlur() { vec3 result = vec3(0.0); for(int i = 0; i < 5; i++) { result += texture2D(brightpassInput,uv0[i]).rgb * weights[i]; } return result; } void CalculateUvs_Weights() { uv0[0] = uv1 + vec2(0,pixelSize.y*2); uv0[1] = uv1 + vec2(0,pixelSize.y); uv0[2] = uv1 + vec2(0,0); uv0[3] = uv1 + vec2(0,-pixelSize.y); uv0[4] = uv1 + vec2(0,-pixelSize.y*2); weights[0] = 0.01330373; weights[1] = 0.11098164; weights[2] = 0.22508352; weights[3] = 0.11098164; weights[4] = 0.01330373; } void main() { CalculateUvs_Weights(); colour.rgb = GuassianBlur(); }          
  14.   Already done, same result.   Edit:   So I set the outColour to vec4(1.0,1.0,1.0,1.0);   and then I run GEDebugger, and it doesnt break when I break on error, but if I ad one line, such as this.   Edit Again:   So the error I get is on the glDrawElements - GL_INVALID_OPERATION.   Which is one of two things:   GL_INVALID_OPERATION is generated if a geometry shader is active and mode is incompatible with the input primitive type of the geometry shader in the currently installed program object. GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to an enabled array or the element array and the buffer object's data store is currently mapped.   Neither of these seem to apply though to this type of issue.     finalColor.r = (baseColour.r * (1.0 - 0.2)) + (cubeColor.r * 0.2);     It will break on an error, so there must be an error I will have to get and output. It is not a compile or linking error though because those are output.   Edit Again:   So I have narrowed down the issue to adding the the result of the first and second parts of the lerp.   Here is the first lerp part [attachment=14294:first.png]   The second lerp part [attachment=14295:second.png]   So these when added causes an OpenGL error. What would cause two vec3's being added together to cause this error? Considering both are valid on there own, but added them breaks it?
  15. I am working on environment mapping my objects from a skybox and I am getting an unexpected result, the final output is nothing, yet all the components that are used in created the final output are correct.     This is my reflective factor [attachment=14292:ReflectiveFactor.png]   this is my base colour [attachment=14290:baseColour.png]   Here is the environment mapped to the object [attachment=14293:subemap.png]   This is the final output from a mix() function, but I also tried just using the standard lerp (I wrote myself), which is all mix is. [attachment=14291:Final.png]   As you can see, all of the inputs are visible, but the output color is blank.   This is the combination line.   finalColor = vec4(mix(baseColour.rgb,cubeColor,reflectiveFactor),1.0);     I did the math by hand as well, and I do not get this result. Any help would be great.     Edit Attaching Shaders:   Vertex Shader #version 330 layout(location = 0) in vec3 vertex; layout(location = 1) in vec2 uv; layout(location = 2) in vec3 normal; layout(location = 3) in vec3 tangent; layout(location = 4) in vec3 bitangent; out vec2 uv0; out vec3 uv1; out vec3 normal0; out vec3 tangent0; out vec3 bitangent0; out vec3 worldPos0; uniform mat4 mvp; uniform mat4 world; uniform vec3 cameraEyeWorldPosition; void main() { gl_Position = mvp * vec4(vertex,1.0); uv0 = uv; normal0 = (world * vec4(normal,1.0)).xyz; tangent0 = (world * vec4(tangent,1.0)).xyz; worldPos0 = (world * vec4(vertex,1.0)).xyz; bitangent0 = (world * vec4(bitangent,1.0)).xyz; vec3 E = normalize(worldPos0 - cameraEyeWorldPosition); uv1 = reflect(E,normal0); } Fragment Shader #version 330 struct Attenuation { float constant; float linear; float exponential; }; struct BaseLight { vec4 colour; float ambientIntensity; float diffuseIntensity; }; struct DirectionalLight { BaseLight base; vec3 direction; }; struct PointLight { BaseLight base; vec3 position; Attenuation attenuation; }; struct SpotLight { PointLight base; vec3 direction; float cutoff; }; vec3 CalcBumpedNormal(); vec4 CalcLightInternal(BaseLight _light, vec3 _lightDirection, vec3 _normal); vec4 CalcDirectionalLight(vec3 _normal); vec4 CalcPointLight(PointLight _light, vec3 _normal); vec4 CalcSpotLight(SpotLight _light, vec3 _normal); const int MAX_POINT_LIGHTS = 10; const int MAX_SPOT_LIGHTS = 5; in vec2 uv0; in vec3 uv1; in vec3 normal0; in vec3 tangent0; in vec3 bitangent0; in vec3 worldPos0; out vec4 finalColor; uniform DirectionalLight directionalLight; uniform PointLight pointLights[MAX_POINT_LIGHTS]; uniform SpotLight spotLights[MAX_SPOT_LIGHTS]; uniform int numPointLights = 0; uniform int numSpotLights = 0; uniform vec3 cameraEyeWorldPosition = vec3(0.0,0.0,0.0); uniform sampler2D diffuseTexture; uniform sampler2D ambientTexture; uniform sampler2D normalTexture; uniform sampler2D specularTexture; uniform sampler2D glossTexture; uniform sampler2D reflectiveTexture; uniform samplerCube cubeMapTexture; void main() { finalColor = vec4(1.0,1.0,1.0,1.0); vec4 MaterialDiffuseColor = texture2D(diffuseTexture, uv0); vec3 Normal = CalcBumpedNormal(); vec4 TotalLight = vec4(0.0,0.0,0.0,1.0); TotalLight = CalcDirectionalLight(Normal); for (int i = 0; i < numPointLights; i++) { TotalLight = TotalLight + CalcPointLight(pointLights[i], Normal); } for (int i = 0 ; i < numSpotLights ; i++) { TotalLight += CalcSpotLight(spotLights[i], Normal); } float reflectiveFactor = texture2D(reflectiveTexture, uv0).r; vec3 cubeColor = texture(cubeMapTexture, uv1.xyz).rgb; finalColor = MaterialDiffuseColor * TotalLight; finalColor = vec4(mix(finalColor.rgb,cubeColor,reflectiveFactor),1.0); } vec3 CalcBumpedNormal() { vec3 Normal = normalize(normal0); vec3 Tangent = normalize(tangent0); vec3 Bitangent = normalize(bitangent0); Tangent = normalize(Tangent - dot(Tangent, Normal) * Normal); vec3 BumpMapNormal = texture(normalTexture, uv0).xyz; BumpMapNormal = 2.0 * BumpMapNormal - vec3(1.0, 1.0, 1.0); vec3 NewNormal; mat3 TBN = mat3(Tangent, Bitangent, Normal); NewNormal = TBN * BumpMapNormal; NewNormal = normalize(NewNormal); return NewNormal; } vec4 CalcLightInternal(BaseLight _light, vec3 _lightDirection, vec3 _normal) { vec3 VertexToEye = vec3(0.0, 0.0, 0.0); VertexToEye = normalize(cameraEyeWorldPosition - worldPos0); vec4 AmbientColor = vec4(0.0, 0.0, 0.0, 0.0); AmbientColor = _light.colour * (texture2D(ambientTexture, uv0)); float DiffuseFactor = 1.0; DiffuseFactor = dot(normalize(_normal), _lightDirection); DiffuseFactor = max(0.0,DiffuseFactor); vec4 DiffuseColor = vec4(0.0, 0.0, 0.0, 0.0); vec4 SpecularColor = vec4(0.0, 0.0, 0.0, 0.0); DiffuseColor = _light.colour * _light.diffuseIntensity * DiffuseFactor; vec3 LightReflect = vec3(0.0, 0.0, 0.0); float SpecularFactor = 0.0; LightReflect = 2.0 * dot(_lightDirection, normal0) * normal0 - _lightDirection; SpecularFactor = dot(VertexToEye, LightReflect);; SpecularFactor = max(0.0,SpecularFactor); float specularPower = (texture2D(glossTexture, uv0).r); float specularIntensity = texture2D(specularTexture, uv0).r; SpecularFactor = pow(SpecularFactor, specularPower); SpecularColor = _light.colour * specularIntensity * SpecularFactor; return (AmbientColor /*+ RimColor*/ + DiffuseColor + SpecularColor); } vec4 CalcDirectionalLight(vec3 _normal) { return CalcLightInternal(directionalLight.base, directionalLight.direction, _normal); } vec4 CalcPointLight(PointLight _light, vec3 _normal) { vec3 LightDirection = vec3(0.0, 0.0, 0.0); float Distance = 0.0; LightDirection = worldPos0 - _light.position; Distance = length(LightDirection); LightDirection = normalize(LightDirection); vec4 Color = vec4(0.0, 0.0, 0.0, 0.0); float Attenuation = 1.0; Color = CalcLightInternal(_light.base, LightDirection, _normal); Attenuation = _light.attenuation.constant + _light.attenuation.linear * Distance + _light.attenuation.exponential * Distance * Distance; return Color/Attenuation; } vec4 CalcSpotLight(SpotLight _light, vec3 _normal) { vec3 LightToPixel = vec3(0.0,0.0,0.0); float SpotFactor = 0.0; LightToPixel = normalize(worldPos0 - _light.base.position); SpotFactor = dot(LightToPixel, _light.direction); if (SpotFactor > _light.cutoff) { vec4 Color = CalcPointLight(_light.base, _normal); return Color * (1.0 - (1.0 - SpotFactor) * 1.0/(1.0 - _light.cutoff)); } else { return vec4(0.0, 0.0, 0.0, 0.0); } }   This issue is now solved, I had two textures using the same texture unit.