SSAO Compositor

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
User avatar
stealth977
Gnoll
Posts: 638
Joined: Mon Dec 15, 2008 6:14 pm
Location: Istanbul, Turkey
x 42

Re: SSAO Compositor

Post by stealth977 »

Nullsquared:

I recently added basic compositor support to Ogitor (and can be extended using custom plugins). The current basic state only uses plugNplay compositors, which dont depend on any listeners to set parameters.

To save me from writing a custom SSAO compositor plugin, is it possible to provide shaders which dont depend on the compositor listener for params? So I can check if it works or not with ogitor...

ismail,
Ismail TARIM
Ogitor - Ogre Scene Editor
WWW:http://www.ogitor.org
Repository: https://bitbucket.org/ogitor
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: SSAO Compositor

Post by nullsquared »

No, the listener provides camera properties which are not accessible via the compositor script alone.
User avatar
stealth977
Gnoll
Posts: 638
Joined: Mon Dec 15, 2008 6:14 pm
Location: Istanbul, Turkey
x 42

Re: SSAO Compositor

Post by stealth977 »

nullsquared wrote:No, the listener provides camera properties which are not accessible via the compositor script alone.
Oh ok, i asked since you mentioned it would be possible to set them inside the shader but you wanted to save shader count, i guess that got changed in the process :) I will try to make it a plugin for ogitor then :)

ismail,
Ismail TARIM
Ogitor - Ogre Scene Editor
WWW:http://www.ogitor.org
Repository: https://bitbucket.org/ogitor
User avatar
Nargil
Greenskin
Posts: 124
Joined: Thu Feb 15, 2007 8:47 pm

Re: SSAO Compositor

Post by Nargil »

Is there something I can do to remove this spotlight that appears on my ssao ? I don't use any flashlight like in the demo, and it looks odd. Well, with diffuse you actually can't see it, but lets say I'm a perfectionist ;)

Image

More important:
Would there be also a method to decrase the cameras far clip plane only for ssao ? High causes errors in ssao, but I need it high for caelums clouds.

Ps. Performance seems a bit poor. No ssao = ~124 fps, ssao without blur = ~72 fps, ssao with blur = ~55 fps
Hardcore libertarian, hardcore programmer.
Dell M6300: T9300, 4GB, Quadro FX1600M, 17" 1920x1200p non-glare, OCZ Vertex 120 + external Seagate 120GB 7200.3
Use the power of 2 - literally. Non 2^n texture sizes may crash your graphic driver
User avatar
Nargil
Greenskin
Posts: 124
Joined: Thu Feb 15, 2007 8:47 pm

Re: SSAO Compositor

Post by Nargil »

Ok: Figured out how to fix the the farclip problem.

Here are some steps:
1. Check for what farclip distance SSAO works fine. (my was 10000)
2. Set your camera to a farcliplane you want. (My is 600000)
3. Divide it 600000 / 10000 = 60
4. change the listener:

Code: Select all

class ssaoListener: public Ogre::CompositorInstance::Listener
{
	// this callback we will use to modify SSAO parameters
	void notifyMaterialRender(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat)
	{
		if (pass_id != 42) // not SSAO, return
			return;

		// this is the camera you're using
		Ogre::Camera *cam = GameEngine::getSingletonPtr()->getCamera();
		Ogre::Real fardist = cam->getFarClipDistance(); // <--- here
		cam->setFarClipDistance(10000); // <--- here

		// calculate the far-top-right corner in view-space
		Ogre::Vector3 farCorner = cam->getViewMatrix(true) * cam->getWorldSpaceCorners()[4];

		// get the pass
		Ogre::Pass *pass = mat->getBestTechnique()->getPass(0);

		// get the vertex shader parameters
		Ogre::GpuProgramParametersSharedPtr params = pass->getVertexProgramParameters();
		// set the camera's far-top-right corner
		if (params->_findNamedConstantDefinition("farCorner"))
			params->setNamedConstant("farCorner", farCorner);

		// get the fragment shader parameters
		params = pass->getFragmentProgramParameters();
		// set the projection matrix we need
		static const Ogre::Matrix4 CLIP_SPACE_TO_IMAGE_SPACE(
			0.5,    0,    0,  0.5,
			0,   -0.5,    0,  0.5,
			0,      0,    1,    0,
			0,      0,    0,    1);
		if (params->_findNamedConstantDefinition("ptMat"))
			params->setNamedConstant("ptMat", CLIP_SPACE_TO_IMAGE_SPACE * cam->getProjectionMatrixWithRSDepth());
		if (params->_findNamedConstantDefinition("far"))
			params->setNamedConstant("far", cam->getFarClipDistance());

		cam->setFarClipDistance(fardist);  // <--- here
	}
};
5. edit your geom_ps shader

