HomeVR Dev Log

HomeVR Dev Log

Donny Donny
November 9, 2020
November 9, 2020
589
-

Tags in blue are handcrafted tags; Tags in green are generated using AutoTag.

Nov 04

  1. WebVR requires HTTPS on Oculus Quest.
  2. WebVR seems to require enabling Universal PR (Will cause some issues)
  3. Universal PR supports ShaderGraph, which is good. But it does not support point light shadows, which is bad.
  4. By default, Universal PR only enable shadows for the main light. Go to UniversalRenderPipelineAssset > Lighting > Additional Lights, enable Cast Shadows. You may also want to enable Shadows > Soft Shadows.
  5. The PostProcessing Volume for Universal PR is Create > Volume > Global Volume. Some suggest creating a empty GameObject and add PostProcessingVolume to it. Do not work for me. (Maybe it is because the Volume Mask is set to Default)

Nov 09

  1. Unity do not have Mirror support for build-in pipeline and URP. HDRP has planar reflection. To make planar reflection work in URP, you may use some tricks like reflection probe or simple reflection camera logics. But these only work for small planar reflection. For larger mirror, they are broken. The most plausible solution, is from the URP BoatAttack sample. There are many variants based on the modified codes from the planar reflection of this sample. Still, there are tons of problems.
  2. I found a piece of codes that will work with URP. However it only supports flat screen, so I am currently using two mirrors, one for each eye. It is a simply fix but maybe it will be better to write a custom shader.
  3. After numerous debugging, the planar reflection starts to work. But it is clipping too much when rotating the camera. After digging into the codes, and even the papers about perspective projection (http://www.songho.ca/opengl/gl_projectionmatrix.html) and oblique projection (http://www.terathon.com/lengyel/Lengyel-Oblique.pdf), I found that, I am setting the opposite direction and the opposite clip plane offset at the same time. (There is a trivial problem in the codes I use though, but it is trivial.)
  4. The planar reflection works fine now, except that the skybox is stretched and twisted, only in VR. If I skip the oblique projection everything works great. It maybe a problem in how the Oculus headset handles the skybox texture rendering. There is a fix for that (https://answers.unity.com/questions/534838/how-can-i-make-a-skybox-respect-oblique-frustum.html), which is to add the oblique manually, may try to fire a issue later.
  5. The controller handler script provided by WebVR will fail when the framerate is too low. Probably they never encounter this problem lol. The solution is to move the codes that updating the lastPosition and lastRotation of the currently grabbing object to the fucntion Update. Though theoritically all physics interaction should be done in FixUpdate. Because they are handling the controller buttons in Update, and releasing the object at that time. However they are calculating the velocity and angular velocity using the deltaTime, which is not the real duration in this case.