https://github.com/moebiussurfing/ofxsurfingpbr
Simple helper with examples for easily testing the new PBR features from OF 0.12+.
https://github.com/moebiussurfing/ofxsurfingpbr
openframeworks openframeworks-addon
Last synced: 8 months ago
JSON representation
Simple helper with examples for easily testing the new PBR features from OF 0.12+.
- Host: GitHub
- URL: https://github.com/moebiussurfing/ofxsurfingpbr
- Owner: moebiussurfing
- Created: 2023-10-29T04:36:57.000Z (over 2 years ago)
- Default Branch: develop
- Last Pushed: 2025-06-06T00:29:13.000Z (about 1 year ago)
- Last Synced: 2025-06-06T01:27:36.229Z (about 1 year ago)
- Topics: openframeworks, openframeworks-addon
- Language: C++
- Homepage:
- Size: 151 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WIP
## OVERVIEW
**openFrameworks** addon to easily test, learn, and use the new **PBR features** from the new **OF 0.12+** releases.
(You should use the [GitHub master branch](https://github.com/openframeworks/openFrameworks)!)
All this code is copied from and hardly based on this [OF forum topic](https://forum.openframeworks.cc/t/ofshadow-and-ofshader-issue-on-of-0-12/42600/19 ).
Original authors: [@NickHardeman](https://github.com/NickHardeman) and [@paolo-scoppola](https://github.com/paolo-scoppola).
## VIDEO
https://github.com/moebiussurfing/ofxSurfingPBR/assets/2106149/43ac19b8-da41-4dd5-ad4d-b77f885d3e24
SCREENSHOTS
### 1_Example_Basic

### 2_Example_Models

### 3_Example_Lights

### 4_Example_Materials

### 5_Example_Shadows

### 6_Example-3D_Parts




## FEATURES
- Main class `ofxSurfingPBR.h` is a **Scene Manager** with default common elements:
- Two ready-to-use editable parametric materials:
- **Material A**. For the **Plane** (floor).
- **Material B**. For the **other Objects**.
- Default **Lights combo**:
- Flexible **Point**, **Directional** and **Spot**.
- **Cubemaps** (**HDR**) files loader.
- **Background color** and **Sphere/Box container** with material.
- Class `SurfingMaterial.h`: **Standalone Materials** can be used independently of the main class.
- Class `SurfingLights.h`: Four **bundled lights**: `Point`, `Direct`, `Spot` and `Area` with shadows.
- Class `SurfingSceneManager.h`: Bundles the lights from `SurfingLights.h` and allows **queuing materials** dynamically. Standalone and not loaded by default on `ofxSurfingPBR`.
- Persistent settings:
- Optimized **auto save** on any change.
- **Plane** simple material, colors, transforms, snapshots, etc...
- All materials with full **PBR** specs.
- Internal `camera`.
- Material **Randomizers**.
- **History** browsing workflow.
- **Presets**/**Snapshots** (Store/Recall) explorer system.
- Included **3D models** browser/loader class.
- Added **Shader** for *testing/code*.
- **Displacement** applied to the plane and his material/mesh.
### TODO
- Add more **Shaders** related stuff. / HELP IS WELCOME!
- _Mesh/vertex_ displacements (not just heightmaps). / TODO
- Shader **Debugger**. / TODO
USAGE
## EXAMPLE
### main.cpp
```.cpp
#include "ofApp.h"
#include "ofMain.h"
int main() {
ofGLWindowSettings settings;
settings.setGLVersion(3, 2);
auto window = ofCreateWindow(settings);
ofRunApp(window, make_shared());
ofRunMainLoop();
}
```
### ofApp.h
```.cpp
#pragma once
#include "ofMain.h"
#include "ofxSurfingPBR.h"
class ofApp : public ofBaseApp {
public:
void setup();
void draw();
ofxSurfingPBR pbr;
void renderScene();
};
```
### ofApp.cpp
```.cpp
void ofApp::setup() {
pbr.setup();
// Pass the render scene function
callback_t f = std::bind(&ofApp::renderScene, this);
pbr.setFunctionRenderScene(f);
}
void ofApp::draw() {
pbr.draw();
pbr.drawGui();
}
void ofApp::renderScene()
{
// Plane floor
pbr.drawPlane();
// Other objects
pbr.beginMaterial();
{
/* DRAW HERE! */
}
pbr.endMaterial();
}
```
## DEPENDENCIES
- [OF 0.12+](https://github.com/openframeworks/openFrameworks).
- [ofxSurfingHelpersLite](https://github.com/moebiussurfing/ofxSurfingHelpersLite).
- **Helper classes** for settings serializers, auto saver, `ofxGui` customizer, layout helpers, `ofDrawBitmapStringBox`...etc.
- [ofxSurfingCameraSimple](https://github.com/moebiussurfing/ofxSurfingCameraSimple).
- An internal improved `ofEasyCam` is bundled.
- **ofxAssimpModelLoader** / _OF core_
- Only for the example `2_Example_Models`.
## REQUERIMENTS
- Download and copy the content of `data.zip` to the examples or to your projects into `/bin/data`:
* Data for any or new projects: [bin/data.zip](https://mega.nz/file/pa0xGarZ#GqUDFxvSn8SZQmDfPFDDhyEHBRYLzMzVkEpq7y4-tPU)
* Data for `2_Example_Models`: [bin/data.zip](https://mega.nz/file/VfEBDbrR#QA9O0R5yaNkEh8Zf00ffq2OTgmAGVOR6LXB875IyScc)
* Data for `6_Example_3D_Parts`: [bin/data.zip](https://mega.nz/file/hHVzWBCL#XFFSxCm_nLtqQ-nqskIhzn4KxeUUVUljOb-UtGOiekA)
* Only shaders: [bin/dataShaders.zip](https://mega.nz/file/0H8gCaII#dOVPZNUMnk891w61zVlmu5zgb9xSLSN5FIY7jDASAoQ)
* Folder with all the files: [@ MEGA](https://mega.nz/folder/tLkR0TqL#KdJ4l0O6v2w6qaT_dLz2IA).
- Notice that all the examples should work without the data files too.
/bin/
-- /data/
---- /assets/fonts/ - ttf,otf | for ofxGui customize
---- /cubemaps/ - exr,hdr,jpg | for CubeMaps
---- /models/ - obj,ply,fbx | for 3d objects
---- /images/ - jpg,png | for Bg sphere texture
---- /shadersGL2/ - frag,vert | used when enabled
---- /shadersGL3/ - frag,vert | used when enabled
## TESTED SYSTEMS
* **Windows 11** / **VS 2022** / **OF 0.12+** @ [GitHub master branch](https://github.com/openframeworks/openFrameworks)
## LICENSE
**MIT License**