Beispiel #1
0
        public RenderTexture GetBrushMask(FilterContext filterContext, RenderTexture heightContext)
        {
            rtc.AddRenderTexture(0, "heightMap", GraphicsFormat.R16_SFloat);
            rtc.AddRenderTexture(1, "output", GraphicsFormat.R16_SFloat);
            filterContext.renderTextureCollection = rtc;
            filterContext.properties.Add("brushRotation", brushRotation);
            filterContext.properties.Add("terrainScale", Mathf.Sqrt(filterContext.terrain.terrainData.size.x * filterContext.terrain.terrainData.size.x + filterContext.terrain.terrainData.size.z * filterContext.terrain.terrainData.size.z));

            filterContext.renderTextureCollection.GatherRenderTextures(heightContext.width, heightContext.height);

            Graphics.Blit(heightContext, filterContext.renderTextureCollection["heightMap"]);
            filterContext.destinationRenderTexture = filterContext.renderTextureCollection["output"];

            brushMaskFilterStack.Eval(filterContext);
            return(filterContext.renderTextureCollection["output"]);
        }
Beispiel #2
0
        private void Init()
        {
            if (!m_initialized)
            {
                LoadSettings();

                m_rtCollection = new RenderTextureCollection();
                m_rtCollection.AddRenderTexture(RenderTextureIDs.cameraView, "cameraView", GraphicsFormat.R8G8B8A8_SRGB);
                m_rtCollection.AddRenderTexture(RenderTextureIDs.meshStamp, "meshStamp", GraphicsFormat.R16_SFloat);
                m_rtCollection.AddRenderTexture(RenderTextureIDs.sourceHeight, "sourceHeight", GraphicsFormat.R16_UNorm);
                m_rtCollection.AddRenderTexture(RenderTextureIDs.combinedHeight, "combinedHeight", GraphicsFormat.R16_UNorm);

                m_rtCollection.debugSize = EditorWindow.GetWindow <SceneView>().position.height / 4;

                m_initialized = true;
            }
        }