Well, no my rasterizer (which might be a piece of trash...) is a scanline rasterizer…
So, for the following triangle:
I know the left gradient, and the right gradient… Problem is that the position gradient of AC (for example) is something like scalar*(sqrt(2)/2,sqrt(2)/2) and not the “down” scalar*(0,1) gradient I’d like… The horizontal gradient works allright, since I’m interpolating between the spans…
As far as I understand the problem, the issue is that for every pixel, I know how to reach the next horizontal lumel (which is one of the things I need), and on the edges, I know how to go to the next lumel on the edge (which most of the time doesn’t match the actual “down” position I need).
For communication purposes, I’m calling the “down” position to the world-relative vector that takes me from the position of the current lumel, to the one that’s right below it in UV space… The “next horizontal lumel” is the one that’s right to the right of the current one in UV space.
Don’t know if this was clear enough, I’m starting to have a hard time getting my head around the problem (maybe too close to it by now)…
From: Sebastian Sylvan [mailto:email@example.com]
Sent: sexta-feira, 4 de Fevereiro de 2011 11:48
To: Game Development Algorithms
Subject: Re: [Algorithms] Texel area
On Fri, Feb 4, 2011 at 10:50 AM, Diogo de Andrade <firstname.lastname@example.org> wrote:
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!
The interpolator in the rasterizer should already know the gradient for the position w.r.t. the pixel (i.e.lumel, in this case) position right? So you once you know the center position for a given pixel (lumel) it should be easy to compute the world space positions of the corners of that pixel (just take the position gradient multiplied by +/- 0.5pixels and add it to the center position), which gives you the quadraliteral in world space.
Sebastian Sylvan------------------------------------------------------------------------------ The modern datacenter depends on network connectivity to access resources and provide services. The best practices for maximizing a physical server's connectivity to a physical network are well understood - see how these rules translate into the virtual world? http://p.sf.net/sfu/oracle-sfdevnlfb_______________________________________________ GDAlgorithms-list mailing list GDAlgorithmsemail@example.com https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list