Code: Select all

geomOut geom_ps(in float4 vp : TEXCOORD0, in float4 vn : TEXCOORD1, uniform float far)
{
    geomOut OUT;
    float COEF = 60; // <-- thats the value we computed in step 3
	OUT.c = float4(length(vp.xyz) * COEF / far, normalize(vn.xyz).xyz);
    return OUT;
}
This screen shows ssao with camera farclip 10000
Image
This screen shows ssao with camera farclip 600000 and the above tweaks
Image
I see no difference at all :)

and this shows the problem with 600000 farclip plane without tweaks
Image
Hardcore libertarian, hardcore programmer.
Dell M6300: T9300, 4GB, Quadro FX1600M, 17" 1920x1200p non-glare, OCZ Vertex 120 + external Seagate 120GB 7200.3
Use the power of 2 - literally. Non 2^n texture sizes may crash your graphic driver
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: SSAO Compositor

Post by nullsquared »

I can't really see the "spotlight". It's probably just some biasing issue; look in the loop code where the random sample is "biased" by the pixel's normal - scale the pixels normal by some coefficient (like 1.5 or 1.25 or whatever) to adjust the bias. If it looks fine with diffuse, though, then that means it's fine. That's like saying that the insides of a computer look ugly without the case cover on, and need to be made prettier...

As for performance... I get 100 FPS and above in the demo on my 8800GTS at 1024x768... I suppose the blur can be optimized a bit. What card do you have? The one in your signature? That's a workstation card, I'm not sure if it's meant for this sort of pixel crunching.
User avatar
Noman
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 714
Joined: Mon Jan 31, 2005 7:21 pm
Location: Israel
x 2

Re: SSAO Compositor

Post by Noman »

Cool stuff!

A remark and a request :
Remark : Assuming my SoC project gets selected, one of the things that I will be adding is coupling between compositor-listener plugins and compositors in scripts. That means that the script will have a 'listener_plugin' or similar directive, and that plugin will be loaded in real time and attached to the compositor, leading to truly disconnecting between the compositor and the listener plugin. More details can be found at The GSoC project thread . You know you want it :)

Request : I want to use this SSAO compositor as one of my test cases for the SoC project. Is that alright with you nullsquared? (Sent you a PM btw)
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: SSAO Compositor

Post by nullsquared »

Noman wrote:Cool stuff!

A remark and a request :
Remark : Assuming my SoC project gets selected, one of the things that I will be adding is coupling between compositor-listener plugins and compositors in scripts. That means that the script will have a 'listener_plugin' or similar directive, and that plugin will be loaded in real time and attached to the compositor, leading to truly disconnecting between the compositor and the listener plugin. More details can be found at The GSoC project thread . You know you want it :)

Request : I want to use this SSAO compositor as one of my test cases for the SoC project. Is that alright with you nullsquared? (Sent you a PM btw)
Sure, feel free to use it in any way you want. Sorry for not replying to your PM, haven't found the time. Will reply ASAP.
User avatar
stealth977
Gnoll
Posts: 638
Joined: Mon Dec 15, 2008 6:14 pm
Location: Istanbul, Turkey
x 42

Re: SSAO Compositor

Post by stealth977 »

Noman wrote:Cool stuff!

A remark and a request :
Remark : Assuming my SoC project gets selected, one of the things that I will be adding is coupling between compositor-listener plugins and compositors in scripts. That means that the script will have a 'listener_plugin' or similar directive, and that plugin will be loaded in real time and attached to the compositor, leading to truly disconnecting between the compositor and the listener plugin. More details can be found at The GSoC project thread . You know you want it :)

Request : I want to use this SSAO compositor as one of my test cases for the SoC project. Is that alright with you nullsquared? (Sent you a PM btw)
Infact, using plugins for compositor listeners can be a bright idea, making compositors totally plugNplay :)

ismail,
Ismail TARIM
Ogitor - Ogre Scene Editor
WWW:http://www.ogitor.org
Repository: https://bitbucket.org/ogitor
User avatar
Nargil
Greenskin
Posts: 124
Joined: Thu Feb 15, 2007 8:47 pm

Re: SSAO Compositor

Post by Nargil »

