Skip to content

Latest commit

 

History

History
60 lines (46 loc) · 3.86 KB

shaders.md

File metadata and controls

60 lines (46 loc) · 3.86 KB

Custom Shaders for Linear Color Space

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.

image

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

image

  • 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.

image

  • Packages/HISPlayerSDK/HisPlayer/Resources/RenderTextures/
    • HISPlayerDefaultRenderTexture.renderTexture - This file is a custom RenderTexture to be used with the HISPlayerDefaultMaterialRenderTexture.mat.

HISPlayer 360 Shader for 360 Video Playback

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/.

image

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

image

  • In the Inspector window, change Shader to HISPlayer360Shader

image

  • Make sure you have the following setting of the material:

image