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

rocklobster

Members
  • Content count

    92
  • Joined

  • Last visited

Community Reputation

415 Neutral

About rocklobster

  • Rank
    Member
  1. Hey guys,   Since the start of my hobby project, I've been using one PC for development which is using an ATI card. I've just tried to run my project on my friends computer and my laptop (both have nVidia cards) and nothing renders, the screen is the same colour as the glClear(...) with nothing showing.    I did some debugging with glGetError and I'm not getting any errors showing up. I removed my render target and just rendered my scene to the default framebuffer and then things started drawing (minus the post-processing). So this leads me to believe my framebuffer object is not created correctly for nVidia cards? bool Graphics::CreateRenderTarget( RenderTarget* target ) { GLuint fbo; glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo); target->SetFrameBufferId(fbo); for (uint32 i = 0; i < target->GetNumSources(); i++) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); GLuint tex; glActiveTexture(GL_TEXTURE0 + i); glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, target->GetWidth(), target->GetHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE, 0); glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, tex, 0); target->SetSourceId(i, tex); } if (target->UseDepth()) { GLuint depth; glGenRenderbuffers(1, &depth); glBindRenderbuffer(GL_RENDERBUFFER, depth); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, target->GetWidth(), target->GetHeight()); target->SetDepthBufferId(depth); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth); } glDrawBuffers(target->GetNumSources(), target->GetDrawBuffers()); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { return false; } return true; } Anything obviously incorrect? I can post more info If needed.
  2. Runs fine on my machine (60 always):   CPU: i5-2500k 3.3ghz RAM: 12GB OS: Windows 64-bit GPU: Sapphire 6950
  3. Awesome mate, seems to be working fine now! Cheers for the help.
  4. Cheers I'll give it a shot when I get home from work.
  5. Ok so this is what I've changed: glm::mat4 modelMatrix = modelNode->GetTransform(); glm::mat4 modelView = viewMatrix * modelMatrix; glm::mat4 mvp = m_renderSystem->GetCamera()->GetProjectionMatrix() * modelView; glm::mat3 normalMat = glm::transpose(glm::inverse(glm::mat3(modelView))); m_graphics->SetUniform(id, "u_NormalMatrix", 1, false, normalMat); m_graphics->SetUniform(id, "u_ModelMatrix", 1, false, modelMatrix); m_graphics->SetUniform(id, "u_ModelViewMatrix", 1, false, modelView); m_graphics->SetUniform(id, "u_MVP", 1, false, mvp);  Vertex Shader:   Multiplying the in_Position by the u_ModelMatrix, getting the direction from the light position to the vertex in world space and then multiplying by normal matrix to get oriented in eye space. void main() { PositionEye = vec3(u_ModelViewMatrix * vec4(in_Position, 1.0)); NormalEye = u_NormalMatrix * in_Normal; TexCoord = in_TexCoord; vec3 PosWorld = vec3(u_ModelMatrix * vec4(in_Position, 1.0)); vec3 lightDirWorld = normalize(GlobalLightPos - PosWorld); LightDirEye = u_NormalMatrix * lightDirWorld; gl_Position = u_MVP * vec4(in_Position, 1.0); } Fragment Shader:   Basically the same, doing normalising here instead of vertex shader. vec3 shadePixel(vec3 diff) { vec3 s = normalize(LightDirEye); float sDotN = max(dot(s, normalize(NormalEye)), 0.0); vec3 diffuse = vec3(1.0, 1.0, 1.0) * diff * sDotN; return diffuse; } void main() { vec3 diff = texture(Texture, TexCoord * TexRepeat); out_Position = PositionEye; out_Normal = normalize(NormalEye); out_Diffuse = shadePixel(texture(Texture, TexCoord * TexRepeat)); out_Tangent = Tangent; out_Binormal = Binormal; } Now this seems to be creating a weird effect, half of my world is shaded which looks normal, the other half is just completely black!?!
  6. Thanks,     It was a point light previously (Sun) but I figured I could switch it easily to a directional light by just getting the direction from it's position to the vertex's position? To transform the in_Position into world space would just be: vec3 PosWorld = vec3(ModelMatrix * vec4(in_Position, 1.0)); correct?          Assuming your model's normal are in object space you need to be using the product of the model view matrix here.  That's one problem.   I'm not sure what you mean by "product of the model view matrix"?    something like this: glm::mat3 normalMatrix = glm::transpose(glm::inverse(glm::mat3(modelView))); So it is the inverse of the ModelView rather than just the View?   I can't test this out at the moment but I'll post back with results later on.
  7. Hey guys,   I'm implementing deferred shading and I've decided to calculate shading for a single global light in the first pass, then do all the other lights in the second pass. I'm not sure If I've got my normal/light and vertex positions all in the correct space and the lighting effect does not look correct.   Vertex shader: #version 400 layout (location = 0) in vec3 in_Position; layout (location = 1) in vec3 in_Normal; layout (location = 2) in vec3 in_TexCoord; layout (location = 3) in vec3 in_Tangent; layout (location = 4) in vec3 in_Binormal; out vec3 PositionEye; out vec3 NormalEye; out vec3 TexCoord; out vec3 Tangent; out vec3 Binormal; out vec3 LightDirEye; uniform vec3 GlobalLightPos; uniform mat4 u_ModelMatrix; uniform mat4 u_ViewMatrix; uniform mat4 u_ModelViewMatrix; uniform mat3 u_NormalMatrix; uniform mat4 u_MVP; void main() { PositionEye = vec3(u_ModelViewMatrix * vec4(in_Position, 1.0)); NormalEye = u_NormalMatrix * in_Normal; TexCoord = in_TexCoord; vec3 lightDirWorld = normalize(GlobalLightPos - in_Position); LightDirEye = u_NormalMatrix * lightDirWorld; gl_Position = u_MVP * vec4(in_Position, 1.0); } Fragment shader: #version 400 in vec3 PositionEye; in vec3 NormalEye; in vec3 TexCoord; in vec3 Tangent; in vec3 Binormal; in vec3 LightDirEye; uniform sampler2D Texture; uniform float TexRepeat; layout (location = 0) out vec3 out_Position; layout (location = 1) out vec3 out_Normal; layout (location = 2) out vec3 out_Diffuse; layout (location = 3) out vec3 out_Tangent; layout (location = 4) out vec3 out_Binormal; vec3 shadePixel(vec3 diff) { vec3 s = LightDirEye; float sDotN = max(dot(s, NormalEye), 0.0); vec3 diffuse = vec3(1.0, 1.0, 1.0) * diff * sDotN; return diffuse; } void main() { vec3 diff = texture(Texture, TexCoord * TexRepeat); out_Position = PositionEye; out_Normal = NormalEye; out_Diffuse = shadePixel(texture(Texture, TexCoord * TexRepeat)); out_Tangent = Tangent; out_Binormal = Binormal; } Uniforms: glm::vec3 lightPos = m_sceneGraph->GetGlobalLightPos(); glm::mat4 viewMatrix = m_renderSystem->GetCamera()->GetViewMatrix(); glm::mat3 normalMat = m_renderSystem->GetCamera()->GetNormalMatrix(); m_graphics->SetUniform(id, "GlobalLightPos", lightPos); m_graphics->SetUniform(id, "u_ViewMatrix", 1, false, viewMatrix); m_graphics->SetUniform(id, "u_NormalMatrix", 1, false, normalMat); glm::mat4 modelMatrix = modelNode->GetTransform(); glm::mat4 modelView = viewMatrix * modelMatrix; glm::mat4 mvp = m_renderSystem->GetCamera()->GetProjectionMatrix() * modelView; m_graphics->SetUniform(id, "u_ModelMatrix", 1, false, modelMatrix); m_graphics->SetUniform(id, "u_ModelViewMatrix", 1, false, modelView); m_graphics->SetUniform(id, "u_MVP", 1, false, mvp); The light pos is just glm::vec3(0.0f, 50.0f, 0.0f)   and the normal matrix is: glm::mat3 Camera::GetNormalMatrix() { return glm::transpose(glm::inverse(glm::mat3(m_view))); } Can't seem to work out what is going wrong here.
  8. Ah ok, I get it thanks. I was wondering about this also, because not all of my geometry has Tangents and BiTangents also, which is a bit annoying... Thanks for all your help.
  9. Just one last thing, what do you mean when you say "one shader for every material type"?   My definition of a material is just something like: class Material { Vec3 diffuse Vec3 ambient Vec3 specular Tex2 diffuse_Map Tex2 normal_Map Tex2 specular_Map } so I don't know what you mean.
  10. Thanks. Right now I'm currently outputting Position, Normal, Diffuse, Tangent and BiTangent. Should I also output specular and ambient properties? Or will this be too much memory usage?
  11. Hey guys,   I've attempted to implement deffered shading lately and I'm a bit confused about the lighting stage.   This is the algorithm for what I do at the moment: FirstPass - Bind render target - bind my G-buffer shader program - render the scene SecondPass - Bind my normal shader for rendering the quad (fragment shader takes Position, Normal and Diffuse samplers as uniforms) - Render full screen quad - swap buffers So am I right to assume that to light the scene I should also add this change to the second pass: SecondPass - Bind my normal shader for rendering the quad (fragment shader takes Position, Normal and Diffuse samplers as uniforms) - FOR EACH LIGHT IN THE SCENE - Set this light as uniform for the shader - Render full screen quad - END FOR - swap buffers And in my fragment shader I'll have the code which shades all the pixels based on the type of light passed in (directional, point or spot).   Cheers for any help
  12. Awesome thanks! That was a great explanation.
  13. What is jointOrientX? Why is it there? Why is there a sub-node with the suffix -pivot?   Can someone please explain this to me, here is part of the .dae file: <node name="Box012" id="Box012" sid="Box012"> <translate sid="translate">91.838813 42.641855 -53.673642</translate> <rotate sid="jointOrientX">1 0 0 -90.000000</rotate> <scale sid="scale">2.540000 2.540000 2.540000</scale> <node id="Box012-Pivot" name="Box012-Pivot"> <translate>0.000000 -13.999999 -0.128876</translate> <rotate>0.000000 0.000000 0.000000 0.000000</rotate> <instance_geometry url="#Box012-lib"> <bind_material> <technique_common> <instance_material symbol="_04 - Default" target="#_04 - Default"/> </technique_common> </bind_material> </instance_geometry> </node> <extra> <technique profile="FCOLLADA"> <visibility>1.000000</visibility> </technique> </extra> </node> The object "Box012" is not rendered in the correct place, and I think it is because it doesn't have the transform of "Box012-Pivot". But pivot is a sub node, and it doesn't reference any mesh? I'm a bit confused why it's even there. I don't remember having a pivot when I exported from 3ds max. 
  14. Just thought I'd link this http://www.gamedev.net/topic/634564-catering-for-multiple-vertex-definitions/#entry5002042   A similar thread I started quite a while ago. Roughly the same stuff, but maybe you'll find some more useful info in there.