Skip to content

customDepthMaterial and customDistanceMaterial are documented in the wrong place #15449

@looeee

Description

@looeee

https://threejs.org/docs/#api/en/materials/Material.customDepthMaterial

https://threejs.org/docs/#api/en/materials/Material.customDistanceMaterial

These are not properties of materials. As far as I can see from the couple of examples where they are used, they should be properties of Mesh, or perhaps Object3D.

By default, these properties are not initialised at all, even to undefined, and the only reference to them in the source is a couple of lines in WebGLShadowMap here:

function getDepthMaterial( object, material, isPointLight, lightPositionWorld, shadowCameraNear, shadowCameraFar ) {
var geometry = object.geometry;
var result = null;
var materialVariants = _depthMaterials;
var customMaterial = object.customDepthMaterial;
if ( isPointLight ) {
materialVariants = _distanceMaterials;
customMaterial = object.customDistanceMaterial;
}

Perhaps we could initialise them in Object3D as

function Object3D() {

    ... 
    
    this.customDepthMaterial = undefined;
    this.customDistanceMaterial= undefined;
    ...
}

and then document them correctly?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions