[SOLVED] Spatial dont render with light

I am having a problem with some objects that dont react to light :


I tried to change the materials, also to build the materisl manually, made diverse combinations, updateGeometricState and TangentBinormalGenerator, nothing seens to fix it.
The material they are using is exactly the same of the biguer asteroids in screen that are ok.
I suspect the tangent is not beeing generated for they somehow, or, they are getting invalid shadown from the onwer object that dosent exists anymore ( they was linked in a node inside an biguer object, but then lather released from the node).

There is any parameter in the geometry about shaddows that maybe be the problem ?
How to force generation of tangent and light information for the object ?
Any way to debug or bether way to try to understand what is going on ?

Just to add that I already checked the normals, also the shadow on all objects are just cast, they should not receive shadows… Maybe it indicate tangent problem ?

Do they show up lit if you turn off shadows? If not then you can once and for all ignore that as an issue.

Call the appropriate method on TangentBinormalGenerator.

You can tell if it has tangents by getting the tangent buffer from the mesh to see if it’s really there.

Otherwise, this looks like a material problem. How do you know they have “exactly the same” material as the big asteroids? Is it the same instance? Loaded from the j3m? Or “because I set them similarly in blender”. (Note: the last one doesn’t count as evidence at all.)

If none of that helps then you will have to reduce it to a simple test case that can be posted. 99 times out of 100, your test case will work fine and then you can work backwards to find the real issue.

Hi pspeed, thanks for your help.
I tried to turn off the shadows for all asteroids, didnt work.

About the tangents I did notice that this is not null :
TangentBinormalGenerator.genTangentLines( ((Geometry)thisPieceNode.getChild(0)).getMesh() , 1)
I am not sure if this is the correctly way to check for the buffer thought.

I tried different materials, and diferent geometries.
They are all the same instance, using the same j3m, there is one asteroid0 spatial that holds inside all other pieces, also, I tried to setup manually the materials creating at runtime an new material, but had the same result.

I suspect from duplicate tangents, since when I load the object from the j3o, there is only one for all objects, this is the way I loud it :

ArrayList asteroidParts = new ArrayList();
asteroid0 = asteroidParts.get(0);
for(int t=1; t<= asteroidParts.size()-1; t++) {
if(scale!=1) asteroidParts.get(t).scale(scale);
BoundingSphere boundingSphere = new BoundingSphere();

I did notice in the Tangent generator, that when you call it using an spatial, it loops and generates the tantent for all childrens, maybe this the problem ? Since I re-generate this tangent when I “detach” the piece from the whole asteroid it maybe duplicated somehow in the buffer ?
Obs: this assignAsteroidMaterial was a try to force the material for all the objects, asteroid0 also is using this.

I dont know if this is something, but there is a warning every-time I spaw this asteroid pices :

WARNING: Colinear uv coordinates for triangle [246, 251, 264]; tex0 = [0.913, 0.585], tex1 = [0.89, 0.579], tex2 = [0.905, 0.583]
Jul 05, 2015 7:33:22 AM com.jme3.util.TangentBinormalGenerator processTriangle

My suspects about the tangents are growing, I tried to remove all generation of tangents.
The result shows the same texture/material in all asteroids :


Show us a screenshot with ShowNormals.j3md.

There we go :


In case it helps, typical debugging procedure:

  1. hypothesize causes
  2. perform tests to rule out (or definitely rule in) causes.

For example:

  1. “Maybe this is tangents”
  2. Well, tangents are only used by materials with normal maps or parallax maps. Ergo: give them a material without a normal map and without a parallax map and see if the problem stays or goes away.

P.S.: Tangent buffers are like normal buffers… they are mesh specific. You only have to generate them once for a particular mesh. To see if a mesh has a tangent buffer, call getBuffer(Type.Tangent) and see if it returns a buffer with data in it.

Found the problem ! Its not tangents at all.
When I detach the pieces, I add it into rootNode.
The lights are attached to an diferent Node, and because of this it dont render the light correctly.
After I made the pieces to be attached to the same node from the lights it fixed it.
Thanks for your help guys.