Skip to content

WebGL ambientMaterial() defaults to white instead of the fill color #6125

@davepagurek

Description

@davepagurek

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build Process
  • Unit Testing
  • Internalization
  • Friendly Errors
  • Other (specify if possible)

p5.js version

1.6.0

Web browser and version

Firefox 108.0

Operating System

MacOS 12.5.1

Steps to reproduce this

Here's an example sketch that shows how the colors in WebGL mode changed between v1.4.2 and the current version, and how to get back to the same look under the current system:

// v1.4.2
fill(this.c)
// v1.6.0
fill(this.c)
// v1.6.0
const c = color(this.c)
ambientMaterial(
  red(c),
  green(c),
  blue(c)
)
fill(this.c)

This happened when we made it possible to separately tweak the ambient material from the specular or fill material of an object. We did this because Processing also allows this, but Processing also defaults the ambient material to the fill material unless explicitly specified.

To match the default behaviour of 1.4.2 (and also Processing) to not get washed out colours by default, we should also default the ambient material to the fill material unless an ambient material is specified.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    DONE! 🎉

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions