Skip to content

Commit

Permalink
Merge branch 'main' of github.com:nwpointer/three-landscape
Browse files Browse the repository at this point in the history
  • Loading branch information
natpoint committed Jul 29, 2023
2 parents 90c2978 + b75b092 commit dab559a
Show file tree
Hide file tree
Showing 41 changed files with 9,756 additions and 3,471 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/npm-publish.yml
Expand Up @@ -27,7 +27,7 @@ jobs:
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci && npm run build
- run: npm ci && npm run build && cp README.md ./package/README.md
- run: npm publish -w package
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
5 changes: 5 additions & 0 deletions .vscode/settings.json
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"metalness"
]
}
8 changes: 8 additions & 0 deletions Makefile
@@ -0,0 +1,8 @@
install:
@npm install

help:
@node -e "console.log(Object.keys(require('.' + require('path').sep + 'package.json').scripts || {}))"

%:
@npm run $@
28 changes: 8 additions & 20 deletions README.md
Expand Up @@ -10,7 +10,7 @@ Note: this package is not capable of procedurally generating terrain. Height map

https://three-landscape.vercel.app/

Source code for example is available in the /examples/highland@latest directory
Source code for example is available in the /examples/highlands directory

### Installation

Expand All @@ -31,11 +31,12 @@ Custom material that extends the meshStandardMaterial with additional properties
- Stochastic sampling
- Triplanar mapping
- Multiple material blending options
- Automatic texture 'atlasing' allows more that 16 textures(max on most hardware by default)

```js
function MySuperCoolTerrain() {
const textures = useTexture([
... list of up to 16* textures
... any number of textures
]);

return (
Expand All @@ -61,8 +62,11 @@ function MySuperCoolTerrain() {
### New props:

- splats: Texture[] (expects 4 channel splat data in rgba)
- noise: Texture; used for stochastic sampling
- Surfaces: Surface[];
- surfaceSamples: Number, defaults to 4.
- surfaces: Surface[];
- smoothness: Number > 0
- distanceOptimizedRendering: Boolean, defaults to true


Most of the new features are configured by modifying surface properties.

Expand All @@ -82,22 +86,6 @@ const grass = {
};
```

### Blend Modes:
by default all surfaces will be alpha blended based on the weights defined in the provided splatmap(s). This generally looks fine from a distance but you may want to try a different blend mode if the camera is likely to be near the ground. blend mode are a surface specific setting.

##### Noise blending:
uses random noise and splat weights to create a detailed edge. To fully control the shape, you can optionally provide one or more octaves of noise.
```
grass.blend = {
mode: "noise",
octaves: {
blur:0.5,
amplitude: 1.25,
wavelength: 1024.0 * 16.0,
accuracy: 1.25
}
}
```
To get a better understanding of how each noise parameter effects the edge check out this interactive demo: https://www.redblobgames.com/x/1730-terrain-shader-experiments/noisy-hex-rendering.html

Please see the example directory for advanced usage and example textures.
Expand Down
Binary file modified examples/.DS_Store
Binary file not shown.
12 changes: 8 additions & 4 deletions examples/highlands/package.json
Expand Up @@ -3,21 +3,25 @@
"private": true,
"version": "0.0.0",
"type": "module",

"scripts": {
"dev": "vite",
"dev": "vite --host",
"build": "tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"@react-three/drei": "^9.34.4",
"@react-three/fiber": "^8.3.1",
"@tensorflow/tfjs": "^4.2.0",
"@upscalerjs/esrgan-thick": "^1.0.0-beta.11",
"install": "^0.13.0",
"leva": "^0.9.34",
"npm": "^9.6.1",
"r3f-perf": "^6.6.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"three": "^0.143.0",
"three-landscape": "*",
"leva": "^0.9.34",
"r3f-perf": "^6.6.0"
"upscaler": "^1.0.0-beta.16"
},
"devDependencies": {
"@types/react": "^18.0.17",
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/highlands/public/Grass_02/download.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/highlands/public/T_MacroVariation_sm.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.

1 comment on commit dab559a

@vercel
Copy link

@vercel vercel bot commented on dab559a Jul 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

three-landscape – ./

three-landscape-git-main-nwpointer.vercel.app
three-landscape.vercel.app
three-landscape-nwpointer.vercel.app

Please sign in to comment.