nullsquared wrote:As for performance... I get 100 FPS and above in the demo on my 8800GTS at 1024x768... I suppose the blur can be optimized a bit. What card do you have? The one in your signature? That's a workstation card, I'm not sure if it's meant for this sort of pixel crunching.
For now only tested on that from sig. It's a mobile geforce 8700m gt card with addinational quadro instructions. Nvidia didn't remove anything from it's base card to make it quadro. Just added some nice features that can be used in 3dsmax or autocad. I will see how the performance scales on a 8800gt, but i think the reason for such a slowdown is the geom pass added to each object (I have a large terrain tile with very much vertices)
Hardcore libertarian, hardcore programmer.
Dell M6300: T9300, 4GB, Quadro FX1600M, 17" 1920x1200p non-glare, OCZ Vertex 120 + external Seagate 120GB 7200.3
Use the power of 2 - literally. Non 2^n texture sizes may crash your graphic driver
osknoes
Gnoblar
Posts: 15
Joined: Tue Jan 20, 2009 4:33 am
Location: Montreal, Canada

Re: SSAO Compositor

Post by osknoes »

null, I've a question for you.
As I read in the old thread, you said we can use the same linear depth to do a deferred shading effect.
The point with the SSAO, is that we use the view direction vectors of the camera frustum, interpolated with a full screen quad.
Well, if we're using deferred with a sphere to represent a point light, how we can use the linear depth to get the position in view space, using the same normal+depth texture.

Thanks.
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: SSAO Compositor

Post by nullsquared »

Pass the top-right-far frustum corner to the vertex shader of the sphere, and do this:

Code: Select all

OUT.pos = mul(worldViewProj, IN.pos); // screen-space output position
// 'fix' the ray vector based on this final position
OUT.ray = topRightFarCorner * float3(OUT.pos.x, OUT.pos.y, 1);
User avatar
Nargil
Greenskin
Posts: 124
Joined: Thu Feb 15, 2007 8:47 pm

Re: SSAO Compositor

Post by Nargil »

There seems to be something wrong at caelums night:
http://www.youtube.com/watch?v=_zd_AaT93ck

I tried to revert my changes, and change the farclip to 10k. It's the same.
Neither caelum materials nor hydrax materials have the geom technique. IMO they should be just white...
I have no clue what's happening, and why it's just during night...
Hardcore libertarian, hardcore programmer.
Dell M6300: T9300, 4GB, Quadro FX1600M, 17" 1920x1200p non-glare, OCZ Vertex 120 + external Seagate 120GB 7200.3
Use the power of 2 - literally. Non 2^n texture sizes may crash your graphic driver
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 116

Re: SSAO Compositor

Post by mkultra333 »

I was redirected to this from the old soft shadows thread.

But the links to the source don't work.

http://willhostforfood.com/files4/5429919/ssao_demo.7z and http://rapidshare.com/files/216761501/ssao_demo.7z.html don't host the file anymore.

http://www.megashare.com/591606 keeps cutting out incomplete and I can't continue or use a download manager.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 116

Re: SSAO Compositor

Post by mkultra333 »

Finally managed to download from megashare. It runs ok in D3D but crashes on startup in OGL. Maybe I just have an old version of OGL, I don't know. Here is the log for OGL mode:

Code: Select all

