Reference
Common Pitfalls
Diagnose silent drawing overruns, stale geometry, history-scope errors, camera targeting mistakes, update misuse, and unexpectedly expensive lighting.
Updated Publisher Alien_AlgorithmsPine Script v6
Drawing problems
| Symptom | Cause | Fix |
|---|---|---|
| Manual labels or lines disappear | They were created before render cleared the drawing pool. | Create manual drawings after the Pine3D render call. |
| Geometry is silently missing | A polyline, line, label, or face budget was exceeded. | Use a budget table, lower maxFaces, reduce contour levels, or simplify overlays. |
| Scene times out | CPU cost exceeded the per-bar limit. | Lower occlusionRaster first, then face count and primitive resolution. |
Silent failure is normal for drawing budgets
TradingView can drop overflow drawings without an exception. Missing geometry is often a budget issue rather than a projection bug.Update and cache problems
| Symptom | Fix |
|---|---|
| updateSurface or updateBars has inconsistent history data | Calculate history operators, ta calls, and request.security at global scope. |
| Direct vertex edits do not appear | Call mesh.invalidateCache() after writing mesh.vertices. |
| Broad low-level changes leave stale output | Call scene.invalidateAllCaches(). |
| A dynamic scene keeps allocating drawings | Build geometry once and mutate existing objects. |
Camera and tag mistakes
Camera will not aim at coordinates
scene.lookAt() accepts a mesh tag. Use scene.camera.lookAt(x, y, z) or a Vec3 for coordinates.
remove(tag) deleted the wrong primitive
Tag removal searches meshes, labels, lines, then polylines. Keep tags unique across types.
Rotation looks wrong
Mesh rotation methods use degrees. Vec3 rotation methods use radians.
Trail3D and Bars3D issues
| Symptom | Explanation |
|---|---|
| Trail capacity stops growing | Trail3D clamps capacity to 300 samples. |
| Bar labels duplicate or consume budget | barLabels() was called more than once. Call it only during build. |
| Bar values do not refresh | Use updateBars() with globally computed values. |
| Trail is empty at startup | It has not reached enough confirmed samples to form its path. |
Lighting performance
Point lights do not use the directional shadow-grid acceleration structure. Switch to directional light, reduce shadow-casting faces, or disable cast shadows on nonessential meshes.