Ambient Occlusion Shader

I was wondering if anyone has been able to get a working ambient occlusion shader in jMonkey - I've been fumbling around with fragment programs designed to work with c++, and haven't had any working results as of yet.



Seems like most other effects have already been handled quite well (e.g. parallax mapping, normal mapping, bloom, etc) so hoping that someone has had some success with amb occ. Thanks!!

If you're using an occlusion map, you can just read the tex coord of the map in the fragment shader into a vec3 variable, and use multiply the r/x/s component with your ambient factor before computing your colour out to gl_FragColor.

What I'm trying to do is implement Dynamic Ambient Occlusion w/ Indirect Lighting pass. This means that the occlusion is calculated in real time. The algorithm that I'm using does not actually calculate the visibility of one element to another, but uses shadowing information from nearby poly's to calculate the final fragment values.



A precomputed amb occlusion pass is what your suggesting, and this is a little bit different. I guess I'm treading in new waters here, so I'll keep working on it and then share results once I get it working.



Basically I'm porting a CG shader version of this effect to GLSL, and its just not wanting to work, I keep getting shader errors.

Why dont you show us the shader?