hey guys, over the last few days i've been working on this:
I'd love for people to play around with it and let me know what they think.http://crazyferretstudios.com/public/PhysicallyBasedLighting.upk
The reason i made this was to get used to a newer way of working, with the industry moving toward a PBR setup, and very few tools out there to use.
To use this tool, there are two materials in the pack, the material itself, and an instance. please use the instance.
the maps you will need are:
Albedo - similar to the current diffuse model, except you just do colour, try not to include any lighting information at all. also, try your best to look up colour values for particular things, especially metals. http://seblagarde.files.wordpress.com/2012/04/dontnodgraphicchartforblinnmicrofacet_lowres2.png?w=630&h=630]something like this should help
Mask texture - this texture has four grayscale maps, one in each channel, which are:
- R: Roughness - this defines the roughness of the material, 0 is not rough, 1 is super rough.
- G: Metalness - this defines whether the material is metallic or not. DO NOT USE GRAY VALUES. this map should either use black for not metal surfaces, or white for metal surfaces. example - if you have a painted metal surface with chips, the paint should be black and the chips should be white in this map.
- B: Emission - This map defines any surfaces which are emissive, it multiplies over your Albedo colour.
- A: Cavity - use this sparingly (there is also a parameter to increase/decrease cavity strength), can be used to remove lighting from cavity areas. could use a light AO map as well.
Normalmap - nothing special here.
Cubemap - you can use pre-filtered maps, or capture from inside UDK. you can use DX9 if you're using pre-filtered maps. if you're using UDK captured maps, please use DX11. there is a parameter for the number of mip-map levels your texture uses. the more the better. (usually 10 is max).
There are limitations with this shader however.
- Currently the image based lighting is using a hacky workaround and isn't true IBL. hopefully i can resolve this in the near future.
- Currently UDK doesn't support area lights that will be used in the future. i have no idea if it's even possible to program a new light type into udk.
- Currently UDK doesn't allow you to bake lightmaps from custom shader setups like this.
09:45 - 22/08/2013
just pushed a new version, fixing the following issue:
cubemap reflections weren't present in dielectric materials at all. they should be vaguely present.http://crazyferretstudios.com/public/PhysicallyBasedLighting_v1.01.upk
11:02 - 25/08/2013
just found out that the above file didn't work. this one should!http://crazyferretstudios.com/public/PhysicallyBasedLighting_v1_02.upk
03:26 - 27/08/2013
BIG OOOOOOOL' UPDATE!http://crazyferretstudios.com/public/PhysicallyBasedLighting_v1_03.upk
Have just put in a basic layering system! you can now have four different material layers which can be defined in the following ways!
- Albedo Colour: choose your materials base albedo. use texture on/off set to 0.
- Albedo Texture: if you want your material to have a texture, put it here. use texture on/off set to 1.
- Metalness: is now a constant (not a mask/map) please use 0 for dielectric, and 1 for metals.
You now need two different mask textures. the first is the material mask, which works in the following ways:
R: Black = layer 1, White = layer 2.
G: Black = layers 1 + 2, White = layer 3.
B: Black = layers 1 + 2 + 3, White = layer 4.
think of it as building up from a base. if you were texturing a metal pipe made of copper, with black glossy paint, and a little surface rust. this would only require 3 layers. so you would start off with the copper, and mask that off with black in the red channel. then add surface rust in the second material, and mask that with white in the red channel. then add black gloss paint to the third material, and mask that with white in the green channel. you will need to do the same thing with normalmaps, although they share the same layer mask texture.
the second mask is roughness. you will need one roughness mask for each material.
R = material 1,
G = material 2,
B = material 3,
A = material 4.
IMPORTANT NOTE - due to feedback, roughness maps are now inverted, treat them the way you do with current gloss maps - black = rough, white = glossy.
there is a (very very basic and bad) set of example textures in the package to demonstrate. i only spent a couple of minutes making them.
this system should hoooopefully allow people to use tiled textures on the various channels and come up with some cool effects. it also allows you to choose whether or not you want to use a basic constant coloured material, or texture per material, or even mix between them.
current functionality removed:
emission, cavity map. these will be added in again soon when i can figure out an efficient way of doing it.
i'll make a good example asset and some maps over the next couple of days to demonstrate better, unless someone beats me to it!
cheers guys, have fun!
20:00 - 27/08/2013LATEST RELEASEhttp://crazyferretstudios.com/public/PhysicallyBasedLighting_v1_04.upkUPDATE TIME!!!
00:08 - 27/09/2013http://crazyferretstudios.com/public/PhysicallyBasedLighting_v1_05.zip
I STRONGLY RECOMMEND DELETING ALL PREVIOUS VERSIONS ENTIRELY.
this will stop any cross over between the shader functions, and hopefully minimize any errors. there are a lot of changes under the hood in this update, so this is the best course!
I've got good and bad news! i've managed to get IBL working the way the UE4 paper says they do, but it's WAY too intense for UDK. my rig is a beast, and it chugs so bad i had to abandon it. which means i need to figure out a better/cheaper way to do it... so here's hoping!
until i've figured that out, the IBL is in the emissive slot, along with your emissive map.
four materials to blend between. each material has it's own normalmap, and albedo slot. they also have a metalness and roughness parameter. simply slot in your albedo, tell it whether that material is metal (1) or not (0), and define how rough it is with the slider. if you want additional functionality, you could put metalness in the alpha channel of the albedo, which would allow you to have more detailed materials, but you would need to swap the alpha and the parameter around in the shader. you can also adjust how much each layer tiles with a parameter, each layer can tile separately from one another.
there is a texture slot in "Masks". this is your layer mask:
R - black = base layer, white = second layer.
G - black = combined first and second layer, white = third layer.
B - black = combined first second and third layers, white = fourth layer.
there are two "Global" map inputs:
Global Normals - here is where you put your models unique normals.
Roughness/Cavity/Emission - R = Roughness channel, again white is rough and black is glossy. G = Cavity, this multiplies lighting down globally, use this for very fine details you want to convey, things like cloth seams or similar. B = emission, multiplies over your albedo to give a coloured glow, there's an emissive parameter to strengthen this effect as desired.
there is a "Cube" input. this needs to be the T-shaped cube texture. you can generate one inside UDK if you need to. currently UDK doesn't support DDS textures, so no custom mip-maps just yet =[