Unity allows you to create Custom Shaders to improve and generate your own materials and graphics.
We provide examples that simulate the Gamma color space even if you are using Linear color space. The color space plays an important role when rendering the scene and there are differences between Gamma and Linear color spaces (refer to this Unity Manual)
If you follow the Import Sample section, please, refer to the GameObject ScreenRawImage and check the Raw Image component. You will see there is a material attach to the material attribute named HISPlayerDefaultMaterialRawImage.
This material is using the custom shader HISPlayer/HISPlayerDefaultShaderRawImage. For more details, you can check the following folders and files:
- Packages/HisPlayerSDK/HisPlayer/Scripts/Shaders/ - Here you can find the custom shaders. These files contain the code to simulate the Gamma color space when using Linear color space.
- HISPlayerDefaultShader.shader
- HISPlayerDefaultShaderRawImage.shader
- Packages/HisPlayerSDK/HisPlayer/Resources/Materials/ - Here you can find 3 different Unity materials:
- HISPlayerDefaultMaterial.mat: It uses the HISPlayerDefaultShader.shader and can be used for the HISPlayer RenderMode “Material”.
- HISPlayerDefaultMaterialRawImage.mat: It uses the HISPlayerDefaultShaderRawImage.shader and can be used attaching the material to the material attribute of the RawImage component.
- HISPlayerDefaultMaterialRenderTexture.mat: It uses the HISPlayerDefaultShader.shader and the HISPlayerDefaultRenderTexture.renderTexture.
- Packages/HisPlayerSDK/HisPlayer/Resources/RenderTextures/
- HISPlayerDefaultRenderTexture.renderTexture - This file is a custom RenderTexture to be used with the HISPlayerDefaultMaterialRenderTexture.mat.
If you are using HISPlayer SDK version 3.4.0 and above, you will find HISPlayer360Shader.shader in Packages/com.hisplayer.hisplayersdk/HISPlayer/Scripts/Shaders/.
When building 360 application, you might use different shaders such as the Unity Skybox/Panoramic shader.
If you use Linear Color Space, please change the default shader to HISPlayer360Shader which will improve the video rendering quality by following these steps :
- Open your 360 material, for example: Assets/HISPlayerOculusSample/Resources/RenderTextures/Materials/HISPlayer_360_Material.mat
- In the Inspector window, change Shader to HISPlayer360Shader
- Make sure you have the following setting of the material: