Search Unity

How to use Material correctly in PPv2?

Discussion in 'General Graphics' started by Gumou, Aug 2, 2021.

  1. Gumou

    Gumou

    Joined:
    Nov 4, 2018
    Posts:
    2
    I want use Material because I want only expose few settings in PostProcessEffectSettings and tweak most properties in Material.
    So I tried this :
    Code (CSharp):
    1.  
    2. [Serializable]
    3. [PostProcess(typeof(PostMaterialRender),PostProcessEvent.AfterStack,"Custom/PostMaterial")]
    4. public sealed class PostMaterial : PostProcessEffectSettings {
    5.     public MaterialParameter mat = new MaterialParameter() {value = null};
    6. }
    7. public sealed class PostMaterialRender : PostProcessEffectRenderer<PostMaterial> {
    8.     public override void Render(PostProcessRenderContext context) {
    9.         Material mat = settings.mat;
    10.         context.command.Blit(context.source,context.destination,mat,0);
    11.     }
    12. }
    13. [Serializable]
    14. public sealed class MaterialParameter : ParameterOverride<Material>{}
    15.  
    Then I got this result.Only 1/4 of the screen rendered.So how to use Material correctly?



    https://ibb.co/pPX3y0S
    https://ibb.co/HpMcCNW
    https://ibb.co/Q8Ct4xb