Hi!
I don't know how to call this. Maybe "frustrum coordinate list generation"? I'd like to generate a list of "quadrant coordinates" (/integer 3d points) from my "view" variables (render range, view matrix, projection matrix, maybe FOV?) instead of starting out with a full list and culling the ones that aren't between frustum planes.
At the moment I have at my disposal...:
- A view matrix and a projection matrix.
- A quasi infinite set of objects / particles (partially procedurally generated, partially in database / hash lists etc)
- A very cheap method of testing which objects are in quadrant [x, y, z] (shouldn't be a problem to do this each frame for every quadrant inside the view frustum with enough time left over to render all the objects).
- A "camera" object, that - at the moment - is limited to always pointing straight down so I can do my "reverse" culling with a simple / easy loop until I figure out how to cram my view/projection matrix (probably also need FOV for the x/y-range increment per z slice somehow?) into that thing...:
for (int z = 0; z<RENDERRANGE && stuffloaded; ++z) {
for (int x = -z *xviewratio; x < z*xviewratio; ++x)
for (int y = -z*yviewratio; y < z*yviewratio; ++y)
{
Quadrant* qu = GetQuadrant(vec3i(RenderCenter.x + x, RenderCenter.y + y, RenderCenter.z - z));
if (qu->GetQuadrantWANTstatus() < QuadrantStatus_e::RenderReady) {
qu->setWantParticleRender();
} else if (qu->GetQuadrantCURRENTstatus() == QuadrantStatus_e::RenderReady)
{ qu->DrawAllParticlesInHere(); }
}
}
My usual "trial + error" approach to math hasn't worked so far because there's just too many steps that I'd have to figure out correctly all at once since smaller steps in between won't render anything for me to use as feedback... And trying to wrap my head around all of them at once hurts my brain -.-. Tried reading some random matrix / math / linear algebra articles, hoping that stuff would just start looking more transparent to me at some point, but that has not worked so far either.
So... Any hints?