Skip to content

Default ambient color incorrect (in v1.5.0) #5857

Closed
@jwdunn1

Description

@jwdunn1

Most appropriate sub-area of p5.js?

  • WebGL

p5.js version

1.5.0

Steps to reproduce:

  1. Version 1.4.2
    note the ambient color
    https://editor.p5js.org/jwdunn1/sketches/GZTNLHnPd
  2. Version 1.5.0
    note the absence of ambient color (it's suddenly a black cube)
    https://editor.p5js.org/jwdunn1/sketches/Um5DLsasQ
  3. Version 1.5.0 with fix, now matches 1.4.2
    must set the ambientMaterial to 255
    https://editor.p5js.org/jwdunn1/sketches/k6Pi7uvtm

Evident here also: p5js.org/reference/#/p5/lights
The ambient lighting is absent, hence the rendering is much darker.
If ambientMaterial() is set to 255, then the gray returns to what we saw prior to 1.5.0

Cause:

Due to PR#5774, the default ambient color is now 0.
Line 98 in src/webgl/p5.RendererGL.js:

this.curAmbientColor = this._cachedFillStyle = [0, 0, 0, 0];

Potentially repaired by setting this to be [1,1,1,1]
This would match both v1.4.2 and Processing 4.0.1

Snippet:

// is this now required in order to match 1.4.2?
ambientMaterial(255);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions