About lights, particles and autopilot (with screenshot)

Hi,



At the moment im trying to figure out how to correctly implement some stuff and was hoping for a little bit of help.



At the moment I have a textured corridor made out of 4 quads. Plain and simple. What I want to do is make them really dark. In order to do so I've used the lighting function from the Flagrush tutorial



    private void buildLighting() {
        /** 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, .5f));
        light.setDirection(new Vector3f(1,100,0));
        light.setShadowCaster(true);
        light.setEnabled(true);

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




Notice the light.setDirection(new Vector3f(1,100,0));
I've put the light way up high above my corridor. Now whenever I am actually -in- my corridor I see the "roof" lit up by the light and the sides and floor being dark.

I thought, for some strange reason, the light was shining trough the "roof" so I placed a even bigger quad between the light source and the corridor, hoping it would block off. This didnt work. Apparantly, the top-side of every item gets lit up by the light source. I was wondering what I should be looking for if i want it to be changed.


About the particle stuff:
I've also checked the tutorial and tried to implement it correctly. However for some strange reason my particles don't move! :'(
The lazy buggers just sit there being all sphere-like. It's hard to explain but the screenshots should be enough. I wanted to make a box with particles coming out of it.

this is my code


package com.techdemo;


import java.io.IOException;
import java.net.URL;
import java.nio.FloatBuffer;
import java.util.HashMap;
import javax.swing.ImageIcon;

import com.jmex.effects.ParticleManager;
import com.jme.scene.state.AlphaState;
import com.jme.scene.state.LightState;
import com.jme.scene.state.TextureState;
import com.jme.scene.state.ZBufferState;
import com.jme.math.Quaternion;
import jmetest.TutorialGuide.HelloStates;
import jmetest.effects.TestParticleSystem;
import jmetest.renderer.ShadowTweaker;
import jmetest.renderer.TestAnisotropic;
import jmetest.renderer.TestSkybox;
import jmetest.terrain.TestTerrain;
import com.jme.app.SimpleGame;
import com.jme.scene.shape.Box;
import com.jme.scene.shape.Quad;
import com.jme.scene.shape.Sphere;
import com.jme.math.Vector3f;
import com.jme.app.BaseGame;
import com.jme.bounding.BoundingBox;
import com.jme.bounding.BoundingSphere;
import com.jme.bounding.BoundingVolume;
import com.jme.image.Texture;
import com.jme.scene.state.LightState;
import com.jme.input.ChaseCamera;
import com.jme.input.FirstPersonHandler;
import com.jme.input.InputHandler;
import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jme.input.joystick.JoystickInput;
import com.jme.input.thirdperson.ThirdPersonMouseLook;
import com.jme.light.DirectionalLight;
import com.jme.math.FastMath;
import com.jme.math.Vector3f;
import com.jme.renderer.Camera;
import com.jme.renderer.ColorRGBA;
import com.jme.renderer.Renderer;
import com.jme.app.SimpleGame;
import com.jme.app.BaseGame;
import com.jme.renderer.Camera;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Node;
import com.jme.scene.SharedMesh;
import com.jme.scene.Text;
import com.jme.scene.shape.Box;
import com.jme.scene.state.*;
import com.jme.input.*;
import com.jme.util.Timer;
import com.jme.util.TextureManager;
import com.jme.util.LoggingSystem;
import com.jme.system.DisplaySystem;
import com.jme.system.JmeException;
import com.jme.math.Vector3f;
import com.jme.image.Texture;
import com.jme.light.PointLight;
import java.util.logging.Level;
import com.jmex.awt.JMECanvas;
import com.jmex.awt.SimpleCanvasImpl;


import com.jme.input.MouseInput;


public class techDemoTorchParticles extends BaseGame
{
   
      private int width, height, depth, freq;
      private boolean fullscreen;
      private Camera cam;
      protected Timer timer;
      private Node scene;
      private Node torchNode;
      private Node partNode;
      protected InputHandler input;
      protected float interpolation;
      private ParticleManager manager;
      
      private Quad wall;
      //private Vector3f axis = new Vector3f(0f, 0f, 1f);
      
      //public URL monkeyLoc=techDemoTest3.class.getClassLoader().getResource("jmetest/data/images/Monkey.jpg");


   
   public static void main(String[] args)
   {
      techDemoTorchParticles app = new techDemoTorchParticles();
      app.setDialogBehaviour(ALWAYS_SHOW_PROPS_DIALOG, techDemoTorchParticles.class.getClassLoader().getResource("jmetest/data/images/Monkey.jpg"));

      app.start();
   }
   
   protected void update(float interpolation)
   {
      timer.update();
      interpolation = timer.getTimePerFrame();
      input.update(interpolation);
   
      if (KeyBindingManager.getKeyBindingManager().isValidCommand("exit"))
         {
         finished = true;
         }
   }
   
   protected void render(float interpolation)
    {
      display.getRenderer().clearBuffers();
      display.getRenderer().draw(scene);
 
    }
   
   protected void initSystem()
    {
      //store the properties information
      width = properties.getWidth();
      height = properties.getHeight();
      depth = properties.getDepth();
      freq = properties.getFreq();
      fullscreen = properties.getFullscreen();
      
      try {
         display = DisplaySystem.getDisplaySystem(properties.getRenderer());
         display.createWindow(width, height, depth, freq, fullscreen);
 
         cam = display.getRenderer().createCamera(width, height);
      } catch (JmeException e) {
         e.printStackTrace();
         System.exit(1);
      }
 
      //set the background to black
      display.getRenderer().setBackgroundColor(ColorRGBA.black);
      
      //initialize the camera
      cam.setFrustumPerspective(45.0f, (float)width / (float)height, 1, 1000);
      Vector3f loc = new Vector3f(0.0f, 0.0f, 25.0f);
      Vector3f left = new Vector3f(-1.0f, 0.0f, 0.0f);
      Vector3f up = new Vector3f(0.0f, 1.0f, 0.0f);
      Vector3f dir = new Vector3f(0.0f, 0f, -1.0f);
      // Move our camera to a correct place and orientation.
      cam.setFrame(loc, left, up, dir);
      /** Signal that we've changed our camera's location/frustum. */
      cam.update();
      
         /** Create a basic input controller. */
        FirstPersonHandler firstPersonHandler = new FirstPersonHandler( cam, properties.getRenderer() );
        /** Signal to all key inputs they should work 10x faster. */
        firstPersonHandler.getKeyboardLookHandler().setActionSpeed(5f);
        firstPersonHandler.getMouseLookHandler().setActionSpeed(2f);
        input = firstPersonHandler;
      
       /** Get a high resolution timer for FPS updates. */
       timer = Timer.getTimer(properties.getRenderer());
       display.getRenderer().setCamera(cam);

      
      KeyBindingManager.getKeyBindingManager().set("exit", KeyInput.KEY_ESCAPE);
 
    }
   
   protected void initGame()
      {
      scene = new Node("Scene graph node");
      
      //Set the Z-buffer up correctly
      ZBufferState buf = display.getRenderer().createZBufferState();
        buf.setEnabled(true);
        buf.setFunction(ZBufferState.CF_LEQUAL);
        scene.setRenderState(buf);
       
        //Implementation of "Culling"; render only objects visible.
        CullState cs = display.getRenderer().createCullState();
        cs.setCullMode(CullState.CS_BACK);
        scene.setRenderState(cs);
       
        //Initialization time!
      
       
       // buildTorch();
        buildFlame();
       
      
       scene.updateGeometricState(0.0f, true);
      scene.updateRenderState();
      }
     
   
   protected void reinit()
   {
      display.recreateWindow(width, height, depth, freq, fullscreen);
   }
   
   
   protected void cleanup()
   {
   
         LoggingSystem.getLogger().log(Level.INFO, "Cleaning up resources.");
         KeyInput.destroyIfInitalized();
         MouseInput.destroyIfInitalized();
         JoystickInput.destroyIfInitalized();
   }
   
   
   
   private void buildTorch()
   {
      Box b=new Box("My box",new Vector3f(0,0,0),new Vector3f(1,1,1));    // Make a box
      b.setModelBound(new BoundingBox());
        b.updateModelBound();
      scene.attachChild(b);
   }
   
   private void buildFlame()
   {
       AlphaState as1 = display.getRenderer().createAlphaState();
       as1.setBlendEnabled(true);
       as1.setSrcFunction(AlphaState.SB_SRC_ALPHA);
       as1.setDstFunction(AlphaState.DB_ONE);
       as1.setTestEnabled(true);
       as1.setTestFunction(AlphaState.TF_GREATER);
       as1.setEnabled(true);

       TextureState ts = display.getRenderer().createTextureState();
       ts.setTexture(
           TextureManager.loadTexture(
           TestParticleSystem.class.getClassLoader().getResource(
           "jmetest/data/texture/flaresmall.jpg"),
           Texture.MM_LINEAR_LINEAR,
           Texture.FM_LINEAR));
       ts.setEnabled(true);

       manager = new ParticleManager(300);
       manager.setGravityForce(new Vector3f(0.0f, 0.0f, 0.0f));
       manager.setEmissionDirection(new Vector3f(0,1,0));
       manager.setParticlesOrigin(new Vector3f(0,0,0));
       manager.setInitialVelocity(.006f);
       manager.setStartSize(2.5f);
       manager.setEndSize(.5f);
       manager.setParticlesMinimumLifeTime(1200f);
       manager.setStartColor(new ColorRGBA(1, 0, 0, 1));
       manager.setEndColor(new ColorRGBA(0, 1, 0, 0));
       manager.setEmissionMaximumAngle(360f * FastMath.DEG_TO_RAD);
       manager.setControlFlow(false);
       manager.setRandomMod(0f);
       manager.warmUp(60);
      
       scene.setRenderState(ts);
       scene.setRenderState(as1);
      
       manager.getParticles().addController(manager);
       manager.getParticles().setModelBound(new BoundingSphere());
       manager.getParticles().updateModelBound();

       scene.attachChild(manager.getParticles());
   }

   
      

}






