Hello again
Im going through the Beginner Tutorials and i tried to load a model from Fuse.
Everything works fine except that the model keeps dark even with added DirectionalLight…
Spatial ol = assetManager.loadModel("Models/Old_lady/old_lady.obj");
ol.scale(0.05f, 0.05f, 0.05f);
ol.rotate(0.0f, -3.0f, 0.0f);
ol.setLocalTranslation(0.0f, -5.0f, 2.0f);
rootNode.attachChild(ol);
// must add a light to make the model visible !
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f).normalizeLocal());
rootNode.addLight(sun);
With the converted j3o model it’s the same.
Im not sure what to do ^^
Maybe my setup is just wrong ?
I mean the model seems good to me and the j3o converter wants the texture files in the same folder so i guess it’s right ?
Are there any warnings printed to the console when you open the j3o in your application?
I haven’t used the SDK in probably 10 years but I know there used to be a way to generate the j3m files for the materials… either during the import process or from the j3o itself. These would have the material parameters (colors, textures, etc.) in it and would make it easier to confirm what’s really happening.
Hopefully someone more familiar with the SDK can chime in.
I dont get it why the model is looking good in the SceneComposer but didnt get any light in the Scene
I mean im new to jMonkey so i guess its normal thjat i have no clue but it seems strange to me
If you are using PBR (which it appears that you are) then you also need to add a LightProbe to your scene in order to simulate the indirect lighting
But I think there is also another issue going on at the same time, considering the fact that your model still renders entirely black even with a Directional Light.
I agree that it is probably a material issue that will require using the SDK to generate material files so you can inspect them:
To generate a material in the SDK, you just need to select a Geometry and then go to the properties panel on the right and find this drop down where you can select “generate j3m file” :
I circled 4 key areas in the SDK to highlight the important things to note:
on the far right, you can see where the “generate j3m file” option should show up when you have selected a Geoemtry
On the bottom left, I circled the geometry that I have selected. It is important that you have selected the geometry (not the parent nodes) in order for the generate material option to show up.
At the top of the scene editor, I circled the button for turning on the DirectionaLight as well as the button for applying a LightProbe. For PBR to render properly, you want to use both a directional light and a light probe to simulate direct and indirect light, and you will notice some subtle (or not so subtle) rendering issues if either one is missing or configured improperly.
So once you’ve generated a .j3m material, it will show up in the material/generated folder, and then you can open it and copy/paste the text back here. Then we should be able to spot what is wrong with the material file.
So it looks like I was incorrect to assume that the model is using PBRLighting.j3md
It looks like you are using the older Lighting.j3md shader, which I personally have not used in a while.
(I would reccommend PBRLighting for most projects, since pbr is capable of producing better visual results and gives you more control over your lighting and materials, but it is ultimately your choice which shader to use for your project)
But after looking at your current material file, I do see that your AmbientColor has a value of 0.0 0.0 0.0 1.0 (black) which would be effectively turning off the ambient light. I am not certain if that would be affecting the DrectionalLight though, its been a while since I looked at the shader code for Lighting.j3md.
But I would still try giving the AmbientColor a value of 1.0 1.0 1.0 1.0 and see if that fixes it.
I DO use lighting all the time and rarely use PBR. What you are trying to do SHOULD be easy. So rest assured you do not need to switch to fancier materials or anything.
A black ambient is also totally fine.
The weirdest part to me is that it works in the scene explorer but not in the application.
As long as you have a white directional light and a properly setup material then things should work. I guess unless you have some code somewhere that is corrupting the ColorRGBA.White “constant”.
You could try explicitly giving your DirectionalLight a color “just in case” it either requires that for some reason or your ColorRGBA.White has somehow turned black.
…
BTW, you can post code directly in the forum instead of taking screen shots of it:
Seems like it has something to do with the material setup.
I switched from Lighning to ColoredTexture and then back to Lightning and now the whole texture is broken but the hands get some results