• Advertisement

PixelSmasher

Member
  • Content count

    24
  • Joined

  • Last visited

Community Reputation

445 Neutral

About PixelSmasher

  • Rank
    Member
  1. Light attenuation not working correctly

    So ? Is your problem solved or do you have no hair left debugging ? ^^
  2. Light attenuation not working correctly

    In your vertex shader, you are computing the vertex normal with frag_normal = normalize(WorldMatrix * vec4(vert_normal, 1.0)); In homogenous coordinates, the last "w" scalar value set to 1.0 means that vert_normal is a point. As it is a mere unpositioned vector, i think using 0.0 should fix your bug.     Moreover, normalizing the interpolation variable frag_normal (set as "smooth out" and "smooth in" by default) will lead to incorrect normal vectors as they won't stay normed during their interpolation across vertices. You should normalize it in the fragment shader.
  3. A blocky mess ? As no filtering is applied, it looks perfectly fine - and shitty - to me. You should add some bias to prevent banding on curved meshes though. You are facing a nasty math-related bug and it always means having a bad time eradicating it.   Try outputting all the values you can to empirically find out what the issue is and be amazed when you discover it was so simple :) (I'd really like to see the values of the variable "fracs" !)   Another trick that could work : use (ShadowMapSize + float2(1, 1)), it helped me in some situations
  4. Clearly the issue comes from bad weights applied to your boolean coefficients. Try outputting the weight values and see if some artifacts appear.   That's the good old way of debugging your shaders ;p
  5. Sorry it was like I was talking to myself ^^   I've already encountered this problem while coding PCF, the problem was located in float2 fracs = frac(shadowTexCoord.xy * ShadowMapSize);   I remember that the solution was something like: float2 fracs = frac(shadowTexCoord.xy * ShadowMapSize + float2(0.5, 0.5));   EDIT : or it could be something similar when you compute your offsets in: float2 offset = float2(x, y) * (1.0f / ShadowMapSize); Try: float2 offset = (float2(x, y) + float2(0.5, 0.5)) * (1.0f / ShadowMapSize);    
  6. Hmmm sounds like an half-pixel issue to me...
  7. SMAA Implementation - Weights Pass

    Here's the code I'm using to integrate the SMAA in our engine shader generator. The #define [b]ENABLE_SMAA_VS[/b] is set only when compiling a vertex shader. The DX9 compiler was messing things up otherwise (as well as our GLSL converter). [CODE] // -- Pass 0 void VS_SmaaPass0( vs_Input _vs_In, out float4 f4_Position : POSITION, out float2 f2_TexCoord : TEXCOORD0, out float4 f4_Offset0 : TEXCOORD1, out float4 f4_Offset1 : TEXCOORD2, out float4 f4_Offset2 : TEXCOORD3 ) { ComputePosUV2D(f4_Position, f2_TexCoord, _vs_In.f4_Position, _vs_In.f2_TexCoord0.xy); // Store the vertex position & its texcoord in f4_Position and f2_TexCoord #if defined(ENABLE_SMAA_VS) float4 f4_Offsets[3]; SMAAEdgeDetectionVS(f4_Position, f4_Position, f2_TexCoord, f4_Offsets); f4_Offset0 = f4_Offsets[0]; f4_Offset1 = f4_Offsets[1]; f4_Offset2 = f4_Offsets[2]; #else f4_Offset0 = float4(0.0, 0.0, 0.0, 0.0); f4_Offset1 = float4(0.0, 0.0, 0.0, 0.0); f4_Offset2 = float4(0.0, 0.0, 0.0, 0.0); #endif } float4 PS_SmaaPass0( float2 f2_TexCoord : TEXCOORD0, float4 f4_Offset0 : TEXCOORD1, float4 f4_Offset1 : TEXCOORD2, float4 f4_Offset2 : TEXCOORD3 ) : COLOR0 { #if defined(ENABLE_SMAA_VS) return float4(0.0, 0.0, 0.0, 0.0); #else float4 f4_Offsets[3]; f4_Offsets[0] = f4_Offset0; f4_Offsets[1] = f4_Offset1; f4_Offsets[2] = f4_Offset2; return SMAALumaEdgeDetectionPS(f2_TexCoord, f4_Offsets, samp_SmaaSourceTex); #endif } // -- Pass 1 void VS_SmaaPass1( vs_Input _vs_In, out float4 f4_Position : POSITION, out float2 f2_TexCoord : TEXCOORD0, out float2 f2_PixCoord : TEXCOORD1, out float4 f4_Offset0 : TEXCOORD2, out float4 f4_Offset1 : TEXCOORD3, out float4 f4_Offset2 : TEXCOORD4 ) { ComputePosUV2D(f4_Position, f2_TexCoord, _vs_In.f4_Position, _vs_In.f2_TexCoord0.xy); #if defined(ENABLE_SMAA_VS) float4 f4_Offsets[3]; SMAABlendingWeightCalculationVS(f4_Position, f4_Position, f2_TexCoord, f2_PixCoord, f4_Offsets); f4_Offset0 = f4_Offsets[0]; f4_Offset1 = f4_Offsets[1]; f4_Offset2 = f4_Offsets[2]; #else f4_Offset0 = float4(0.0, 0.0, 0.0, 0.0); f4_Offset1 = float4(0.0, 0.0, 0.0, 0.0); f4_Offset2 = float4(0.0, 0.0, 0.0, 0.0); #endif } float4 PS_SmaaPass1(float2 f2_TexCoord : TEXCOORD0, float2 f2_PixCoord : TEXCOORD1, float4 f4_Offset0 : TEXCOORD2, float4 f4_Offset1 : TEXCOORD3, float4 f4_Offset2 : TEXCOORD4) : COLOR0 { #if defined(ENABLE_SMAA_VS) return float4(0.0, 0.0, 0.0, 0.0); #else float4 f4_Offsets[3]; f4_Offsets[0] = f4_Offset0; f4_Offsets[1] = f4_Offset1; f4_Offsets[2] = f4_Offset2; return SMAABlendingWeightCalculationPS(f2_TexCoord, f2_PixCoord, f4_Offsets, samp_SmaaSourceTex, samp_SmaaAreaTex, samp_SmaaSearchTex, 0); #endif } // -- Pass 2 void VS_SmaaPass2( vs_Input _vs_In, out float4 f4_Position : POSITION, out float2 f2_TexCoord : TEXCOORD0, out float4 f4_Offset0 : TEXCOORD1, out float4 f4_Offset1 : TEXCOORD2 ) { ComputePosUV2D(f4_Position, f2_TexCoord, _vs_In.f4_Position, _vs_In.f2_TexCoord0.xy); #if defined(ENABLE_SMAA_VS) float4 f4_Offsets[2]; SMAANeighborhoodBlendingVS(f4_Position, f4_Position, f2_TexCoord, f4_Offsets); f4_Offset0 = f4_Offsets[0]; f4_Offset1 = f4_Offsets[1]; #else f4_Offset0 = float4(0.0, 0.0, 0.0, 0.0); f4_Offset1 = float4(0.0, 0.0, 0.0, 0.0); #endif } float4 PS_SmaaPass2( float2 f2_TexCoord : TEXCOORD0, float4 f4_Offset0 : TEXCOORD1, float4 f4_Offset1 : TEXCOORD2 ) : COLOR0 { #if defined(ENABLE_SMAA_VS) return float4(0.0, 0.0, 0.0, 0.0); #else float4 f4_Offsets[2]; f4_Offsets[0] = f4_Offset0; f4_Offsets[1] = f4_Offset1; return SMAANeighborhoodBlendingPS(f2_TexCoord, f4_Offsets, samp_SmaaSourceTex, samp_SmaaBlendTex); #endif } [/CODE]
  8. SMAA Implementation - Weights Pass

    Hi FriendlyFire. I'm sorry for the late answer, I'm in total crunch time and deadlines do not forgive ! I eventually got SMAA to work on console aaaannnnnd it took 10 ms to render ! This is the time I gave up. To have it working on PC, I simply turned the pixel shader interpolated array "offsets[3]" into 3 interpolated values "offset0", "offset1" and "offset2". The compiler did mess with them.
  9. SMAA Implementation - Weights Pass

    A fast update during my epic and painful quest for SMAA : after a week of despair, I noticed the DX9 version of SMAA is working on a GTX560 Ti... How cool is that ? This code is actually working !!! Not that cool ! As I'm now into the depths of HLSL assembly, trying to find out what the compiler messed up [img]http://public.gamedev.net//public/style_emoticons/default/ph34r.png[/img].
  10. Unfortunately, I am not. This technique seems to remain unnoticed (or people consider that such artifacts are unworthy of their time [img]http://public.gamedev.net//public/style_emoticons/default/tongue.png[/img]). There is this [url="http://www.youtube.com/watch?v=WnNOMTDmYTg"]video[/url], made by the author of Dual-Sphere Unfolding (It was my only help when implementing my demo), but nothing from the community. If you ever find something, I would be greatly interested.
  11. SMAA Implementation - Weights Pass

    Hi FriendlyFire, I'm currently replacing FXAA with SMAA 2.7 in our engine and I'm stuck on the same problem: the result of the second pass is very similar to yours. Have you figured out what was wrong with your implementation ?
  12. I tried this method in a recent [url="https://vimeo.com/39475515"]project[/url] to fill a scene with 100 dynamic lights casting shadows. The theory is appealing and the results are not so bad... BUT you'll want to have a very fine geometry in order to obtain accurate shadows: the projection used to store the whole shadow sphere in a single texture will highly bend the geometric data, thus leading to frequent artifacts during the depth comparison. (Though I had to rush that project so I might have missed something) Still, it was tremendously fast and produced cool shadows... If you don't stare at them too much [img]http://public.gamedev.net//public/style_emoticons/default/tongue.png[/img]
  13. SSAO using line integrals

    Hi again and sorry for the late answer. After several optimizations, loop unrolling and code vectorization, I get awesome results with the same image produced in 2.36ms for a 720p resolution ![list] [*]AO computation pass : [b]1.5 ms[/b] [*]Horizontal bilateral blur : [b]0.43 ms[/b] [*]Vertical bilateral blur : [b]0.43 ms[/b] [/list] Hints : - The GL_AMD_texture_texture4 extension (allowing to quickly fetch 4 adjacent pixels) was available on the target console. Always use it (or fetch4 or textureGather or whatever with the same behaviour) and smile while looking at your perf counter. - Kill loops with fire ! They are horridly slow ! (Look at the code generated by your shader compiler to see if they were not unrolled at compil time)
  14. SSAO using line integrals

    I get good results on PC (5 ms with an unoptimized version). On console, which is the release target, I get disastrous perf (8 ms on a 720p resolution), mainly due to a low texture cache. I'm currently working on aggressive optimizations and will update this post when I'll get a shippable implementation.
  • Advertisement