1 Star 0 Fork 0

褚旭 / PBR

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Physically Based Rendering

(c) 2017 - 2018 Michał Siejak (@Nadrin)

An implementation of physically based shading model & image based lighting in various graphics APIs.

Screenshot

API SLOC Implementation status
OpenGL 4.5 508 Done
Vulkan 1843 Done
Direct3D 11 673 Done
Direct3D 12 1205 Done

About

The goal of this project is to showcase the use of various modern graphics APIs and to provide a clear side-by-side comparison of them. I believe that an implementation of physically based shading is a sufficiently non-trivial use case for that comparison to be useful.

Each implementation is completely self contained within a single source/header pair residing directly in src directory. The coding style is mostly procedural ("C with classes") using simple POD structs for grouping related data together. This was done for simplicity, readability, and to not impose any particular renderer design/organization.

Shared functionality (loading of images & 3D models, application event loop & entry point, misc utility functions) can be found in src/common directory.

Please note that it was not my goal to try to come up with the most efficient/optimized use of each API. The rendered scene is very simple anyway (only handful of drawcalls, mostly static data), and when in doubt I tried to refrain from using "clever" tricks and went for simple solutions.

Shaders are heavily commented because there's where interesting stuff happens. :)

Building

Windows

Prerequisites

  • Windows 10 or Windows Server 2016 (x64 versions)
  • Visual Studio 2017 (any edition)
  • Relatively recent version of Windows 10 SDK
  • LunarG Vulkan SDK

How to build

Visual Studio solution is available at projects/msvc2017/PBR.sln. After successful build the resulting executable and all needed DLLs can be found in data directory. Note that precompiled third party libraries are only available for x64 target.

Linux

Prerequisites

  • C/C++ compiler supporting C++14
  • CMake 3.8 or newer
  • pkg-config
  • glslang from Khronos
  • Development files for GLFW3, Assimp, OpenGL & Vulkan

How to build

  1. Install prerequisites; for Debian/Ubuntu:
sudo apt install build-essential cmake pkg-config libglfw3-dev libassimp-dev libgl1-mesa-dev libvulkan-dev
  1. Download & install glslang. Make sure that glslangValidator binary is in PATH or in /opt/glslang/bin.

  2. Configure & build the project:

mkdir -p projects/cmake/build
cd projects/cmake/build
cmake ..
make install
  1. After successful build the resulting executable can be found in data directory.

macOS

Help wanted.

Running

Make sure to run from within data directory as all paths are relative to it. API to be used can be specified on the command line as a single parameter (-opengl, -vulkan, -d3d11, or -d3d12). When run with no parameters -d3d11 is used on Windows, and -opengl on other platforms.

Controls

Input Action
LMB drag Rotate camera
RMB drag Rotate 3D model
Scroll wheel Zoom in/out
F1-F3 Toggle analytical lights on/off

Bibliography

This implementation of physically based shading is largely based on information obtained from the following courses:

Other resources that helped me in research & implementation:

Third party libraries

This project makes use of the following open source libraries:

Included assets

The following assets are bundled with the project:

MIT License Copyright (c) 2017-2018 Michał Siejak Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

An implementation of physically based shading model & image based lighting in various graphics APIs. 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/chuxu1793/PBR.git
git@gitee.com:chuxu1793/PBR.git
chuxu1793
PBR
PBR
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891