materialSceneInputs top-level constant

List<MaterialInput> const materialSceneInputs

What a fragment body of version 2 reads of the scene behind it — item 9 of tasks/1.0-scope-additions.md, for soft edges, fog and water.

Only a translucent material reads them, and the parser holds it to that: the scene behind a surface is the opaque half's depth, which the engine lends a translucent draw after that half is done. sceneDepth is how far the opaque surface behind this fragment lies along the view axis, in metres, and a million where nothing was drawn behind — the sky is far; viewDepth is this fragment's own depth along the same axis, so sceneDepth - viewDepth is the thickness of what lies between; scenePosition is where, in the world, that opaque surface is.

Implementation

const List<MaterialInput> materialSceneInputs = <MaterialInput>[
  MaterialInput(
    'sceneDepth',
    ExpressionType.float,
    'f3d_scene_depth',
    since: 2,
  ),
  MaterialInput('viewDepth', ExpressionType.float, 'f3d_view_depth', since: 2),
  MaterialInput(
    'scenePosition',
    ExpressionType.vec3,
    'f3d_scene_position',
    since: 2,
  ),
];