When developing a custom shading model, every compilation seems to be forever.
Using the shading model developed by external software, you also need to debug when you want to migrate to UE4.
Also, need to compile (forever).
So I developed a little trick: shading model testbed.
Looks like this
Overall, this is a technique designed only for developers of custom shading models.
When I developed the shading model, I often encountered this situation:
You made a small change to the line of code in ShadingModels.ush, then you return to the engine, press Ctrl + Shift +. , and then wait for 7000+ shaders to compile.
After you have had a few cups of tea, the shader is compiled. You find that the effect is still somewhat unsatisfactory, so you change the line of the code back, and then guess what, wait for another 7000+ shaders to compile!
So I developed this trick, find the shading code from the engine source code, put it into a custom node of the material editor, and then use the scene texture already in the material editor as its input. Basically, the shading of the engine is reimplemented in the material editor.
As can be seen from the comparison, after removing the fog, skylight, reflection, AO, there is no visible difference between the default shading of the engine and the material I wrote.
At the same time, in terms of compile speed, modifying the code in the custom node is much faster than directly changing the code in the source code: from a few cups of tea to a few seconds:cool:.
@IOChair
You can compile just certain shaders you want. Some things i picked up while learning to make custom shading models:
ShadingModelsMaterials.ush - You just need to make a change in material graph hit apply and the changes will propagate.
The command below will allow you to compile specific shaders:
recompileshaders /Engine/Private/X
where X is the shader file
ShadowProjectionPixelShader.usf
SkyLighting.usf
DeferredLightPixelShaders.usf - This compiles a bunch of shaders including ShadingModels.ush
ScreenSpaceReflections.usf
PostProcessAmbientOcclusion.usf
You can put a shell that is slightly larger than the original object like the chair on the left side of the figure, and then you give the shell a Toon shading material.
Obviously, this has a lot of limitations.