Finally, I want to fly arround the corridor allong a predetermined path, give the watcher a demonstration so to speak. What is the best way to achieve this?

Thanks in advance!

Maybe we need macro recording support. :wink:



You can script destinations and how long you want it to take to get there and on each update determine the percentage of the time that has elapsed and adjust the positioning accordingly.



darkfrog

Check out TestBezierCurve in the jmetest.curve package, it's an example on how to move an spatial along a specified path.

One thing to make note of.  Placing something (like a roof) between a light source and something else does NOT block the light.  Shadowing is something that has to be setup properly and generally you can do the effect without resorting to the use of shadows anyway.

You may try applying a material state to the walls to get a dimmer shade

Gaheris said:

Check out TestBezierCurve in the jmetest.curve package, it's an example on how to move an spatial along a specified path.


Good suggestion! Thanks!
I'll look into it!

kidneybean said:

You may try applying a material state to the walls to get a dimmer shade


I'll look into this as well!

Thanks alot for the replies. Atleast I have a lead again :)
I'm still wondering about the particle thing though.

The fireball on the screenshot is motionless. Nothing happends. A hint where I need to look to set it in motion would help me alot!

Again, thanks for the support! :)

you need to update controllers etc with



            scene.updateGeometricState(tpf, true);



in your update method…

