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

refracton aframe #545

Closed
lovisio opened this issue Jun 24, 2019 · 2 comments
Closed

refracton aframe #545

lovisio opened this issue Jun 24, 2019 · 2 comments

Comments

@lovisio
Copy link

lovisio commented Jun 24, 2019

Hello all,
I am trying to use refraction with aframe and ar.js . But I dont find any example or code working.

Video from Jerome Etienne : https://twitter.com/jerome_etienne/status/838749280999518208
Shader aframe for refraction ( doesnt work, only black render ) : https://gist.github.com/AndresCuervo/b4cfdbc46fe056832d822871522ae3bb

Does anyone know if refraction work in ar.js and have a working example ?

Thank you.

@commentatorboy
Copy link
Contributor

No, but the black render problem might be solved by doing changing the renderer:
#494

@gftruj
Copy link

gftruj commented Jul 1, 2019

Hi, I think I got the shader to work, actually the component was trying to access

this.el.sceneEl.systems.arjs.arToolkitSource.domElement

to create it's video texture, but (...).arjs.arToolkitSource(...) is no longer a valid reference. At least at first glance. I've switched it to

this.el.sceneEl.systems.arjs['_arSession'].arSource.domElement

and check this out:
Imgur Image

Not only it's working, but it's cool as hell 😄
Here's the glitch. (aframe 0.9.2, ar.aframe 1.6.0)

Although there is a nasty trick - the _arSession is null at initialization. I've thrown the init into a timer, which is bad. I could throw there an interval checking when _arSession is initialized, but if anyone knows a callback or signal which I can catch it would be way better.

Although now i see in the source code tricks like i've mentioned

var timerId = setInterval(function(){
var anchorComponent = anchorEl.components['arjs-anchor']
// wait until anchorComponent is isReady
if( anchorComponent === undefined || anchorComponent.isReady === false )	return

clearInterval(timerId)

Honestly I just wanted to make it work (super curious, but little time atm), maybe i could take a while and turn it into a question/anwser on SO with more detail.

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

No branches or pull requests

4 participants