question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[docs] TorusKnotGeometry & TorusKnotBufferGeometry misleading code in the official docs

See original GitHub issue
Description of the problem

The official docs for TorusKnotGeometry and TorusKnotBufferGeometry has misleading code examples. To achieve that one as in the docs developers need to use MeshLambertMaterial, not MeshBasicMaterial as written in the docs. It gives completely different output than in the code examples which you can see in the CodeSandboxes below.

If you’ll take a look into the color 0xffff00 in code examples, it cannot match, because it’s yellow. Not like in the visualisation light blue…

It looks like these docs should be improved to give a real code, because based on these I couldn’t reproduce the effect, at all. Possibly it would be MeshLambertMaterial with AmbientLight/PointLight (or any other lights - couldn’t fully reproduce on my own). For other settings of this visualisation I’ve followed creating a scene manual.

Three.js version
  • 110 (latest at CDN)
Browser
  • All of them
OS
  • Not applicable
Hardware Requirements (graphics card, VR Device, …)
  • None

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
danieldanieleckicommented, Apr 27, 2020

@Mugen87 many thanks!

Didn’t catch this, just used parameters from the official docs.

1reaction
Mugen87commented, Apr 27, 2020

Here is the updated live example. The parameters of TorusKnotBufferGeometry were slightly off:

https://codesandbox.io/s/torusknotbuffergeometry-almost-complete-as-in-the-official-docs-4qgci?file=/index.html

PS. MeshBasicMaterial is not being used, as you can see its MeshPhongMaterial., which is different than LineBasicMaterial.

I was referring to the minimal code example, not the geometry browser.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TorusKnotGeometry – three.js docs
Creates a torus knot, the particular shape of which is defined by a pair of coprime integers, p and q. If p and...
Read more >
pythreejs Documentation
See for example the official three.js documentation. ... Preview(child=TorusKnotGeometry(radius=20.0, tube=5.0), shadowMap=WebGLShadowMap()).
Read more >
TorusKnotBufferGeometry (almost) complete as in the official ...
Visualisation of TorusKnotBufferGeometry inspired by Three.js docs example (https://threejs.org/docs/#api/en/geometries/TorusKnotBufferGeometry). The docs ...
Read more >
Build 3D visuals in Vue with Lunchbox.js - LogRocket Blog
The above code above would translate to the following in Lunchbox: ... To learn more about the library, visit the official docs and...
Read more >
Google's making code formatting a breeze in Docs - The Verge
Google is adding code blocks that automatically format and apply syntax highlighting to code written in Google Docs, though it seems like ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found