Jump to content
  • Advertisement
  • Advertisement
  • intellogo.png

    Are you ready to promote your game?

    Submit your game for Intel® certification by December 21, 2018 and you could win big! 

    Click here to learn more.

  • Latest Featured Articles

  • Featured Blogs

  • Advertisement
  • Popular Now

  • Similar Content

    • By babaliaris
      Hello!

      I was trying to load some textures and I was getting this access violation atioglxx.dll access violation
      stb image which i'm using to load the png file into the memory, was not reporting any errors.

      I found this on the internet explaining that it is a bug from AMD.
      I fixed that problem by changing the image file which i was using. The image that was causing this issue was generated by this online converter from gif to pngs.

      Does anyone know more about it?

      Thank you.
    • By lGuy
      Hi, I've recently been trying to implement screen space reflections into my engine, however, it is extremely buggy. I'm using this tutorial : http://imanolfotia.com/blog/update/2017/03/11/ScreenSpaceReflections.html
      The reflections look decent when I am close to the ground (first image), however when I get further away from the ground (the surface that is reflecting stuff), the reflections become blocky and strange (second image).
      I have a feeling that it has something to do with the fact that the further the rays travel in view space, the more scattered they get -> therefore the reflected image is less detailed hence the blockiness. However I really am not sure about this and if this is the case, I don't know how to fix it.
      It would be great if anyone had any suggestions around how to debug or sort this thing out. Thanks.
      Here is the code for the ray casting
      vec4 ray_cast(inout vec3 direction, inout vec3 hit_coord, out float depth_difference, out bool success) { vec3 original_coord = hit_coord; direction *= 0.2; vec4 projected_coord; float sampled_depth; for (int i = 0; i < 20; ++i) { hit_coord += direction; projected_coord = projection_matrix * vec4(hit_coord, 1.0); projected_coord.xy /= projected_coord.w; projected_coord.xy = projected_coord.xy * 0.5 + 0.5; // view_positions store the view space coordinates of the objects sampled_depth = textureLod(view_positions, projected_coord.xy, 2).z; if (sampled_depth > 1000.0) continue; depth_difference = hit_coord.z - sampled_depth; if ((direction.z - depth_difference) < 1.2) { if (depth_difference <= 0) { vec4 result; // binary search for more detailed sample result = vec4(binary_search(direction, hit_coord, depth_difference), 1.0); success = true; return result; } } } return vec4(projected_coord.xy, sampled_depth, 0.0); } Here is the code just before this gets called
      float ddepth; vec3 jitt = mix(vec3(0.0), vec3(hash33(view_position)), 0.5); vec3 ray_dir = reflect(normalize(view_position), normalize(view_normal)); ray_dir = ray_dir * max(0.2, -view_position.z); /* ray cast */ vec4 coords = ray_cast(ray_dir, view_position, ddepth);  


    • By lukash
      Hello everybody! I decided to write a graphics engine, the killer of Unity and Unreal. If anyone interested and have free time, join. High-level render is based on low-level OpenGL 4.5 and DirectX 11. Ideally, there will be PBR, TAA, SSR, SSAO, some variation of indirect light algorithm, support for multiple viewports and multiple cameras. The key feature is COM based (binary compatibility is needed). Physics, ray tracing, AI, VR will not. I grabbed the basic architecture from the DGLE engine. The editor will be on Qt (https://github.com/fra-zz-mer/RenderMasterEditor). Now there is a buildable editor. The main point of the engine is the maximum transparency of the architecture and high-quality rendering. For shaders, there will be no new language, everything will turn into defines.
    • By FantasyVII
      Hi everyone,
      I have an issue where my geometry color would flicker from red to black. I narrowed the issue down to it being caused by my Uniform Buffers, but for the life of me I cannot figure out why its happening.
      So I have two Uniform Buffers. One for my camera matrices and the other is for my material colors.
       
      This is my first buffer, the camera buffer and this is how it looks like
      struct SystemBuffer { BF::Math::Matrix4 modelMatrix; // 0 + 4 bytes * 4 floats * 4 vector4 = 64 byte BF::Math::Matrix4 viewMatrix; // 64 + 4 bytes * 4 floats * 4 vector4 = 128 byte BF::Math::Matrix4 projectionMatrix; // 128 + 4 bytes * 4 floats * 4 vector4 = 192 byte BF::Math::Vector4f cameraPosition; // 192 + 4 bytes * 4 floats = 208 byte }; This is 208 bytes and is aligned perfectly for OpenGL std140 as far as I know.
       
      This is my second buffer, the material buffer and this is how it looks like
      struct ColorBuffer { Color ambientColor; // 0 + 4 bytes * 4 floats = 16 byte Color diffuseColor; // 16 + 4 bytes * 4 floats = 32 byte Color specularColor; // 32 + 4 bytes * 4 floats = 48 byte float shininess = 0.0f; // 48 + 4 bytes = 52 byte }; This is 52 bytes and is also aligned perfectly for OpenGL std140 as far as I know.
       
      My issue is that if I remove the shininess variable from my color buffer, my geometry does not flicker to black at all and the problem is solved the flickering is reduced a lot but still does not get better. However, when I add that variable back it goes back to flickering. I tried to add padding as in add 3 more floats under the shininess variable to make my ColorBuffer a multiple of 16 bytes but that did not help at all.
       
      This is how my uniform buffer class looks like
      namespace BF { namespace Platform { namespace API { namespace OpenGL { GLConstantBuffer::GLConstantBuffer() : buffer(0), bindingIndex(0) { } GLConstantBuffer::~GLConstantBuffer() { GLCall(glDeleteBuffers(1, &buffer)); } void GLConstantBuffer::Create(unsigned int size, unsigned int bindingIndex) { this->bindingIndex = bindingIndex; GLCall(glGenBuffers(1, &buffer)); GLCall(glBindBufferBase(GL_UNIFORM_BUFFER, bindingIndex, buffer)); GLCall(glBufferData(GL_UNIFORM_BUFFER, size, nullptr, GL_STATIC_DRAW)); GLCall(glBindBuffer(GL_UNIFORM_BUFFER, 0)); } void GLConstantBuffer::Update(const void* data, unsigned int size) { GLCall(glBindBufferBase(GL_UNIFORM_BUFFER, bindingIndex, buffer)); GLCall(glBufferSubData(GL_UNIFORM_BUFFER, 0, size, data)); GLCall(glBindBuffer(GL_UNIFORM_BUFFER, 0)); } } } } }  
      This is my usage for the buffers
      void Camera::Initialize() { constantBuffer.Create(sizeof(SystemBuffer), 0); } void Camera::Update() { constantBuffer.Update(&systemBuffer, sizeof(SystemBuffer)); } //------ void ForwardRenderer::Initialize() { materialConstantBuffer.Create(sizeof(MeshMaterial::ColorBuffer), 2); } void ForwardRenderer::Render() { // clear depth + color buffers for (size_t i = 0; i < meshes.size(); i++) { //transform meshe constantBuffer.Update(&systemBuffer, sizeof(SystemBuffer)); materialConstantBuffer.Update(&meshes[i]->material->colorBuffer, sizeof(MeshMaterial::ColorBuffer)); //draw } }  
      and this is how my shader looks like
      vertexShader = R"( #version 450 core layout(location = 0) in vec3 inPosition; layout (std140, binding = 0) uniform camera_data { mat4 buffer_modelMatrix; mat4 buffer_viewMatrix; mat4 buffer_projectionMatrix; vec4 cameraPos; }; void main() { vec4 worldSpace = buffer_modelMatrix * vec4(inPosition.xyz, 1.0f); gl_Position = buffer_projectionMatrix * buffer_viewMatrix * worldSpace; } )"; pixelShader = R"( #version 450 core struct Material { vec4 ambientColor; vec4 diffuseColor; vec4 specularColor; float shininess; }; layout (std140, binding = 2) uniform MaterialUniform { Material material; }; out vec4 color; void main() { color = material.ambientColor * material.diffuseColor * material.specularColor; } )";  

      All these planes will flicker randomly to black then back to red.
       
      Any help would be greatly appreciated.
       
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!