Exemplo n.º 1
0
    public void Render(RenderTexture source, RenderTexture destination, ref RenderTexture flowFieldBuffer, bool exportFlowField = false)
    {
        edgeSettings.ApplyToMaterial(materials[FLOWFIELD], materials[GEOMEDGES], materials[IMGEDGES]);
        if (edgeSettings.fade)           // this rewrites a shader parameter, so it is important to put this _after_ the other apply
        {
            fadeControl.ApplyToMaterial(materials[GEOMEDGES]);
            fadeControl.ApplyToMaterial(materials[IMGEDGES]);
        }
        switch (edgeSettings.edgeType)
        {
        case NprEdgeSettings.EDGETYPE.Geometry: RenderGeometryEdges(source, destination); break;

        case NprEdgeSettings.EDGETYPE.ImageSpace: RenderImageSpaceEdges(source, destination, ref flowFieldBuffer, exportFlowField); break;

        case NprEdgeSettings.EDGETYPE.Combined: RenderCombinedEdges(source, destination, ref flowFieldBuffer, exportFlowField); break;

        default: Debug.LogWarning("Edge type not supported: " + edgeSettings.edgeType.ToString()); break;
        }
    }
Exemplo n.º 2
0
    public void Render(RenderTexture source, RenderTexture destination, Texture flowField)
    {
        simplificationSettings.ApplyToMaterial(materials[SMOOTH], materials[QUANTIZATION_GRADIENT], materials[QUANTIZE]);
        if (simplificationSettings.fade) // this rewrites a shader parameter, so it is important to put this _after_ the other apply
        {
            fadeControl.ApplyToMaterial(materials[SMOOTH]);
        }
        RenderTexture buffer  = RenderTexture.GetTemporary(Screen.height, Screen.width, 0, RenderTextureFormat.DefaultHDR);
        RenderTexture buffer2 = RenderTexture.GetTemporary(Screen.height, Screen.width, 0, RenderTextureFormat.DefaultHDR);

        RenderEffect(source, buffer, RGB2CIELAB);
        SmoothImage(buffer, buffer2, flowField, simplificationSettings.blurIterations);

        if (simplificationSettings.quantize)
        {
            QuantizeImage(buffer2, buffer);
            Graphics.Blit(buffer, buffer2);
        }
        RenderTexture.ReleaseTemporary(buffer);

        RenderEffect(buffer2, destination, CIELAB2RGB);
        RenderTexture.ReleaseTemporary(buffer2);
    }
Exemplo n.º 3
0
 public void Render(RenderTexture source, RenderTexture destination)
 {
     fadeControl.ApplyToMaterial(materials[1]);
     RenderEffects(source, destination);
 }