diff --git a/app/helpers/helpers3D.module.js b/app/helpers/helpers3D.module.js index 07211e7..ffa9ff9 100644 --- a/app/helpers/helpers3D.module.js +++ b/app/helpers/helpers3D.module.js @@ -2,6 +2,8 @@ import * as THREE from '/app/thirdparty/Three/three.module.js' import { EffectComposer } from '/app/thirdparty/Three/postprocessing/EffectComposer.module.js' import { RenderPass } from '/app/thirdparty/Three/postprocessing/RenderPass.module.js' import { OutlinePass } from '/app/thirdparty/Three/postprocessing/OutlinePass.module.js' +import { ShaderPass } from '/app/thirdparty/Three/postprocessing/ShaderPass.module.js' +import { GammaCorrectionShader } from '/app/thirdparty/Three/shaders/GammaCorrectionShader.module.js' if(!app.helpers) app.helpers = {} /** @@ -130,8 +132,9 @@ app.helpers.helpers3D = { this.composer.addPass(this.outlinePass) this.highlighted3DObjects = [] - this.outlinePass.selectedObjects = this.highlighted3DObjects - + this.outlinePass.selectedObjects = this.highlighted3DObjects + + this.composer.addPass(new ShaderPass(GammaCorrectionShader)) } }, diff --git a/app/thirdparty/Three/shaders/GammaCorrectionShader.module.js b/app/thirdparty/Three/shaders/GammaCorrectionShader.module.js new file mode 100644 index 0000000..7199604 --- /dev/null +++ b/app/thirdparty/Three/shaders/GammaCorrectionShader.module.js @@ -0,0 +1,43 @@ +/** + * Gamma Correction Shader + * http://en.wikipedia.org/wiki/gamma_correction + */ + +const GammaCorrectionShader = { + + name: 'GammaCorrectionShader', + + uniforms: { + + 'tDiffuse': { value: null } + + }, + + vertexShader: /* glsl */` + + varying vec2 vUv; + + void main() { + + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + + }`, + + fragmentShader: /* glsl */` + + uniform sampler2D tDiffuse; + + varying vec2 vUv; + + void main() { + + vec4 tex = texture2D( tDiffuse, vUv ); + + gl_FragColor = sRGBTransferOETF( tex ); + + }` + +}; + +export { GammaCorrectionShader }; diff --git a/app/thirdparty/Threetobus/threetobus.module.js b/app/thirdparty/Threetobus/threetobus.module.js index 1366e86..782835d 100644 --- a/app/thirdparty/Threetobus/threetobus.module.js +++ b/app/thirdparty/Threetobus/threetobus.module.js @@ -206,11 +206,10 @@ export class Threetobus{ this.cameras.cam2Dtop.layers.enable(1) // Lights - const light = new THREE.DirectionalLight(0xffffff, 1) + const light = new THREE.DirectionalLight(0xffffff, 2) light.position.set(5, 5, 5) - light.intensity = 2 this.scene.add(light) - this.scene.add(new THREE.AmbientLight(0xffffff, 0.4)) + this.scene.add(new THREE.AmbientLight(0xffffff, 1)) } diff --git a/app/views/editors/modules/kfArena.module.js b/app/views/editors/modules/kfArena.module.js index a28a67d..b3ed925 100644 --- a/app/views/editors/modules/kfArena.module.js +++ b/app/views/editors/modules/kfArena.module.js @@ -32,9 +32,8 @@ export class kfArena{ // Lights const light = new THREE.DirectionalLight(0xffffff, 1) light.position.set(5, 5, 5) - light.intensity = 2 this.scene.add(light) - this.scene.add(new THREE.AmbientLight(0xffffff, 0.4)) + this.scene.add(new THREE.AmbientLight(0xffffff, .4)) this.grid = new THREE.GridHelper(this.sceneSize.x, this.sceneSize.x, 0x8888AA, 0x8888AA) this.grid.layers.set(1) @@ -43,7 +42,7 @@ export class kfArena{ // Base plane const planeGeo = new THREE.PlaneGeometry(100, 100) const planeMat = new THREE.MeshBasicMaterial({ - color: 0xaaaacc, + color: 0x8888aa, opacity: 0.3, transparent: true, // needed for opacity < 1 to take effect side: THREE.DoubleSide @@ -124,7 +123,7 @@ export class kfArena{ } - addAgent(typeId, aid, properties, values){ console.log('==addAgent==>',typeId, aid, properties, values) + addAgent(typeId, aid, properties, values){ const agentSprite = this.agentSprites.find(item => item.atp_id==typeId) if(!agentSprite) { console.warn(`No sprite for type: ${typeId}`)