It worked!  :smiley:

Ahem… I mean… ofcourse it worked  :lol:



One small question, is there also a "SharedMesh" for particlestuff?



It seems like a waste of resources to recreate the same particle flame over and over again.

I would simply create a factory that reuses from a pool of particlemesh objects.  FurBallz did this for its explosions in ExplosionFactory.

Thanks alot!  XD

This is what I got after messing with it some more!





Unfortunatly I’ve run into another problem which I can’t solve.

It involves lighting. I’ve checked the TestLightState.java file but no luck. What I want is to have a Spotlight pointed at the flames as to portray the light coming off from it.



What I’ve done is the following:



I’ve copied the TestLightState example.

I’ve added a Quad.

I created a light spot pointing at the squad.

I get -no- sight of the spotlight unless the spotlight’s angle is ridiculously high.



I’ve added boxes at the location of the lightspots as to see they’ve been placed well.



The existing spotlights reflect perfectly but whenever I add another light spot it aint working well.

What am I doing wrong and how can I make a good lightspot. Its unclear to me, even with the use of examples, what im doing wrong.  :expressionless:



Thanks in advance again! :slight_smile:









package com.techdemo;
import java.io.IOException;
import java.net.URL;
import java.nio.FloatBuffer;
import java.util.HashMap;
import javax.swing.ImageIcon;
import com.jme.scene.state.AlphaState;
import com.jme.scene.state.FragmentProgramState;
import com.jme.scene.state.LightState;
import com.jme.scene.state.TextureState;
import com.jme.scene.state.VertexProgramState;
import com.jme.scene.state.ZBufferState;
import com.jme.math.Quaternion;
import jmetest.TutorialGuide.HelloStates;
import jmetest.effects.TestParticleSystem;
import jmetest.renderer.ShadowTweaker;
import jmetest.renderer.TestAnisotropic;
import jmetest.renderer.TestSkybox;
import jmetest.renderer.state.TestLightState;
import jmetest.terrain.TestTerrain;
import com.jme.app.SimpleGame;
import com.jme.scene.shape.Box;
import com.jme.scene.shape.Pyramid;
import com.jme.scene.shape.Quad;
import com.jme.scene.shape.Sphere;
import com.jme.math.Vector3f;
import com.jme.app.BaseGame;
import com.jme.bounding.BoundingBox;
import com.jme.bounding.BoundingSphere;
import com.jme.bounding.BoundingVolume;
import com.jme.image.Texture;
import com.jme.scene.state.LightState;
import com.jme.input.ChaseCamera;
import com.jme.input.FirstPersonHandler;
import com.jme.input.InputHandler;
import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jme.input.joystick.JoystickInput;
import com.jme.input.thirdperson.ThirdPersonMouseLook;
import com.jme.light.DirectionalLight;
import com.jme.math.FastMath;
import com.jme.math.Vector3f;
import com.jme.renderer.Camera;
import com.jme.renderer.ColorRGBA;
import com.jme.renderer.Renderer;
import com.jme.app.SimpleGame;
import com.jme.app.BaseGame;
import com.jme.renderer.Camera;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Node;
import com.jme.scene.SharedMesh;
import com.jme.scene.Spatial;
import com.jme.scene.Text;
import com.jme.scene.TriMesh;
import com.jme.scene.shape.Box;
import com.jme.scene.state.*;
import com.jme.input.*;
import com.jme.util.Timer;
import com.jme.util.TextureManager;
import com.jme.util.LoggingSystem;
import com.jme.system.DisplaySystem;
import com.jme.system.JmeException;
import java.util.logging.Level;
import com.jme.animation.SpatialTransformer;
import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingSphere;
import com.jme.light.PointLight;
import com.jme.light.SimpleLightNode;
import com.jme.light.SpotLight;
import com.jme.math.FastMath;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Node;
import com.jme.scene.shape.Sphere;
import com.jme.scene.state.LightState;
import com.jme.util.LightStateController;
import com.jme.util.LightStateCreator;
import com.jme.light.LightNode;
import com.jme.input.MouseInput;
import com.jmex.effects.ParticleManager;
import com.jmex.effects.transients.FadeInOut;
import com.jmex.effects.transients.FadeInOutController;


