Skip to content

Commit

Permalink
improved bloom effect
Browse files Browse the repository at this point in the history
  • Loading branch information
Resaki1 committed Jan 13, 2024
1 parent 7576a55 commit b0a00d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/components/Planet/Planet.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Sphere, shaderMaterial, useTexture } from "@react-three/drei";
import { extend, useFrame } from "@react-three/fiber";
import { useRef } from "react";
import { memo, useRef } from "react";
import {
AdditiveBlending,
DoubleSide,
Expand Down Expand Up @@ -104,7 +104,7 @@ const Planet = () => {

return (
<group position={position} rotation={rotation} ref={planet}>
<Sphere args={[81, 48, 48]} ref={atmosphere}>
<Sphere args={[81, 64, 64]} ref={atmosphere}>
<atmosphereShaderMaterial
attach="material"
args={[
Expand All @@ -124,7 +124,7 @@ const Planet = () => {
specular={"lightblue"}
/>
</Sphere>
<Sphere args={[80.2, 48, 48]}>
<Sphere args={[80.2, 64, 64]}>
<meshPhongMaterial {...clouds} transparent alphaTest={0} />
</Sphere>
</group>
Expand All @@ -133,4 +133,4 @@ const Planet = () => {

useTexture.preload("/textures/earth_day.webp");

export default Planet;
export default memo(Planet);
11 changes: 8 additions & 3 deletions src/components/Scene/Scene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Bloom,
ToneMapping,
} from "@react-three/postprocessing";
import { ToneMappingMode } from "postprocessing";
import { KernelSize, ToneMappingMode } from "postprocessing";
import SpaceShip from "@/components/Spaceship";
import StarsComponent from "../Stars/StarsComponent";
import Star from "../Star/Star";
Expand Down Expand Up @@ -47,9 +47,14 @@ const Scene = () => {
dpr={[1, 2]}
>
{isSafari ? <Stats /> : <StatsGl />}
{gpu.tier > 1 && (
{(gpu.tier > 1 || false) && (
<EffectComposer disableNormalPass>
<Bloom mipmapBlur intensity={0.02} />
<Bloom
mipmapBlur
intensity={0.02}
luminanceThreshold={0}
kernelSize={KernelSize.VERY_SMALL}
/>
<ToneMapping mode={ToneMappingMode.ACES_FILMIC} />
</EffectComposer>
)}
Expand Down

0 comments on commit b0a00d4

Please sign in to comment.