'Adding a light to Sceneform node has no effect
I'm following the google developers guide on adding Light to a Node in SceneView:
https://developers.google.com/sceneform/develop/build-scene
Light spotLightYellow =
Light.builder(this, Light.Type.FOCUSED_SPOTLIGHT)
.setColor(new Color(android.graphics.Color.YELLOW))
.setShadowCastingEnabled(true)
.build();
However it doesn't seem to do anything to my rendered model.
Is there anything else I'm missing?
ModelRenderable.builder()
.setSource(
this,
Uri.parse(card)
)
.build()
.thenAccept(
modelRenderable -> {
node.setParent(scene);
node.setLocalPosition(vector3);
node.setLocalScale(new Vector3(1.4f, 1.4f, 1.4f));
node.setName("Test");
Light light =
Light.builder(Light.Type.FOCUSED_SPOTLIGHT)
.setColor(new Color(android.graphics.Color.YELLOW))
.setShadowCastingEnabled(true)
.build();
node.setLight(light);
node.setRenderable(modelRenderable);
})
.exceptionally(
throwable -> {
Toast toast =
Toast.makeText(this, "Unable to load Fox renderable" + throwable, Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
return null;
});
Solution 1:[1]
Make sure that DIRECTIONAL
light's intensity is considerably lower than FOCUSED_SPOTLIGHT
's intensity. A position and direction of a spotlight do matter, however a directional light is controlled by direction only (as its name suggests). If FOCUSED_SPOTLIGHT
still doesn't work, try regular SPOTLIGHT
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Andy Jazz |