My blog directory
小IVan:专题概述及目录![图标](https://i-blog.csdnimg.cn/blog_migrate/d6ea8e09530a242b2ee5802be9b6a242.png)
Introduce:
As we all know, we can't modify the main render pipeline of unreal engine 4。We can only edit our shader in the material editor. If we want to do something special which material editor can't meet our needs, Using c++ to modify the engine is currently the only viable method. My previous article has detailed implementation steps for this method.
小IVan:虚幻4渲染编程(材质编辑器篇)【第二卷:自定义光照模型】
However, Using c++ to modify the engine is not a good way. Because This method is very inconvenient. Below I will introduce a way to modify the rendering pipeline directly in the material editor.
Main Content:
Let's see the results first.
![v2-8ad070d8aeb7ff0693cf469a3f3f87ab_b.jpg](https://i-blog.csdnimg.cn/blog_migrate/5f57eeb4d1b76d9ce43f1ef6df38ca6e.jpeg)
![v2-921e1006ee368b2ecb98517abc3cc6b2_b.jpg](https://i-blog.csdnimg.cn/blog_migrate/d6b652bf1dcebd0a0ee8a6f3c5737083.jpeg)
The code shown above is relatively simple, but the goal of modifying the rendering pipeline directly in the material editor has been achieved.
First we need to modify the source code of CustomNode。
![v2-bc2cba798f82beec59095031b48044af_b.jpg](https://i-blog.csdnimg.cn/blog_migrate/c1389366d234decc53200e8a54b4417e.jpeg)
![v2-53ba1cf41d8dac3c3f883fd4e35e52fc_b.jpg](https://i-blog.csdnimg.cn/blog_migrate/4d69ebc8766b10ced8762d80ce594451.jpeg)
Compile the engine, then open the material editor to add a CustomNode and you will see the following result.
![v2-6be58a948a17cd882ae3cc55f17a3cde_b.jpg](https://i-blog.csdnimg.cn/blog_migrate/9869ce7c727f9e5d4dd487b6b2de6dbe.jpeg)
If you write a macro to def, the macro will be pushed into the shader, and the rendering pipeline will get the macros.
![v2-6805e6df9c555cd8cd80d2ca13dbf9a7_b.jpg](https://i-blog.csdnimg.cn/blog_migrate/3973faab178e673c2b542f9b797863e1.jpeg)
Then we can write our code into the engine shader, which can be easily enabled using the material editor.
![v2-4e6e10bfbd5213a21bb3fd728cbe9498_b.jpg](https://i-blog.csdnimg.cn/blog_migrate/ffd9cf38eaf60625ddd16a8963eccb92.jpeg)
Summary and outlook:
Enjoy it !