void CreateRenderTarget() { // for receive result renderTarget = SqUtility.CreateRT(attachedCam.pixelWidth, attachedCam.pixelHeight, 32, RenderTextureFormat.DefaultHDR, "Color(Normal) Target"); transparentDepth = SqUtility.CreateRT(attachedCam.pixelWidth, attachedCam.pixelHeight, 32, RenderTextureFormat.Depth, "Transparent Depth"); normalTarget = SqUtility.CreateRT(attachedCam.pixelWidth, attachedCam.pixelHeight, 0, RenderTextureFormat.DefaultHDR, "Trans Normal Target"); result = SqUtility.CreateRT(attachedCam.pixelWidth, attachedCam.pixelHeight, 0, RenderTextureFormat.DefaultHDR, "Result"); }
void OnDestroy() { SqUtility.SafeDestroyRT(ref renderTarget); SqUtility.SafeDestroyRT(ref transparentDepth); SqUtility.SafeDestroyRT(ref normalTarget); SqUtility.SafeDestroyRT(ref result); instance = null; }
void InitLights() { int downSample = 1; // create collect shadows collectShadows = SqUtility.CreateRT(Screen.width >> downSample, Screen.height >> downSample, 0, RenderTextureFormat.ARGBHalf, "Collect Shadows"); // create reflection rt reflectionRT = SqUtility.CreateRT(Mathf.CeilToInt(Screen.width * reflectionScale), Mathf.CeilToInt(Screen.height * reflectionScale), 0, RenderTextureFormat.ARGB32, "Reflection RT", true, true); // create ambient rt ambientRT = SqUtility.CreateRT(Mathf.CeilToInt(Screen.width * ambientScale), Mathf.CeilToInt(Screen.height * ambientScale), 0, RenderTextureFormat.ARGB32, "Ambient RT", true); InitSqLight(maxDirectionalLight, maxPointLight, maxSpotLight); InitRayShadow(collectShadows.GetNativeTexturePtr(), shadowScale); InitRayReflection(reflectionRT.GetNativeTexturePtr()); InitRayAmbient(ambientRT.GetNativeTexturePtr(), ambientNoise.GetNativeTexturePtr()); }
void OnDestroy() { SqUtility.SafeDestroyRT(ref collectShadows); SqUtility.SafeDestroyRT(ref reflectionRT); SqUtility.SafeDestroyRT(ref ambientRT); }