Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 16 Jul 2009
Offline Last Active Jul 23 2015 02:20 AM

Topics I've Started

Help with box stacking instability

06 July 2014 - 01:47 AM

Hi, I'm trying to implement my own physics simulation, but get stuck on jittering problem even if I only put one box on the infinite plane. I use sequential impulse to solve contact constraint, and I also add some penetration slop.


after some debugging I found out that when the box is resting on the infinite plane the collision point isn't exactly the center of the contact surface of the box, about 1e-8 error grade off the center.  And that is generating some rotation impulse which I think is the problem (if I comment out the application of rotation impulse, the box would rest still). How can I solve this? I don't think I can further improve collision point accuracy it's the numerical limit of floating point. and I haven't implemented contact caching. 


Thanks in advance.

Variance Shadow Map fades when shadow is close to occluder

01 July 2014 - 01:56 AM

I've implemented the variance shadow map, but still got a problem that is the shadow fades when it approaches the occluder. The same issue was posted here


It seems like it's the weakness of the algorithm because p_max ( = variance / [variance + d * d]) would inevitably go to 1 when d becomes smaller. But I don't see the same problem in the authors' paper or demo, neither did they mention it. I guess I probably did something wrong. Do you have the same issue? how do you address it? Thanks.


very small variance value from Variance Shadow Mapping

27 June 2014 - 09:10 PM

Sorry, it was a bug in my code. How can I delete the thread?


Hi, I'm trying to implement Variance Shadow Mapping, but get very small variance and Chebychev's upper bound, which results in sharp shadow edges. And I've turned on OpenGL texture linear filtering. Could anyone help out on this? Thanks.


#version 400

layout(location = 0) out vec2 moments;

void main()

      float depth = gl_FragCoord.z/*  * 0.5 + 0.5 */;

      float moment1 = depth;
      float moment2 = depth * depth;

      moments = vec2(moment1, moment2);
float chebyshevUpperBound(vec3 shadowPos)
vec2 moments = texture(shadowMap[0], shadowPos.xy).rg;

float bias = 0.000028;
if (shadowPos.z - bias <= moments[0])
return 1.0 ;

float variance = moments.y - (moments.x * moments.x);
variance = max(variance, 0.00002);

float d = v2fShadowPos.z - moments.x;
// this value is really small !!!!
float p_max = variance / (variance + d * d);

return p_max;

problems with shadow mapping(frontface culling, depth texture)

24 June 2014 - 01:47 AM

I'm trying to implement Variance Shadow Mapping. As I searched around I found many sites mentioned that frontface culling could reduce self-shadowing artifacts, but I failed to generate shadow map whenever I turned on frontface culling, and I think it's reasonable, because all the front facing triangle would be culled out. I mean let's imagine your eyes are camera and there's a counter-clock winding(front facing) triangle in front of you, then you do a frontface culling and throw the triangle away, now how could you get the depth of the back face of that triangle? Could someone explain this to me?


another question is: when I render depth to texture, OpenGL would convert x and y from normal device coordinate to texture coordinate(from [-1, 1] to [0, 1]), does the same goes to z axis?

problem about torque generated by sequential impulse

14 June 2014 - 12:12 AM

Sorry, I made a mistake in calculating the angular velocity. Fixed.


Hi, I'm making my own physics engine. The problem I now came across is that when I position the box on its edge on the plane at the beginning of the simulation, then it rotates really slowly to the resting position(lying on one face on the plane). I think this is expected, because the penetration between the box and the plane is really small, the torque impulse generated by "sequential impulse" method is also really small, hence slow rotation. But how do I deal with this problem?


Thanks in advance.