PipelineChanger 1.0.0
by Black Rose Projects
|
You can convert any shader to any other using custom conversion. It's simple for basic conversions but also supports more advanced cases with the use of the API.
This section will show you how to do it.
Shader Pairing Tool is a simple UI tool for mapping properties between shaders. Mapped data will be used during custom conversions, providing a straightforward way to convert specific materials to another.
You need to have or create a shader that will work on the other pipeline. This tool allows you to convert all materials with one shader to another one.
To open Shader Pairing Tool, use the menu option:
'Tools' -> 'Black Rose Projects' -> 'Change Render Pipeline' -> 'Custom Converters' -> 'Shader Pairing Tool'
Insert your shaders in corresponding fields.
In the picker, you can press the 'Package Visibility' button to see shaders that are in Packages, not only in Assets
After shaders are selected, the Load Shaders button will become interactable. Pressing it will scan shaders, gather their properties, and display them in a sorted way.
_BaseMap
and _MainTex
or _NormalMap
and _BumpMap
By pressing the Try Find Similar button, you can try to automatically bind similar names, but remember to check if it's a good match afterward. If some properties were not matched, you can manually pair them by pressing the red button near the property from Shader to Change, and next a yellow one near the targeted one from Targeted Shader.
You can press the green button on the Targeted Shader area to remove the created pair.
You can match 1:many, but not many:1
After matching all properties, just press the Save Convert Data button. If in the current editing session you cleared all pairs and then pressed Save Convert Data, the shader pair will be removed from the database.
Saved data is stored in the database at BlackRoseProjects\BlackRoseTools\PipelineChanger\Editor\Database
in the ConversionDatabase asset. In the inspector of this asset, you can see which shader pairs you created.
Each pair has 2 buttons:
BlackRoseProjects.ChangeRenderPipeline.CustomConverter
class instead of MonoBehaviour
.RegisterConverter()
method and leave it empty if you want to write code instead of using data from Shader Pairing Tool. RegisterShaderPair()
method here. If you pass the wrong shader pair, there will be an error during conversion.RenameShader
method. Rename...
methods in the constructor. Convert
method. SetFinalizer
API. Remember - that code will be executed AFTER conversion. To run automatic conversion of all/selected materials that have shaders from the registered pair in Shader Pairing Tool or written by you in C# code, you can just use the menu option Black Rose Projects/ChangeRenderPipeline/CustomConverters/Selected or All Materials
You can also write your own function that will work only on converters that you want. The code below allows you to run your converter on a material that was right-clicked by selecting the MyCustomConversion
command in the context menu.