franck22000 Posted April 15, 2010 Share Posted April 15, 2010 If found a new SSAO that is looking great in this thread on gamedev forums: http://www.gamedev.net/community/forums/topic.asp?topic_id=556187&whichpage=9 Maybe someone can convert it for leadwerks, im pretty noob with shaders Images: Video: Have fun with that Quote You guys are going to be the death of me. Josh Link to comment Share on other sites More sharing options...
omid3098 Posted April 15, 2010 Share Posted April 15, 2010 amazing one! Quote Omid Saadat OD Arts Blog AMD Phenom II X4 940 - Geforce 8800GTS - 4GB RAM - XP x86 AMD 6000+ - Geforce 9800 GT - 2GB RAM - XP x86 (Home pc) Intel Core i7 - Geforce 310M - 4GB Ram - Win7 x64 (Laptop) Link to comment Share on other sites More sharing options...
Josh Posted April 15, 2010 Share Posted April 15, 2010 I like our SSDO better. You can see a weird shadow on the front of the right column. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
franck22000 Posted April 15, 2010 Author Share Posted April 15, 2010 I like the SSDO shader too but as Mickael Betke said: In the comments of Joshs Blog we came to the conclusion that a slight blur filter over the SSDO effect would soften the effect in a good performance way. I adjusted the Quality settings and fps get down noticeable. So doing a blur would be better but I dont know how to do this. So Josh is it possible for you to update the source code of SSDO to to this ? It would be very cool for a lot of user Quote You guys are going to be the death of me. Josh Link to comment Share on other sites More sharing options...
Pancakes Posted April 15, 2010 Share Posted April 15, 2010 I mentioned "martinsh" before. I think it might be useful if he could so some shader stuff for Leadwerks. He and the Hydrax guy are amazing. Quote Core I5 2.67 / 16GB RAM / GTX 670 Zbrush/ Blender / Photoshop CS6 / Renoise / Genetica / Leadwerks 3 Link to comment Share on other sites More sharing options...
Masterxilo Posted May 13, 2010 Share Posted May 13, 2010 For anyone interested, here's a cleaned up version of that shader that works with LE: // from http://www.gamedev.net/community/forums/topic.asp?topic_id=556187&whichpage=9 // / http://www.pasteall.org/12282 (newer) uniform sampler2D texture0; //RenderedTexture; uniform sampler2D texture1; //DepthTexture; //uniform sampler2D LuminanceTexture; uniform float apptime; uniform vec2 buffersize; uniform vec2 camerarange; // Math constants const float _2PI = 2.0*3.14159265; // Effect settings const int samples = 6; // samples on each ring (3-7) ! This gets multiplied by the current ring index ! -> very expensive const int rings = 4; // ring count (2-8) const float aoCap = 1.0; const float aoMultiplier = 100.0; const float aoMultiplier2 = 1.0; const float depthTolerance = 0.0000; const float aorange = 60.0;// units in space the AO effect extends to (this gets divided by the camera camerarange.y range const float radius = 0.5; const float aoexp = 1; const float noiseMultiplier = 1.0; const vec3 treshold = vec3(0.3); const bool allowEarlyOut = true; // Globals vec2 texCoord; // Functions inline vec2 rand(in vec2 coord) //generating random noise { float noiseX = (fract(sin(apptime*0.0001+dot(coord, vec2(12.9898,78.233))) * 43758.5453)); float noiseY = (fract(sin(apptime*0.0001+dot(coord, vec2(12.9898,78.233)*2.0)) * 43758.5453)); return vec2(noiseX,noiseY) * 0.004; } inline float readDepth(in vec2 coord) { float depth = texture2D(texture1, coord ).x; return (2.0 * camerarange.x) / (camerarange.y + camerarange.x - depth * (camerarange.y-camerarange.x)); } inline float compareDepths( in float depth1, in float depth2 ) { float diff = sqrt(clamp(1.0-(depth1-depth2) / (aorange/(camerarange.y-camerarange.x)),0.0,1.0)); float ao = min(aoCap, max(0.0,depth1-depth2-depthTolerance) * aoMultiplier) * diff; return ao; } void main(void) { // Calculate texCoord of current pixel texCoord = gl_FragCoord.xy/buffersize; // Get color and calculate luminance vec3 color = texture2D(texture0,texCoord).rgb; vec3 luminance = color; luminance = clamp(max(vec3(0.0),luminance-treshold) * vec3(3.0), vec3(0.0), vec3(1.0)); // high pass, original code // Early out if the luminance is nearly white if (allowEarlyOut && any(greaterThanEqual(luminance, vec3(0.7)))){gl_FragColor = vec4(color,1.0); return;} // Calculate ao float depth = readDepth(texCoord); if (allowEarlyOut && depth >= 1.0){gl_FragColor = vec4(color,1.0); return;} float aspect = buffersize.x/buffersize.y; vec2 noise = rand(texCoord); vec2 pixelSize = (vec2(1.0) / buffersize)/ vec2(clamp(depth,0.05,1.0))+(noise*(vec2(1.0)-noise)) * vec2(noiseMultiplier); float ao = 0.0, // Total ao s = 0.0; // Steps float fade = 1.0; for (int i = 0 ; i < rings; ++i) { float _step = _2PI / (samples*i); fade *= 0.5; for (int j = 0 ; j < samples*i; ++j) { float pw = (cos(j * _step) * i * radius); float ph = (sin(j * _step) * i * radius) * aspect; float d = readDepth( vec2(texCoord.s + pw * pixelSize.x, texCoord.t + ph * pixelSize.y)); ao += compareDepths(depth, d)*fade; s += 1.0*fade; } } ao /= s; ao *= aoMultiplier2; ao = 1.0-ao; ao = clamp(ao, 0.0, 1.0); ao = pow(ao,aoexp); gl_FragColor = vec4(color * mix(vec3(ao), vec3(1.0), vec3(luminance)), 1.0); return; } Doesn't look too bad: Quote Hurricane-Eye Entertainment - Site, blog. Link to comment Share on other sites More sharing options...
Canardia Posted May 13, 2010 Share Posted May 13, 2010 This doesn't work with Framework, but I think Josh should make it work since the current SSAO shader is horrible, it's too slow and makes things look worse than without SSAO. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
VeTaL Posted May 13, 2010 Share Posted May 13, 2010 Looking nice. Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
Jordan Posted May 13, 2010 Share Posted May 13, 2010 The current SSAO (SSDO) looks nicer in my opinion. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.