Spaces:
Running
Running
Update ar.html
Browse files
ar.html
CHANGED
|
@@ -257,7 +257,77 @@
|
|
| 257 |
</a-entity>
|
| 258 |
-->
|
| 259 |
|
| 260 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 261 |
<a-entity id="example-target" mindar-image-target="targetIndex: 0">
|
| 262 |
<a-entity id="ar-content-group">
|
| 263 |
<a-entity id="myVid"
|
|
@@ -271,7 +341,7 @@
|
|
| 271 |
</a-text>
|
| 272 |
</a-entity>
|
| 273 |
</a-entity>
|
| 274 |
-
</a-scene
|
| 275 |
|
| 276 |
<!-- LOGIC -->
|
| 277 |
<script>
|
|
|
|
| 257 |
</a-entity>
|
| 258 |
-->
|
| 259 |
|
| 260 |
+
<script>
|
| 261 |
+
AFRAME.registerShader('soft-video', {
|
| 262 |
+
schema: {
|
| 263 |
+
src: {type: 'map'},
|
| 264 |
+
softness: {type: 'number', default: 0.15} // 0.15 controlla la quantità di sfocatura
|
| 265 |
+
},
|
| 266 |
+
init: function (data) {
|
| 267 |
+
this.material = new THREE.ShaderMaterial({
|
| 268 |
+
uniforms: {
|
| 269 |
+
map: { value: undefined },
|
| 270 |
+
softness: { value: data.softness }
|
| 271 |
+
},
|
| 272 |
+
vertexShader: `
|
| 273 |
+
varying vec2 vUV;
|
| 274 |
+
void main() {
|
| 275 |
+
vUV = uv;
|
| 276 |
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
| 277 |
+
}
|
| 278 |
+
`,
|
| 279 |
+
fragmentShader: `
|
| 280 |
+
uniform sampler2D map;
|
| 281 |
+
uniform float softness;
|
| 282 |
+
varying vec2 vUV;
|
| 283 |
+
void main() {
|
| 284 |
+
vec4 tex = texture2D(map, vUV);
|
| 285 |
+
// Calcola la trasparenza basata sulla distanza dai bordi
|
| 286 |
+
float alphaX = smoothstep(0.0, softness, vUV.x) * (1.0 - smoothstep(1.0 - softness, 1.0, vUV.x));
|
| 287 |
+
float alphaY = smoothstep(0.0, softness, vUV.y) * (1.0 - smoothstep(1.0 - softness, 1.0, vUV.y));
|
| 288 |
+
gl_FragColor = vec4(tex.rgb, tex.a * alphaX * alphaY);
|
| 289 |
+
}
|
| 290 |
+
`,
|
| 291 |
+
transparent: true
|
| 292 |
+
});
|
| 293 |
+
},
|
| 294 |
+
update: function (data) {
|
| 295 |
+
this.material.uniforms.map.value = data.src;
|
| 296 |
+
this.material.uniforms.softness.value = data.softness;
|
| 297 |
+
}
|
| 298 |
+
});
|
| 299 |
+
</script>
|
| 300 |
+
|
| 301 |
+
<a-scene mindar-image="imageTargetSrc: ./targets.mind;" color-space="sRGB" renderer="colorManagement: true, physicallyCorrectLights" vr-mode-ui="enabled: false" device-orientation-permission-ui="enabled: false">
|
| 302 |
+
<a-assets>
|
| 303 |
+
<video id="vid" src="./tuo_video.mp4" loop="true" crossorigin="anonymous"></video>
|
| 304 |
+
</a-assets>
|
| 305 |
+
|
| 306 |
+
<a-entity id="example-target" mindar-image-target="targetIndex: 0">
|
| 307 |
+
|
| 308 |
+
<a-entity id="ar-content-group"
|
| 309 |
+
animation="property: position; to: 0 0.1 0; dir: alternate; dur: 2000; loop: true; easing: easeInOutSine">
|
| 310 |
+
|
| 311 |
+
<a-entity id="myVid"
|
| 312 |
+
geometry="primitive: plane; width: 1.25; height: 1"
|
| 313 |
+
material="shader: soft-video; src: #vid; softness: 0.2; transparent: true"
|
| 314 |
+
position="0 0 0">
|
| 315 |
+
</a-entity>
|
| 316 |
+
|
| 317 |
+
<a-text value="INNOVATION_LAB_DEV"
|
| 318 |
+
color="#00ff41"
|
| 319 |
+
align="center"
|
| 320 |
+
width="1.5"
|
| 321 |
+
position="0 -0.65 0.01"
|
| 322 |
+
font="https://cdn.aframe.io/fonts/Roboto-msdf.json"
|
| 323 |
+
animation="property: opacity; from: 0.3; to: 1; dir: alternate; dur: 800; loop: true">
|
| 324 |
+
</a-text>
|
| 325 |
+
|
| 326 |
+
</a-entity>
|
| 327 |
+
</a-entity>
|
| 328 |
+
</a-scene>
|
| 329 |
+
|
| 330 |
+
<!-- TARGET MINDAR (AR REALE) 5:4
|
| 331 |
<a-entity id="example-target" mindar-image-target="targetIndex: 0">
|
| 332 |
<a-entity id="ar-content-group">
|
| 333 |
<a-entity id="myVid"
|
|
|
|
| 341 |
</a-text>
|
| 342 |
</a-entity>
|
| 343 |
</a-entity>
|
| 344 |
+
</a-scene>-->
|
| 345 |
|
| 346 |
<!-- LOGIC -->
|
| 347 |
<script>
|