23:36:42: Creating resource group General
23:36:42: Creating resource group Internal
23:36:42: Creating resource group Autodetect
23:36:42: SceneManagerFactory for type 'DefaultSceneManager' registered.
23:36:42: Registering ResourceManager for type Material
23:36:42: Registering ResourceManager for type Mesh
23:36:42: Registering ResourceManager for type Skeleton
23:36:42: MovableObjectFactory for type 'ParticleSystem' registered.
23:36:42: OverlayElementFactory for type Panel registered.
23:36:42: OverlayElementFactory for type BorderPanel registered.
23:36:42: OverlayElementFactory for type TextArea registered.
23:36:42: Registering ResourceManager for type Font
23:36:42: ArchiveFactory for archive type FileSystem registered.
23:36:42: ArchiveFactory for archive type Zip registered.
23:36:42: FreeImage version: 3.9.3
23:36:42: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
23:36:42: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi
23:36:42: DDS codec registering
23:36:42: Registering ResourceManager for type HighLevelGpuProgram
23:36:42: Registering ResourceManager for type Compositor
23:36:42: MovableObjectFactory for type 'Entity' registered.
23:36:42: MovableObjectFactory for type 'Light' registered.
23:36:42: MovableObjectFactory for type 'BillboardSet' registered.
23:36:42: MovableObjectFactory for type 'ManualObject' registered.
23:36:42: MovableObjectFactory for type 'BillboardChain' registered.
23:36:42: MovableObjectFactory for type 'RibbonTrail' registered.
23:36:42: *-*-* OGRE Initialising
23:36:42: *-*-* Version 1.6.0RC1 (Shoggoth)
23:36:42: Loading library RenderSystem_GL
23:36:42: Installing plugin: GL RenderSystem
23:36:42: OpenGL Rendering Subsystem created.
23:36:42: Plugin successfully installed
23:36:42: Loading library Plugin_CgProgramManager
23:36:42: Installing plugin: Cg Program Manager
23:36:43: Plugin successfully installed
23:36:43: CPU Identifier & Features
23:36:43: -------------------------
23:36:43:  *   CPU ID: AuthenticAMD: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
23:36:43:  *      SSE: yes
23:36:43:  *     SSE2: yes
23:36:43:  *     SSE3: yes
23:36:43:  *      MMX: yes
23:36:43:  *   MMXEXT: yes
23:36:43:  *    3DNOW: yes
23:36:43:  * 3DNOWEXT: yes
23:36:43:  *     CMOV: yes
23:36:43:  *      TSC: yes
23:36:43:  *      FPU: yes
23:36:43:  *      PRO: yes
23:36:43:  *       HT: no
23:36:43: -------------------------
23:36:43: *** Starting Win32GL Subsystem ***
23:36:43: GLRenderSystem::_createRenderWindow "Ogre SSAO Compositor and Soft Shadows", 1024x768 windowed  miscParams: FSAA=4 vsync=false 
23:36:43: Created Win32Window 'Ogre SSAO Compositor and Soft Shadows' : 1024x768, 32bpp
23:36:43: GL_VERSION = 2.1.1
23:36:43: GL_VENDOR = NVIDIA Corporation
23:36:43: GL_RENDERER = GeForce 7950 GT/PCI/SSE2/3DNOW!
23:36:43: GL_EXTENSIONS = GL_ARB_color_buffer_float GL_ARB_depth_texture GL_ARB_draw_buffers GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_half_float_pixel GL_ARB_imaging GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_shadow GL_ARB_shader_objects GL_ARB_shading_language_100 GL_ARB_texture_border_clamp GL_ARB_texture_compression GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_dot3 GL_ARB_texture_float GL_ARB_texture_mirrored_repeat GL_ARB_texture_non_power_of_two GL_ARB_texture_rectangle GL_ARB_transpose_matrix GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_window_pos GL_ATI_draw_buffers GL_ATI_texture_float GL_ATI_texture_mirror_once GL_S3_s3tc GL_EXT_texture_env_add GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_compiled_vertex_array GL_EXT_Cg_shader GL_EXT_depth_bounds_test GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXT_framebuffer_object GL_EXT_gpu_program_parameters GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_pixels GL_EXT_pixel_buffer_object GL_EXT_point_parameters GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shadow_funcs GL_EXT_stencil_two_side GL_EXT_stencil_wrap GL_EXT_texture3D GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_filter_anisotropic GL_EXT_texture_lod GL_EXT_texture_lod_bias GL_EXT_texture_mirror_clamp GL_EXT_texture_object GL_EXT_texture_sRGB GL_EXT_timer_query GL_EXT_vertex_array GL_IBM_rasterpos_clip GL_IBM_texture_mirrored_repeat GL_KTX_buffer_region GL_NV_blend_square GL_NV_copy_depth_to_color GL_NV_depth_clamp GL_NV_fence GL_NV_float_buffer GL_NV_fog_distance GL_NV_fragment_program GL_NV_fragment_program_option GL_NV_fragment_program2 GL_NV_framebuffer_multisample_coverage GL_NV_half_float GL_NV_light_max_exponent GL_NV_multisample_filter_hint GL_NV_occlusion_query GL_NV_packed_depth_stencil GL_NV_pixel_data_range GL_NV_point_sprite GL_NV_primitive_restart GL_NV_register_combiners GL_NV_register_combiners2 GL_NV_texgen_reflection GL_NV_texture_compression_vtc GL_NV_texture_env_combine4 GL_NV_texture_expand_normal GL_NV_texture_rectangle GL_NV_texture_shader GL_NV_texture_shader2 GL_NV_texture_shader3 GL_NV_vertex_array_range GL_NV_vertex_array_range2 GL_NV_vertex_program GL_NV_vertex_program1_1 GL_NV_vertex_program2 GL_NV_vertex_program2_option GL_NV_vertex_program3 GL_NVX_conditional_render GL_SGIS_generate_mipmap GL_SGIS_texture_lod GL_SGIX_depth_texture GL_SGIX_shadow GL_SUN_slice_accum GL_WIN_swap_hint WGL_EXT_swap_control 
23:36:43: Supported WGL extensions: WGL_ARB_buffer_region WGL_ARB_extensions_string WGL_ARB_make_current_read WGL_ARB_multisample WGL_ARB_pbuffer WGL_ARB_pixel_format WGL_ARB_pixel_format_float WGL_ARB_render_texture WGL_ATI_pixel_format_float WGL_EXT_extensions_string WGL_EXT_swap_control WGL_NV_float_buffer WGL_NV_render_depth_texture WGL_NV_render_texture_rectangle 
23:36:43: ***************************
23:36:43: *** GL Renderer Started ***
23:36:43: ***************************
23:36:43: Registering ResourceManager for type GpuProgram
23:36:43: GLSL support detected
23:36:43: GL: Using GL_EXT_framebuffer_object for rendering to textures (best)
23:36:43: FBO PF_UNKNOWN depth/stencil support: D16S0 D24S0 D32S0 Packed-D24S8 
23:36:43: FBO PF_R5G6B5 depth/stencil support: D0S0 D16S0 
23:36:43: FBO PF_B5G6R5 depth/stencil support: D0S0 D16S0 
23:36:43: FBO PF_R8G8B8 depth/stencil support: D0S0 D24S0 D32S0 Packed-D24S8 
23:36:43: FBO PF_B8G8R8 depth/stencil support: D0S0 D24S0 D32S0 Packed-D24S8 
23:36:43: FBO PF_A8R8G8B8 depth/stencil support: D0S0 D24S0 D32S0 Packed-D24S8 
23:36:43: FBO PF_B8G8R8A8 depth/stencil support: D0S0 D24S0 D32S0 Packed-D24S8 
23:36:43: FBO PF_A2R10G10B10 depth/stencil support: D0S0 D24S0 D32S0 Packed-D24S8 
23:36:43: FBO PF_A2B10G10R10 depth/stencil support: D0S0 D24S0 D32S0 Packed-D24S8 
23:36:43: FBO PF_FLOAT16_RGB depth/stencil support: D0S0 D24S0 D32S0 Packed-D24S8 
23:36:43: FBO PF_FLOAT16_RGBA depth/stencil support: D0S0 D24S0 D32S0 Packed-D24S8 
23:36:43: FBO PF_FLOAT32_RGB depth/stencil support: D0S0 D24S0 D32S0 Packed-D24S8 
23:36:43: FBO PF_FLOAT32_RGBA depth/stencil support: D0S0 D24S0 D32S0 Packed-D24S8 
23:36:43: FBO PF_X8R8G8B8 depth/stencil support: D0S0 D24S0 D32S0 Packed-D24S8 
23:36:43: FBO PF_X8B8G8R8 depth/stencil support: D0S0 D24S0 D32S0 Packed-D24S8 
23:36:43: FBO PF_SHORT_RGBA depth/stencil support: D0S0 D24S0 D32S0 Packed-D24S8 
23:36:43: FBO PF_R3G3B2 depth/stencil support: D0S0 D16S0 
23:36:43: FBO PF_SHORT_RGB depth/stencil support: D0S0 D24S0 D32S0 Packed-D24S8 
23:36:43: [GL] : Valid FBO targets PF_UNKNOWN PF_R5G6B5 PF_B5G6R5 PF_R8G8B8 PF_B8G8R8 PF_A8R8G8B8 PF_B8G8R8A8 PF_A2R10G10B10 PF_A2B10G10R10 PF_FLOAT16_RGB PF_FLOAT16_RGBA PF_FLOAT32_RGB PF_FLOAT32_RGBA PF_X8R8G8B8 PF_X8B8G8R8 PF_SHORT_RGBA PF_R3G3B2 PF_SHORT_RGB 
23:36:43: RenderSystem capabilities
23:36:43: -------------------------
23:36:43: RenderSystem Name: OpenGL Rendering Subsystem
23:36:43: GPU Vendor: nvidia
23:36:43: Device Name: GeForce 7950 GT/PCI/SSE2/3DNOW!
23:36:43: Driver Version: 2.1.1.0
23:36:43:  * Fixed function pipeline: yes
23:36:43:  * Hardware generation of mipmaps: yes
23:36:43:  * Texture blending: yes
23:36:43:  * Anisotropic texture filtering: yes
23:36:43:  * Dot product texture operation: yes
23:36:43:  * Cube mapping: yes
23:36:43:  * Hardware stencil buffer: yes
23:36:43:    - Stencil depth: 8
23:36:43:    - Two sided stencil support: yes
23:36:43:    - Wrap stencil values: yes
23:36:43:  * Hardware vertex / index buffers: yes
23:36:43:  * Vertex programs: yes
23:36:43:  * Fragment programs: yes
23:36:43:  * Geometry programs: no
23:36:43:  * Supported Shader Profiles: arbfp1 arbvp1 fp20 fp30 fp40 glsl vp30 vp40
23:36:43:  * Texture Compression: yes
23:36:43:    - DXT: yes
23:36:43:    - VTC: yes
23:36:43:  * Scissor Rectangle: yes
23:36:43:  * Hardware Occlusion Query: yes
23:36:43:  * User clip planes: yes
23:36:43:  * VET_UBYTE4 vertex element type: yes
23:36:43:  * Infinite far plane projection: yes
23:36:43:  * Hardware render-to-texture: yes
23:36:43:  * Floating point textures: yes
23:36:43:  * Non-power-of-two textures: yes
23:36:43:  * Volume textures: yes
23:36:43:  * Multiple Render Targets: 4
23:36:43:    - With different bit depths: yes
23:36:43:  * Point Sprites: yes
23:36:43:  * Extended point parameters: yes
23:36:43:  * Max Point Size: 63.375
23:36:43:  * Vertex texture fetch: yes
23:36:43:    - Max vertex textures: 4
23:36:43:    - Vertex textures shared: yes
23:36:43:  * Render to Vertex Buffer : no
23:36:43:  * GL 1.5 without VBO workaround: no
23:36:43:  * Frame Buffer objects: yes
23:36:43:  * Frame Buffer objects (ARB extension): no
23:36:43:  * Frame Buffer objects (ATI extension): no
23:36:43:  * PBuffer suppport: no
23:36:43:  * GL 1.5 without HW-occlusion workaround: no
23:36:43: Registering ResourceManager for type Texture
23:36:43: Using FSAA from GL_ARB_multisample extension.
23:36:43: ResourceBackgroundQueue - threading disabled
23:36:43: Particle Renderer Type 'billboard' registered
23:36:43: Creating resource group Media
23:36:43: Added resource location '../../data' of type 'FileSystem' to resource group 'Media'
23:36:43: Initialising resource group Media
23:36:43: Parsing scripts for resource group Media
23:36:43: Parsing script ambient.program
23:36:43: Parsing script diffuse.program
23:36:43: Parsing script shadow_caster.program
23:36:43: Parsing script colours.material
23:36:43: Parsing script diffuse.material
23:36:43: Parsing script metal.material
23:36:43: Parsing script ogre.material
23:36:43: Parsing script shadow_caster.material
23:36:43: Parsing script ssao.material
23:36:43: Parsing script ssao.compositor
23:36:43: Finished parsing scripts for resource group Media
23:36:43: OGRE EXCEPTION(2:InvalidParametersException): All framebuffer formats with this texture internal format unsupported in GLFrameBufferObject::initialise at c:\Ogre_Shoggoth\RenderSystems\GL\src\OgreGLFrameBufferObject.cpp (line 276)

