Jump to content

Lightmapping levels: Difference between revisions

m (/cat)
Line 2: Line 2:
Oni doesn't really support light maps, but we like to pretend that it does. See [http://geyser.oni2.net/TEMP/tower/lightmap.jpg HERE] for why we do and [http://geyser.oni2.net/TEMP/tower/lightmap2.jpg HERE] for why we shouldn't.
Oni doesn't really support light maps, but we like to pretend that it does. See [http://geyser.oni2.net/TEMP/tower/lightmap.jpg HERE] for why we do and [http://geyser.oni2.net/TEMP/tower/lightmap2.jpg HERE] for why we shouldn't.


In these screenshots, the lightmaps are part of the environment. They form a second layer of quads over the notmally 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 of the blur effect. The only problem is that right now this texture is transparent, but doesn't have a BSP tree (supposed to be used for sorting when rendering particles etc, see [[ABNA]]). Apparently these shadows are always rendered in front of the opaque 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.
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 lightmaps of all that, another file with invisiwalls and invisiramps, another with a pathfinding mesh, etc.
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==