Re: [Algorithms] Lightmapping method
Brought to you by:
vexxed72
From: Paul at H. <pa...@ru...> - 2007-02-25 17:20:02
|
Thanks, I'll bear this in mind. You guessed right about shadows. I've actually started doing that, but I've had to move on to redoing my octree stuff as it was a port from an old engine and there's some bugs in that too! Not a good weekend so far :( Regards, Paul Johnson. Managing Director, Rubicon Mobile, Ltd. www.rubiconmobile.com ----- Original Message ----- From: "Thatcher Ulrich" <tu...@tu...> To: "Game Development Algorithms" <gda...@li...> Sent: Sunday, February 25, 2007 5:13 PM Subject: Re: [Algorithms] Lightmapping method > On 2/24/07, Paul at Home <pa...@ru...> wrote: >> I have the basic idea about rasterising the triangle. I was trying to set >> a >> texel box if the line passed anywhere through it as opposed to just the >> right side of centre. I think I must've had some bugs or alignment issues >> going on though as even after outline filtering it I still saw the >> occasional gap or crack. >> >> I've switched over to my plan B after someone mentioned barycentric >> coordinates to me and it all dropped into place. I now run over the >> entire >> rectangle, use bary to get the right point/normal on the triangle and >> bobs >> your uncle. I appreciate that with care a triangle plotter could/shoud be >> workable, but this new (to me) method is a lot more robust. I get no >> seams, >> no gaps, no anything and the new code took 10 minutes to slot in. Having >> opened my post with a call for help, I'd now feel confident recommending >> this method to anyone, if only for its ease of implementation. >> >> I didn't clamp those barycentrics btw, which is why it works so well, I >> think. Sure the accuracy drops off as you start scanning outside the >> triangle, but this fall-off is linear and gradual and the source normals >> should all be fairly similar to begin with, so it's not noticeable in >> practice. Not to me anway. >> >> A better still way would probably to switch to the "other" triangle as >> soon >> as you pass out of the first one, but so far in my reasonably complicated >> test case, I don't see anywhere where this refinement is needed - it all >> looks great as it is :) > > 1. I'm guessing you're not computing shadows yet. Smooth lighting can > hide many fudges in a lightmapper, but shadow edges tend to expose > them. > > 2. If and when you start mapping larger connected pieces of the mesh > into one chart (as Jon mentioned), I think you will have problems with > your technique, i.e. what do you do with interior edges? > > What worked for me was an antialiased renderer; i.e. compute exact > texel coverage along boundaries. I used an additive > blending/precomputed alpha scheme for rendering, so the coverage went > into the alpha channel. After the chart was rendered, I bled unfilled > texels using nearby filled texels (fattening). And then, divide > through by alpha to get the correct final color. This makes interior > edges and fattened texels behave pretty well. > > Another random trick (for the record): on the boundary of a chart, > snap vertex mappings to texel centers. > > -T > >> Good point about using bigger polygons where possible. My current first >> pass >> just puts one triangle into a rectangle and is very wasteful. I was >> thinking >> about reflections into the 'other' corner to reuse space, but using >> larger >> areas to begin with will help there too. I might need to look at my >> packing >> routine a bit though so it's not dependent on outer bounding rectangles >> so >> much as smaller divisions for "L" shaped polys. >> >> One other thing that overscanning back-projection may solve is the >> differences between renderers. It's been a long time since I did any OGL, >> but I remember at least at some point the texel offset rules were >> different >> to D3D for example. This may of course apply to any other rendering >> solutions too, so a triangle plotting solution would need to >> overcompensate >> for this possibility too ? >> >> Regards, >> Paul Johnson. >> >> Managing Director, >> Rubicon Mobile, Ltd. >> www.rubiconmobile.com >> >> ----- Original Message ----- >> From: "Jon Watte" <hp...@mi...> >> To: "Game Development Algorithms" >> <gda...@li...> >> Sent: Saturday, February 24, 2007 12:10 AM >> Subject: Re: [Algorithms] Lightmapping method >> >> >> > >> > >> > Paul Johnson wrote: >> >> Hmmm, maybe I'm missing something here. When I have a triangle that's >> >> basically a near-degenerate sliver at 45 degrees, all it's going to >> >> draw >> >> is some dots. Fattening up just isn't working for me in those cases. >> >> Maybe my UV are off generally, but I don't think so - I've spent time >> >> looking at pixel centre issues already. >> >> >> >> >> > >> > If you rasterize the triangle as the union of the inside and its edge >> > lines, and then fatten up, you'll get more than a few dots. Mapping >> > backwards can work, too, as you say, but you have to clamp to the >> > nearest point within the triangle. Also make sure to leave enough >> > gutter >> > for MIP mapping. Because of gutters (and other filtering and efficiency >> > reasons), good light mappers will attempt to create as large connected >> > charts as possible for the light maps, btw. >> > >> > Cheers, >> > >> > / h+ >> > >> > >> > ------------------------------------------------------------------------- >> > Take Surveys. Earn Cash. Influence the Future of IT >> > Join SourceForge.net's Techsay panel and you'll get the chance to share >> > your >> > opinions on IT & business topics through brief surveys-and earn cash >> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> > _______________________________________________ >> > GDAlgorithms-list mailing list >> > GDA...@li... >> > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list >> > Archives: >> > http://sourceforge.net/mailarchive/forum.php?forum_id=6188 >> > >> > >> > >> > >> >> >> ------------------------------------------------------------------------- >> Take Surveys. Earn Cash. Influence the Future of IT >> Join SourceForge.net's Techsay panel and you'll get the chance to share >> your >> opinions on IT & business topics through brief surveys-and earn cash >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> _______________________________________________ >> GDAlgorithms-list mailing list >> GDA...@li... >> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list >> Archives: >> http://sourceforge.net/mailarchive/forum.php?forum_id=6188 >> >> > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=6188 > > > > |