Именование источников света

From Valve Developer Community
< Ru
Jump to navigation Jump to search
English (en)Русский (ru)中文 (zh)Translate (Translate)

Указание целевого имени(en) объекта источника света light вынуждает VRAD(en) создавать второй "слой" карты освещения(en) для поверхностей, которые освещаются этим источником. Это не повлияет на производительность в игре, но увеличит время компиляции и размер BSP-файла, независимо от того, будет ли использоваться вход(en) источника света для изменения его состояния.

При попытке обработать большое количество перекрывающихся источников света с разными именами (поскольку количество необходимых слоёв увеличивается в геометрической прогрессии) может произойти превышение возможностей системы освещения. В этом случае производительность может снизиться, и возможно появление аномалий освещения.

VRAD пытается избежать этого с помощью жёстко заданных ограничений в 4 слоя карты освещения на грань (слои создаются для каждой возможной комбинации состояний) и 30 стилей/поведений источника света(en), созданных для целевого имени. При превышении этих ограничений VRAD выдаёт предупреждение "Too many light styles on a face (Слишком много стилей освещения на грани)" и пропустит расчёт карт освещения для этих источников света, в результате эти области будут выглядеть неосвещенными. Можно сократить их количество, указав общее целевое имя источникам света, которые всегда будут одновременно менять своё состояние, что позволит VRAD объединить их слои.

Tip.pngСовет: If your game supports dynamic lighting system (Black Mesa Black Mesa or Portal 2: Desolation Portal 2: Desolation for example) - use dynamic light sources instead of light and light_spot. This will reduce map size and make load times better. Don't do so in cases when dynamic light looks much worse then baked light, or when dynamic light causes big problems with performance.
Note.pngПримечание:
  • Light styles will affect page growth exponentially. To calculate the number of pages a brush face will have, take 2n where n is the number of different names used for lights affecting the brush face.
  • To reduce the number of pages created, light from named light entities is direct and won't bounce between surfaces. This can look very crude!
PlacementTip.pngОбходной приём: If the light is never entirely turned off, add an unnamed dimmer light source next to it. Its lighting will create bounces. If the light is, however, ever entirely turned off, you can add dimmer named lights around the area to simulate bounces instead.
Icon silk wrench green fix.pngРешение:Garry's Mod VRAD(en) has a -bounceFromNamed parameter that can force named and styled lights to cast bounced lighting. Note that this will increase lightmap usage!
Confirm.pngПодтвердить: According to ficool2, this adds bounced lighting data to all lightmap pages, making lights untoggleable
  • Setting an animated appearance(en) for the light counts as "naming it", even though the style key is incompatible with targetname(en).
  • Pre-baked static prop(en) lighting is always generated in with named and styled lights in their "off" position. If this is an issue, disable per-vertex lighting for the given prop.
  • Cubemaps defined using env_cubemap will only store lighting for one state of the toggled light. If this is an issue, and the surface is not part of a static prop or displacement, manually define an $envmap and use a material proxy to toggle the $envmapframe.
Icon-Bug.pngБаг:There is a bug in the Left 4 Dead Left 4 Dead engine that affect the use of named lights. A named light, even if totally still will be considered fully dynamic by the engine and pump up a large chunk of frames per second until it is turned off and on for the first time. The workaround is to set the light to start turned off and to turn it on on map spawn using a logic_auto entity for instance. This could also affect Left 4 Dead 2 Left 4 Dead 2, but this has not been proven.
Warning.pngПредупреждение: Although lights with the same targetname share lightmap pages, each light will still count as a separate edict(en)! If using a bunch of lights with a shared name, consider removing the targetname from all but one of the light entities of a given name after compiling lighting, using a tool such as Entspy Entspy.
Cpp.pngИсправление кода: Modify VRAD(en) to add a _targetname KV to lights that acts the same as targetname. This way, only one light will need a targetname, and the rest will have a _targetname that is ignored by the game instead.
Нужно сделать: Which source code file and function checks for targetname on light entities? Mention such here.
Confirm.pngПодтвердить: Potential workaround: If you only have one set of named lights, it should be possible to manually set the style key to 32 for all but one light that will be affected by that name.
If you have multiple sets of named lights, editing the VMF manually may be necessary (lightstyles for named lights are defined in the order the names are listed in the VMF).

Смотреть также