Renderer · function

screenRayOrigin

Lift a point off the surface it stands on, along that surface's normal.

Explained in Hello world.

function screenRayOrigin(point: ReadonlyVec3, normal: ReadonlyVec3, biasM: number, out: Float32Array): Float32Array
import { screenRayOrigin } from '@driftengine/core';

Parameters

ParameterTypeDescription
pointReadonlyVec3
normalReadonlyVec3
biasMnumber
outFloat32Array

In depth

A normal that is not unit length is normalised, because an interpolated one rarely is. A normal of zero length has no direction to lift along, so the point is returned unmoved rather than as three NaNs — which would reach the projection and come back as a miss for the wrong reason.