DIR*_*AVE 7 android sceneview arcore sceneform
我正在关注关于在 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();
Run Code Online (Sandbox Code Playgroud)
但是它似乎对我的渲染模型没有任何作用。
还有什么我想念的吗?
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;
});
Run Code Online (Sandbox Code Playgroud)
确保DIRECTIONAL光的强度远低于 的FOCUSED_SPOTLIGHT强度。聚光灯的位置和方向确实很重要,但是定向光仅由方向控制(顾名思义)。如果FOCUSED_SPOTLIGHT仍然不起作用,请尝试常规SPOTLIGHT.
| 归档时间: |
|
| 查看次数: |
309 次 |
| 最近记录: |