项目作者: nqpz

项目描述 :
Weekend toy
高级语言: Makefile
项目地址: git://github.com/nqpz/surrender.git
创建时间: 2018-12-02T23:42:07Z
项目社区:https://github.com/nqpz/surrender

开源协议:

下载


surrender

Screenshot

Don’t use this.

Render triangles with Futhark (install this
first). Run something like this (requires SDL2 and SDL2-ttf headers):

  1. futhark pkg sync && make && ./lys

This works by being parallel in the number of triangles. Contrast to
raycasting which is parallel in the number of pixels. We use the
reduce_by_index Futhark construct.

A few workarounds are needed to make this work in a regular-arrays
setting. For instance, we need to have each triangle take up the same
amount of space in the output of its rendering computation, i.e., its
pixels and their indexes into the global frame. We solve this by
letting the user of our library pass a size along with the triangles; we
then check that all triangle renders can fit into this size. If this is
not the case, we forcefully split the offending triangles into smaller
sizes, and repeat the check. Do this until everything checks out. This
is not terribly efficient; maybe there’s a better way?

TODO (if someone finds this interesting):

  • Support passing a camera position to the scene.
  • Implement a simple lighting system.
  • Let triangles consist of more than just colors (textures, shaders).
  • Add an interactive interface.
  • Fix some of the perspective stuff.
  • Try to fix some of the aliasing stuff (or whatever it is; z-fighting?).
  • Make measurements.