"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: SSAO Compositor

Post by nullsquared »

What's your GPU? Sounds like it just doesn't support those floating point formats in OpenGL.
User avatar
subquantum
Goblin
Posts: 270
Joined: Tue Oct 02, 2007 10:23 pm
Location: Rochester, NY

Re: SSAO Compositor

Post by subquantum »

That's odd, because the capabilities shows that it supports: PF_FLOAT16_RGB PF_FLOAT16_RGBA PF_FLOAT32_RGB PF_FLOAT32_RGBA, all with full depth/stencil buffers.
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 116

Re: SSAO Compositor

Post by mkultra333 »

Device Name: GeForce 7950 GT/PCI/SSE2/3DNOW! (PCI Express x16, 512 meg)

I use an older video driver, forceware 163.75, due to a compatability issue with some other hardware (stereoscopic glasses). The drivers are good enough for Doom3, Quake4, Prey, which are OGL. And they can handle Stalker which is D3D.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: SSAO Compositor

Post by nullsquared »

Chances are that those old drivers do not support 4-channel float16 render targets under OpenGL... It doesn't matter if you can run Prey/Doom3/Quake4, each of those do not us 4-channel float16 render targets. And Stalker probably might, but as you said, it uses Direct3D... which seems to work for you.
User avatar
Evak
Orc Shaman
Posts: 707
Joined: Sun Apr 02, 2006 7:51 pm
Location: Sacramento, CA
x 1

