English
Appearance
English
Appearance
This page focuses on the most fundamental and most frequently used capabilities in the 3D rendering layer.
const camera = await api.getDefaultCamera();Note: this refers to the perspective camera used in 3D rendering, not the phone's physical camera hardware.
const fov = await api.getCameraFov(camera);
await api.setCameraFov(camera, 55);
const aspect = await api.getCameraAspect(camera);
await api.setCameraAspect(camera, aspect);
await api.updateCameraProjectionMatrix();Also supported:
getCameraNear() / setCameraNear()getCameraFar() / setCameraFar()getCameraWorldDirection()await api.setEnableMask(obj);
await api.setDisableMask(obj);await api.setObjectAlpha(obj, 'blend', 0.5);setObjectAlpha() is most useful when you want to adjust transparency or alpha clipping on an existing object.
In addition to blend, the following modes are supported:
none - opaqueblend - transparent / semi-transparentclip-legacy - legacy transparency clipping behavior from older Kivicube platform versions; kept only for compatibility and not recommendedclip - standard alpha clipping behaviorThe cutOff = 0.5 argument represents the threshold used for alpha clipping.
setGLState() lets you directly modify a subset of material-level rendering state.
await api.setGLState(obj, 'transparent', true, true);
await api.setGLState(obj, 'opacity', 0.6, true);Currently supported fields:
sideshadowSideblendingtransparentopacityalphaTestdepthTestdepthWritecolorWriteWhen the fourth parameter, recursive, is true, the change is applied recursively to child nodes as well.
Good fits:
If you find yourself changing lots of low-level rendering state from the host layer, it usually means: