Light problem (simple)

Hi dudes,



How can I set a scene with light everywhere?

I mean, same light, to all objets and faces ?

That's all. Any tip?  :expressionless:

I found this code in some post:


    private void setupLighting(Renderer renderer, Node rootNode) {
        /** Set up a basic, default light. */
        DirectionalLight light = new DirectionalLight();
        light.setDiffuse(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
        light.setAmbient(new ColorRGBA(0.5f, 0.5f, 0.5f, 1.0f));
        light.setDirection(new Vector3f(1, -1, 0));
        light.setEnabled(true);

        /** Add a second light for more brightness */
        DirectionalLight light2 = new DirectionalLight();
        light2.setDiffuse(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
        light2.setAmbient(new ColorRGBA(0.5f, 0.5f, 0.5f, 1.0f));
        light2.setDirection(new Vector3f(-1, 1, 0));
        light2.setEnabled(true);

        /** Attach the light to a lightState and the lightState to rootNode. */
        LightState lightState = renderer.createLightState();
        lightState.setGlobalAmbient(new ColorRGBA(1f, 1f, 1f, 0f));
        lightState.setEnabled(true);
        lightState.attach(light);
        lightState.attach(light2);
        rootNode.setRenderState(lightState);
    }



It creates 2 directional lights in opposite directions and could be a solution depending on the case... I don't know of any 'general illumination' solution

Maybe make use of ambient light - theres some useful info in this thread



http://www.jmonkeyengine.com/forum/index.php?topic=11711.0