Re: SSAO Compositor

Post by Evak »

Our team haven't managed to get the SSAO demo to work in GL on any of our Nvidia cards. two 8800GT's and a 7800GS. Works fine in D3D
User avatar
Jerrith
Gnoblar
Posts: 13
Joined: Sat May 26, 2007 11:40 pm
Location: Hunt Valley, MD

Re: SSAO Compositor

Post by Jerrith »

nullsquared: Thank you for posting such easy to integrate and understand code. I'd been meaning to try and integrate the old Soft Shadows code, and finally got around to doing it this weekend. Saw the post redirecting to this thread. Got the example and ran it (D3D only on my 7800 GTX btw), and then spent some time yesterday and today making it work for me. I got the basic functionality working fairly quickly (SSAO plus Soft Shadows), and then went and added some more functionality (support for a specular map (which you basically had there, commented out, thanks!), then three tint channels, and finally, support for a normal map.

One helpful tip I wanted to mention: My shadows were really pixelated, and increasing the resolution of the shadow texture didn't seem to help. What I eventually found as a solution was changing computeShadow in diffuse.cg. Specifically:

Code: Select all

    float2 moments = btex2D(shadowMap, suv, 0.01, 4).rg;
to

Code: Select all

    float2 moments = btex2D(shadowMap, suv, 0.0025, 4).rg;
