ndc

Reconstructing world position from linear depth

这一生的挚爱 提交于 2019-12-13 05:12:53
问题 i have issues reconstructing world positions from previously stored linear depth in glsl. I read lots of info online, but can't find my problem... So this is what I got: VS (storing depth to 32F): float linDepth(float z) { return (-z-zNear)/(zFar-zNear); } void main() { vec4 position = uViewMatrix * uModelMatrix * vec4(aPosition, 1); depth = linDepth(position.z); //store linear view-depth } FS (reconstuction): void main() { vec3 vUV = vec2(0..1, 0..1); (from screen aligned quad) vec3 ndc =

Transform to NDC, calculate and transform back to worldspace

谁都会走 提交于 2019-12-11 00:06:36
问题 I have a problem moving world coordinates to ndc coordinates than calculate something with it and move it back inside the shader. The Code looks like that: vec3 testFunc(vec3 pos, vec3 dir){ //pos and dir are in worldspace, convert to NDC vec4 NDC_dir = MVP * vec4(dir,0); vec4 NDC_pos = MVP * vec4(pos,1); NDC_dir /= NDC_dir.w; NDC_pos /= NDC_pos.w; //... do some caclulations => get newPos in NDC //Transform newPos back to worldspace vec4 WS_newPos = inverse(MVP) * vec4(newPos,1); return WS

When to use 'nested diagnostic context' (NDC)?

谁说胖子不能爱 提交于 2019-11-28 03:53:35
Playing with log4net, I have seen the possibility to use a per-thread stack of context labels called the NDC. The labels pushed on this stack are displayed in a PatternLayout by specifying the %x or the %ndc format parameter. The usage is something like: ILog log = log4net.LogManager.GetLogger(...) ; //pattern layout format: "[%ndc] - %message%newline" log.Info("message 1"); using(log4net.NDC.Push("context") { using(log4net.NDC.Push("inner_context") { log.Info("message 2"); } log.Info("message 3"); } log.Info("message 4"); The output is something like: null - message 1 context inner_context -

When to use 'nested diagnostic context' (NDC)?

ぐ巨炮叔叔 提交于 2019-11-27 05:14:05
问题 Playing with log4net, I have seen the possibility to use a per-thread stack of context labels called the NDC. The labels pushed on this stack are displayed in a PatternLayout by specifying the %x or the %ndc format parameter. The usage is something like: ILog log = log4net.LogManager.GetLogger(...) ; //pattern layout format: "[%ndc] - %message%newline" log.Info("message 1"); using(log4net.NDC.Push("context") { using(log4net.NDC.Push("inner_context") { log.Info("message 2"); } log.Info(