LightsprintSDK 2021.08.08
Baking

Baked lighting is common approach today. Superior lighting quality is reached at cost of fixing lights in static positions, global illumination is precomputed.

Lightsprint SDK helps by baking

  • lightmaps, directional lightmaps, ambient maps, environment maps, bent normals and light detail maps for static objects
  • lightfields for dynamic objects
  • unwrap, if you don't provide yours

SceneViewer tool

SceneViewer is an interactive tool ready for immediate use in both static GI and realtime GI. It lets you build lightmaps, ambient occlusion, unwrap, manipulate lights, materials and geometry with immediate GI updates etc. More about SceneViewer.
Run prebuilt version by bin/win32/SceneViewer.*.exe or bin/x64/SceneViewer.*.exe, or build your own version, source code is included.

BuildLightmaps tool

BuildLightmaps is a commandline tool ready for immediate use. More about BuildLightmaps.
Enter LightsprintSDK/samples/BuildLightmaps directory and see .bat files that demonstrate how to use it (comments inside). Run BuildLightmaps.bat for complete list of commandline arguments.
BuildLightmaps comes with source code, so programmers can customize it.

Custom tools

If you prefer lightmap building integrated into your existing tools (e.g. game editor), consult your programmers. Lightsprint functions are easily accessible for tool programmers, they were already integrated into several game editors.

Geometry

Any triangle-based geometry is supported without restrictions.
Scene size is virtually unlimited with 64bit code. With 32bit code, read how to relax scene size limits.
In rare cases, artifacts may appear in proximity of huge triangles. Solution is to avoid or temporarily tessellate huge triangles.

Materials

All material types are supported. There's no need for any additional information, Lightsprint automatically converts your engine's native materials to Lightsprint materials used during calculation.

Lights

All light sources are supported - point, spot, directional, emissive materials, sky (flat color, LDR or HDR texture).

Unwrap

Lightsprint SDK supports both user-provided and automatically generated unwrap. SceneViewer and other samples let you build unwrap in single fully automatic step. If you build unwrap in third party tools like 3ds Max, export it as part of scene or model. Various scene formats have different ways of marking uv channel for lightmaps (unwrap). To test whether your unwrap is imported properly, open scene in SceneViewer sample and click Global illumination / Inspect unwrap. Click objects in Scene tree to see unwrap of different objects. You can try Global illumination / Build lightmaps with low quality just to see whether unwrap errors (e.g. missing unwrap) are reported. If you see only warnings, it's up to you to review calculated lighting, sometimes problems are hardly visible and may be ignored.

In order to better utilize lightmap space and reduce lightmap sizes and baking time, you want to reduce lightmap resolutions and gutter padding (horizontal or vertical distance between charts, usually 2 or 2.5 texels) as much as possible. However, if you reduce it too much, single texel will affect two charts, it will show up mapped to two different places in scene. Lightsprint is specially hardened for such situation and calculates the best possible compromise color to make this error as noteless as possible. With unwrap charts optimally aligned, gutter may be as small as 1 texel, without any errors. In worst case of unaligned charts, gutter must be at least 2 for perfect result.

File formats

Lightsprint SDK does not lock your data in properietary formats. Instead, it supports 95+ standard file formats. In case you pick Collada, here's list of available Collada plugins.

Night scenes

When creating night scene, you might consider two options - reduce light intensity or make materials darker. Both have the same effect on direct illumination. But global illumination reveals dramatic difference - bright materials reflect lots of light and create rich indirect illumination with color bleeding; dark materials absorb light and hardly create any indirect illumination. So reducing light intensity simulates night in normal world; making all materials dark simulates day in world covered by black color. Of course we recommend keeping usual materials and reducing light intensity, results look better.

Tangent space

Directional lightmaps (RNMs) approximate illumination by storing light incoming from 3 directions. These directions are derived from tangent basis - normal, tangent and bitangent. When using different tangent basis, lighting is approximated differently, and may be slightly brighter or darker. So if you need things to look identically, ensure that they use identical tangent bases or properly mirrored bases. Mirroring with RNMs is tricky, it works only in one axis, tangent or bitangent (depends on naming convention). When mirrored along wrong axis, RNMs use different set of directions and lighting differs.

Soft or Penumbra shadows

"Soft" shadows, shadows with smooth edges, can be created with smoothing parameter (BuildLightmaps: smoothing=, ToolBench: LsSmoothing, code: smoothingAmount or lightmapSmooth()). It makes all edges equally smooth.

"Penumbra" shadows, shadows of varying softness, are created when light does not come from single point but from multiple directions, either

  • from sky (set sky/environment texture and make sure there are open windows or 'holes' in mesh so that skylight gets inside)
  • or from large surface with emissive material
  • or from cloud of 20+ lights (created manually or by your program)
  • or from realtime area light (supported only in Lightsprint's realtime renderer)

"occlusion" option in BuildLightmaps tool also creates penumbra shadows, it works by setting white environment.