Skip to content

[p5.js 2.0 Bug Report]:When drawing using textToModel, depending on the font, the face normals may not be very clean. #8074

@inaridarkfox4231

Description

@inaridarkfox4231

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
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

2.0.5

Web browser and version

Chrome

Operating system

Windows11

Steps to reproduce this

Steps:

  1. Create a model of the letter "H" using textToModel().
  2. No strokes are used, only fills and lighting.
  3. The appearance of the top and bottom by lighting doesn't look very clean.

Snippet:

demo

let font;
let geom;

async function setup() {
  createCanvas(400, 400, WEBGL);

  // Using Source Serif for this example:
  font = await loadFont('https://inaridarkfox4231.github.io/assets/fonts/SourceSerif4.ttf');

  geom = font.textToModel("H", 320, 0, { sampleFactor: 2, extrude: 1 });
  geom.clearColors();
  geom.normalize();
}

function draw() {
  background(0);
  noStroke();
  orbitControl();
  fill("white");
  noStroke();
  ambientLight(128);
  const s = TAU*frameCount/360;
  const t = TAU*frameCount/240;
  directionalLight(255,255,255,cos(s),sin(s)*cos(t),sin(s)*sin(t));
  scale(min(width, height) / 300);
  model(geom);
}
Image

This is more of an aesthetic issue than a bug, so it may be inappropriate, but I thought I'd bring it up because it bothered me.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions