Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Line strips are no longer a disconnected series of quads (#8065)
### What * Fixes #829 * Fixes #7191 Fixes a long standing issue that the segments of a line have small gaps between them. Other than originally planned, the solution employed here is entirely based on fragment shader discard + elongation of the line. This can cause some slight artifacts for 3D lines but it's quite hard to spot those issues. Otherwise the biggest drawback of this is that we have more overdraw which gonna be tricky to deal with once we add transparency. On the flip side this is fairly simple and can re-use some of the round cap handling code - round caps no longer use the "trailing triangle" we had for every strip internally, and instead use the quad extension, actually leading to better looking round caps.⚠️ To allow loops to "just work", all line segments & line strips start and end now with extended round caps. I.e. if your line has a radius of 1 and goes from (0,0,0) to (100,0,0), then what's drawn goes from (-1,0,0) to (101,0,0). Before we didn't have caps on this, so we essentially drew a square starting at (0,0,0) whereas now it's more capsule like (it does not exactly behave like a capsule under perspective though). Line loops on map view: Before: <img width="383" alt="image" src="https://github.com/user-attachments/assets/6d19ef7b-ea8e-422d-8ad9-6eb18f567340"> After: <img width="303" alt="image" src="https://github.com/user-attachments/assets/81ffb6a7-3216-4c96-84fd-3f4d9268300c"> RRT Star: Before: <img width="300" alt="image" src="https://github.com/user-attachments/assets/a72352e7-8a73-4507-9f3a-5b4c713f7fc0"> After: <img width="300" alt="image" src="https://github.com/user-attachments/assets/03040348-f275-49c5-ad89-36fafc9fc1e9"> 3D line snippet snippet: Before: <img width="420" alt="image" src="https://github.com/user-attachments/assets/000dfef6-5d03-45e6-95bf-03a5033cc7a3"> After: <img width="420" alt="image" src="https://github.com/user-attachments/assets/1e511ee3-6464-4d30-aa30-34dce358bd85"> Failure Example in #7191 Before - confusingly broken: <img width="1000" alt="image" src="https://github.com/user-attachments/assets/261fe4dd-1d21-46e9-8139-6444af4e8cdf"> After - pretty bad rendering performance due to quite massive overdraw of alpha tested geometry, but no longer broken. <img width="1000" alt="image" src="https://github.com/user-attachments/assets/1bbe8b0b-c90b-4164-bf14-6b2de1c6884b"> (After: setting the radius to something large, but sane) <img width="1000" alt="image" src="https://github.com/user-attachments/assets/5f02e388-80cf-472b-b99d-8f45dfb2e9f2"> re_renderer 2D demo. Left before, right after. Note that "shaded lines" look a lot better now as a sideffect, with shading of arrows slightly broken. Afaik we don't use this anywhere in Rerun today though. However, rounded caps are higher quality now in general. <img width="999" alt="Screenshot 2024-11-11 at 11 10 29" src="https://github.com/user-attachments/assets/9404e2b1-218a-41c4-bc62-e711bdbcfe63"> ---- Things that were several segments before can now be strips. No visual change there: Rectangles: <img width="364" alt="image" src="https://github.com/user-attachments/assets/85ef5d5d-da82-4e70-a828-54e802fdd447"> Frustum: <img width="873" alt="image" src="https://github.com/user-attachments/assets/a58ec4d6-9500-40b0-9023-61b077a63920"> Box wireframes: This fixes a regression! In 0.19 those boxes had disconnected lines, in 0.18 this still worked since they were separate segments with rounded corners. Before (regression): <img width="233" alt="image" src="https://github.com/user-attachments/assets/b2a2aade-7271-46cc-a0ff-aa82031638e4"> After: <img width="233" alt="image" src="https://github.com/user-attachments/assets/727df4ea-9b63-43b1-ab48-64afdf508567"> ---- Due to aforementioned always-round-caps, a list of segments can now look indistinguishable from a single strip: <img width="438" alt="image" src="https://github.com/user-attachments/assets/ec0ca8da-201a-4d80-8e3e-c512c9fdb23b"> ---- Under more extreme circumstances it is still (!) possible to have boxes exhibit some artifacts: <img width="400" alt="image" src="https://github.com/user-attachments/assets/fee28464-f0f8-4b5c-9cbe-2e049df92153"> This is due to the quasi-capsule nature of our line segments. Calculating a world position from ray-capsule intersection would yield the correct result. What's actually happening right now is that we interpolate the world position over the spanned quad (which is a lot cheaper). ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using examples from latest `main` build: [rerun.io/viewer](https://rerun.io/viewer/pr/8065?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [rerun.io/viewer](https://rerun.io/viewer/pr/8065?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! * [x] If have noted any breaking changes to the log API in `CHANGELOG.md` and the migration guide - [PR Build Summary](https://build.rerun.io/pr/8065) - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html) To run all checks from `main`, comment on the PR with `@rerun-bot full-check`. ### Testing * [x] Tested on WebGL * [x] Tested on WebGPU
- Loading branch information