Show skybox in hololens using MRTK - c#

I'm using Unity and MRTK to create an immersive application for the hololens (similar to Holotour). In this application, I need to simulate the sky. In Unity, a Skybox is sufficient to show this. However, in Hololens, it is not. How do I go about showing the sky/what's on the skybox in my Hololens? Thus far, I have tried adding a render texture for a camera high in the sky to an inverted sphere (i.e. a sphere that encompasses the playspace and shows the material of the sphere on the inside); but that doesn't seem to work...

The HoloLens uses the Transparent camera display settings to determine how to clear the scene. If you change Clear Flags to Skybox, you should get your desired effect.

In Window>Rendering>Lighting Settings, set "Skybox Material" to the skybox of your choice. Also make sure, that your Camera "ClearFlag" is set to "Skybox".
If in doubt, please refer to the docs.

Related

Unity Fog looks different on Android

The fog from my 3d game looks good in Unity (Desktop) but on Android the fog looks different? Can anyone explain the reason?
PC Unity:
Android:
There are few settings, which you have to check first.
Project Settings/Quality: make sure that your editor quality is same as your Android build.
Project Settings/Player/Other Settings: Color Space and Graphic APIs
According to your android screenshot, you also have color bending issue. And you have different gamma value on displays too.
Oversized scaled cubes/low vertex objects often cause issues on mobile
The solution would be cutting/separate the cube into more small cubes or add even more vertexes to the cube
Here is the thread I found this reference from

I imported an image in my project in unity and it doesn't blend with the lighting ; cause in the dark light i can still see the image pretty clear

I imported an image instead of a 3d model for am enemy, and the game is supposed to be in dark at night but the image is not blending with the rest of the environment so can anyone plz help.
If it is set to sprite it uses an unlit shader that does not respond to lighting. If you have it on a material as the albeto channel on a 3D plane, it will respond to lighting but only as a flat surface. Unless you also have a normal map for it.

How to set up render textures in VR for Unity

I am trying to build a VR applications with portals into other worlds. These portals do however not have to be flat, they can be bent. Here https://www.youtube.com/watch?v=EpoKwEMtEWc is video from an early version.
Right now, the portals are 2D planes with camera textures which stretch and move according to the users position. For VR use, and to ease performance issues, I would like to define which area of the screen gets rendered by which camera. Sort of like a viewport in regular Unity, but not rectangular, and for VR with Windows Mixed Reality.
Is this somehow possible? Possibly even without Unity Pro?

Unity - All Canvas's become invisible when using render texture on Two Cameras

****Update:** I've created a test scene where I've recreated the usage of a canvas with image and text, primitive game objects and the use of two cameras in addition to the Camera Rig, with target textures set to the same render texture. In this state, it worked, however when I installed and upgraded all materials to via the lightweight render pipeline, the render texture turned pink and would not render anything from the cameras.
Considering this, my next step forward is to remove the lightweight render pipeline via reverting to a previous commit which does not have the lightweight render pipeline.* If you run into the same situation remember if you do not have a previous commit you can revert to, after removing the lightweight render pipeline you will need to create new materials for all your game objects.*
Problem: In one scene within a VR Project project we are using a world space canvas to display interactable UI. When running through the editor we have no issues, however, when we build the project, all UI canvas's become invisible, though with the use of a laser pointer we can still interact with buttons on the canvas.
I've narrowed the cause down to the use of a specific render texture (only one), which is applied to the target texture of two (2) cameras in the scene. The two cameras are used to provide a live feed to a mesh of the view of a device in the scene.
When I set the two cameras (neither are the main camera in the scene) target texture's to null, that is the only way which I can get the Canvas to appear.
When after running a build I always check the output_log.txt file and have not found any errors.
We are using:
Unity 2018.1.3f1,
VRTK 3.3.0a,
Steam VR w/HTC Vive,
Unity's Lightweight Render Pipeline,
Post Process layer
There is only one canvas in the scene, with all UI objects as children of that object. Our Canvas set up:
Note: I've set the VRTK_UI Canvas component to be inactive to check if that was the cause, and it was not.
[
Camera One:
Note: I've tried clicking the "Fix now" under the target texture, with no change or improvement
[
Camera 2:
Note: I've tried clicking the "Fix now" under the target texture, with no change or improvement
[
Mesh we are Rendering to:
[
Render Texture:
[
Main Camera:
[MainCamera]6
The lightweight render pipeline was the issue, removing it allowed for everything to work as expected/needed.
We have faced the same problem with one camera. Disabling the camera and manually call Render() from another script resolve this issue.

Discrepancy with screen orientation between Unity3d and iPad, game not affected by device rotation

I'm helping develop a game in Unity3d using C#. We're developing for the iPad and using Unity's
Apple plugin. Our game is a 2-D platform game that features gameplay that uses the rotation of the device (iPad). We're using physics for character movement.
The game is played mostly in Landscape Right. We can change the orientation of the device easy enough using Screen.orientation = ScreenOrientation.LandscapeRight, etc. We want to be able to rotate the device from either LandscapeLeft and LandscapeRight to either Portrait or PortraitUpsideDown, which we can do.
When running our scene within Unity3d, when we rotate from Landscape to Portrait, our character falls because we rotate the world (what she's standing on), while she remains in the same orientation (physics remains the same), causing her to fall. This is the desired behavior we want. However, when we build to Xcode and run the game on the iPad simulator (version 5.1), and we rotate the device so that the world rotates, it merely rotates the device with the game still having the same orientation (landscape). The iPad is in portrait however the game is still in landscape. Are there other variables that we need to set within the device other that ScreenOrientation? How do we have our game state consistent with the device's orientation?
A quick summary: we want our game to default to Landscape. When we rotate to portrait we want the world to rotate with the camera and the player remaining constant. Physics is tied with the character meaning once the world rotates, she falls because she's no longer standing on the ground. Currently when we rotate the iPad, the orientation of the device changes but the game's orientation doesn't change. We want the world to shift on rotation but the character remain constant. It works in Unity3d but doesn't work correctly using the Xcode iPad simulator. How do we do this?
Thank you!
Kenneth
Very confusing question, I must say. Checking the orientation should be simple and straight forward.
First and foremost: Forget XCode simulator! It sucks even if you're building directly on XCode and not using Unity or anything else. Maybe this alone already solves your issue. Get an iPad and test on it.
Also, you'll need scripts in place to handle the physics changing behavior with rotation. I couldn't understand if you got this, but in case you don't this might not be too trivial. Although it seems you got it.
Lastly, the most confusing part is when you talk about ScreenOrientation and Screen.Orientation, and just maybe there's a mistake there. When you use Screen.orientation = ScreenOrientation.LandscapeRight you're forcing the actual screen orientation to change (it is not read-only) and this should be done only for testing purposes. You could even include all code relating to it inside #if UNITY_EDITOR and #endif precompiler 'tags'. For the device, you should only have ScreenOrientation == ScreenOrientation.LandscapeRight, either on if or switch clauses, with the comparison operator, the double equal sign (==).
Can't think of any other thing that could go wrong there.

Categories

Resources