Skip to content

Commit fe9e2aa

Browse files
committed
Keep rivers blue and roads crisp under the painterly terrain blend
The neighbor-blend pass that smooths biome banding was also averaging away the road tint and smearing river cells into green. Overlays are now stamped after the blur: river cells get solid water blue (icy tint in winter), road cells a strong packed-earth lerp, and the blend itself is gentler. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJUuoQXWUkMk2YSxRM2MSp
1 parent e6484cc commit fe9e2aa

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

index.html

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ <h3 id="insptitle">—</h3>
991991
const t=clamp((h-470)/130,0,1);
992992
c.lerp(new THREE.Color(0xe9edf2),t*t);
993993
}
994-
if(W.roadCells[i]&&bio!==B.WATER)c.lerp(new THREE.Color(0x8a7448),0.8); // roads read at map altitude
994+
// note: road/river overlays are stamped after the blend pass so they stay crisp
995995
if(W.drought&&(bio===B.MEADOW||bio===B.FARM))c.lerp(new THREE.Color(0xb3a35c),0.55);
996996
// winter snow accumulation on flat/high ground
997997
if(snowT>0&&bio!==B.WATER){
@@ -1050,17 +1050,28 @@ <h3 id="insptitle">—</h3>
10501050
const c=colorForVertex(i,sp,snowT,SEED);
10511051
buf[i*3]=c.r;buf[i*3+1]=c.g;buf[i*3+2]=c.b;
10521052
}
1053-
// neighbor blend calms biome banding into painterly gradients
1053+
// gentle neighbor blend calms biome banding into painterly gradients
10541054
for(let cz=0;cz<GRID;cz++)for(let cx=0;cx<GRID;cx++){
10551055
const i=cIdx(cx,cz);
1056-
let r=buf[i*3]*0.44,g=buf[i*3+1]*0.44,b=buf[i*3+2]*0.44,ws=0.44;
1056+
let r=buf[i*3]*0.6,g=buf[i*3+1]*0.6,b=buf[i*3+2]*0.6,ws=0.6;
10571057
for(const[dx,dz]of[[1,0],[-1,0],[0,1],[0,-1]]){
10581058
if(!inB(cx+dx,cz+dz))continue;
10591059
const j=cIdx(cx+dx,cz+dz);
1060-
r+=buf[j*3]*0.14;g+=buf[j*3+1]*0.14;b+=buf[j*3+2]*0.14;ws+=0.14;
1060+
r+=buf[j*3]*0.1;g+=buf[j*3+1]*0.1;b+=buf[j*3+2]*0.1;ws+=0.1;
10611061
}
10621062
col.setXYZ(i,r/ws,g/ws,b/ws);
10631063
}
1064+
// crisp overlays AFTER the blur: rivers stay blue, roads stay packed earth
1065+
const riverC=new THREE.Color(0x3a6d8e).lerp(new THREE.Color(0xcfdae2),snowT>0.5?0.5:0);
1066+
const roadC=new THREE.Color(0x8a7448);
1067+
for(let i=0;i<N;i++){
1068+
if(W.water[i]===2){
1069+
col.setXYZ(i,riverC.r,riverC.g,riverC.b);
1070+
}else if(W.roadCells[i]){
1071+
C1.setRGB(col.getX(i),col.getY(i),col.getZ(i)).lerp(roadC,0.85);
1072+
col.setXYZ(i,C1.r,C1.g,C1.b);
1073+
}
1074+
}
10641075
col.needsUpdate=true;
10651076
// trees seasonal tint
10661077
if(G.decid){

0 commit comments

Comments
 (0)