playMaker

Author Topic: Using Post-process profile  (Read 94 times)

Mupp

  • Junior Playmaker
  • **
  • Posts: 58
    • View Profile
Using Post-process profile
« on: February 13, 2020, 06:12:19 PM »
I'm wondering how I can modify my PP profile. I've checked out the package on Eco but most of my effects are custom made and I wonder how I can access them.

I'm looking for a way to turn them on/off and change their values.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14938
  • Official Playmaker Support
    • View Profile
Re: Using Post-process profile
« Reply #1 on: February 14, 2020, 03:56:26 AM »
Hi,

 What do you mean by Custom Made?

Bye,

 Jean

Mupp

  • Junior Playmaker
  • **
  • Posts: 58
    • View Profile
Re: Using Post-process profile
« Reply #2 on: February 14, 2020, 06:41:41 AM »
What is unclear? The PP profile can have have more than Unitys default shaders. Many 3rd party assets and also my own are used through it.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14938
  • Official Playmaker Support
    • View Profile
Re: Using Post-process profile
« Reply #3 on: February 16, 2020, 11:52:37 PM »
Hi,

 I did not know that Unity post processing profiles could be custom :) all the custom ones I used where using their own boiler plate components to create the effects.

Do you have a link to an asset that use the PP profile so that I can see how it integrates? thanks.

Can you explain how you created your own? It seems that you can only achieve that via c# coding right? if that's the case, then I think you have enough skills to create the custom action to control these scripts, right?

Bye,

 Jean

Mupp

  • Junior Playmaker
  • **
  • Posts: 58
    • View Profile
Re: Using Post-process profile
« Reply #4 on: February 17, 2020, 02:56:46 PM »
Sorry, I was a bit confused that I thought I wrote something wrong. I'm using this. http://staggart.xyz/unity/sc-post-effects/scpe-docs/?section=sc-post-effects

For my own shaders I use Amplify Shaders which auto generates a script for me. It can look like this.
Code: [Select]
// Amplify Shader Editor - Visual Shader Editing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
#if UNITY_POST_PROCESSING_STACK_V2
using System;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;

[Serializable]
[PostProcess( typeof( ColourAdjustPPSRenderer ), PostProcessEvent.AfterStack, "Colour Adjust", true )]
public sealed class ColourAdjustPP : PostProcessEffectSettings
{
[Tooltip("Brightness")]
[Range(-1f, 1)]
public FloatParameter Brightness = new FloatParameter { value = 0f };
[Tooltip("Contrast")]
[Range(-1f, 1)]
public FloatParameter Contrast = new FloatParameter { value = 0f };
[Tooltip("Saturation")]
[Range(-1f, 1)]
public FloatParameter Saturation = new FloatParameter { value = 0f };
[Space(5)]
[Header("Tint")]
[Tooltip("H")]
[Range(0f, 1)]
public FloatParameter H = new FloatParameter { value = 0.5f };
[Tooltip("S")]
[Range(0f, 1)]
public FloatParameter S = new FloatParameter { value = 1f };
[Tooltip("V")]
[Range(0f, 1)]
public FloatParameter V = new FloatParameter { value = 0f };
}

public sealed class ColourAdjustPPSRenderer : PostProcessEffectRenderer<ColourAdjustPP>
{
public override void Render( PostProcessRenderContext context )
{
var sheet = context.propertySheets.Get( Shader.Find( "Colour Adjust" ) );
sheet.properties.SetFloat( "Brightness", settings.Brightness );
sheet.properties.SetFloat( "Contrast", settings.Contrast );
sheet.properties.SetFloat( "Saturation", settings.Saturation );
sheet.properties.SetFloat( "H", settings.H );
sheet.properties.SetFloat( "S", settings.S );
sheet.properties.SetFloat( "V", settings.V );
context.command.BlitFullscreenTriangle( context.source, context.destination, sheet, 0 );
}
}
#endif

Now, I don't expect a custom action for everything, that would be insane and it wouldn't work for my own stuff.
Using Get/Set properties does not work but maybe a custom action that can get/set the shaders variables in the profile?
Maybe something like the Conditional Expression action, there you have to write the variables and logic yourself would work?
« Last Edit: February 17, 2020, 05:17:21 PM by Mupp »