The model looks very black.
DirectionalLight and AmbientLight have been set.
AmbientLight ambientLight = new AmbientLight(new ColorRGBA(ColorRGBA.LightGray));
rootNode.addLight(ambientLight);
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(-0.5f,-0.5f,-0.5f).normalizeLocal());
sun.setColor(ColorRGBA.White);
rootNode.addLight(sun);
Does anyone know how this happened? Do I need to set anything else?
Ali_RS
September 8, 2022, 7:08am
2
Yes, you need to add a light probe to the scene. You can use a pre-made probe or generate one with LightProbeFactory.
You can use this pre-made one here:jmonkeyengine/jme3-testdata/src/main/resources/Scenes at master · jMonkeyEngine/jmonkeyengine · GitHub
Node probeNode = (Node) assetManager.loadModel("Scenes/defaultProbe.j3o");
LightProbe probe = (LightProbe) probeNode.getLocalLightList().iterator().next();
rootNode.addLight(probe);
See this example for how to generate one for your scene.
/*
* Copyright (c) 2009-2020 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
This file has been truncated. show original
Related topics:
I am playing around with PBR materials and I cant get them to work correctly. When I create a material using PBR the model appears gray in game. Any ideas on why I’m not getting the same result?
val floorMaterial = Material(assetManager, "Common/MatDefs/Light/PBRLighting.j3md")
floorMaterial.setTexture("BaseColorMap", assetManager.loadTexture("Textures/Floor_Diffuse.png"))
floorMaterial.setTexture("NormalMap", assetManager.loadTexture("Textures/Floor_Normal.png"))
floorMaterial.setTexture("Spec…
Is there any chance I could see how your method is used within the rest of the class, because im not sure exactly what Node i should be saving.
I can’t save the rootNode, since it has other spatials and nodes attached, I can’t make a seperate node just for the light as none of my other spatials are children to the seperate node, and i cannot cast the LightProbe to a node?
1 Like
Ali_RS
September 8, 2022, 7:14am
3
Note, PBR material might be heavy for Android devices so if you do not require PBR material I would suggest converting them to the Phong material (Lighting.j3md).
There is also an optimized version of PBR developed for mobile in case you want to check:
Hi everyone, I have been improving the MobilePBRLigting material during this time. The purpose is to perform PBR rendering on Mobile while ensuring a certain frame rate. I decided to publish an updated version of the latest results. The following are some of my research results:
PATTERN1:
Applicable objects: objects with low metallicity and high roughness (usually metal is between 0-0.5 and roughness is between 0.5-1, among which, when metal is close to 0.5, roughness should be close to 1, and…
1 Like
Thank you very much for your help.
2 Likes