feat: terrain
This commit is contained in:
parent
f86b4ada13
commit
81474b6bca
13 changed files with 251 additions and 279 deletions
|
|
@ -35,16 +35,6 @@ export type RenderConfig = {
|
|||
* jittered as the camera moved. 0 = off (smooth), 1 = one-pixel snap,
|
||||
* higher = coarser and more pronounced wobble. */
|
||||
vertexSnap: number
|
||||
/**
|
||||
* Texture-mapping correction, 0..1. At 0, texture coords interpolate linearly
|
||||
* in screen space (affine): geometrically wrong on any receding surface, so
|
||||
* the texture bends and swims along triangle diagonals -- the classic PS1
|
||||
* artifact. Faces viewed head-on still look perfect because their depth is
|
||||
* constant. At 1, coords are perspective-correct and everything is straight.
|
||||
* Values in between soften the swim; subdividing geometry reduces it too,
|
||||
* because each smaller triangle spans less depth.
|
||||
*/
|
||||
perspectiveCorrect: number
|
||||
/** Texture sampling. `nearest` point-samples for crunchy PS1 texels;
|
||||
* `linear` does bilinear smoothing (cleaner, but not period-accurate).
|
||||
* Neither uses mipmaps, so distant textures shimmer regardless. */
|
||||
|
|
@ -58,9 +48,8 @@ export type RenderConfig = {
|
|||
fog: Fog | null
|
||||
}
|
||||
|
||||
/** Ready-made looks. The demo binds keys 1/2/3 to these, and they intentionally
|
||||
* sweep `perspectiveCorrect` 0 -> 0.5 -> 1 so you can watch the texture swim
|
||||
* straighten out as you press through them. */
|
||||
/** Ready-made looks. The demo binds keys 1/2/3 to these, sweeping resolution,
|
||||
* color depth, dither, vertex snap, and filtering from crunchy PS1 to clean. */
|
||||
export namespace RenderConfig {
|
||||
export const standard: RenderConfig = {
|
||||
internalWidth: 384,
|
||||
|
|
@ -69,10 +58,9 @@ export namespace RenderConfig {
|
|||
colorDepth: 5,
|
||||
dither: 1,
|
||||
vertexSnap: 1,
|
||||
perspectiveCorrect: 0.25,
|
||||
textureFilter: "nearest",
|
||||
lighting: "flat",
|
||||
fog: { color: Color.rgb(150, 170, 200), near: 6, far: 22 },
|
||||
fog: { color: Color.rgb(150, 170, 200), near: 12, far: 200 },
|
||||
}
|
||||
|
||||
export const ps1: RenderConfig = {
|
||||
|
|
@ -82,10 +70,9 @@ export namespace RenderConfig {
|
|||
colorDepth: 5,
|
||||
dither: 1,
|
||||
vertexSnap: 1,
|
||||
perspectiveCorrect: 0.25,
|
||||
textureFilter: "nearest",
|
||||
lighting: "flat",
|
||||
fog: { color: Color.rgb(150, 170, 200), near: 6, far: 22 },
|
||||
fog: { color: Color.rgb(150, 170, 200), near: 12, far: 200 },
|
||||
}
|
||||
|
||||
export const soft: RenderConfig = {
|
||||
|
|
@ -95,10 +82,9 @@ export namespace RenderConfig {
|
|||
colorDepth: 6,
|
||||
dither: 0.5,
|
||||
vertexSnap: 0.5,
|
||||
perspectiveCorrect: 0.5,
|
||||
textureFilter: "nearest",
|
||||
lighting: "flat",
|
||||
fog: { color: Color.rgb(170, 190, 215), near: 10, far: 40 },
|
||||
fog: { color: Color.rgb(170, 190, 215), near: 16, far: 240 },
|
||||
}
|
||||
|
||||
export const clean: RenderConfig = {
|
||||
|
|
@ -108,7 +94,6 @@ export namespace RenderConfig {
|
|||
colorDepth: 8,
|
||||
dither: 0,
|
||||
vertexSnap: 0,
|
||||
perspectiveCorrect: 1,
|
||||
textureFilter: "linear",
|
||||
lighting: "flat",
|
||||
fog: null,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue