Jax implementation of rasterizer renderer.
Project description
JAX Renderer
Key Difference from erwincoumans/tinyrenderer
- Native JAX implementation, supports
jit
,vmap
, etc. - Lighting is computed in main camera's eye space; while in PyTinyrenderer it is computed in world space.
- Texture specification is different: in PyTinyrenderer, the texture is specified in a flattened array, while in JAX Renderer, the texture is specified in a shape of (width, height, colour channels). A simple way to transform old specification to new specification is to use the convenient method
build_texture_from_PyTinyrenderer
. - Rendering pipeline is different. PyTinyrenderer renders one object at a time, and share zbuffer and framebuffer across one pass. This renderer first merges all objects into one big mesh in world space, then process all vertices together, then interpolates and rasterise and render. For fragment shading, this is done by sweeping each row in a for loop, and batch compute all pixels together. For computing a pixel, all fragments for that pixels are batch compute together, then mixed. This is more memory efficient and allows
vmap
batching as far as possible. - Shadowing within the same object / mesh is allowed. This is not possible in PyTinyrenderer, as it deliberately checks if the shadow comes from the same object; if so, it will not consider to draw a shadow there.
- Quaternion (for specifying rotation/orientation) is in the form of
(w, x, y, z)
instead of(x, y, z, w)
in PyTinyrenderer. This is for consistency withBRAX
. - No clipping is performed. To ensure correct rendering of objects with vertices at or behind camera plane, homogeneous interpolation (Olano and Greer, 1997)[^1] is used to avoid the need of homogeneous division.
- Fix bugs
- Specular lighting was wrong, where it forgets to reverse the light direction vector.
[^1]: Marc Olano and Trey Greer. 1997. Triangle Scan Conversion Using 2D Homogeneous Coordinates. In Proceedings of the ACM SIGGRAPH/EUROGRAPHICS Workshop on Graphics Hardware (HWWS ’97). ACM, New York, NY, USA, 89–95.
Roadmap
- Support double-sided objects
- Profile and accelerate implementation
- Differentiable rendering
- Build a ray tracer as well
-
Correctly implement a proper clipping algorithm
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jaxrenderer-0.2.0.tar.gz
(50.5 kB
view hashes)
Built Distribution
Close
Hashes for jaxrenderer-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43770d4682d5dd91e6260ddba2559e743ecee1b7057089840cfbb549026c77b2 |
|
MD5 | ca983073c26c0ef912cf13561d2ef74a |
|
BLAKE2b-256 | 6628ff290d169142b29585282b4e075b44a3d1495bc1884e9e0d17dbab99aebb |