public class techDemoLightStateTest extends BaseGame
{
   
      private int width, height, depth, freq;
      private boolean fullscreen;
      private Camera cam;
      protected Timer timer;
      private Node scene;
      private Node torches;
      protected InputHandler input;
      protected float interpolation;
      protected float tpf;
      
      private FadeInOut fio;
      private FadeInOutController fioC;
      
      private ParticleManager manager;
      
      private Node partNode1;
      private Node partNode2;
      private Node partNode3;
      private Node partNode4;
      private Node partNode5;
      private Node partNode6;
      
      private Quad wall;
      private Quad smallerWall;
      private Quad floor;
      private Quad antiLightWall;
      private Box  torch;
      
      protected LightState lightState;
      private TriMesh t;
      private LightNode lightnode;
      //private Vector3f axis = new Vector3f(0f, 0f, 1f);
      
      //public URL monkeyLoc=techDemoTest3.class.getClassLoader().getResource("jmetest/data/images/Monkey.jpg");


   
   public static void main(String[] args)
   {
      techDemoLightStateTest app = new techDemoLightStateTest();
      app.setDialogBehaviour(NEVER_SHOW_PROPS_DIALOG, techDemoTest1.class.getClassLoader().getResource("jmetest/data/images/Monkey.jpg"));

      app.start();
   }
   
   protected void update(float interpolation)
   {
      timer.update();
      interpolation = timer.getTimePerFrame();
      input.update(interpolation);
   
      if (KeyBindingManager.getKeyBindingManager().isValidCommand("exit"))
         {
         finished = true;
         }
   
      timer.update();
        /** Update tpf to time per frame according to the Timer. */
        tpf = timer.getTimePerFrame();
        /** Check for key/mouse updates. */
        input.update( tpf );
   
   scene.updateGeometricState(tpf, true);
      
   }
   
   protected void render(float interpolation)
    {
      display.getRenderer().clearBuffers();
      display.getRenderer().draw(scene);
 
    }
   
