03 marzo 2011

Modifying Unreal Source Shaders

Today, my challenge was accesing to unreal shader sources. Its possible to modify them! (Will be possible to add new(text based) ones? Ill try). My first goal was easy, just to DELETE once and for all the odd phong specular model and using Blinn instead. If you know unreal, you know the listbox in the Material editor where specular models are listed, MLM_Phong, MLM_Unlit and all the family. I changed the name too. I wanted to add my new one, but its not possible without having acces to the C++ source files. If you take a look at the generated HLSL window, youll find this bad new:


Defined by the C++ code:
[...]
MATERIAL_LIGHTINGMODEL_PHONG
MATERIAL_LIGHTINGMODEL_NONDIRECTIONAL
MATERIAL_LIGHTINGMODEL_UNLIT
MATERIAL_LIGHTINGMODEL_CUSTOM
MATERIAL_LIGHTINGMODEL_ANISOTROPIC
[...]

So i can only use those slots :/

I have never understood, why a supposed 'next-gen' engine insists on using the old-poor-nonreal phong specular model. Blinn is not much more expensive, less than 10 more instructions and looks closer to real life.

So, here is a comparison between my hardcoded Blinn and the node-based one:




Exactly the same than the hardcoded one:




A new world discovered!

No hay comentarios:

Publicar un comentario