{"id":16866171,"url":"https://github.com/elliottt/rendrs","last_synced_at":"2025-04-11T10:14:31.344Z","repository":{"id":66493503,"uuid":"196903291","full_name":"elliottt/rendrs","owner":"elliottt","description":"A raytracer in rust","archived":false,"fork":false,"pushed_at":"2024-09-09T04:22:17.000Z","size":4434,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T07:01:41.591Z","etag":null,"topics":["ray-tracing","raymarching","rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elliottt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-15T01:36:12.000Z","updated_at":"2024-09-09T04:22:20.000Z","dependencies_parsed_at":"2025-02-19T03:32:16.367Z","dependency_job_id":"13023df2-6233-4894-a91f-5f1019244bf0","html_url":"https://github.com/elliottt/rendrs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliottt%2Frendrs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliottt%2Frendrs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliottt%2Frendrs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliottt%2Frendrs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elliottt","download_url":"https://codeload.github.com/elliottt/rendrs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248373069,"owners_count":21093138,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ray-tracing","raymarching","rust"],"created_at":"2024-10-13T14:49:43.493Z","updated_at":"2025-04-11T10:14:31.318Z","avatar_url":"https://github.com/elliottt.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rendrs\n\n`rendrs` is a poorly named ray-marching raytracer. It has a scene description\nlanguage that's s-expression based, and documented in the language section.\n\n## Examples\n\n`cargo run --release -- render scenes/complicated.scene`\n\n![](examples/complicated.png)\n\n## Running\n\n`rendrs` can be run in one of two modes, as an offline renderer that will output\nthe render targets of the scene description, or in an interactive mode where it\nwill refresh the render targets in a web-browser window as the scene description\nis edited and saved.\n\nThe first mode is run via the `render` sub-command. It expects a scene file as\nan argument, and has an optional `--threads` argument to control the number of\nthreads spawned during rendering.\n\nThe second mode is run via the `serve` sub-command. It will watch the scene file\nprovided, and will open your web-browser to `http://127.0.0.1:8080` when\nstarted. The port used can be controlled via the `--port` argument, and the\n`--threads` argument is also valid here.\n\n## TODO\n\n* [ ] `.obj` file mesh loading\n* [ ] Global illumination integrator\n* [ ] Handle non-square pixels for ascii rendering\n* [x] Transparent objects\n* [x] Sub-pixel sampling strategies\n\n## Language\n\nThe scene description language is made up of s-expressions. Top-level\ndeclarations are used to define nodes, lights, patterns, materials, and cameras,\nwhich are all used by render targets to produce a final output.\n\nSingle-line comments start with the `;` character.\n\nThe following conventions are used in the descriptions below:\n\n* `\u003cname\u003e` - an identifier, starting with a lower-case ascii letter, followed by\n  ascii letters, digits or the symbols `-`, `_`, `!`, or `?`\n* `\u003cnumber\u003e` - a number, with an optional decimal component\n* `\u003cvector\u003e` - a three dimensional vector, specified as `(\u003cx\u003e \u003cy\u003e \u003cz\u003e)`, where\n  each of the components are expected to be number literals\n* `\u003cpoint\u003e` - a three dimensional point, specified in the same format as\n  `\u003cvector\u003e`\n* `\u003cstring\u003e` - a double-quoted string\n* `\u003csymbol\u003e` - the same format as `\u003cname\u003e`, but with a leading `:`\n* `\u003ccolor\u003e` - a hex color, specified as `#rrggbb`\n* `\u003cangle\u003e` - either a number specifyin the value in radians, or\n  `(degrees \u003cnumber\u003e)` to specify it in degrees.\n\n### Nodes\n\nNode declarations take the form:\n\n```lisp\n(node \u003cname\u003e \u003cshape-description\u003e)\n```\n\nThe following shape descriptions are available:\n\n* `(plane \u003cvector\u003e)` - a plane whose normal is given by the vector.\n* `(sphere \u003cnumber\u003e)` - a sphere whose radius is given by the number.\n* `(box \u003cnumber\u003e \u003cnumber\u003e \u003cnumber\u003e)` - a box whose width, height, and depth are\n  given by the three numeric literal arguments.\n* `(torus \u003cnumber\u003e \u003cnumber\u003e)` - a torus with the given hole diameter, and outer\n  radius.\n* `(group \u003cnode\u003e...)` - Group together the following nodes into one node. The\n  nodes can be either inlined shape definitions, or the names of nodes\n  introduced through a top-level `(node ...)` declaration.\n* `(union \u003cnode\u003e...)` - Union together nodes. This behaves similarly to\n  `(group \u003cnode\u003e...)`, but the difference is that for material application it's\n  considered to be a single object, wheras the members of a group are still\n  considered to be separate objects.\n* `(smooth-union \u003cnumber\u003e \u003cnode\u003e...)` - Union the nodes together, but smoothly\n  blend between the nodes according to the numeric parameter given.\n* `(subtract \u003cnode\u003e \u003cnode\u003e)` - Subtract the second node from the first. The\n  material from the second node will be used as the material for the cutout,\n  giving some control over how the removal looks.\n* `(intersect \u003cnode\u003e...)` - The intersection of all of the objects.\n* `(transform \u003ctransform\u003e \u003cnode\u003e)` - Apply the given transform to the node when\n  rendering it.\n* `(paint \u003cmaterial\u003e \u003cnode\u003e)` - Apply the given material to the node when\n  rendering.\n\n### Transforms\n\nTransforms can be used to transform nodes or patterns in the scene graph during\nrendering.\n\n* `(compose \u003ctransform\u003e...)` - Compose all the transformations left-to-right.\n* `(rotate \u003cvector\u003e)` - A rotation specified in axis-angle notation.\n* `(uniform-scale \u003cnumber\u003e)` - Uniform scaling in all dimensions.\n* `(scale \u003cvector\u003e)` - Non-uniform scaling in all dimensions. WARNING: this\n  doesn't function exactly correctly for SDFs, and may have unexpected behavior\n  as a result.\n* `(look-at \u003cpoint\u003e \u003cpoint\u003e \u003cvector\u003e)` - Compose the look-at transform to orient\n  the first point, the eye, towards the second point, the target. Especially\n  useful for orienting cameras.\n\n### Lights\n\nLights can be added to the scene with a `light` declaration:\n\n```lisp\n(light \u003clight\u003e)\n```\n\nThe light value can take one of the following forms:\n\n* `(diffuse \u003ccolor\u003e)` - A diffuse light applied to the entire scene.\n* `(point \u003ccolor\u003e \u003cpoint\u003e)` - A point light with the given color, positioned at\n  the point.\n\n### Patterns\n\nPatterns can be declared with the following form:\n\n```lisp\n(pattern \u003cname\u003e \u003cpattern\u003e)\n```\n\nThe pattern values can take one of the following forms:\n\n* `(solid \u003ccolor\u003e)` - The solid color pattern.\n* `(gradient \u003ccolor\u003e \u003ccolor\u003e)` - Blending between the two colors given the\n  object-space coordinate's x-value.\n* `(stripes \u003cpattern\u003e \u003cpattern\u003e)` - Alternating between the two patterns in\n  vertical stripes, based on the object space coordinate's x-value.\n* `(checkers \u003cpattern\u003e \u003cpattern\u003e)` - A checkerboard pattern that alternates\n  between the two patterns. The checkers are three-dimensional volumes, so\n  they're more like cubes in space.\n* `(shells \u003cpattern\u003e \u003cpattern\u003e)` - Rings of alternating patterns, centered at\n  the origin.\n* `(transform \u003ctransform\u003e \u003cpattern\u003e)` - Apply the transformation to the\n  object-space point before determing the color produced by the sub-pattern.\n\n### Materials\n\nMaterials can be declared with the following form:\n\n```lisp\n(material \u003cname\u003e \u003cmaterial\u003e)\n```\n\nThe material values can take one of the following forms:\n\n* `(phong \u003cargs\u003e)` - The Phong reflection model, with the following arguments:\n  * `:pattern \u003cpattern\u003e` - (required) the pattern to use for the surface\n  * `:ambient \u003cnumber\u003e` - (default `0.1`) the ambient light contribution,\n    `[0,1]`\n  * `:diffuse \u003cnumber\u003e` - (default `0.9`) the diffuse light contribution,\n    `[0,1]`\n  * `:specular \u003cnumber\u003e` - (default `0.9`) the specular light contribution,\n    `[0,1]`\n  * `:shininess \u003cnumber\u003e` - (default `200`) the specular light contribution\n  * `:reflective \u003cnumber\u003e` - (default `0`) how reflective the surface is,\n    `[0,1]`\n  * `:transparent \u003cnumber\u003e` - (default 0) how transparent the surface is,\n    `[0,1]`\n  * `:refractive_index \u003cnumber\u003e` - (default 0) the index of refraction for the\n    surface, must be positive.\n* `(emissive \u003cpattern\u003e)` - The surface behaves as a light source. This is\n  currently not very helpful, as the only integrator available is a Whitted\n  ray-tracer, that doesn't handle emissive objects well.\n\n### Cameras\n\nCameras can be declared at the top-level with the following form:\n\n```lisp\n(camera \u003cname\u003e \u003ccamera\u003e)\n```\n\nThere is currently only one type of camera, a `pinhole` camera. It takes the\nfollowing form:\n\n```lisp\n(pinhole \u003cnumber\u003e \u003cnumber\u003e \u003ctransform\u003e \u003cangle\u003e)\n```\n\nThe first two numbers are width and height of the canvas produced, the transform\nis the world-to-camera transform, and the last angle is the field of view of\nthe transform.\n\n### Render Targets\n\nRender targets are declared as follows:\n\n```lisp\n(render \u003ctarget\u003e \u003cintegrator\u003e \u003cnode\u003e)\n```\n\n`\u003ctarget\u003e` is one of the following forms:\n\n* `(file \u003cstring\u003e)` - write the output to the file specified in the string\n* `(ascii \u003cstring\u003e)` - Render the output as ascii, and use the string name to\n  disambiguate it from other `ascii` targets.\n\nThere is currently only one `\u003cintegrator\u003e` supported, the `whitted` integrator.\nIt takes as an argument a `\u003csampler\u003e` and `\u003ccamera\u003e` value. The only sampler\ncurrently implemented is the `(uniform \u003cnumber\u003e \u003cnumber\u003e)` sampler, where the\ntwo numeric parameters are the number of horizontal and vertical samples to\ncollect for a single pixel.\n\nFinally, the `\u003cnode\u003e` argument will be the root of the scene, and only nodes\nreachable from that node will be rendered.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felliottt%2Frendrs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felliottt%2Frendrs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felliottt%2Frendrs/lists"}