ViroReact 3.3.0: Android material emission and reflection, web point clouds and a 3D virtual camera
On Android, materials take emissionColor, emissionTexture and reflectiveTexture as they do on iOS, and a reflectiveTexture no longer crashes the app. On the web, AR surfaces are in metres from the first one and keep their ids through a tracking loss. The tracker's point cloud reaches onARPointCloudUpdate and displayPointCloud, and hit tests return feature points. The 3D navigators take an opt-in virtual camera, cameras take a field of view, materials take emission and reflection, and a browser without WebGL2 gets a message instead of a blank canvas. The web build needs @reactvision/viro-web-renderer 1.4.0. iOS behaves as in 3.2.3. @reactvision/react-viro-onnx 1.1.0 ships alongside, and runs the object detector on CoreML on iOS.
Android
emissionColor,emissionTextureandreflectiveTextureon a material work, as on iOS. The first two threw "Invalid color/texture property" when the materials were created, and the reflective cube map was loaded and then dropped. As on iOS and the web, anemissionTexturescalesemissionColor, which is black by default, so it needs anemissionColorto show. See ViroMaterials.- A material with a
reflectiveTextureno longer crashes the app withUnable to find "uri" key.
Web
Everything in this section is web platform support: it is new on the web and already worked on iOS and Android. See the Web Setup Guide.
- AR surfaces. Surfaces are in metres from the first one, and keep their anchor ids through a tracking loss, so a
ViroARPlaneand the content on it stay put. On an iPhone, the first surfaces used to be tens of metres across and tens of metres away. See ViroARPlane. - Point clouds and feature points.
onARPointCloudUpdateanddisplayPointCloudwork onViroARScene. Points arrive in native's shape ([x, y, z, confidence]plusidentifiers) once the tracker's scale is in metres; the web tracker has no confidence, so it is always 1. While either prop is set, hit tests also returnFeaturePointresults, and Editor scenes' tap-to-place falls back to one when a tap misses every plane, as the native host does. See ViroARScene. - Tracking. A frame the tracker still tracks but flags with a reason (excessive motion, too few features or too little light) reports
TRACKING_LIMITEDwith that reason, as ARKit does, while content keeps drawing. - Scene cameras in live AR. Under a scene
ViroCameraorViroOrbitCamera, dragging and camera reads work, and the ray and position hit tests start from the drawn camera: the camera node's position with the device's rotation, as on native. - Navigators.
virtualCameraworks onViro3DSceneNavigatorandViroSceneNavigator. It is opt-in: the mouse, two fingers or the keys move the point of view (walk, look around in place, orbit a centre,lookFrom,pose). It stands aside while the scene makes one of its ownViroCameras active.onWebRendererErroron the web navigators is called when the renderer cannot start, and a message over the canvas says why (most often, no WebGL2). See Viro3DSceneNavigator. - Cameras and materials.
fieldOfViewworks onViroCamera, across the viewport's longer side, as on native.emissionColor,emissionTextureandreflectiveTexturework on materials. See ViroCamera. - Images, models and input.
ViroAnimatedImageplays GIFs whereImageDecoderis missing or reads fewer frames than the file has.ViroSpinner's built-in images load in any bundler. A GLB loads as a GLB whatevertypeit is given. Dragging a node under a turned or scaled parent moves it along the parent's axes from the first frame. A scene's owntimeToFuseapplies. - Editor scenes on web.
StudioSceneNavigatorreports a renderer that could not start throughonErrorandrenderError, as it does a failed scene load. See StudioSceneNavigator.
Object detection (@reactvision/react-viro-onnx 1.1.0)
@reactvision/react-viro-onnx 1.1.0)- iOS runs the model on CoreML, on the CPU, GPU and Neural Engine, and falls back to the CPU when CoreML cannot take the model. Before, iOS ran on the CPU only. Detections are unchanged.
- One detection core for iOS and Android. On Android it ships for
arm64-v8aandx86_64. On the 32-bit ABIs (armeabi-v7a,x86) the provider does not register. See ViroObjectDetector.
Check when upgrading
- Web: install
@reactvision/viro-web-renderer1.4.0. The peer range is now^1.4.0. Copy its wholewasm/andslam/folders. With 1.3.0 the new features stay off and a one-time warning names what is missing. - Materials with an
emissionTexturealso need anemissionColor, on every platform: the texture scales it, and it is black by default. On Android, check materials that set emission or reflection, since they now show. - Web:
TRACKING_LIMITEDnow arrives with a reason where renderer 1.3.0 reportedTRACKING_NORMAL. Check code that waits forTRACKING_NORMALbefore showing content. - Web:
virtualCameraright-drag turns the view in place. Alt with right-drag orbits, as right-drag alone used to. - ONNX detector on Android:
@reactvision/react-viro-onnx1.1.0 does not register on 32-bit ABIs.
See Upgrading to 3.2.0 for the upgrade notes, and the GitHub releases for ViroReact 3.3.0 and viro-web-renderer 1.4.0.