Hey guys.
I wanted to try to get blended normals in an UDK material and I don't know how to approach this or if it's even possible?
I know how blended normals work in theory and I've created this with other software, just not with udk... yet. In very few words, you need to do two diffuse calculations, one with normal map other just geometry normals, then you lerp between these with different weight values per channel.
First of all, is it possible to have to diffuse calculations in an UDK material? Is there some form of mult-material feature where you can combine two materials?
Thanks!
Replies
Ooo... thanks. Going to look into this.
http://udn.epicgames.com/Three/MaterialsCompendium.html#WorldNormal
Either way, I'm quite certain that you have to do it with two diffuse calculations, otherwise you won't get the RGB channels to differ and get the desired effect. I mean, no matter how much you modify the normal input of one diffuse calculations you will only ever get B/W diffuse output right?
I think I need to go with the approach Xoliul suggested. I just need to figure out what node gives me the geometry normals. Either that or use the Custom node and figure out how to write custom shader code for UDK.
Kodde, you're a bit confused here. Unreal's normals work in tangent space by default. That means whatever you input into the Normal slot, is transformed to world space behind the scenes before it is eventually applied in the diffuse calculations. I know this is kinda weird compared to how you're probably used to work, but it doesn't really limit you or anything.
So as Jonathan says, if you want to access the geometry normals, you just use a constant vector of 0.5,0.5,1. Use a Transform node to transform it from tangent to world if you want. Just make sure your other vectors are in the same space before you start combining them.
You don't need the WorldNormal node, that one's just for WorldPositionOffset input.
If you use the custom input, you need to handle all your space for the vectors yourself, so that would be easier for you.
Is it the CustomLighting or CustomLightingDiffuse I'm supposed to be using? Can't really seem to get either of these to work. Any secrets surrounding these?
Right now I'm stuck on trying to reproduce Blinn-Phong diffuse shading using the CustomLighting/CustomLightingDiffuse as a first step.
Here's where I'm at now. At least I'm a bit closer but not there yet. I'm not at all certain of how to properly reproduce the phong shading since I'm not that experienced with the inner workings of the lighting calculations. But since the non-normal mapped and normal mapped solutions produce a different shade of neutral color I get the red shifted results.
Oh and btw. Why is my 0.5 0.5 1.0 vector in the lower right part so pale? It's not at all close to your default normal color in say a normal map texture.
Also you do not need to normalize your light vector it's already a normalized tangent space vector
the way custom lighting should be used is like this if you're recreating basic diffuse.
dot product of normal and light vector, constant clamped * Diffuse goes into custom ligthing, this handles any interactions with a direct light.
your diffuse texture/material effects go into CustomLightingDiffuse, this handles your diffuse getting multiplied by any skylights or spherical harmonics.
You should look at the package called malehead (I think) in udk, it shows an example of custom lighting and blended normals.
I couldn't find that malehead package you're referring to. Only a base material for Male Characters (i think) and lots of instanced materials.
When using the MLM_Custom type material, does it get lit with anything else besides the CustomLighting slot? I tried to keep it basic just to create the diffuse lighting the way you described it. But it seems to get lit by some other source from above as well?
Notice how my diffuse multiplier is at 0. It should be all black if that is the only light source right?
If you break the connection to the CustomLightingDiffuse, it should be black.
There is basic skylight and SH bounceighting present at all times it seems - Jordan, is there anyway to control/turn this off on a material level? That way ambient light could be 100% controlled with CustomLightingDiffuse for those of us making more stylized stuff.
Also Kodde, what exactly are you trying to achieve?
I want to achieve similar results to the top row of images in this image: