Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Tunnel Vision #450

Merged
merged 38 commits into from
Sep 7, 2018
Merged

Enhancement: Tunnel Vision #450

merged 38 commits into from
Sep 7, 2018

Conversation

tony056
Copy link
Contributor

@tony056 tony056 commented Jul 6, 2018

  • Target Issue: #378
  • Changes:
    • Included essential shaders/postprocessing files found in the example of THREE.js to utils/postprocessing & utils/shaders.
    • Created systems/tunnel-effect.js, an Aframe system that applies vignette postprocessing while the character is moving.

@tony056 tony056 requested a review from gfodor July 6, 2018 21:09
@gfodor
Copy link
Contributor

gfodor commented Jul 7, 2018

Adding @johnshaughnessy

Copy link
Contributor

@johnshaughnessy johnshaughnessy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still reading thru rending code as it's all new to me. It looks like we add render passes, which I thought would make the FPS drop significantly, but in my initial (and not very thorough) tests it appears to run fine.

Left a few comments for things that can be improved in the meantime.

One other thought: We should allow the user to enable/disable this effect. A query string parameter might suffice, given that we don't have a settings menu or anything similar. I expect this is a polarizing feature, so we might find that we need to provide a user-friendly way of toggling it.

src/hub.html Outdated
@@ -319,7 +318,8 @@
drawIncrementally: true;
incrementalDrawMs: 600;
hitOpacity: 0.3;
missOpacity: 0.2;"
missOpacity: 0.2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need these changes to teleport-controls attributes in this PR

THREE.EffectComposer = function(renderer, renderTarget) {
this.renderer = renderer;
this.delta = 0;
window.addEventListener("vrdisplaypresentchange", this.resize.bind(this));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to disable this effect when not in VR.

if (this.characterVelocity.distanceTo(STATIC) < CLAMP_VELOCITY) {
// the character stops, so we use the aframe default render func
this.scene.renderer.render = this.originalRenderFunc;
this.isMoving = false;
Copy link
Contributor

@johnshaughnessy johnshaughnessy Jul 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The effect seems to "pop" at the end, when you stop moving. Can we fade away quickly and continuously? It only seems to be a problem when I stop moving. When I start moving, it fades in nicely.

@tony056
Copy link
Contributor Author

tony056 commented Aug 7, 2018

  • enabled it after entering in VR
  • removed the teleport parameters.
  • left the switch between postprocessing and regular aframe renderer as the same.

Actually, both starting and stopping are 'pop'. The starting part looks good cuz you don't expect when it will show up and the radius becomes smaller and smaller after it starts.

Currently, I don't come up with any good approach to fade out after the avatar stops since the vignette shader renders two circles together and no matter how big the radius is, you still can see the gap between two circles.

@tony056
Copy link
Contributor Author

tony056 commented Aug 8, 2018

  • Done:

    • updated fade out method
    • no new fun in bindRenderFunc
    • turned off tunnel vision after exitVR
  • Didn't do:

    • create a new global var in character-controller and track it in the tunnel vision.
    • new approach to import the EffectComposer/Pass files.

Math.abs(r - TARGET_RADIUS) > CLAMP_RADIUS &&
Math.abs(softness - TARGET_SOFTNESS) > CLAMP_SOFTNESS
) {
if (this.deltaR !== 0 && this.deltaS !== 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line will only be true once, when this.deltaR and this.deltaS are undefined. Is that desired?

},

_enterVR: function() {
this.isVR = true;
Copy link
Contributor

@johnshaughnessy johnshaughnessy Aug 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately if you press the "f" key without a headset plugged in, the "entervr" event still fires. You go into full screen, but you're not actually in VR. If you press F11 you can go into fullscreen mode without going into VR, but we may want to fix this anyway because we don't mean to use the vignette pass when we're not in vr.

Copy link
Contributor

@johnshaughnessy johnshaughnessy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address minor issues above then looks ready to push.
Any idea why the tunnel effect renders the scene very blurry without a headset plugged in? (In the current version of this system, will trick it into thinking it's in VR when it's not).

import "../utils/shaders/VignetteShader";
import qsTruthy from "../utils/qs_truthy";

const isDisabled = qsTruthy("disableTunnel");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On by default, then disabled with a query parameter will get you the most feedback. Add a note in README.md under the ##Query Params header.

@@ -74,7 +74,7 @@ AFRAME.registerSystem("tunneleffect", {
Math.abs(r - TARGET_RADIUS) > CLAMP_RADIUS &&
Math.abs(softness - TARGET_SOFTNESS) > CLAMP_SOFTNESS
) {
if (this.deltaR !== 0 && this.deltaS !== 0) {
if (!this.deltaR && !this.deltaS) {
this.deltaR = TARGET_RADIUS - r;
this.deltaS = softness - TARGET_SOFTNESS;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still confused about why these are set once with some particular value for r and softness. Are deltaR and deltaS supposed to be constants? Do they need to be on this? Given their names, I expected them to change whenever r or softness changed, but perhaps they're better understood to be fixed increments by which we will change r or softness every frame. In that case, should these constants be defined above with CLAMP_SPEED, etc?

Copy link
Contributor Author

@tony056 tony056 Aug 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the deltaR is defined by the value of TARGET_RADIUS and minRadius. Since we define the minRadius value in schema, I don't think it should be defined as a constant like CLAMP_SPEED, but I init those delta values in init in the latest commit.

@buildsize
Copy link

buildsize bot commented Sep 7, 2018

File name Previous Size New Size Change
avatar-selector.html 608 bytes 608 bytes 0 bytes (0%)
favicon.ico 33.69 KB 33.69 KB 0 bytes (0%)
hub-preview.png 22.78 KB 22.78 KB 0 bytes (0%)
hub.html 24.86 KB 24.86 KB 0 bytes (0%)
index.html 784 bytes 784 bytes 0 bytes (0%)
link.html 804 bytes 804 bytes 0 bytes (0%)
LoadingObject_Atom-[hash].glb 27.43 KB 27.43 KB 0 bytes (0%)
waternormals-[hash].jpg 242.98 KB 242.98 KB 0 bytes (0%)
bubble_off-[hash].png 8.58 KB 8.58 KB 0 bytes (0%)
bubble_off-hover-[hash].png 10.41 KB 10.41 KB 0 bytes (0%)
bubble_on-[hash].png 9.24 KB 9.24 KB 0 bytes (0%)
bubble_on-hover-[hash].png 8.88 KB 8.88 KB 0 bytes (0%)
create_object-[hash].png 15.05 KB 15.05 KB 0 bytes (0%)
create_object-hover-[hash].png 15.87 KB 15.87 KB 0 bytes (0%)
freeze_off-[hash].png 12.24 KB 12.24 KB 0 bytes (0%)
freeze_off-hover-[hash].png 12.82 KB 12.82 KB 0 bytes (0%)
freeze_on-[hash].png 12.83 KB 12.83 KB 0 bytes (0%)
freeze_on-hover-[hash].png 13.31 KB 13.31 KB 0 bytes (0%)
mute_off-[hash].png 4.81 KB 4.81 KB 0 bytes (0%)
mute_off-hover-[hash].png 6.08 KB 6.08 KB 0 bytes (0%)
mute_on-[hash].png 9.57 KB 9.57 KB 0 bytes (0%)
mute_on-hover-[hash].png 8.61 KB 8.61 KB 0 bytes (0%)
spawn_photo-[hash].png 5.78 KB 5.78 KB 0 bytes (0%)
tooltip.9-[hash].png 815 bytes 815 bytes 0 bytes (0%)
watch-[hash].glb 880.11 KB 880.11 KB 0 bytes (0%)
account-[hash].svg 826 bytes 826 bytes 0 bytes (0%)
daydream_entry-[hash].svg 7.13 KB 7.13 KB 0 bytes (0%)
default_thumbnail-[hash].png 3.23 KB 3.23 KB 0 bytes (0%)
desktop_screen_entry-[hash].svg 604 bytes 604 bytes 0 bytes (0%)
device_entry-[hash].svg 3.66 KB 3.66 KB 0 bytes (0%)
dropdown_arrow-[hash].png 206 bytes 206 bytes 0 bytes (0%)
dropdown_arrow@2x-[hash].png 302 bytes 302 bytes 0 bytes (0%)
gearvr_entry-[hash].svg 574 bytes 574 bytes 0 bytes (0%)
generic_vr_entry-[hash].svg 1.15 KB 1.15 KB 0 bytes (0%)
giphy_logo-[hash].png 1.38 KB 1.38 KB 0 bytes (0%)
help-hud-[hash].png 11.76 KB 11.76 KB 0 bytes (0%)
help-hud@2x-[hash].png 18.87 KB 18.87 KB 0 bytes (0%)
level_background-[hash].png 4.97 KB 4.97 KB 0 bytes (0%)
level_background@2x-[hash].png 6.46 KB 6.46 KB 0 bytes (0%)
level_fill-[hash].png 1.71 KB 1.71 KB 0 bytes (0%)
level_fill@2x-[hash].png 3.38 KB 3.38 KB 0 bytes (0%)
logo-[hash].svg 14.21 KB 14.21 KB 0 bytes (0%)
mic_denied-[hash].png 4.11 KB 4.11 KB 0 bytes (0%)
mic_denied@2x-[hash].png 8.08 KB 8.08 KB 0 bytes (0%)
mic_granted-[hash].png 3.71 KB 3.71 KB 0 bytes (0%)
mic_granted@2x-[hash].png 7.43 KB 7.43 KB 0 bytes (0%)
mic_level-[hash].png 990 bytes 990 bytes 0 bytes (0%)
mic_level@2x-[hash].png 2.32 KB 2.32 KB 0 bytes (0%)
mic_small-[hash].png 298 bytes 298 bytes 0 bytes (0%)
mic_small@2x-[hash].png 298 bytes 298 bytes 0 bytes (0%)
mobile_screen_entry-[hash].svg 1.28 KB 1.28 KB 0 bytes (0%)
speaker_level-[hash].png 953 bytes 953 bytes 0 bytes (0%)
speaker_level@2x-[hash].png 2.13 KB 2.13 KB 0 bytes (0%)
warning_icon-[hash].png 582 bytes 582 bytes 0 bytes (0%)
warning_icon@2x-[hash].png 1.05 KB 1.05 KB 0 bytes (0%)
aframe-inspector.min-[hash].js 384.44 KB 384.44 KB 0 bytes (0%)
avatar-selector-[hash].js 32.48 KB 32.48 KB 1 bytes (0%)
avatar-selector-[hash].js.map 73.78 KB 73.78 KB 0 bytes (0%)
engine-[hash].js 1.42 MB 1.42 MB 7 bytes (0%)
engine-[hash].js.map 4.47 MB 4.47 MB 0 bytes (0%)
gifparsing.worker-[hash].js 1.91 KB 1.91 KB 0 bytes (0%)
gifparsing.worker-[hash].js.map 8.32 KB 8.32 KB 0 bytes (0%)
hub-[hash].js 281.47 KB 292.41 KB 10.94 KB (4%)
hub-[hash].js.map 684.94 KB 714.89 KB 29.95 KB (4%)
index-[hash].js 50.47 KB 50.47 KB 1 bytes (0%)
index-[hash].js.map 92.81 KB 92.81 KB 0 bytes (0%)
link-[hash].js 23.17 KB 23.17 KB 0 bytes (0%)
link-[hash].js.map 45.91 KB 45.91 KB 0 bytes (0%)
sketchfab-zip.worker-[hash].js 155.49 KB 155.49 KB 0 bytes (0%)
sketchfab-zip.worker-[hash].js.map 774.45 KB 774.45 KB 0 bytes (0%)
vendor-[hash].js 528.27 KB 528.27 KB 0 bytes (0%)
vendor-[hash].js.map 1.78 MB 1.78 MB 0 bytes (0%)
quack-[hash].mp3 7.03 KB 7.03 KB 0 bytes (0%)
specialquack-[hash].mp3 11.57 KB 11.57 KB 0 bytes (0%)
tone-[hash].mp3 53.92 KB 53.92 KB 0 bytes (0%)
tone-[hash].wav 385.29 KB 385.29 KB 0 bytes (0%)
tone-[hash].webm 32.04 KB 32.04 KB 0 bytes (0%)
tone-[hash].ogg 32.55 KB 32.55 KB 0 bytes (0%)
avatar-selector-[hash].css 1.12 KB 1.12 KB 0 bytes (0%)
avatar-selector-[hash].css.map 136 bytes 136 bytes 0 bytes (0%)
hub-[hash].css 42.85 KB 42.85 KB 0 bytes (0%)
hub-[hash].css.map 124 bytes 124 bytes 0 bytes (0%)
index-[hash].css 34.53 KB 34.53 KB 0 bytes (0%)
index-[hash].css.map 126 bytes 126 bytes 0 bytes (0%)
link-[hash].css 4.64 KB 4.64 KB 0 bytes (0%)
link-[hash].css.map 125 bytes 125 bytes 0 bytes (0%)
home-[hash].mp4 2 MB 2 MB 0 bytes (0%)
home-[hash].webm 1.81 MB 1.81 MB 0 bytes (0%)
negx-[hash].jpg 54.45 KB 54.45 KB 0 bytes (0%)
negy-[hash].jpg 50.97 KB 50.97 KB 0 bytes (0%)
negz-[hash].jpg 53.29 KB 53.29 KB 0 bytes (0%)
posx-[hash].jpg 58.64 KB 58.64 KB 0 bytes (0%)
posy-[hash].jpg 19.17 KB 19.17 KB 0 bytes (0%)
posz-[hash].jpg 57.49 KB 57.49 KB 0 bytes (0%)
spawn_pen-[hash].png 4.6 KB 4.6 KB 0 bytes (0%)
spawn_pen-hover-[hash].png 5.25 KB 5.25 KB 0 bytes (0%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants