sceneform

How to change camera type to Orthographic in Sceneform Android SDK?

故事扮演 提交于 2020-01-02 05:26:20
问题 I'd like to use an Orthographic camera when presenting a model in SceneView (without AR). Couldn't find a way to do so in API. Am I missing something or the feature is missing? 回答1: As far as I know, there's no ORTHO method ( cube frustum ) for camera projection in ARCore / Sceneform at the moment. But you can make it yourself via 4x4 Matrix. So, all you need to do is to calculate left , right , top , bottom , near and far properties using the following principles. Here is how your projection

How to change Color of ModelRenderable?

邮差的信 提交于 2019-12-24 21:58:44
问题 i have a ModelRenderable attached to a Node and rendered in an ArFragment. I would like to highlight this element to the user for 0.5 sec in a prominent color. I tried to change the material, but it didn't work out. The rendering freezes without throwing an error. Here is what I tried: private void addHighlightToNode(Node node) { CompletableFuture<Material> materialCompletableFuture = MaterialFactory.makeOpaqueWithColor(this, new Color(0, 255, 244)); ModelRenderable highlightedRenderable =

How to prepare a 3D model to embed in an AR App

落花浮王杯 提交于 2019-12-24 20:39:52
问题 I have a newbie-questions regarding a 3D model I want to use in an AR App (with sceneform). The model itself is in .fbx format and I have 5 textures or maps (as .jpg files) for opacity, metal, roughness, base color and normal. Importing the .fbx model works, but I have no idea how to assign the textures to it. According to the documentation (https://developers.google.com/ar/develop/java/sceneform/custom-material), I need a .mat file. And that's my problem, how to create one. Manually or

How to reset or restart the ARCore sessio

こ雲淡風輕ζ 提交于 2019-12-23 04:59:08
问题 I developed based on Android platform, and the initial state of AR session is loaded in fragment form. In order to reset the AR session, a solution found on Google is to update the fragments. At present, the session can be restarted, but the frame cannot be updated, and I cannot realize my own business of following the frame changes. Seek help: 1. Why to update fragments? Frame does not update 2. or do the partners have a better way to reset the AR session The main idea is to use a cycle

Placing an object with a given compass bearing in ARCore

柔情痞子 提交于 2019-12-22 08:52:37
问题 I'd like to place a north facing arrow into an ARCore world using sceneform. I am trying to understand the correct system of transformations to go from the phone's compass to sceneform's quaternions. 回答1: This was the code I used to solve the problem: //Get the phone's pose in ARCore Pose deviceOrientedPose = frame.getCamera().getDisplayOrientedPose().compose( Pose.makeInterpolated( Pose.IDENTITY, Pose.makeRotation(0, 0, (float)Math.sqrt(0.5f), (float)Math.sqrt(0.5f)), dhelper.getRotation()))

ArCore Sceneform: Play .mp4 video when detect image

情到浓时终转凉″ 提交于 2019-12-13 17:01:07
问题 When I find an image, I want to place a text and a video above it. The text view is placed on the scene but the video is not, it is just added to my main layout in the middle. I'm using the component VideoView, I'm not sure that's the problem override fun onCreate(savedInstanceState: Bundle?) { (....) arFragment!!.arSceneView.scene.addOnUpdateListener { this.onUpdateFrame(it) } arSceneView = arFragment!!.arSceneView } private fun onUpdateFrame(frameTime: FrameTime) { val frame = arFragment!!

ARCore – How to place/create objects on surfaces like walls without any Feature Points?

冷暖自知 提交于 2019-12-12 12:10:03
问题 For example: I am interested in placing 2D images on a vertical plane (like: white or single solid color walls with no feature points present). What are different workarounds? I am aware that ARCore supports placement of objects with respect to other objects. How can I extend this to fulfill my requirement of placing objects relative to other objects where feature points are not detected? Any ideas or workaround much appreciated. 回答1: You can set an Anchor relative to the camera position - i

How do I delete individual renderables from the scene using a button using arcore and sceneform?

守給你的承諾、 提交于 2019-12-11 04:25:36
问题 I'm trying to make a button that will delete a 3d model from the scene after it is selected. I know that the way to delete 3d objects is by using anchor.detach(). And I can select individual models using node.select(). However, I am not sure how to access the anchor after selecting the node. FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { deleteObject(//I'm not sure how to

Replace node renderable ( same rotation, position and scale ) with another node renderable in Sceneform sdk

不打扰是莪最后的温柔 提交于 2019-12-10 23:33:47
问题 I am new to sceneform sdk for Android . I have added one Transformable Node , then i applied some rotation , scaling and changed its position also. Now on click of button i need to place second node with same rotation , scaling and position. For that what i did is: Node nodeTwo = new Node(); // second node nodeTwo.setLocalPosition(nodeOne); nodeTwo.setLocalRotation(nodeOne); nodeTwo.setLocalScale(nodeOne); nodeTwo.setRenderable(renderable); I have also tried with setWorldPosition() ,

Added object on vertical plane always rotated in ARCore

久未见 提交于 2019-12-08 18:52:31
问题 I am adding an image on vertical plane in Sceneform ARFragment. But it always get rotated. The code is working fine on horizontal plane. My code for placing images on vertical Plane is as follow: arFragment.setOnTapArPlaneListener { hitResult: HitResult, plane: Plane, motionEvent: MotionEvent -> if(!isOnceTapedOnSurface) { val anchor = hitResult.createAnchor() val anchorNode = AnchorNode(anchor) anchorNode.setParent(arFragment.arSceneView.scene) andy = TransformableNode(arFragment