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;
});
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With