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!
Post Reply
fabio71
Gnoblar
Posts: 11
Joined: Thu May 12, 2011 10:18 am

Re: SSAO Compositor

Post by fabio71 »

The link http://www.nullular.com/files/ssao_demo.7z ins't working. Can somebody upload this demo, please?
Sheen
Halfling
Posts: 58
Joined: Mon May 26, 2008 9:32 pm
Location: St. Petersburg, Russia
x 1

Re: SSAO Compositor

Post by Sheen »

I was looking for it and finally found it on one of my old hard drives, so here's REALLY PERMANENT download link - http://sheen.me/ogre/ssao_demo.zip
fabio71
Gnoblar
Posts: 11
Joined: Thu May 12, 2011 10:18 am

Re: SSAO Compositor

Post by fabio71 »

Thank you very much Sheen, at last I can see this famous demo running! :D
User avatar
Lee04
Minaton
Posts: 945
Joined: Mon Jul 05, 2004 4:06 pm
Location: Sweden
x 1

Re: SSAO Compositor

Post by Lee04 »

Any one tried this on 1.8?
Ph.D. student in game development
User avatar
lordsme
Gremlin
Posts: 167
Joined: Sun Mar 11, 2007 1:11 pm
Location: Turin, Italy
x 10
Contact:

Re: SSAO Compositor

Post by lordsme »

Hi guys,

I'd like to contribute to this topic posting my solution for objects that have "alpha-rejection materials", such as tree leaves, metal grids, etc.

The idea is to modify SSAO scene geometry shaders in order to discard pixels using the same texture of their base material.

Here's the Cg shader code:

Code: Select all

void SSAO_SceneGeom_Alpha_Tex_VS
(    
	in float4 in_uv : TEXCOORD0,
	out float2 out_uv : TEXCOORD3,
	
	in float4 p : POSITION, 
	in float3 n : NORMAL,
	
    out float4 cp : POSITION,
    out float4 vp : TEXCOORD0, // view-space position
    out float4 vn : TEXCOORD1,
    
	uniform float4x4 wvpMat, uniform float4x4 wvMat
)
{
    cp = mul(wvpMat, p);
	vp = mul(wvMat, p);
    vn = mul(wvMat, float4(n, 0));
	
	// copy UVs for the pixel shader
	out_uv = in_uv.xy;
}


float4 SSAO_SceneGeom_Alpha_Tex_PS(
	in float4 vp : TEXCOORD0
	,in float4 vn : TEXCOORD1
	,uniform float far
	// ,uniform float coef
	,in float2 uv : TEXCOORD3
	,uniform sampler2D AlphaSampler : TEXUNIT0
	
	) : COLOR
{
    
// test alpha
float alpha = tex2D(AlphaSampler,uv).a;	
	if (alpha < 0.47) // same as OGRE pass directive "alpha_rejection greater 120"
		discard;
	
	// a coef should help to tune scenes with different unit scales
	float coef = 0.25;
	float4 c = float4(length(vp.xyz) * coef / far, normalize(vn.xyz).xyz);

    return c;
}
Attachments
AlphaRejection_SSAO_2.jpeg
AlphaRejection_SSAO_1.jpeg
My Portfolio
http://davidedigiannantonio.weebly.com

MESH - Mise-en-scene Helper
http://www.mesh-project.org/

ASALab @ Virtual Reality & Multimedia Park
http://www.vrmmp.it
User avatar
lordsme
Gremlin
Posts: 167
Joined: Sun Mar 11, 2007 1:11 pm
Location: Turin, Italy
x 10
Contact:

Re: SSAO Compositor

Post by lordsme »

Here are some better screenshots.
The second one features some other fx too :) (lens flares, bloom, FXAA, gamma, GaussLighten, Vignetting... )
Thanks to tree[d] for quick trees!
Attachments
AlphaRejection_SSAO_4.jpeg
AlphaRejection_SSAO_3.jpeg
My Portfolio
http://davidedigiannantonio.weebly.com

MESH - Mise-en-scene Helper
http://www.mesh-project.org/

ASALab @ Virtual Reality & Multimedia Park
http://www.vrmmp.it
TomSmithGR
Gnoblar
Posts: 1
Joined: Fri May 09, 2014 11:15 am

Re: SSAO Compositor

Post by TomSmithGR »

Don't suppose anyone still has a copy of the code for this one? seems all the mirrors are dead
User avatar
Mind Calamity
Ogre Magi
Posts: 1255
Joined: Sat Dec 25, 2010 2:55 pm
Location: Macedonia
x 81

Re: SSAO Compositor

Post by Mind Calamity »

TomSmithGR wrote:Don't suppose anyone still has a copy of the code for this one? seems all the mirrors are dead
I do, and I made a simple to use class a few years ago, you can find it in my signature, but in case I change it in the future, here's a link:
http://www.ogre3d.org/tikiwiki/Simple+SSAO

The screenshots seem to be down, I'll try to make new ones ASAP. :)
BitBucket username changed to iboshkov (from MindCalamity)
Do you need help? What have you tried?
- xavier
---------------------
HkOgre - a Havok Integration for OGRE | Simple SSAO | My Blog | My YouTube | My DeviantArt
User avatar
Jefferian
Halfling
Posts: 63
Joined: Sun Jun 12, 2011 12:53 am
Location: Italy
x 1

Re: SSAO Compositor

Post by Jefferian »

Mind Calamity wrote:
TomSmithGR wrote:Don't suppose anyone still has a copy of the code for this one? seems all the mirrors are dead
I do, and I made a simple to use class a few years ago, you can find it in my signature, but in case I change it in the future, here's a link:
http://www.ogre3d.org/tikiwiki/Simple+SSAO

The screenshots seem to be down, I'll try to make new ones ASAP. :)
Uh, not only the screenshot. The download itself is dead as well, actually.
User avatar
Mind Calamity
Ogre Magi
Posts: 1255
Joined: Sat Dec 25, 2010 2:55 pm
Location: Macedonia
x 81

Re: SSAO Compositor

Post by Mind Calamity »

Ouch sorry about that, updated the link on the wiki page now.

Here's a quick jump to it.
BitBucket username changed to iboshkov (from MindCalamity)
Do you need help? What have you tried?
- xavier
---------------------
HkOgre - a Havok Integration for OGRE | Simple SSAO | My Blog | My YouTube | My DeviantArt
Post Reply