Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[General] Torch light disappearing

Discussion in 'World Editor Help Zone' started by HerrDave, Jul 2, 2017.

  1. HerrDave

    HerrDave

    Joined:
    Dec 23, 2013
    Messages:
    1,095
    Resources:
    165
    Models:
    137
    Icons:
    20
    Skins:
    8
    Resources:
    165
    Can someone explain to me why when I have a custom model (no mesh, just omni light) in my map, all other light sources stop working?

    Custom torch models and regular ones no longer produce light, and this is rather annoying as that was the entire point of having them there.
     
  2. HerrDave

    HerrDave

    Joined:
    Dec 23, 2013
    Messages:
    1,095
    Resources:
    165
    Models:
    137
    Icons:
    20
    Skins:
    8
    Resources:
    165
    Slight update - I've found /a single/ torch which produces light, but it stops if I move it out of an invisible square I cannot see.
     
  3. Lord Aiden

    Lord Aiden

    Joined:
    Jun 20, 2017
    Messages:
    959
    Resources:
    0
    Resources:
    0
    I think the new patches screwed lots of things up. . .
     
  4. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    26,124
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    The fixed function shader pipeline used by Warcraft III only supports a maximum of 8 different light sources per vertex patch. Since it is possible to have more than 8 lights in a scene Warcraft III uses a spatial light selection model that tries to select the 8 most appropriate lights to render a vertex patch. This is good enough for accurate lighting in most cases, such as a few torches with huge distances between them. However if there are a lot of lights present in close proximity then it is possible that less significant lights get selected or that not enough lights can be selected for reasonable illumination.

    8 lights might seem a lot but one must remember that 1 light is already used by the global environment model. Additionally portraits might use lights, which seem to have a spatial positioning of 0,0 (selecting Crypt Lord unit will cause the middle of the map to get brighter!).

    Any custom lights have to be kept small so that the spatial light selection algorithm can function reasonably well. If they are made too big, eg global, then the algorithm might select them from far away when there are much closer lights that are more meaningful. In the worst case it is possible that the algorithm will even discard the global environment model light in favour of other lights, resulting in there being no base level of brightness for the vertex patch (likely what is happening to you).

    Coping with more lights per vertex patch would have required additional passes through the pipeline (each pass for 8 lights so 24 lights would be 3 passes) with the results being blended together. This causes scene complexity to be dependent on the product of number of lights and number of vertex patches. This square like scaling would mean that scenes with a lot of lights could potentially perform very badly despite having only average patch complexity, a situation where one can go from high FPS to low FPS just by moving the camera around. To prevent such complexity scaling from occurring Blizzard decided to limit each patch to a single lighting pass so render time was only dependent on the number of vertex patches in the scene.

    Technically the 8 light limit applies to processing fragments, however the lights used have to be specified per vertex patch job and so are constant for all fragments from that vertex patch.

    If you want to use light as a gameplay element I recommend using StarCraft II rather than Warcraft III. StarCraft II has a much more advanced lighting system which can deal with a near infinite number of lights in a scene as well as have spotlights that cast shadows. This is the difference around 10 years of technology and using programmable shaders makes.