I've been struggling with a problem and I hope somebody can point me in the right direction...
I'm making a lightmap/ambient occlusion map generator system, and for that I built a rasterizer that calls a function that does the computations and fills the target image.
The rasterizer works in UV space, but all parameters of the triangle are interpolated.
Now, I wanted to add multisampling, so that I don't get just a single sample for the ambient occlusion, and I want to "jitter" the source point (not only the raycast direction),
and for that I need to find out what's the area of the target lumel. By area, I mean not only the actual area value, but the "rectangle" that bounds the lumel, in world space...
So, what I want to do is, given
- triangle T=(V1,V2,V3), in which V1, V2, V3 are vertexes that have some properties (world space position, normal, diffuse color, texture coordinates 0 (in uniform space), texture coordinates 1 (in texture space, [0..texture size[), etc),
- texture size
- position inside the triangle (absolute value in texture space)
is to find out the rectangle that bounds the texel in world space (origin+2 vectors)...
I've been thinking about this, but can't seem to find an approach that works correctly... I'm expecting some error in this calculation (due to the rasterizing process itself), but it's not a big deal since it's for sampling purposes, but even so I can't seem to make it work...
So, if anyone got any links, keywords, or just a simple algorithm he doesn't mind sharing, I'd appreciate it!
Diogo de Andrade