AB4D Forum
Lights sources and animation - Printable Version

+- AB4D Forum (https://forum.ab4d.com)
+-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4)
+--- Forum: Viewer3ds and Ab3d.Reader3ds (https://forum.ab4d.com/forumdisplay.php?fid=5)
+--- Thread: Lights sources and animation (/showthread.php?tid=205)

Lights sources and animation - ViSoR - 11-23-2011


I'm using Reader3ds with PowerTools for 3D scene visualization and animation and I have found one issue with lights.

My 3D scene contains 5 light sources with color #FF666666. This scene looks fine, lighting is soft and beautiful, but when I run the animation, all lights change color to #FFFFFFFF that breaks scene lighting.
Same behavior in the Viewer3ds.

Sample image attached.

Are there any workaround for this issue?


RE: Lights sources and animation - ViSoR - 11-23-2011

I have found workaround for this issue. Maybe it is not very good solution from the performance side, but on my dev and test configurations it works fine.
Main idea - collect lights settings after scene loading and restore it on each animation step.

private Dictionary<Light, Color> _lights;

private void ReadSceneLightsColors()
    _lights = new Dictionary<Light, Color>();

    foreach (var light in _mainReader3ds.Lights)
        _lights[light] = light.Color;

private void RestoreLights()

    foreach (var light in _mainReader3ds.Lights)
        light.Color = _lights[light];


private void ViewOnRendering(object sender, EventArgs e)


RE: Lights sources and animation - abenedik - 11-24-2011

From the original 3ds file that was privately sent to me I have seen that the light color was changed because the 3ds file defines one key frame (used to define animations) for the color of the light with white color.

This color was different from the color that was set when the light was initially defined in 3ds file - there the light was gray.

So when the animation was started, this key frame was used for the light color. Usually (at least for the 3ds file that I had) the color defined by the light and in the key frame are the same. But in your case this was not the case.

I have changed the Reader3ds to not use the key frame color if there is only one key frame defined (so if the color is not being animated).

I have already send a fixed version to ViSor. I am preparing a new version of Reader3ds and Viewer3ds that will be available soon and will also contain that fix.