{"id":13413208,"url":"https://github.com/fogleman/pt","last_synced_at":"2025-05-15T19:04:03.648Z","repository":{"id":26301763,"uuid":"29749675","full_name":"fogleman/pt","owner":"fogleman","description":"A path tracer written in Go.","archived":false,"fork":false,"pushed_at":"2019-03-21T10:07:26.000Z","size":1437,"stargazers_count":2089,"open_issues_count":9,"forks_count":109,"subscribers_count":60,"default_branch":"master","last_synced_at":"2025-05-15T19:03:13.171Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fogleman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-23T19:39:29.000Z","updated_at":"2025-05-09T18:18:36.000Z","dependencies_parsed_at":"2022-08-07T12:00:18.362Z","dependency_job_id":null,"html_url":"https://github.com/fogleman/pt","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/fogleman%2Fpt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fogleman%2Fpt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fogleman%2Fpt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fogleman%2Fpt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fogleman","download_url":"https://codeload.github.com/fogleman/pt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254404356,"owners_count":22065641,"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":[],"created_at":"2024-07-30T20:01:35.186Z","updated_at":"2025-05-15T19:04:03.590Z","avatar_url":"https://github.com/fogleman.png","language":"Go","readme":"# pt: a golang path tracer\n\n[![Build Status](https://travis-ci.org/fogleman/pt.png?branch=master)](https://travis-ci.org/fogleman/pt) [![GoDoc](https://godoc.org/github.com/fogleman/pt/pt?status.svg)](https://godoc.org/github.com/fogleman/pt/pt)\n\nThis is a CPU-only, unidirectional [path tracing](http://en.wikipedia.org/wiki/Path_tracing) engine written in Go. It has lots of features and a simple API.\n\n![Examples](http://i.imgur.com/BTaDLC3.png)\n\n---\n\n### Features\n\n* Supports OBJ and STL\n* Supports textures, bump maps and normal maps\n* Supports raymarching of signed distance fields\n* Supports volume rendering from image slices\n* Supports various material properties\n* Supports configurable depth of field\n* Supports iterative rendering\n* Supports adaptive sampling and firefly reduction\n* Uses k-d trees to accelerate ray intersection tests\n* Uses all CPU cores in parallel\n* 100% pure Go with no dependencies besides the standard library\n\n### Installation\n\n    go get -u github.com/fogleman/pt/pt\n\n### Examples\n\nThe are [lots of examples](https://github.com/fogleman/pt/tree/master/examples) to learn from! To try them, just run, e.g.\n\n    cd go/src/github.com/fogleman/pt\n    go run examples/gopher.go\n\n### Optional Embree Acceleration\n\nYou can optionally utilize Intel's Embree ray tracing kernels to accelerate triangle mesh intersections. First, install embree on your system: http://embree.github.io/ Then get the `go-embree` wrapper and checkout the `embree` branch of `pt`.\n\n    git checkout embree\n    go get -u github.com/fogleman/go-embree\n\n### Hello World\n\nThe following code demonstrates the basics of the API.\n\n```go\npackage main\n\nimport . \"github.com/fogleman/pt/pt\"\n\nfunc main() {\n\t// create a scene\n\tscene := Scene{}\n\n\t// create a material\n\tmaterial := DiffuseMaterial(White)\n\n\t// add the floor (a plane)\n\tplane := NewPlane(V(0, 0, 0), V(0, 0, 1), material)\n\tscene.Add(plane)\n\n\t// add the ball (a sphere)\n\tsphere := NewSphere(V(0, 0, 1), 1, material)\n\tscene.Add(sphere)\n\n\t// add a spherical light source\n\tlight := NewSphere(V(0, 0, 5), 1, LightMaterial(White, 8))\n\tscene.Add(light)\n\n\t// position the camera\n\tcamera := LookAt(V(3, 3, 3), V(0, 0, 0.5), V(0, 0, 1), 50)\n\n\t// render the scene with progressive refinement\n\tsampler := NewSampler(4, 4)\n\trenderer := NewRenderer(\u0026scene, \u0026camera, sampler, 960, 540)\n\trenderer.AdaptiveSamples = 128\n\trenderer.IterativeRender(\"out%03d.png\", 1000)\n}\n```\n\n![Hello World](http://i.imgur.com/FyAmeMx.png)\n\n### Adaptive Sampling\n\nThere are several sampling options that can reduce the amount of time needed to converge to an acceptable noise level. Both images below were rendered in 60 seconds. On the left, no advanced features were enabled. On the right, the features listed below were used.\n\n![Gopher](http://i.imgur.com/nidccRU.png)\n\nHere are some of the options that are utilized to achieve this improvement:\n\n- **stratified sampling** - on first intersection, spawn NxN rays in a stratified pattern to ensure well-distributed coverage\n- **sample all lights** - at each intersection, sample all lights for direct lighting instead of one random light\n- **forced specular reflections** - at each intersection, force both a diffuse and specular bounce and weigh them appropriately\n- **adaptive sampling** - spend more time sampling pixels with high variance\n- **firefly reduction** - very heavily sample pixels with very high variance\n\nCombining these features results in cleaner, faster renders. The specific parameters that should be used depend greatly on the scene being rendered.\n\n### Links\n\nHere are some resources that I have found useful.\n\n* [WebGL Path Tracing - Evan Wallace](http://madebyevan.com/webgl-path-tracing/)\n* [Global Illumination in a Nutshell](http://www.thepolygoners.com/tutorials/GIIntro/GIIntro.htm)\n* [Simple Path Tracing - Iñigo Quilez](http://www.iquilezles.org/www/articles/simplepathtracing/simplepathtracing.htm)\n* [Realistic Raytracing - Zack Waters](http://web.cs.wpi.edu/~emmanuel/courses/cs563/write_ups/zackw/realistic_raytracing.html)\n* [Reflections and Refractions in Ray Tracing - Bram de Greve](http://graphics.stanford.edu/courses/cs148-10-summer/docs/2006--degreve--reflection_refraction.pdf)\n* [Better Sampling - Rory Driscoll](http://www.rorydriscoll.com/2009/01/07/better-sampling/)\n* [Ray Tracing for Global Illumination - Nelson Max at UC Davis](https://www.youtube.com/playlist?list=PLslgisHe5tBPckSYyKoU3jEA4bqiFmNBJ)\n* [Physically Based Rendering - Matt Pharr, Greg Humphreys](http://www.amazon.com/Physically-Based-Rendering-Second-Edition/dp/0123750792)\n\n### Samples\n\n![Go](http://i.imgur.com/LMNUoaM.jpg)\n\n![Dragon](https://www.michaelfogleman.com/static/gallery/out1000c.png)\n\n![Cornell](https://www.michaelfogleman.com/static/gallery/853.png)\n\n![Lucy](https://www.michaelfogleman.com/static/gallery/756b.png)\n\n![SDF](https://www.michaelfogleman.com/static/gallery/470d.png)\n\n![Spheres](https://www.michaelfogleman.com/static/gallery/dof.png)\n\n![Suzanne](http://i.imgur.com/iw32US1.png)\n\n![Molecule](https://www.michaelfogleman.com/static/gallery/600d.png)\n","funding_links":[],"categories":["Images","Go","others","Relational Databases","图像","Images 图像处理","圖象","\u003cspan id=\"图片-images\"\u003e图片 Images\u003c/span\u003e","图片"],"sub_categories":["Advanced Console UIs","Search and Analytic Databases","交流","SQL 查询语句构建库","高级控制台界面","高級控制台界面","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","检索及分析资料库"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffogleman%2Fpt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffogleman%2Fpt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffogleman%2Fpt/lists"}