path tracer 正在参加 2021 年度 OSC 中国开源项目评选,请投票支持!
path tracer 在 2021 年度 OSC 中国开源项目评选 中已获得 {{ projectVoteCount }} 票,请投票支持!
2021 年度 OSC 中国开源项目评选 正在火热进行中,快来投票支持你喜欢的开源项目!
2021 年度 OSC 中国开源项目评选 >>> 中场回顾
path tracer 获得 2021 年度 OSC 中国开源项目评选「最佳人气项目」 !
授权协议 MIT
开发语言 Google Go
操作系统 跨平台
软件类型 开源软件
开源组织
地区 不详
投 递 者 红薯
适用人群 未知
收录时间 2015-03-05

软件简介

pt 是用 Go 语言实现的 path tracer 用于渲染各种 3D 模型图。

特征

  • 支持OBJ和STL
  • 支持纹理,凹凸贴图和法线贴图
  • 支持有符号距离场的光线行进
  • 支持从图像切片进行体积渲染
  • 支持各种材料特性
  • 支持可配置的景深
  • 支持迭代渲染
  • 支持自适应采样和萤火虫减少
  • 使用KD树加速射线相交测试
  • 并行使用所有CPU内核
  • 100%纯净的Go,除了标准库外没有依赖项

示例代码:

package main

import (
    "log"

    "github.com/fogleman/pt/pt"
)

func main() {
    scene := pt.Scene{}
    wall := pt.SpecularMaterial(pt.HexColor(0xFCFAE1), 2)
    scene.Add(pt.NewSphere(pt.Vector{4, 7, 3}, 2, pt.LightMaterial(pt.Color{1, 1, 1}, 1, pt.NoAttenuation)))
    scene.Add(pt.NewCube(pt.Vector{-30, -1, -30}, pt.Vector{-8, 10, 30}, wall))
    scene.Add(pt.NewCube(pt.Vector{-30, -1, -30}, pt.Vector{30, 0.376662, 30}, wall))
    material := pt.GlossyMaterial(pt.Color{}, 1.5, pt.Radians(30))
    mesh, err := pt.LoadOBJ("examples/gopher.obj", material)
    if err != nil {
        log.Fatalln("LoadOBJ error:", err)
    }
    mesh.SmoothNormals()
    scene.Add(mesh)
    camera := pt.LookAt(pt.Vector{8, 3, 0.5}, pt.Vector{-1, 2.5, 0.5}, pt.Vector{0, 1, 0}, 45)
    pt.IterativeRender("out%03d.png", 10, &scene, &camera, 2560/4, 1440/4, -1, 16, 4)
}

展开阅读全文

代码

的 Gitee 指数为
超过 的项目

评论

点击引领话题📣
暂无内容
发表了博客
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
发表了问答
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
暂无内容
0 评论
6 收藏
分享
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部