   protected void initSystem()
    {
      //store the properties information
      width = properties.getWidth();
      height = properties.getHeight();
      depth = properties.getDepth();
      freq = properties.getFreq();
      fullscreen = properties.getFullscreen();
      
      try {
         display = DisplaySystem.getDisplaySystem(properties.getRenderer());
         display.createWindow(width, height, depth, freq, fullscreen);
 
         cam = display.getRenderer().createCamera(width, height);
      } catch (JmeException e) {
         e.printStackTrace();
         System.exit(1);
      }
 
      //set the background to black
      display.getRenderer().setBackgroundColor(ColorRGBA.black);
      
      //initialize the camera
      cam.setFrustumPerspective(45.0f, (float)width / (float)height, 1, 1000);
      Vector3f loc = new Vector3f(0.0f, 0.0f, -13.0f);
      Vector3f left = new Vector3f(-1.0f, 0.0f, 0.0f);
      Vector3f up = new Vector3f(0.0f, 1.0f, 0.0f);
      Vector3f dir = new Vector3f(0.0f, 0f, -1.0f);
      // Move our camera to a correct place and orientation.
      cam.setFrame(loc, left, up, dir);
      /** Signal that we've changed our camera's location/frustum. */
      cam.update();
      
         /** Create a basic input controller. */
        FirstPersonHandler firstPersonHandler = new FirstPersonHandler( cam, properties.getRenderer() );
        /** Signal to all key inputs they should work 10x faster. */
        firstPersonHandler.getKeyboardLookHandler().setActionSpeed(10f);
        firstPersonHandler.getMouseLookHandler().setActionSpeed(1f);
        input = firstPersonHandler;
      
       /** Get a high resolution timer for FPS updates. */
       timer = Timer.getTimer(properties.getRenderer());
       display.getRenderer().setCamera(cam);

      
      KeyBindingManager.getKeyBindingManager().set("exit", KeyInput.KEY_ESCAPE);
      
      

 
    }
   
