-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### What Draw order was not doing anything on 0.14! The underlying issue was that the depth offset context system which converts draw order to depth offsets didn't iterate any entities since it used a iterator for entities. This means we're now iterating a much larger entity set. I checked with the "many entities" manual test and the context system takes about 0.5ms for me in release there. This is kinda bad but it's not a big dent here (unfortunately) and it runs in parallel to the much slower transform context system. This PR moves the (also broken due to heuristic changes) test from "api_test" to a release check with a description what should be observable. ### 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 newly built examples: [rerun.io/viewer](https://rerun.io/viewer/pr/5794) * Using examples from latest `main` build: [rerun.io/viewer](https://rerun.io/viewer/pr/5794?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/5794?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)! - [PR Build Summary](https://build.rerun.io/pr/5794) - [Docs preview](https://rerun.io/preview/a10a84ef97637dd05c615ac65b63b6711edeba44/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/a10a84ef97637dd05c615ac65b63b6711edeba44/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html) --------- Co-authored-by: Jeremy Leibs <[email protected]>
- Loading branch information
Showing
7 changed files
with
111 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
from __future__ import annotations | ||
|
||
import os | ||
from argparse import Namespace | ||
from uuid import uuid4 | ||
|
||
import numpy as np | ||
import rerun as rr | ||
import rerun.blueprint as rrb | ||
|
||
README = """ | ||
# 2D Draw order | ||
This checks whether the draw order correctly determines the layering of 2D content. | ||
### Action | ||
You should see a single 2D space view with the following features: | ||
- Gray background image | ||
- On top of the background a green/red gradient image | ||
- On top of that a blue (slightly transparent) blue square | ||
- On top of the blue square a white square. *Nothing* is overlapping the white square! | ||
- Between the gradient and the blue square rectangle (Box2D) | ||
- Lines *behind* the rectangle | ||
- Regular raster of points *in front* of the rectangle (unbroken by the rectangle) | ||
""" | ||
|
||
|
||
def log_readme() -> None: | ||
rr.log("readme", rr.TextDocument(README, media_type=rr.MediaType.MARKDOWN), timeless=True) | ||
|
||
|
||
def run_2d_layering() -> None: | ||
rr.set_time_seconds("sim_time", 1) | ||
|
||
# Large gray background. | ||
img = np.full((512, 512), 64, dtype="uint8") | ||
rr.log("2d_layering/background", rr.Image(img, draw_order=0.0)) | ||
|
||
# Smaller gradient in the middle. | ||
img = np.zeros((256, 256, 3), dtype="uint8") | ||
img[:, :, 0] = np.linspace(0, 255, 256, dtype="uint8") | ||
img[:, :, 1] = np.linspace(0, 255, 256, dtype="uint8") | ||
img[:, :, 1] = img[:, :, 1].transpose() | ||
rr.log("2d_layering/middle_gradient", rr.Image(img, draw_order=1.0)) | ||
|
||
# Slightly smaller blue in the middle, on the same layer as the previous. | ||
img = np.full((192, 192, 3), (0, 0, 255), dtype="uint8") | ||
rr.log("2d_layering/middle_blue", rr.Image(img, draw_order=1.0)) | ||
|
||
# Small white on top. | ||
img = np.full((128, 128), 255, dtype="uint8") | ||
rr.log("2d_layering/top", rr.Image(img, draw_order=2.0)) | ||
|
||
# Rectangle in between the top and the middle. | ||
rr.log( | ||
"2d_layering/rect_between_top_and_middle", | ||
rr.Boxes2D(array=[64, 64, 256, 256], draw_order=1.5, array_format=rr.Box2DFormat.XYWH), | ||
) | ||
|
||
# Lines behind the rectangle. | ||
rr.log( | ||
"2d_layering/lines_behind_rect", | ||
rr.LineStrips2D([(i * 20, i % 2 * 100 + 100) for i in range(20)], draw_order=1.25), | ||
) | ||
|
||
# And some points in front of the rectangle. | ||
rr.log( | ||
"2d_layering/points_between_top_and_middle", | ||
rr.Points2D( | ||
[(32.0 + int(i / 16) * 16.0, 64.0 + (i % 16) * 16.0) for i in range(16 * 16)], | ||
draw_order=1.51, | ||
), | ||
) | ||
|
||
|
||
def run(args: Namespace) -> None: | ||
rr.script_setup( | ||
args, | ||
f"{os.path.basename(__file__)}", | ||
recording_id=uuid4(), | ||
default_blueprint=rrb.Grid(rrb.Spatial2DView(origin="/"), rrb.TextDocumentView(origin="readme")), | ||
) | ||
|
||
log_readme() | ||
run_2d_layering() | ||
|
||
|
||
if __name__ == "__main__": | ||
import argparse | ||
|
||
parser = argparse.ArgumentParser(description="Interactive release checklist") | ||
rr.script_add_args(parser) | ||
args = parser.parse_args() | ||
run(args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters