Skip to content

[p5.js 2.0+ Bug Report]: Floats in strands shaders are always rounded to 4 decimals #8884

@davepagurek

Description

@davepagurek

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • WebGPU
  • p5.strands
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

2.3.0

Web browser and version

All

Operating system

All

Steps to reproduce this

In strands_glslBackend.js, we do this when converting number literals into shader code:

if (node.baseType === BaseType.FLOAT) {
return node.value.toFixed(4);

This means that if you include 0.00001 in your strands code, your shader code would be 0.0000. That seems like a problem. Is there any way we can do this in a more context-dependent way where we don't just add more decimals across the board for everything?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions