Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/repalash/cc0textures-threejs
PBR Material loader from cc0textures.com for webgl projects.
https://github.com/repalash/cc0textures-threejs
cc0 cc0-textures loader materials pbr threejs
Last synced: 1 day ago
JSON representation
PBR Material loader from cc0textures.com for webgl projects.
- Host: GitHub
- URL: https://github.com/repalash/cc0textures-threejs
- Owner: repalash
- Created: 2021-05-15T09:40:06.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-03T11:56:43.000Z (8 months ago)
- Last Synced: 2024-06-26T05:20:50.401Z (5 months ago)
- Topics: cc0, cc0-textures, loader, materials, pbr, threejs
- Language: TypeScript
- Homepage:
- Size: 4.64 MB
- Stars: 14
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CC0Textures threejs Material Loader
### PBR Material loader from cc0textures.Demo -
https://repalash.github.io/cc0textures-threejs/![alt text](example/demo1.png "Metal")
Browse over 1000 PBR materials from cc0textures.com and use as `MeshStandardMaterial` or `MeshStandardMaterial` in three.js.
## Usage
Copy the files [cc0_threejs_loader.js](src/cc0_threejs_loader.js) and [cc0textures_helper.js](src/cc0textures_helper.js) to your project.Sample load material directly from the link (Get it from cc0textures.com)
```javascript
var mesh;
var loader = new CC0MaterialLoader();
loader.load('https://cdn3.struffelproductions.com/file/CC0-Textures/download/Ground019_01fsyirl/Ground019_1K-PNG.zip', (params)=>{
mesh.material = new MeshStandardMaterial(params);
// or
mesh.material = new MeshPhysicalMaterial(params);
});
```
You can also use indirect link like: `https://cc0textures.com/get?file=Ground019_2K-JPG.zip`![alt text](example/demo2.png "Lava")
It is possible to preload the data and find materials and create dynamic links (like in the example). The get complete data from [src/data](src/data)
```javascript
var mesh;
var materials_data = `Ground019,01fsyirl,1K-JPG|1K-PNG\nTiles064,nzs0hgad,1K-JPG\nRocks005,fsrk453n,1K-JPG`;var loader = new CC0MaterialLoader(new THREE.LoadingManager(), materials_data);
loader.findAndLoad('ground', (params)=>{
mesh.material = new MeshStandardMaterial(params);
// or
mesh.material = new MeshPhysicalMaterial(params);
})
```