🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Shadow map and ambient occlusion at the same time

Started by
12 comments, last by AndreyVK_D3D 3 years, 7 months ago

Now that I have shadow maps working, I'd like to add in ambient occlusion. I have all of the code in place, and I try to draw a fullscreen quad, but it's like the shader isn't called. The code is at https://github.com/sjhalayka/opengl4_stlview_shadow_map

The relevant code is in main.cpp on line 342.

Any ideas?

Advertisement

@taby Try it:

glBindVertexArray(quad_vao);

glDisable(GL_CULL_FACE);

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

glEnable(GL_CULL_FACE);

3DGraphics,Direct3D12,Vulkan,OpenCL,Algorithms

Sorry, but that has no effect. :(

@taby

  1. could you add executable file of Visual Studio project ? I need RenderDoc capture, it can help
  2. try to draw screen quad with VB/IB, instead of reading Vertex's Position inside Vertex's shader
  3. try to comment all code except drawing of fullscreen's quad, may be problem in some GL state

3DGraphics,Direct3D12,Vulkan,OpenCL,Algorithms

Hi again, Andrey. I tried a few things, but I'm still stuck.

A reference SSAO code that works is at: https://github.com/sjhalayka/opengl4_stlview

Thanks for your time!

@taby Hi.

glutInitContextVersion(3, 3);

glutInitContextProfile(GLUT_COMPATIBILITY_PROFILE);

glutInitContextProfile(GLUT_CORE_PROFILE); // need for RenderDoc, but doesn't work

I will continue later.

3DGraphics,Direct3D12,Vulkan,OpenCL,Algorithms

taby said:
and I try to draw a fullscreen quad, but it's like the shader isn't called

ssao.fs.glsl:

void main(void)

{

// Get texture position from gl_FragCoord

vec2 P = gl_FragCoord.xy / textureSize(sNormalDepth, 0);

// ND = normal and depth

vec4 ND = textureLod(sNormalDepth, P, 0);

// Extract normal and depth

vec3 N = ND.xyz;

float my_depth = ND.w;

if(my_depth <= 1.0)

{

colour = textureLod(sColor, P, 0);

return;

}

colour = vec4(1.0f, 0.0, 0.0f, 1.0f);

}

you should simplify SSAO pixel shader to find problem. your shader called

3DGraphics,Direct3D12,Vulkan,OpenCL,Algorithms

Hi again Andrey,

Thanks for your help. Is there any chance that you could please upload your version of the code to a repository on GitHub?

@taby , Hi I'm going to upload my modification today, later

3DGraphics,Direct3D12,Vulkan,OpenCL,Algorithms

@taby , Hi https://github.com/Andreyogld3d/opengl4_stlview

3DGraphics,Direct3D12,Vulkan,OpenCL,Algorithms

This topic is closed to new replies.

Advertisement