   protected void initGame()
      {
      scene = new Node("Scene graph node");
      
      //Set the Z-buffer up correctly
      ZBufferState buf = display.getRenderer().createZBufferState();
        buf.setEnabled(true);
        buf.setFunction(ZBufferState.CF_LEQUAL);
        scene.setRenderState(buf);
       
        //Implementation of "Culling"; render only objects visible.
        CullState cs = display.getRenderer().createCullState();
        cs.setCullMode(CullState.CS_BACK);
        scene.setRenderState(cs);
       
        lightState = display.getRenderer().createLightState();
        lightState.setEnabled( true );
        //lightState.attach( light );
        scene.setRenderState( lightState );
       
        //Initialization time!

        display.setTitle("Light State Test");
        cam.setLocation(new Vector3f(-10,0,40));
        cam.update();

        Vector3f max = new Vector3f(10,10,10);
        Vector3f min = new Vector3f(0,0,0);

      
       
        Box slt1 = new Box("spotlighttracker1", new Vector3f(0,0,0), new Vector3f(2,2,2));
        slt1.setModelBound(new BoundingBox());
        slt1.updateModelBound();
       
        Box slt2 = new Box("spotlighttracker2",new Vector3f(0,0,0), new Vector3f(2,2,2));
        slt2.setModelBound(new BoundingBox());
        slt2.updateModelBound();
       
        Box slt3 = new Box("spotlighttracker3",new Vector3f(0,0,0), new Vector3f(2,2,2));
        slt3.setModelBound(new BoundingBox());
        slt3.updateModelBound();
       
       
       
       
        t = new Box("Box", min,max);
        t.setModelBound(new BoundingSphere());
        t.updateModelBound();

        Pyramid t2 = new Pyramid("Pyramid", 10,20);
        t2.setModelBound(new BoundingSphere());
        t2.updateModelBound();

        Quad t3 = new Quad("Quad",100,100);
        t3.setModelBound(new BoundingBox());
        t3.updateModelBound();
       
        t.setLocalTranslation(new Vector3f(0,0,-10));

        t2.setLocalTranslation(new Vector3f(-20,0,0));

        t3.setLocalTranslation(new Vector3f(-10,10,-20));
       
        scene.attachChild(t);
        scene.attachChild(t2);
        scene.attachChild(t3);

        SpotLight sp1 = new SpotLight();
        sp1.setDiffuse(new ColorRGBA(0.0f, 1.0f, 0.0f, 1.0f));
        sp1.setAmbient(new ColorRGBA(0.5f, 0.5f, 0.5f, 1.0f));
        sp1.setDirection(new Vector3f(-1, -0.5f, 0));
        sp1.setLocation(new Vector3f(25, 10, 0));
        sp1.setAngle(15);
        sp1.setEnabled(true);

        SpotLight sp2 = new SpotLight();
        sp2.setDiffuse(new ColorRGBA(1.0f, 0.0f, 0.0f, 1.0f));
        sp2.setAmbient(new ColorRGBA(0.5f, 0.5f, 0.5f, 1.0f));
        sp2.setDirection(new Vector3f(1, -0.5f, 0));
        sp2.setLocation(new Vector3f(-25, 10, 0));
        sp2.setAngle(15);
        sp2.setEnabled(true);

        DirectionalLight dr = new DirectionalLight();
        dr.setDiffuse(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
        dr.setAmbient(new ColorRGBA(0.5f, 0.5f, 0.5f, 1.0f));
        dr.setSpecular(new ColorRGBA(1.0f, 0.0f, 0.0f, 1.0f));
        dr.setDirection(new Vector3f(150, 0 , 150));
        dr.setEnabled(true);
       
        SpotLight sp3 = new SpotLight();
        sp3.setDiffuse(new ColorRGBA(1.0f, 0.312f, 0.121f, 1.0f));
        sp3.setAmbient(new ColorRGBA(0.5f, 0.5f, 0.5f, 1.0f));
        sp3.setDirection(new Vector3f(2, 0, -25));
        sp3.setLocation(new Vector3f(-25, 10, -15));
        sp3.setAngle(40);
        sp3.setEnabled(true);
       
        slt1.setLocalTranslation(new Vector3f(25, 10, 0));
        slt2.setLocalTranslation(new Vector3f(-25, 10, 0));
        slt3.setLocalTranslation(new Vector3f(-5, 10, -15));
      
       scene.attachChild(slt1);
       scene.attachChild(slt2);
       scene.attachChild(slt3);

        lightState.detachAll();
        lightState.attach(sp1);
        lightState.attach(dr);
        lightState.attach(sp2);
        lightState.attach(sp3);

        TextureState ts = display.getRenderer().createTextureState();
                ts.setEnabled(true);
                ts.setTexture(
                    TextureManager.loadTexture(
                        TestLightState.class.getClassLoader().getResource("jmetest/data/images/Monkey.jpg"),
                        Texture.MM_LINEAR_LINEAR,
                        Texture.FM_LINEAR));

        scene.setRenderState(ts);
       
      
       scene.updateGeometricState(0.0f, true);
      scene.updateRenderState();
      }
     
   
   protected void reinit()
   {
      display.recreateWindow(width, height, depth, freq, fullscreen);
   }
   
   
   protected void cleanup()
   {
   
         LoggingSystem.getLogger().log(Level.INFO, "Cleaning up resources.");
         KeyInput.destroyIfInitalized();
         MouseInput.destroyIfInitalized();
         JoystickInput.destroyIfInitalized();
   }
   

   

      

}




Nice screenshot.  About the spotlights… I didn't have a chance to run your test code, but I would check your direction and location args.  Generally direction should be normalized for example and if you are having to crank it up, you are either not in the right place, not pointing the right way, or perhaps closer to the target than you should be.



Also, consider what the spotlight is hitting.  If the target is not highly tesselated (lots of triangles) then your spotlight won't show up as a nice round light.

renanse said:

Nice screenshot.  About the spotlights... I didn't have a chance to run your test code, but I would check your direction and location args.  Generally direction should be normalized for example and if you are having to crank it up, you are either not in the right place, not pointing the right way, or perhaps closer to the target than you should be.

Also, consider what the spotlight is hitting.  If the target is not highly tesselated (lots of triangles) then your spotlight won't show up as a nice round light.


What do you exactly mean with "normalized" and how can you make a quad or a box more tesselated? :)

I've messed arround some more with the lightspots and found a -very- nice trainingdemo I must've overseen before.
This is my result:



I attached a Pointlight to the particlemanager.
Something I can't figure out though is why my sphere gets blank when I use 5 or more Pointlights on it. With 4 it displays the colours correctly but adding another one will make everything blank.

I read somewhere jME could handle 6 lightsources but would pick the 6 most logical to display rather than not displaying them at all.
Perhaps I forgot to enable a function?

Thanks!

EDIT: On the image I use 5 particlemanagers and 4 lightspots.

lights are additive, so the more you combine together, the more likely you are to become washed out.  The settings are everything.  Your card should handle 8 lights ok, (but do you really need that many is the question…)  jME can handle even more in a scene using the classes in com.jme.light

I guess white is the addition of all colour.