Creating simple cell shading custom post-process in HDRP

Requirements for this project

  • HDRP 7.0.0+
  • Unity 2019.4+
  • Code Editor of your choice

A bit of background

  • Hue is the color portion of the model.
  • Saturation describes the amount of gray in a particular color.
  • Value works in conjunction with saturation and represents the brightness or intensity of the color.

Tutorial

public override CustomPostProcessInjectionPoint injectionPoint => CustomPostProcessInjectionPoint.BeforePostProcess;
float3 outColor = LOAD_TEXTURE2D_X(_InputTexture, positionSS).xyz;
float3 outColor = LOAD_TEXTURE2D_X(_InputTexture, positionSS).xyz;float3 hsvColor = RgbToHsv(outColor);hsvColor.b = 1;outColor = HsvToRgb(hsvColor);
float posterize(float In, float steps){
return floor(In / (1 / steps)) * (1 / steps);
}
hsvColor.b = 1;
hsvColor.b = posterize(hsvColor.b, 6);
hsvColor.b = posterize(hsvColor.b, _PosterizeAmount);
[SerializeField] private FloatParameter _posterizeAmount = new FloatParameter(1f);
m_Material.SetFloat(“_PosterizeAmount”, _posterizeAmount.value);

References

--

--

--

Unity Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Integrating Extent Report in a .NET Project

What is The Difference Between Rational and Irrational Numbers

How to Get Rid of Sage Error 22665?

Service Integration Patterns With BPMN And Camunda Cloud

eero 6 Review

RBAC in Kubernetes: Demystified

Error Messages for Enterprise Mobile Applications — part one

Business person in a car looking at their smartphone. They seem uneasy.

KeplerSwap Security Updates

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Raguel

Raguel

Unity Developer

More from Medium

Using Multiple Post Processing Profiles and Reflection Probes

Reduce Lag on Multiplayer games in Unity&Photon Pun2

Script communication in unity using GetComponent:

Unity — new input system create an action map