百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
P

pbr

> 编程语言
开源

Go 中的基于物理的渲染器 (PBR)

1.2K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

Go 中的基于物理的渲染器 (PBR)

pbr: 一款 Golang 3D 渲染器

包 pbr 通过单向的 CPU 单向蒙特卡洛路径跟踪实现基于物理的渲染。 pbr 使用 dep 依赖管理。

bash
$ go get github.com/hunterloftis/pbr
$ dep ensure
$ make


你好,世界

go
func main() {
	floor := surface.UnitCube(material.Plastic(1, 1, 1, 0.05))
	floor.Shift(geom.Vec{0, -0.1, 0}).Scale(geom.Vec{10, 0.1, 10})
	ball := surface.UnitSphere(material.Gold(0.05, 1))
	ball.Scale(geom.Vec{0.1, 0.1, 0.1})

	c := camera.NewSLR().MoveTo(geom.Vec{0, 0, -0.5}).LookAt(geom.Vec{0, 0, 0})
	s := surface.NewList(ball, floor)
	e := env.NewGradient(rgb.Black, rgb.Energy{750, 750, 750}, 7)

	scene := render.NewScene(c, s, e)
	err := render.Iterative(scene, "hello.png", 898, 450, 8, true)
	if err != nil {
		fmt.Fprintf(os.Stderr, "\nError: %v\n", err)
	}
}

特性

  • 简单的同步 API、并发执行、100% 使用 Go
  • 独立的 CLI
  • .obj 和 .mtl 网格和材质 (Wavefront)
  • .hdri 环境贴图 (Radiance)
  • 基于物理的材质 (金属性/粗糙度工作流程)
  • 纹理贴图 (基础、粗糙度、金属度)
  • 基于物理的相机 (景深, f 停,焦距,传感器大小)
  • 直接照明、间接照明和基于图像的照明
  • 逐步渲染

相关工作

  • https://github.com/alexflint/go-arg
  • https://github.com/ftrvxmtrx/tga
  • https://github.com/Opioid/rgbe
  • https://github.com/fogleman/pt

CLI

…

渲染

所有这些,以及更多内容都在 Makefile 中。 要自己渲染它们,您需要 3D 资源的 fixtures 目录:

$ make fixtures

注意:下载文件大小超过 1 千兆字节!

渲染农场

farm 包提供了一个客户端和服务器,可用于快速启动渲染农场。 客户端工作线程渲染场景并通过 HTTP 将样本发送到服务器。 服务器将样本整合到一个渲染结果中,并通过 GET / 返回该结果。 要尝试"玩具"渲染农场示例:

$ heroku create
$ heroku stack:set container
$ heroku labs:enable runtime-dyno-metadata
$ git push heroku master
$ heroku scale web=1:performance-l worker=

[More examples](#renders)

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Go

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言