Skip to content

Image light performance improvements #6531

@davepagurek

Description

@davepagurek

Increasing Access

#6255 is now merged and adds new lighting features to p5.

We have not yet spent much time optimizing it. There is potential room to keep the feature working the same, but have it load faster, and also run faster, to let this feature work better on more devices.

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)

Feature enhancement details

Some things we think would be worth doing for sure:

  • Calculate diffuse and specular textures in Framebuffers instead of p5.Graphics. It is known that keeping everything in the same WebGL context will be faster in general, and will avoid browser issues where it has trouble with having many WebGL contexts. Additionally, we send p5.Graphics data to the GPU every frame when using one in a shader, but don't for p5.Framebuffer, so this will save on runtime performance.
  • Refine into the number of samples used when creating diffuse/specular textures. It may still look OK if we use fewer samples but apply dithering to the sample locations, which is a strategy we use in our blur shader.

Less sure changes that need some benchmarking:

  • Would it make it run faster to use cubemaps instead of equirectangular textures, which require trig to calculate texture coordinates?

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