19,903
edits
m (/cat) |
m (link fix) |
||
| (8 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
==Lightmaps and Oni== | ==Lightmaps and Oni== | ||
Oni doesn't really support light maps, but we like to pretend that it does. See [ | Oni doesn't really support light maps, but we like to pretend that it does. See [[:Image:Lightmap particle sorting issue 1.jpg|HERE]] for why we do and [[:Image:Lightmap particle sorting issue 2.jpg|HERE]] for why we shouldn't. | ||
In these screenshots, the | In these screenshots, the light maps are part of the environment. They form a second layer of quads over the normally textured ones, but they have their own texture coordinates, and they have their own unique texture. This shadow texture has a much lower resolution than the regular textures, but that is not a problem because the large pixels are also blurred-out: that's how light maps are usually done anyway. The only problem is... well, there are two problems. | ||
#Normally (for a game that supports actual light maps) each quad of the environment would have not one but two sets of UV coordinates: one for the main texture, and the other for the light map data, which would directly darken the color of the main texture. Since Oni only draws regular quads, with one set of UVs each, we need to have those two identical quads (same vertex positions, but different textures and UVs), and the texture on one of the quads needs to be transparent, so we can use the alpha blending. That means that we are using twice as many quads as required by the actual geometry. | |||
#Since the transparent light map quad does not work as a window, we don't want it to have a BSP tree (which is used for sorting when rendering particles etc, see [[ABNA]]). So these are transparent quads, but of a different kind ([[ABNA]]-less), never encountered in the original Oni. Apparently such quads are always rendered in front of the texture quads, unless hidden by other environment (which is good), but particles are always rendered ''behind'' the shadows (i.e., between the opaque environment and the shadow), and this is quite noticeable, unless the shadows are very subtle. | |||
At the time of writing (14:54, 4 October 2010 (UTC)), OniSplit can import level geometry from several COLLADA files. For example, there could be one file for geometry and furniture, another file for the | At the time of writing (14:54, 4 October 2010 (UTC)), OniSplit can import level geometry from several COLLADA files. For example, there could be one file for geometry and furniture, another file for the light maps of all that, another file with invisi-walls and invisi-ramps, another with a pathfinding mesh, etc. | ||
==Our options== | ==Our options== | ||
| Line 17: | Line 19: | ||
The tool that does all that is Blender. The task is not exactly "mainstream", so there is not much support for it, but the ingredients are there. Here they are: | The tool that does all that is Blender. The task is not exactly "mainstream", so there is not much support for it, but the ingredients are there. Here they are: | ||
#[ | #[https://vi-wer.de.tl/Lightmap-Tutorial.htm A tutorial for the "Lightmap UV Pack" script]. The good thing about this script is that it can batch-process several meshes at once. The bad thing is that for every mesh, it packs the UVs into a single texture, so for large or detailed meshes meshes either the lightmap will be pixellated, or you need to make the texture's resolution huge. | ||
#[http://blenderartists.org/forum/showthread.php?t=128467 An alternative Multi Lightmapper script], which generates new textures as needed, but can only process one mesh at a time. | #[https://web.archive.org/web/20080917030026/http://blenderartists.org/forum/showthread.php?t=128467 An alternative Multi Lightmapper script], which generates new textures as needed, but can only process one mesh at a time. | ||
# | #Some more scripts for the batch processing of many meshes (<nowiki>https://forum.unity3d.com/viewtopic.php?t=36467</nowiki>, dead link) (e.g. for saving the generated textures to files; neither of the above scripts save the baked lightmaps, and since there can be hundreds of them, automatic saving is badly needed). | ||
No tutotial of our own, for now, but if you want to experiment with this, you can. | No tutotial of our own, for now, but if you want to experiment with this, you can. | ||
| Line 27: | Line 29: | ||
:You can also see that my current GFX card (or, rather, lack thereof) is ''not'' OK (there's no anisotropic filtering, and the texture detail decreases very fast with camera distance). | :You can also see that my current GFX card (or, rather, lack thereof) is ''not'' OK (there's no anisotropic filtering, and the texture detail decreases very fast with camera distance). | ||
:This means that no matter how good the lightmaps are, the screenshot session that I had planned will probably look crappy if done on my current rig. I should've known that. F##k. | :This means that no matter how good the lightmaps are, the screenshot session that I had planned will probably look crappy if done on my current rig. I should've known that. F##k. | ||
[[Image:Lightmapped monitor bank.jpg]] | |||
:Tomorrow (Tuesday) there will be some time for Konoko to upload some screenshots from Monday's errands. | :Tomorrow (Tuesday) there will be some time for Konoko to upload some screenshots from Monday's errands. | ||
For now, here are the instance files of the above test (level5), for | For now, here are the instance files of the above test (level5), for | ||
[http://geyser.oni2.net/edition/levels/examples/lightmaps/monitor/ | [http://geyser.oni2.net/edition/levels/examples/lightmaps/monitor/level5_MonitorPC.zip PC], | ||
[http://geyser.oni2.net/edition/levels/examples/lightmaps/monitor/level5_MonitorMacIntel.zip Intel Mac] | [http://geyser.oni2.net/edition/levels/examples/lightmaps/monitor/level5_MonitorMacIntel.zip Intel Mac] | ||
and | and | ||
| Line 37: | Line 40: | ||
==Catch him Konoko== | ==Catch him Konoko== | ||
:This is the "blue" area of the Syndicate Warehouse, the one with the first [[Comguy]] and [[ | :This is the "blue" area of the Syndicate Warehouse, the one with the first [[Comguy]] and [[Data console#Alarm consoles|alarm console]]. | ||
[[Image:Lightmapped Warehouse.jpg]] | |||
:The lightmaps are mostly OK, but "mostly" is not enough, as you can see for yourself: [http://geyser.oni2.net/edition/levels/examples/lightmaps/C1SP3/level5_C1SP3.zip PC], [http://geyser.oni2.net/edition/levels/examples/lightmaps/C1SP3/level5_C1SP3MacIntel.zip Intel Mac], [http://geyser.oni2.net/edition/levels/examples/lightmaps/C1SP3/level5_C1SP3MacPPC.zip PPC Mac]. (WARNING: It requires globalized environment textures, so it will NOT work with the current [[AE]], only with the previous one). | :The lightmaps are mostly OK, but "mostly" is not enough, as you can see for yourself: [http://geyser.oni2.net/edition/levels/examples/lightmaps/C1SP3/level5_C1SP3.zip PC], [http://geyser.oni2.net/edition/levels/examples/lightmaps/C1SP3/level5_C1SP3MacIntel.zip Intel Mac], [http://geyser.oni2.net/edition/levels/examples/lightmaps/C1SP3/level5_C1SP3MacPPC.zip PPC Mac]. (WARNING: It requires globalized environment textures, so it will NOT work with the current [[AE]], only with the previous one). | ||
:The most remarkable thing is that some quads are either black or very dark. Sometimes they stay out of the way of radiosity iterations, but sometimes it's the texture-baking part that ignores them. The first problem can (apparently) be solved by separating the level into even smaller parts than what you see here (for example, the staircases can be lightmapped separately, to compensate for the large number of smallish quads). The second problem can (apparently) be solved by baking to very large textures (1024x1024, 2048x2048 etc) and then downsampling the result. A third solution would be for the lightmaps to use another background color than black, so that all the abnormally dark quads would get some default brightness (probably normal-looking enough to the casual eye). I rather like that last solution best, because it's quick and dirty, and I'm getting sick enough of lightmapping as it is ^_^ | :The most remarkable thing is that some quads are either black or very dark. Sometimes they stay out of the way of radiosity iterations, but sometimes it's the texture-baking part that ignores them. The first problem can (apparently) be solved by separating the level into even smaller parts than what you see here (for example, the staircases can be lightmapped separately, to compensate for the large number of smallish quads). The second problem can (apparently) be solved by baking to very large textures (1024x1024, 2048x2048 etc) and then downsampling the result. A third solution would be for the lightmaps to use another background color than black, so that all the abnormally dark quads would get some default brightness (probably normal-looking enough to the casual eye). I rather like that last solution best, because it's quick and dirty, and I'm getting sick enough of lightmapping as it is ^_^ | ||