Comments (5)
@ArnaudHambenne is right, the current Chrome immersive-ar implementation does not allow JS-side access to camera pixels. For the future, my understanding is that there should be a separate API or feature that provides pose-aligned camera images, where applications would need to request such access at session start so that the user agent can show appropriate consent prompts.
See https://github.com/immersive-web/computer-vision which mentions this as a use case. Previous discussion was also in immersive-web/webxr#694 (comment) and immersive-web/proposals#36 .
(I also had some thoughts on this in a technical paper at https://www.tdcommons.org/dpubs_series/1902/ . That isn't intended to represent any particular future directions or plans, though I'm still partial to the dinosaur sketches.)
from webxr-samples.
There have been some efforts to make this happen. Very early prototype is available in Chrome, behind WebXRIncubations flag - the API is described here with a sample usage demonstrated here, but please note that the API is potentially unstable and in no way final.
from webxr-samples.
Hi @ArnaudHambenne ,
.readPixels() doesn't seem to work as well. What browser did you use and what device?
My code is something like -
function onXRFrame(t, frame) { let session = frame.session; let gl = session.renderState.baseLayer.context; var pixels = new Uint8Array(gl.drawingBufferWidth * gl.drawingBufferHeight * 4); gl.readPixels(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight, gl.RGBA, gl.UNSIGNED_BYTE, pixels); if (pixels.every( (val, i, arr) => val === arr[0] ) ){ console.log("none"); }else{ console.log(pixels); } }
What did you use to read the pixels?
I am not too worried about the performance hit as I would only like to read the frames at specific intervals. Could you please let me know if you used any other flag to access the pixel values?
Hi. It's been a while since I've worked on this API, although last time I did they had just released a major update stripping all extraction capabilities of the WebXR buffers out of privacy concerns. I'm not sure if they've come around on that, but if they haven't this means that neither readPixels() nor DrawImage() nor TransferToImageBitmap() can be used to extract the pixels from the buffers. All these functions will return an array of zeroes, so viewing any content of the buffers is off the table. I did however read that there was a group of people advocating for some kind of computer vision capabilities, but not sure how far they've come on that. Your code is probably fine.
from webxr-samples.
Hi @ArnaudHambenne ,
.readPixels() doesn't seem to work as well. What browser did you use and what device?
My code is something like -
function onXRFrame(t, frame) {
let session = frame.session;
let gl = session.renderState.baseLayer.context;
var pixels = new Uint8Array(gl.drawingBufferWidth * gl.drawingBufferHeight * 4);
gl.readPixels(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
if (pixels.every( (val, i, arr) => val === arr[0] ) ){
console.log("none");
}else{
console.log(pixels);
}
}
What did you use to read the pixels?
I am not too worried about the performance hit as I would only like to read the frames at specific intervals. Could you please let me know if you used any other flag to access the pixel values?
from webxr-samples.
Are there any news on this issue?
It's a shame no to be able to let the user record a video or take a screenshot of his/her webXR session.
from webxr-samples.
Related Issues (20)
- WebXR Content Broken in Chrome in Android 12 HOT 1
- Animated gltf HOT 1
- Modifying attributes
- WebXR Samples VR Not Found - Vive Pro 2, SteamVR Beta, Chrome 97 / Edge 97 HOT 11
- AR sample doesnt work on OnePlus 7T HOT 1
- Stats fps display overflow
- A blinking bug on pause video in WebXR Layers HOT 3
- Immersive ar session samples not work HOT 1
- Hittest-offsetRay -may be same mistake in origin.z HOT 2
- Depth sensing not work on pixel 4XL
- Video alpha not working with skybox HOT 1
- Anchors Drifting HOT 11
- How do I render cesium scene to webxr? HOT 1
- Hit Test with Anchors WebXR #19 sample crashes on my device HOT 2
- License for equirect test images?
- WebXR samples renderer issue
- Video Playback not working on VR mode using Safari and Vision Pro Simulator
- XRProjectionLayerInit in the webxr layers samples is not the same as in Spec
- Immersive AR does not work on the Samsung browser HOT 1
- Open AR screen with script without clicked button HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webxr-samples.