Baking Lightmaps

Baking Lightmaps

Postby UraniumSlug » 31 Jul 2012, 23:00

Figured it was time to start a new topic. I'm planning on adding support for lightmaps. Would it be possible for an artist to bake me all the lightmaps that are required?
UraniumSlug
 
Posts: 19
Joined: 21 Jul 2012, 12:58

Re: Baking Lightmaps

Postby Auria » 01 Aug 2012, 00:43

UraniumSlug: I think you have missed http://supertuxkart.sourceforge.net/Tra ... #Lightmaps :D SuperTuxKart already has support for lightmaps in 0.8

Now, unless you are referring to the combination of lightmaps and splatting, which is something I referred to in another post. For this, I don't think you need a 'real' baked lightmap, I suggest just taking the splatting map used for the overworld in SVN, and manually paint a rought lightmap with lighter and darker areas, then it's easy to see in-game if the shadows painted on the lightmap are properly applied. And while I usualyl say "lightmap" what we do are generally more shadow maps, just multiplying the pixel from shadow image
Image
User avatar
Auria
STK Moderator
 
Posts: 2976
Joined: 07 Dec 2009, 03:52

Re: Baking Lightmaps

Postby UraniumSlug » 01 Aug 2012, 15:14

Ah I see, I totally forgot the original spec then. So let me get this right, are you wanting to add Shadow maps, or just the technique you described manually painting a lightmap?
UraniumSlug
 
Posts: 19
Joined: 21 Jul 2012, 12:58

Re: Baking Lightmaps

Postby Auria » 01 Aug 2012, 22:17

UraniumSlug {l Wrote}:Ah I see, I totally forgot the original spec then. So let me get this right, are you wanting to add Shadow maps, or just the technique you described manually painting a lightmap?


I'm not sure I followed you. Whether the map was painted by hand or baked is irrelevant to the implementation. The implementation will just load a grayscale image and multiply the color by the value at the corresponding location on the shadow map
Image
User avatar
Auria
STK Moderator
 
Posts: 2976
Joined: 07 Dec 2009, 03:52

Re: Baking Lightmaps

Postby UraniumSlug » 03 Aug 2012, 11:16

I'll give it a shot, I've never manually painted a map before but if it's decent then I'll give it a shot using the splatted overworld map. Shall I take the task on Sourceforge?
UraniumSlug
 
Posts: 19
Joined: 21 Jul 2012, 12:58

Re: Baking Lightmaps

Postby Auria » 03 Aug 2012, 22:53

UraniumSlug {l Wrote}:I'll give it a shot, I've never manually painted a map before but if it's decent then I'll give it a shot using the splatted overworld map. Shall I take the task on Sourceforge?


yes you can take the sourceforge task.

And really don't worry about painting the map, just make something in 2 minutes for the sake of testing only. When the feature is coded by us developers, artists can start using it (properly) ;) the important is that you have some fake data to test that it works. You can just use greyscale clouds or something like that and you will be able to see if it works
Image
User avatar
Auria
STK Moderator
 
Posts: 2976
Joined: 07 Dec 2009, 03:52

Re: Baking Lightmaps

Postby UraniumSlug » 08 Aug 2012, 17:52

Argh, I'm having huge problems logging into SourceForge and claiming the ticket for some reason (this has been an ongoing issue). Is there any way you can assign me the ticket, then I'll get started on it as soon as I know I've "claimed" it. Should be a quick job.

If you're able to assign it to me, my nick is the same as on here.
UraniumSlug
 
Posts: 19
Joined: 21 Jul 2012, 12:58

Re: Baking Lightmaps

Postby UraniumSlug » 10 Aug 2012, 17:27

One last question Auria. Can I use the same UV coordinates as the splat overlay?
UraniumSlug
 
Posts: 19
Joined: 21 Jul 2012, 12:58

Re: Baking Lightmaps

Postby Auria » 11 Aug 2012, 01:07

UraniumSlug {l Wrote}:One last question Auria. Can I use the same UV coordinates as the splat overlay?


not only you can, but you need to :) because irrlicht, until version 2.0 (which none of us expects before a couple gazillion years), is limited to 2 UV layers. So this leaves us no choice but to use the same UV layer for the lightmap and splatting map (though that's not especially bad since those are similar things so normally the same mapping will work good enough for both)
Image
User avatar
Auria
STK Moderator
 
Posts: 2976
Joined: 07 Dec 2009, 03:52

Re: Baking Lightmaps

Postby UraniumSlug » 13 Aug 2012, 10:09

Good thing I asked then, just wanted to make sure you didn't have some other idea that I hadn't thought about for this lightmap ^_^. I'll get the rest sorted this week then!
UraniumSlug
 
Posts: 19
Joined: 21 Jul 2012, 12:58

Re: Baking Lightmaps

Postby UraniumSlug » 14 Aug 2012, 22:12

So, I gave this a try yesterday and I was greeted with a black texture. After reverting the shader and doing some digging I suspect it's got to do with the fact that the splatting sets four textures and I was attempting to set a fifth as a lightmap. Judging by the source code, irrlicht only supports up to four materials.

Auria, how do you suggest I work around this limitation?
UraniumSlug
 
Posts: 19
Joined: 21 Jul 2012, 12:58

Re: Baking Lightmaps

Postby Auria » 14 Aug 2012, 23:43

UraniumSlug {l Wrote}:So, I gave this a try yesterday and I was greeted with a black texture. After reverting the shader and doing some digging I suspect it's got to do with the fact that the splatting sets four textures and I was attempting to set a fifth as a lightmap. Judging by the source code, irrlicht only supports up to four materials.

Auria, how do you suggest I work around this limitation?


oh yeah I forgot to tell you. Irrlicht does support more than 4, edit IrrCompileConfig.h and change line #define _IRR_MATERIAL_MAX_TEXTURES_ 4 to say 8

We plan to integrate our own copy of irrlicht inside STK soon so that we can configure it as we wish. Sorry for forgetting this piece of information
Image
User avatar
Auria
STK Moderator
 
Posts: 2976
Joined: 07 Dec 2009, 03:52

Re: Baking Lightmaps

Postby UraniumSlug » 15 Aug 2012, 20:14

As soon as I attempt to raise the value of the define above 4 I start getting exceptions. Specifically
{l Code}: {l Select All Code}
irr_driver->getVideoDriver()->enableMaterial2D();
it's in engine.cpp line 1229. Any idea what could be causing this?
UraniumSlug
 
Posts: 19
Joined: 21 Jul 2012, 12:58

Re: Baking Lightmaps

Postby Auria » 16 Aug 2012, 00:40

you did rebuild irrlicht after doing this change?
Image
User avatar
Auria
STK Moderator
 
Posts: 2976
Joined: 07 Dec 2009, 03:52

Re: Baking Lightmaps

Postby UraniumSlug » 16 Aug 2012, 20:00

I'm pretty sure I built it again before I did. Let me do it again to make doubly sure. It was pretty late...
UraniumSlug
 
Posts: 19
Joined: 21 Jul 2012, 12:58

Re: Baking Lightmaps

Postby UraniumSlug » 16 Aug 2012, 22:45

No idea what was going on, bit the bullet and updated to the current build. Seems to be cool. Shader mod will be ready soon!
UraniumSlug
 
Posts: 19
Joined: 21 Jul 2012, 12:58

Re: Baking Lightmaps

Postby Arthur » 16 Aug 2012, 23:08

UraniumSlug {l Wrote}:No idea what was going on, bit the bullet and updated to the current build. Seems to be cool. Shader mod will be ready soon!

That's strange; I thought Irrlicht was the culprit.

Oh. Never mind. ;)
Hey pal, I took an oath for justice! "In happy days or tightest tights..." or something like that.
User avatar
Arthur
 
Posts: 1073
Joined: 06 Dec 2009, 00:49

Re: Baking Lightmaps

Postby Auria » 17 Aug 2012, 01:47

UraniumSlug {l Wrote}:No idea what was going on, bit the bullet and updated to the current build. Seems to be cool. Shader mod will be ready soon!


glad you got the problem solved :)
Image
User avatar
Auria
STK Moderator
 
Posts: 2976
Joined: 07 Dec 2009, 03:52

Re: Baking Lightmaps

Postby UraniumSlug » 30 Aug 2012, 10:08

Haven't looked at this for a while, real life got a bit in the way :(. I've put the shader together though, however my 5th sample isn't being set properly (there weren't many checks in the original source to validate this). This evening I plan to step through and find out exactly why this is occuring. Fear not, it will be finished :).
UraniumSlug
 
Posts: 19
Joined: 21 Jul 2012, 12:58

Re: Baking Lightmaps

Postby Auria » 31 Aug 2012, 02:00

UraniumSlug {l Wrote}:Haven't looked at this for a while, real life got a bit in the way :(. I've put the shader together though, however my 5th sample isn't being set properly (there weren't many checks in the original source to validate this). This evening I plan to step through and find out exactly why this is occuring. Fear not, it will be finished :).


Thanks for the update, don't worry if real life gets in the way, it happens to all of us
Image
User avatar
Auria
STK Moderator
 
Posts: 2976
Joined: 07 Dec 2009, 03:52

Who is online

Users browsing this forum: No registered users and 1 guest