@woosh/meep-engine 2.33.56 → 2.33.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,7 +33,7 @@ export class AmbientOcclusionPostProcessEffect extends EnginePlugin {
33
33
  // AO parameters
34
34
  const uniforms = this.__material.uniforms;
35
35
  uniforms.bias.value = 0.5;
36
- uniforms.intensity.value = 1;
36
+ uniforms.intensity.value = 2;
37
37
 
38
38
  uniforms.kernelRadius.value = 30;
39
39
  uniforms.minResolution.value = 0;
@@ -16,7 +16,6 @@ const SAOShader = {
16
16
  uniforms: {
17
17
 
18
18
  'tDepth': { value: null },
19
- 'tDiffuse': { value: null },
20
19
  'tNormal': { value: null },
21
20
  'size': { value: new Vector2(512, 512) },
22
21
 
@@ -47,10 +46,6 @@ const SAOShader = {
47
46
 
48
47
  varying vec2 vUv;
49
48
 
50
- #if DIFFUSE_TEXTURE == 1
51
- uniform sampler2D tDiffuse;
52
- #endif
53
-
54
49
  uniform sampler2D tDepth;
55
50
 
56
51
  #if NORMAL_TEXTURE == 1
@@ -75,14 +70,6 @@ const SAOShader = {
75
70
 
76
71
  out float out_occlusion;
77
72
 
78
- vec4 getDefaultColor( const in vec2 screenPosition ) {
79
- #if DIFFUSE_TEXTURE == 1
80
- return texture2D( tDiffuse, vUv );
81
- #else
82
- return vec4( 1.0 );
83
- #endif
84
- }
85
-
86
73
  float getDepth( const in vec2 screenPosition ) {
87
74
  #if DEPTH_PACKING == 1
88
75
  return unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );
@@ -114,7 +101,14 @@ const SAOShader = {
114
101
  return normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );
115
102
  #endif
116
103
  }
117
-
104
+
105
+ // Non-sin based hash function, fast and has good randomness
106
+ float hash12(vec2 p){
107
+ vec3 p3 = fract(vec3(p.xyx) * .1031);
108
+ p3 += dot(p3, p3.yzx + 33.33);
109
+ return fract((p3.x + p3.y) * p3.z);
110
+ }
111
+
118
112
  float minResolutionMultipliedByCameraFar;
119
113
 
120
114
  float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {
@@ -139,7 +133,7 @@ const SAOShader = {
139
133
  vec3 centerViewNormal = getViewNormal( centerViewPosition, vUv );
140
134
 
141
135
  // jsfiddle that shows sample pattern: https://jsfiddle.net/a16ff1p7/
142
- float angle = rand( vUv + randomSeed ) * PI2;
136
+ float angle = hash12( vUv + randomSeed ) * PI2;
143
137
  vec2 radius = vec2( kernelRadius * INV_NUM_SAMPLES ) / size;
144
138
 
145
139
  float occlusionSum = 0.0;
@@ -83,6 +83,7 @@ import { ShadedGeometrySystem } from "../../../ecs/mesh-v2/ShadedGeometrySystem.
83
83
  import { FogOfWar } from "../../../../ecs/fow/FogOfWar.js";
84
84
  import { FogOfWarRevealer } from "../../../../ecs/fow/FogOfWarRevealer.js";
85
85
  import Team from "../../../../../../model/game/ecs/component/Team.js";
86
+ import { AmbientOcclusionPostProcessEffect } from "../../buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js";
86
87
 
87
88
  const geo_light_center_octahedron = new BoxBufferGeometry(0.1, 0.1, 0.1);
88
89
  const engineHarness = new EngineHarness();
@@ -163,6 +164,7 @@ function makeConfig(engine) {
163
164
 
164
165
  // Plugins
165
166
  config.addPlugin(ForwardPlusRenderingPlugin);
167
+ config.addPlugin(AmbientOcclusionPostProcessEffect);
166
168
  // config.addPlugin(MicronRenderPlugin);
167
169
 
168
170
  // Knowledge
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "productName": "Meep",
6
6
  "description": "production-ready JavaScript game engine based on Entity Component System Architecture",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.33.56",
8
+ "version": "2.33.57",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",