Page 1 of 1
Baking Lightmaps

Posted:
31 Jul 2012, 23:00
by UraniumSlug
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?
Re: Baking Lightmaps

Posted:
01 Aug 2012, 00:43
by Auria
UraniumSlug: I think you have missed
http://supertuxkart.sourceforge.net/Tra ... #Lightmaps 
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
Re: Baking Lightmaps

Posted:
01 Aug 2012, 15:14
by UraniumSlug
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?
Re: Baking Lightmaps

Posted:
01 Aug 2012, 22:17
by Auria
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
Re: Baking Lightmaps

Posted:
03 Aug 2012, 11:16
by UraniumSlug
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?
Re: Baking Lightmaps

Posted:
03 Aug 2012, 22:53
by Auria
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
Re: Baking Lightmaps

Posted:
08 Aug 2012, 17:52
by UraniumSlug
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.
Re: Baking Lightmaps

Posted:
10 Aug 2012, 17:27
by UraniumSlug
One last question Auria. Can I use the same UV coordinates as the splat overlay?
Re: Baking Lightmaps

Posted:
11 Aug 2012, 01:07
by Auria
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)
Re: Baking Lightmaps

Posted:
13 Aug 2012, 10:09
by UraniumSlug
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!
Re: Baking Lightmaps

Posted:
14 Aug 2012, 22:12
by UraniumSlug
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?
Re: Baking Lightmaps

Posted:
14 Aug 2012, 23:43
by Auria
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
Re: Baking Lightmaps

Posted:
15 Aug 2012, 20:14
by UraniumSlug
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?
Re: Baking Lightmaps

Posted:
16 Aug 2012, 00:40
by Auria
you did rebuild irrlicht after doing this change?
Re: Baking Lightmaps

Posted:
16 Aug 2012, 20:00
by UraniumSlug
I'm pretty sure I built it again before I did. Let me do it again to make doubly sure. It was pretty late...
Re: Baking Lightmaps

Posted:
16 Aug 2012, 22:45
by UraniumSlug
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!
Re: Baking Lightmaps

Posted:
16 Aug 2012, 23:08
by Arthur
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.

Re: Baking Lightmaps

Posted:
17 Aug 2012, 01:47
by Auria
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

Re: Baking Lightmaps

Posted:
30 Aug 2012, 10:08
by UraniumSlug
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

.
Re: Baking Lightmaps

Posted:
31 Aug 2012, 02:00
by Auria
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