Skip to main content

ascii rendering engine

Project description

asciirend

. ...    . . .  .  .     . . ..   ..  .. .  ..    .  . .. ... . . ...
.     . .       ..  ..  ...... . .   .......   .  ..  . .. ....... . ..
.  .   .   ... .. . =======+=+==+======+=====+======.  . ...            .
.   ....######======+================+=====+===+===+===+=+=+=+== .... ...
    . . .###%##########=============+===+=========++++++=====+      . . .
.     .  ..######%###%###%####%======+===++==++=+===+==+++++=..  .   . .
 ...    ... ##########%##%######%####=+==+======++++===+==+=. .  .  ...
  .. ..   . .#####%#######%####...........=+====+=====+=== ..    . .. ..
. ..... .  ... ##%####%%######%.asciirend.======+=+==+===  . .... ..... .
  ..    .. . .  ##########%####...........+========+====     ..    ...  .
. .    ..  .     ##%##############%##=+++======+==+=== .. ... ..  .. ..
 .. ....  .       .##################=+=====++===+==+   .   .      .  .
.      ...  . ...    #%####%#####%###==+=+==+=+++==    ...  . ...      ..
. .. . . ...  . ..  .. ##########%%##+===++===+=+  .  .   ..    ..  ..
.    .    . .. . .. .    ############+===+=++==.    . . ..  .  ..    .
 . .   .  . .   .  . ...   ##########+==++=++ ..... . . . .  .      .   .
 ....  ..    ... ....  ..    #%#####%==+===   .. .    .  .. .. . ....  ..
..   . ... .. .. ..     ...  ..##%###+=== .    ...   .  ..    .   .   . .

Generic ascii renderer

asciirend is a no_std compatible 3D rendering core. This crate renders objects in several stages:

  • Primitive shading (similar to vertex shading, albeit works on whole primitives).
  • Fragment shading.
  • Additional text pass.

Fragments are shaded in full sRGB float color space, which then is quantized to characters with a dithering algorithm. This allows the image to have clearer color transitions, as opposed to direct character shading. This also means the rendering backend is agnostic to the available color space (so long as it's not HDR!), which is important for a generic no_std compatible renderer.

Examples

Please see examples/sample.rs for usage sample.

JavaScript

asciirend has a javascript sample that uses WASM. Albeit the API surface is limited, it is possible to use it to draw basic interactive scenes. Please see web_sample directory for details.

Python

In addition, there is a python sample (and pip package). Please see python subdirectory for more details, or install asciirend package, and run the python sample at sample.py.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asciirend-0.2.1.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

asciirend-0.2.1-py3-none-any.whl (105.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page