Skip to content

Commit

Permalink
fix: Color space issue for skybox
Browse files Browse the repository at this point in the history
  • Loading branch information
Losses committed Jun 10, 2024
1 parent 78a711f commit 97f9f91
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
3 changes: 0 additions & 3 deletions src/components/Grass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ const GRID_SEGMENTS_Y = Math.ceil(SEGMENTS_BASE_Y * VISUAL_LOAD.value);
export const GRID_WIDTH = 80;
export const GRID_HEIGHT = Math.PI / 8 + 0.1;

GRASS_BASE_COLOR.setHex(THEME_VALUE.value.grassBase, THREE.LinearSRGBColorSpace);
GRASS_TIP_COLOR.setHex(THEME_VALUE.value.grassTip, THREE.LinearSRGBColorSpace);

export const Grass = (tracker: ResourceTracker) => {
const positions = createRectanglePositions(
GRASS_WIDTH,
Expand Down
2 changes: 1 addition & 1 deletion src/manager/GrassManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const GrassManager = (
);

material.uniformsNeedUpdate = true;
});
}, true);

return {};
};
6 changes: 3 additions & 3 deletions src/manager/SkyBoxManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type * as THREE from 'three';
import * as THREE from 'three';

import type { ResourceTracker } from '../utils/ResourceTracker';
import { SkyBox } from '../components/SkyBox';
Expand All @@ -15,8 +15,8 @@ export const SkyBoxManager = (
THEME_VALUE.subscribe((theme) => {
const uniforms = skyBox.material.uniforms;

(uniforms.color2.value as THREE.Color).setHex(theme.sky0);
(uniforms.color1.value as THREE.Color).setHex(theme.sky1);
(uniforms.color2.value as THREE.Color).setHex(theme.sky0, THREE.LinearSRGBColorSpace);
(uniforms.color1.value as THREE.Color).setHex(theme.sky1, THREE.LinearSRGBColorSpace);

skyBox.material.uniformsNeedUpdate = true;
}, true);
Expand Down

0 comments on commit 97f9f91

Please sign in to comment.