brianzinn Posted October 17, 2017 Share Posted October 17, 2017 I have the highlighter working in a regular scene. In the VR scene the highlight is not appearing where the mesh is and with left/right eye it is in different positions. Is this a bug or is using the Highlighter not supported with VR cameras? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 17, 2017 Share Posted October 17, 2017 It should work can you try to reproduce it in the PG with a VRDeviceOrientationFreeCamera? Quote Link to comment Share on other sites More sharing options...
brianzinn Posted October 19, 2017 Author Share Posted October 19, 2017 I can confirm that the highlighter works perfectly in a PG with VR:https://www.babylonjs-playground.com/#1KUJ0A#83 I will try to isolate what is happening in my scene. Thanks. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
brianzinn Posted October 22, 2017 Author Share Posted October 22, 2017 @DeltakoshThe bug is related to specifying a VR camera in highlighter options.https://www.babylonjs-playground.com/#1KUJ0A#84 If I comment out line 39 (camera option) then the highlighter works as expected. Additionally, if I am using a regular FreeCamera then it also works as expected. I think the issue is here (and on line 430): https://github.com/BabylonJS/Babylon.js/blob/2c0fa2446981bfb173cb7dca0fd76891e1b6e9be/src/Materials/Textures/babylon.renderTargetTexture.ts#L356 The cameras are the "same" camera, but not seen as the "same". Their ids are: "WebVRCamera_L" and "WebVRCamera". This code will fix the left camera to be working, but not right. if (this.activeCamera !== scene.activeCamera && (this.activeCamera.leftCamera && this.activeCamera.leftCamera !== scene.activeCamera)) { scene.setTransformMatrix( this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(true) ); } I think though, a better check would involve checking RigMode and a way on the camera classes themselves to determine equality. So, maybe better for someone more familiar with this code? I'm probably going to switch my highlighter code to GUI anyway, but wanted to share the cause + resolution. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 23, 2017 Share Posted October 23, 2017 Hey why do you want to force the VR camera in the highlighter option? if you do not force it, it works: https://www.babylonjs-playground.com/#1KUJ0A#85 Quote Link to comment Share on other sites More sharing options...
brianzinn Posted October 24, 2017 Author Share Posted October 24, 2017 yes, as I said it works if you don't specify a camera. I was just adding that the highlight layer would also work if RenderTargetTexture was updated to understand VR cameras, which seems more like an expected behaviour. marking as solved! GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.