The 0.01 to 0.0025 change ended up being the best for me. (I also tried some changes with the 4, but ended up staying with 4.)

Since screenshots seem to be popular in the thread, I'll offer up one of my own. Not all that impressive a scene - a wall, a floor, two copies of an object, and a spotlight, but you can see the shadows, and a bit of the SSAO effect (most significantly at the base of the objects and the wall). The base wall texture is just a lighter version of the floor, but it has a tint map that is responsible for the numbers and the gradient, a specular map that affect the brightness of the four squares, and a normal map to generate the alternating raised / sunken look of each square.

Image

Thanks again. :)

Edit: I realized the normal mapping isn't quite right yet. Still working on it. :)
lukeneorm
Halfling
Posts: 61
Joined: Wed Apr 01, 2009 12:03 am

Re: SSAO Compositor

Post by lukeneorm »

Hi,
thanks for your code nullsquared! :)
I tried to implement your ssao and soft shadow in my code, but the shadows doesn't work. :(
This is the scene rendered with only ambient light and ssao turned on:
Image
..it looks that there is need for some adjustments, but for now it is ok.
The real problem come when I assign one of the material in the color.material file to my entities in the scene: I tried with 'orange' material for example, and this is the result:
Image
..no shadows at all, and the texture orange.bmp doesn't seem to be used, instead of that entities are covered by blue and green colors! And this problem comes with all types of materials I should use (white, blue, metal, etc.)
I copied all the 'media' stuff in the right directory.
The loader in ogre.log doesn't seem to report errors about that. :?
Where I am wrong?

Thanks for any kind of help!
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: SSAO Compositor

Post by nullsquared »

Can I see the log? Something's not going on right. Did you adapt the demo's shadow code to your own code? There's some C++ side shadow setup that needs to be done in addition to the materials.
lukeneorm
Halfling
Posts: 61
Joined: Wed Apr 01, 2009 12:03 am

Re: SSAO Compositor

Post by lukeneorm »

nullsquared wrote:Can I see the log? Something's not going on right. Did you adapt the demo's shadow code to your own code? There's some C++ side shadow setup that needs to be done in addition to the materials.

I think I added all the C++ code useful to implement shadows:
* I copied the shadowListener in my code
* I call initShadows() after I create the sceneManager and the camera.

After parsing without errors material, programs and compositor scripts, this is the log outpout:

Code: Select all

