Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
scene.add(camera);
// set up controls
if (CONTROL_DEBUG) {
// eslint-disable-next-line
const controls = new OrbitControls(camera);
}
renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
/** POST PROCESSING ( BLOOM EFFECT ) * */
composer = new EffectComposer(renderer);
const renderPass = new RenderPass(scene, camera);
const bloomPass = new EffectPass(camera, new BloomEffect({
distinction: 0.1,
}));
bloomPass.renderToScreen = true;
composer.addPass(renderPass);
composer.addPass(bloomPass);
/** BASIC SCENE SETUP * */
// add a point light to follow the dog
light = new THREE.PointLight(0x6eabfb, 0.7, 8);
light.position.y = 5;
scene.add(light);
bottomLight = new THREE.PointLight(0xff0000, 0.7, 8);
bottomLight.position.y = -5;
scene.add(bottomLight);
scaleEffects.push(new Effect(
'sampling',
readFileSync(resolve(__dirname, '../../glsl/sampling.glsl')).toString(),
{
blendFunction: 13 // normal -- overwrite
}
));
// space
spaceEffects.push(new Effect(
'space',
readFileSync(resolve(__dirname, '../../glsl/space-travel.glsl')).toString()
));
// bloom
spaceEffects.push(new BloomEffect({
kernelSize: 3,
distinction: -0.5
}));
return [
{ pass: new EffectPass(null, ...scaleEffects) },
{ pass: new EffectPass(null, ...spaceEffects) }
];
};
[ 'ambientLight', new THREE.Uniform(0.05)],
[ 'pixelHeight', new THREE.Uniform(8.0)],
[ 'pixelization', new THREE.Uniform(false)],
[ 'rbgSplit', new THREE.Uniform(0.2)],
]),
}
);
new THREE.TextureLoader().load(resolve(__dirname, '../../images/allNoise512.png'), texture => {
texture.minFilter = THREE.LinearFilter;
texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping;
retroEffect.uniforms.get('noiseSource').value = texture;
});
const bloomEffect = new POSTPROCESSING.BloomEffect({
kernelSize: 3,
distinction: 0.2,
// blendFunction: POSTPROCESSING.BlendFunction.AVERAGE,
});
const frameEffect = new GlslEffect('retro_frame', {
uniforms: new Map([
[ 'frameColor', new THREE.Uniform(new THREE.Vector3(245/255, 238/255, 216/255))],
[ 'screenCurvature', new THREE.Uniform(screenCurvature)],
]),
}
);
function coordinateTransform(x, y) {
x -= 0.5;
y -= 0.5;
module.exports = ({ hyperTerm, xTerm }) => {
const effects = [];
effects.push(new GlitchEffect({
delay: new Vector2(1, 7),
duration: new Vector2(0, 1),
columns: 0.05
}));
effects.push(new BloomEffect({
kernelSize: 3,
distinction: 1,
blendFunction: 1 // add
}));
effects.push(new ScanlineEffect({ density: 1.3 }));
effects.push(new SepiaEffect({ intensity: 0.5 }));
effects.push(new VignetteEffect({
darkness: 0.6,
offset: 0
}));
effects.push(new Effect(
'curvedMonitorEffect',
readFileSync(resolve(__dirname, '../../glsl/curved-monitor.glsl')).toString()
));
// new pp.EffectPass(null, new pp.ShockWaveEffect()),
// new pp.EffectPass(null, new pp.ScanlineEffect()),
// new pp.EffectPass(null, new pp.PixelationEffect()),
// new pp.EffectPass(null, new pp.NoiseEffect()),
// new pp.EffectPass(null, new pp.OutlineEffect()),
// new pp.EffectPass(null, new pp.HueSaturationEffect()),
// new pp.EffectPass(null, new pp.GridEffect()),
// new pp.EffectPass(cameraFar, new pp.GodRaysEffect()),
// new pp.EffectPass(null, new pp.GlitchEffect()),
// new pp.EffectPass(null, new pp.GammaCorrectionEffect()),
// new pp.EffectPass(null, new pp.DotScreenEffect()),
// new pp.EffectPass(null, new pp.DepthEffect()),
// new pp.EffectPass(null, new pp.ChromaticAberrationEffect()),
// new pp.EffectPass(null, new pp.ColorAverageEffect()),
// new pp.EffectPass(null, new pp.BrightnessContrastEffect()),
new pp.EffectPass(null, new pp.BloomEffect({ resolutionScale: 0.2, distinction: 0.2 })),
// new pp.EffectPass(null, new pp.BloomEffect()),
] };
};
fog: false,
});
const sun = new THREE.Mesh(sunGeometry, sunMaterial);
const rescaled = rescaleArray([0.1, 0.1, 0.0]);
sun.position.set(rescaled[0], rescaled[1], rescaled[2]);
sun.updateMatrix();
sun.updateMatrixWorld();
const godRaysEffect = new GodRaysEffect(camera, sun, {
color: 0xfff5f2,
blur: false,
});
*/
//godRaysEffect.dithering = true;
const bloomEffect = new BloomEffect(this._scene, camera, {
width: 240,
height: 240,
luminanceThreshold: 0.2,
});
bloomEffect.inverted = true;
bloomEffect.blendMode.opacity.value = 2.3;
const renderPass = new RenderPass(this._scene, camera);
renderPass.renderToScreen = false;
const effectPass = new EffectPass(
camera,
/*smaaEffect, godRaysEffect*/ bloomEffect,
);
effectPass.renderToScreen = true;
const bokehEffect = new post_pss.RealisticBokehEffect({
focus: 90.0,
focalLength: 190,
luminanceThreshold: 0.325,
luminanceGain: 2.0,
bias: -0.35,
fringe: 0.7,
maxBlur: 50,
rings: 5,
samples: 5,
showFocus: false,
manualDoF: false,
pentagon: true
});
const bloomEffect = new post_pss.BloomEffect({
blendFunction: post_pss.BlendFunction.ADD,
resolutionScale: 0.5,
distinction: 4.0
});
bloomEffect.blendMode.opacity.value = 2.1;
var bokeh = new post_pss.EffectPass(options.camera, bokehEffect, bloomEffect);
composer.bokeh = bokeh;
composer.addPass(bokeh);
bokeh.renderToScreen = true;
window.bokeh = bokeh;
}
return composer;
}