PointLight doesn't looks like a PointLight

Hi guys,



I have a problem with the pointlights in JME 3. I’ve made a gif file for you, to make it better understandable. The pointlight’s location is always the same as the location of the flame. But you can see how it looks.



http://imgur.com/NRKbM



Normally a pointlight should have a bright radial area around it. That how i thought? So why does it looks now like above?



Her is the generation of the pointlight:

[java]

markLight = new PointLight();

markLight.setPosition(new Vector3f(5, 1, 5));

markLight.setRadius(30f);

markLight.setColor(new ColorRGBA(1f, 0.7f, 0f, 1f));



super.addLight(markLight);

[/java]



And the conten of the .j3m file whitch is used as material for the ground-plate.

[xml]

Material My Material : Common/MatDefs/Light/Lighting.j3md {

MaterialParameters {

DiffuseMap : Repeat Models/Ground/01.jpg

NormalMap : Repeat Models/Ground/01_normal.jpg

AlphaDiscardThreshold : 0.0

Shininess : 10.0

ParallaxMap : Repeat Models/Ground/01_height.jpg

LATC : false

UseMaterialColors : false

EnvMapAsSphereMap : false

LowQuality : false

HighQuality : false

UseAlpha : false

VertexLighting : false

}

AdditionalRenderState {

DepthWrite Off

}

}

[/xml]



So i hope you can help me understand this problem.

nova

You can use a flat terrain for better vertex sampling, instead of a quad.

What’s the problem? Do you want to make your point light follow your flame particle emitter properly? How are you doing it?

Create a node, attach the flame and the point light to it and move the node instead of moving them individually.

Edit: Make the flame and the point light centered at node.

I guess your ground is a quad, lighting is computed for each vertex.

use a grid instead of quad.

2 Likes

Thanks for your answers!

@ glaucomardano:

The particle emitter and the rotating box are in one node, this node and the pointLights are in a further node where also the ground is. So this cant be the reaon of my problem.



@ nehon:

This sounds very possible. First i tried it with the class “Grid” but this class is only for debugging: you only see grindlines, no textures. So my question: is there another class like Box or Quad which has the funktion where I can say how many lines I wont to have in x and y direction. Or is there something like a “Subdivision Survace” modifier like in blender, which makes 4 faces out of 1?

I don’t believe so, but i don’t really know anything :P. You could create a custom mesh, or as you said just create a quad in blender, press w then subdivide, then on the left panel select the number of cuts.

By default attenuation is computed per vertex and not per pixel. To compute it per pixel, set the HighQuality boolean in your J3M file.



E.g.

[java]MaterialParameters {

// …

HighQuality : true

}[/java]

3 Likes

Oh yeah, thank you “Momoko Fan”, it works now. Sometimes such easy thinks can change so mutch^^!

Oh ok, that is actually important. Would’ve been better to have named it something like “PerPixel” but allright.

My next problem, again with the PointLight, or with the Spatial on whitch its shining:



http://imgur.com/P8Cx6



My question: Why shines the light of the fire only on the left side of the wall?

Material of the Wall:

[xml]

Material My Material : Common/MatDefs/Light/Lighting.j3md {

MaterialParameters {

DiffuseMap : Models/Walls/Wall02/wall02.jpeg

ParallaxMap : Models/Walls/Wall02/wall02_high.jpeg

NormalMap : Models/Walls/Wall02/wall02_normal.jpeg

HighQuality : true

VertexLighting : false

Shininess : 19.0

}

AdditionalRenderState {

}

}

[/xml]



How i creat the wall:

[java]

for(int i=0;i<columns;i++)

{

Spatial wall= assetManager.loadModel(“Models/Walls/Wall02/wall02.j3o”);

wall.setMaterial(assetManager.loadMaterial((“Models/Walls/Wall02/wall02.j3m”)));

wall.setLocalScale(0.51f);

wall.setLocalRotation(new Quaternion(new float[]{0f,(float)Math.PI/2,0f}));

wall.setLocalTranslation(0.5f+i,0,-0.1f);

gameBoard.attachChild(wall);

}

[/java]

Why are you loading the material?It’s automatically loaded when you load the .j3o model.

Oh, i hadn`t known. But that doesnt resolves my problem.

Can we get a test case that reproduces this issue?

Ok i have now made such a class:

[java]

import com.jme3.app.SimpleApplication;

import com.jme3.light.PointLight;

import com.jme3.material.Material;

import com.jme3.math.ColorRGBA;

import com.jme3.math.Quaternion;

import com.jme3.math.Vector3f;

import com.jme3.scene.Geometry;

import com.jme3.scene.Spatial;

import com.jme3.scene.shape.Sphere;



public class Test extends SimpleApplication {



public static void main(String[] args)

{

new Test().start();

}



@Override

public void simpleInitApp() {



//creating a wall out of singel wall-elements

rootNode.attachChild(creatWall(0));

rootNode.attachChild(creatWall(1));

rootNode.attachChild(creatWall(2));

rootNode.attachChild(creatWall(3));

rootNode.attachChild(creatWall(4));



//the pointlight

PointLight lamp = new PointLight();

lamp.setPosition(new Vector3f(2.5f,0.5f,0.5f));

lamp.setColor(ColorRGBA.White);

lamp.setRadius(7);

rootNode.addLight(lamp);



//marks the position of the pointlight

Sphere sphere = new Sphere(10, 10, 0.2f);

Geometry lightMarker = new Geometry(“Middle”, sphere);

Material midMat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);

midMat.setColor(“Color”, ColorRGBA.Yellow);

lightMarker.setMaterial(midMat);

lightMarker.setLocalTranslation(lamp.getPosition());

rootNode.attachChild(lightMarker);

}



public Spatial creatWall(float x)

{

Spatial wall = assetManager.loadModel(“Models/Walls/Wall02/wall02.j3o”);

wall.setLocalRotation(new Quaternion(new float[]{0f,(float)Math.PI/2,0f}));

wall.setLocalScale(0.501f);

wall.setLocalTranslation(x, 0, 0);

return wall;

}



}

[/java]

the model + textures…:

nova6.bplaced.net/trash/Wall02.zip



Or as JME3 Platform projekt( not testet):

nova6.bplaced.net/trash/NovaTD.zip



Image of the problem:

http://imgur.com/46KgL

Your model has no normals.

You have to generate normals when exporting from Blender by selecting “Normals” in the exporter options

Oh, your right!

Thank you!