cinetec_tech Posted March 12, 2015 Posted March 12, 2015 hi: I currently have a procedural material problem and blocked. Hope someone could give a hand. Here is how to reproduce my issue: 1:extract the attach rar file and put under data/ dir, open the test world, you should see the statues in depth 2:open system menu and set the anti aliasing to 4x (my issue only happen with anti aliasing on) 3: now press space to capture a image , it should be stored in the test1.jpg in the same dir under data issue: with anti aliasing on, the captured depth image is not correct as the viewport . if turn the anti-aliasing off or change the image resolution to same as the viewport looks ok. in my case , i need render the viewport 2x or 3x larger than the viewport size while the anti-aliasing has to be on. I guess it should be some thing to do with viewport size function in the shader , but i couldn't figure it out. thanks alot! test.rar
unclebob Posted March 13, 2015 Posted March 13, 2015 Hello there! Thanks for the issue, looks like it's our bug. As a workaround you can make your own version of texture2DDeferredNorm. So your fragment_filter_post1.shader will look like this: #include <core/shaders/default/common/fragment_base.h> /******************************************************************************\ * * Direct3D11 * \******************************************************************************/ half4 my_texture2DDeferredNorm(TEXTURE_2DMS s_texture,SamplerState s_sampler,float2 texcoord) { #ifdef MULTISAMPLE_0 half4 deferred = s_texture.SampleLevel(s_sampler,texcoord,0.0f); #else uint width,height,samples; s_texture.GetDimensions(width,height,samples); half4 deferred = s_texture.Load(int2(texcoord * int2(width,height)),0); // half4 deferred = s_texture.Load(int2(texcoord * s_viewport.xy),0); // this was broken #endif return deferred; } TEXTURE_2DMS s_texture_0 : register(t0); struct FRAGMENT_IN { float4 position : SV_POSITION; float2 texcoord_0 : TEXCOORD0; }; /* */ float4 main(FRAGMENT_IN IN) : SV_TARGET { ///////////// half4 deferred_depth = my_texture2DDeferredNorm(s_texture_0,s_sampler_0,IN.texcoord_0); float depth = getDeferredDepth(deferred_depth); return depth; }
Recommended Posts