PDA

View Full Version : finding used texels...



tobiaso
05-01-2002, 07:44 AM
Hi all!

I need to get the actual texels that are used by a triangle. That is I have the texture coordinates and an image, I now need to know exactly which texels are beeing used when the triangle is displayed.

I have tried making a simple "triangle rasterizer" and this seems to be the way to go but my algo misses some texels in some cases.

Any ideas?

regards!

/hObbE

Robbo
05-01-2002, 12:08 PM
You cannot get this information from OpenGL. If you are doing your own rasterizer for triangles, the information is immediately available to you however. Unfortunately, your graphics card will skip texels or blend them depending on scale, mapping, alpha etc.

Furrage
05-02-2002, 04:53 AM
Would feedback help with this? Or is the information returned by feedback insufficient.

Robbo
05-02-2002, 10:47 AM
Feedback refers primarily to the transform and lighting part of the pipeline. It allows you to get back transformed and lit vertex information so that your own code can do analysis or rasterize the geometry from there on in (can't think of many applications that would need to do this).

If there is a particular application you need this for, we might be able to think up some alternative solution?

zed
05-02-2002, 02:04 PM
someone gave me this link the other day http://developer.nvidia.com/view.asp?IO=Show_Footprint

tobiaso
05-03-2002, 07:48 AM
Thanx for the replies guys! Nice to know that one always can find help from U!

Actually I reworked all my code today and fond a robust sollution. It is a subpixel accuracy DDA (I think it's called ;-) It seems to be working fine!

Got the general idea from this page:
http://cs-people.bu.edu/jisidoro/cs480/additional/trirast5.htm

I use this to calculate lightmaps in my application. That is I map the vertices of the poly, create a suitable image and then iterate over the texels actually visible performing lighting calcs. Works fine.

Now my problem is that my triangle fan poly generator generates some degenerate (non convex) polygons messing up the whole thing. But I have the whole weekend to fix that one ;-)

regards!
/hObbE

zed
05-03-2002, 02:15 PM
>>I use this to calculate lightmaps in my application. That is I map the vertices of the poly, create a suitable image and then iterate over the texels actually visible performing lighting calcs. Works fine.<<

easy with barycentric coordinates