• Create Account

# ic0de

Member Since 11 Nov 2010
Offline Last Active Apr 21 2016 03:24 PM

### In Topic: point inside convex quad, using only integers?

03 April 2016 - 05:41 PM

So here's what I managed to do, I get the sign of the determinant for each edge and make sure all the edges have the same sign if they do then the point is in the quad. Seems to work ok so far.

```bool pointInBox(quad q, point p)
{
point* v = q.vertices;

bool d0 = ((int32_t)(v[1].x - v[0].x) * (int32_t)(p.y - v[0].y)) > ((int32_t)(v[1].y - v[0].y) * (int32_t)(p.x - v[0].x));
bool d1 = ((int32_t)(v[2].x - v[1].x) * (int32_t)(p.y - v[1].y)) > ((int32_t)(v[2].y - v[1].y) * (int32_t)(p.x - v[1].x));
bool d2 = ((int32_t)(v[3].x - v[2].x) * (int32_t)(p.y - v[2].y)) > ((int32_t)(v[3].y - v[2].y) * (int32_t)(p.x - v[2].x));
bool d3 = ((int32_t)(v[0].x - v[3].x) * (int32_t)(p.y - v[3].y)) > ((int32_t)(v[0].y - v[3].y) * (int32_t)(p.x - v[3].x));

return d0 == d1 &&  d1 == d2 && d2 == d3;
}
```

### In Topic: fitting Geomipmapping into my existing tree system

02 December 2014 - 02:27 PM

Do you put the heightmap in the same data structure as the rest of the world scenery (buildings etc.) though?

### In Topic: Problem with perspective in opengl

23 November 2014 - 01:44 PM

This doesn't look like a perspective problem, it looks like you're culling the wrong faces. Have you set glCullFace(GL_BACK)? If not that may fix your problem. You may also need to set glFrontFace(GL_CCW).

### In Topic: getting better results with exponential shadow mapping

18 November 2014 - 11:40 AM

OK so after filtering my shadow map with a separable log space Gaussian blur and capping the shadow frustum far plane at the point where light fades to zero, I have started to see some improvement. I have determined that the problem originates from the fact that I appear to be getting less depth buffer precision for objects that are far away from the light. Shortening the distance between the near and far planes of the light frustum seems to combat this. I'm not really sure if I can shorten them any more, especially the near plane as I could miss objects between the light and the shadow receiver. As of now I'm not using any polygon offset, is this technique still relevant for ESM?

Anyways this is where I'm at now (although the lighting conditions are slightly different):

Its better than before but occluders far from the light experience a far worse manifestation of this artifact.

### In Topic: odd behavior with globally declared scoped reference types, is this normal?

22 October 2014 - 09:51 PM

Thanks for the amazingly quick fix. I know that new isn't guaranteed to be aligned but I overloaded the operator to ensure this as I was having trouble in other parts of application.

EDIT: tested your revision with my code and it works like magic, you really are a wizard.

PARTNERS