Skip to content

Reproducing a shader from the game

Raytwo edited this page Oct 18, 2024 · 6 revisions

Preface

This guide will require AssetStudio. Do not forget to input the correct version of the game (Options > Specify Unity version > 2020.3.18f1) before importing a bundle!

Extracting the shader

Start by opening AssetStudio and dropping in the shader of your choice from your dump of Fire Emblem Engage. I've chosen charastandard.shader.bundle for this example.

Navigate to the Asset List tab to confirm that it loaded properly.

image

Now, select the Shader in the list (the one with a legible name), and stretch the preview on the right to have more visibility.

You'll want to highlight everything that's part of the "Properties" group in the preview, including the name and colons.

image

Right click it, and copy the text.

Replicating the shader

In your Unity project, reproduce the hierarchy to the shader (in this case CustomRP/Shaders/Chara), right click and create a new Shader asset (Standard Surface Shader is fine).

Double click on your asset and it should open up in your default text editor. Replace the properties with the ones you copied from AssetStudio.

Make sure to also properly rename the "Shader" name at the top of the file.

image

Now scroll down to the end of the file until you see a line starting with "FallBack". Depending on the shader you are replicating, you'll have to either remove or change the content of that line. You can find out if you need to do so by looking at the dependencies of the bundle with a tool such as CBT or UABEA, which should usually contain a dependency on "FallbackError".

In our case, CharaStandard falls back on the FallbackError shader in case of error, so we'll indicate that by changing the line to refer to its internal name: Fallback "Hidden/Universal Render Pipeline/FallbackError"

To finish it all off:

  1. Make sure to mark your file as Addressable so it isn't bundled with your models!
  2. Update the Addressable path as well. For CharaStandard, it should be CustomRP/Shaders/Chara/CharaStandard.shader

Save your file and voila! It can now be used by materials in your project.

Clone this wiki locally