10:43:12: ********************************
10:43:12: **     oScene Loader Lib      **
10:43:12: ********************************
10:43:12: oSceneLoader: Loading 'cubes_omni.osm' file
10:43:13: Initialising resource group cubes_omni.osm
10:43:13: oSceneLoader: Creating scene on 'Root' node
10:43:13: Mesh: Loading Plane01.mesh.
10:43:13: Texture: orange.bmp: Loading 1 faces(PF_R8G8B8,4x4x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,4x4x1.
10:43:13: Mesh: Loading Box01.mesh.
10:43:13: Mesh: Loading Box02.mesh.
10:43:13: Mesh: Loading Box03.mesh.
10:43:13: Mesh: Loading Box04.mesh.
10:43:13: Mesh: Loading Box05.mesh.
10:43:13: Mesh: Loading Box06.mesh.
10:43:13: Mesh: Loading Box07.mesh.
10:43:13: Mesh: Loading Box08.mesh.
10:43:13: Mesh: Loading Box09.mesh.
10:43:13: Mesh: Loading Torus Knot01.mesh.
10:43:13: Mesh: Loading Torus Knot02.mesh.
10:43:13: Mesh: Loading Torus Knot03.mesh.
10:43:13: Mesh: Loading Torus Knot04.mesh.
10:43:13: Mesh: Loading Torus Knot05.mesh.
10:43:13: Mesh: Loading Torus Knot06.mesh.
10:43:13: Mesh: Loading Torus Knot07.mesh.
10:43:13: Mesh: Loading Torus Knot08.mesh.
10:43:13: Mesh: Loading Torus Knot09.mesh.
10:43:13: ********************************
10:43:13: ** oSceneLoader: Scene loaded **
10:43:13: ********************************
10:43:13: *** Initializing OIS ***
10:43:13: Texture: random.png: Loading 1 faces(PF_R8G8B8,1024x1024x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,1024x1024x1.
10:43:13: Texture: white.bmp: Loading 1 faces(PF_R8G8B8,4x4x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,4x4x1.
10:43:13: Texture: spot_shadow_fade.png: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
10:43:19: PCZone Factory Type 'ZoneType_Octree' unregistered
10:43:19: PCZone Factory Type 'ZoneType_Terrain' unregistered
10:43:19: Unregistering ResourceManager for type BspLevel
10:43:19: *-*-* OGRE Shutdown
10:43:19: Unregistering ResourceManager for type Compositor
10:43:19: Unregistering ResourceManager for type Font
10:43:19: Unregistering ResourceManager for type Skeleton
10:43:19: Unregistering ResourceManager for type Mesh
10:43:19: Unregistering ResourceManager for type HighLevelGpuProgram
10:43:19: Uninstalling plugin: Octree & Terrain Scene Manager
10:43:19: Plugin successfully uninstalled
10:43:19: Unloading library .\Plugin_OctreeSceneManager_d
10:43:19: Uninstalling plugin: Octree Zone Factory
10:43:19: Plugin successfully uninstalled
10:43:19: Unloading library .\Plugin_OctreeZone_d.dll
10:43:19: Uninstalling plugin: Portal Connected Zone Scene Manager
10:43:19: Plugin successfully uninstalled
10:43:19: Unloading library .\Plugin_PCZSceneManager_d.dll
10:43:19: Uninstalling plugin: Cg Program Manager
10:43:19: Plugin successfully uninstalled
10:43:19: Unloading library .\Plugin_CgProgramManager_d
10:43:19: Uninstalling plugin: BSP Scene Manager
10:43:19: Plugin successfully uninstalled
10:43:19: Unloading library .\Plugin_BSPSceneManager_d
10:43:19: Uninstalling plugin: ParticleFX
10:43:19: Plugin successfully uninstalled
10:43:19: Unloading library .\Plugin_ParticleFX_d
10:43:19: Uninstalling plugin: GL RenderSystem
10:43:19: *** Stopping Win32GL Subsystem ***
10:43:19: Plugin successfully uninstalled
10:43:19: Unloading library .\RenderSystem_GL_d
10:43:19: Uninstalling plugin: D3D9 RenderSystem
10:43:19: D3D9 : Shutting down cleanly.
10:43:19: Unregistering ResourceManager for type Texture
10:43:19: Unregistering ResourceManager for type GpuProgram
10:43:19: D3D9 : Direct3D9 Rendering Subsystem destroyed.
10:43:19: Plugin successfully uninstalled
10:43:19: Unloading library .\RenderSystem_Direct3D9_d
10:43:19: Unregistering ResourceManager for type Material
I used orange material for my objects, and from the log the orange.bmp texture seems to be loaded, but.. the output is the same: all objects are coloured in blue and green, without shadows, like the previuos image.
The problem is the same even if I don't call initSSAO().

it seems to be something related to materials script: if I delete the line "scheme lighting" in diffuse_material.material, the material "orange" seems to be loaded correctly (can that line be removed without problems?), but the shadows are strange. In this scene for example, it seems that only the center torous knot casts shadow (1), but when the light comes closer to the horizon, also the boxes begin to cast shadows (2):

Image

in this sequence you can see what happend in relation with light direction: the shadow of the torous knot disappear when the light is at the zenit, perpendicular to the plane:

Image

I really don't know what kind of problem is this.. :?
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: SSAO Compositor

Post by nullsquared »

That can't be the full log. I don't see any materials being parsed.

You can't remove "scheme lighting". What you're seeing there is an artifact - not actual shadows, but the shadow depth map is coming up as the "shadows." Either something is loading incorrectly (I need the full log), or you're not setting something up right as the demo does it.