📜 ⬆️ ⬇️

Cruise opens Worldview source code

In Cruise Automation, hundreds of engineers and testers work with data collected on the roads and through a simulator. Also a special internal team AV Tools creates applications for visualizing, searching and analyzing this data. After all, users and developers should understand what the vehicle “sees” and what it is going to do, including a cloud of points from the lidar, hundreds of classified and tracked objects, detailed maps and other data for visualization.

Like many other teams within the Cruise , the AV Tools team creates tools for rendering in the browser, and here React is the standard within the company. To reduce the complexity of the company's applications and facilitate the creation of complex visualization systems, the team created a react-library that simplifies rendering 2D and 3D scenes, called Worldview (previously Uber released a similar tool called AVS ).

image

Webgl is tough


GPU programming provides great opportunities, but it can be tedious to learn. A modern browser provides a powerful API for compiling and linking shaders, loading vertex and texture buffers, as well as objects - but all this is very difficult to learn, develop, and debug. Throughout the work, the AV Tools team experimented with different frameworks over WebGL.
')
image The decision was made to dwell on regl , a library that hides the complexity of working with WebGL for a simple and lightweight API that turns “props” into low-level primitives and simplifies rendering - almost like React uses props and state to abstract from DOM.

Regl provides an interface very similar to React, but at the same time providing full access to WebGL features, such as textures, framebuffers and instantiation. This tool allowed us to concentrate on the development of functionality, instead of digging inside WebGL.

Cruise loves React


Many front-end development teams in Cruise, who started using regl rendering in their projects, quickly realized that some of the reacting patterns were difficult to maintain in the regl API. Despite the similar paradigm of props, some aspects of GL required the creation of custom visualization and its effective integration into our rendering system.

image

To further simplify the development process, developers have abstracted from the template code that provides the rendering of standard shapes and data types in regl by creating the react components library. This allowed other teams not to reinvent their bikes, but to use ready-made bricks.

The library was named Worldview . It provides 2D and 3D cameras, mouse and keyboard controls, and tools for drawing objects and scenes. Thanks to it, Cruise engineers can easily create their own visualization systems without having to dive into learning the low-level WebGL APIs and write their own wrappers for them.

Opening the source of Worldview


Initially, the development of Worldview was closely aligned with the proprietary visualization system Cruise. However, as the system grew older, it was decided to allocate it into a separate library under the Apache 2.0 license. Cruise hopes that Worldview will lower the threshold for WebGL entry for many, providing web developers with simple tools for rendering complex scenes.

image

What's next?


Cruise will continue to develop and update the code for Worldview and other visualization libraries. Developers welcome any help from the side - pull requests are welcome.

Source: https://habr.com/ru/post/441398/


All Articles