Hey guy's
I'm having a problem with my lighting in UDK,
This happens after bake and before, there is nothing wrong with the model or lightmaps. (that i'm aware anyway)
Here the specular is working correctly between the 2 tiles
But after rotating this the lighting is reacting totally wrong? i need to rotate these tiles as i'm trying to make something modular any ideas?
Thanks! (oh p.s ignore the messy textures hehe)
Replies
I'm just thinking out loud here, I don't have that much experience with UDK yet, but wouldn't it be possible to:
Split up the model with different material ID's.
Make a material where you set up a parameter so you can rotate the normal 90 degrees.
Make an instance of the material, and apply it to each material ID with a different rotation.
PS. If this is possible, please share how you'd go about doing it exactly.
Also going to try rotating a clean static mesh then applying a texture to it so hopefully its fine.. but will see.
Would still love some more help though!
Anyone?
Open up your material.
Find the Material drop down.
Select Lighting Model > MLM_NonDirectional
That's wrong? You're losing out on all the maps expect Diffuse and Emissive, which is not the solution unless somehow baking takes into consideration the Normal Map, Specular and etc bounce even in NonD, in which case you will be getting the old issue back.
How the fudge does modular modelling work then? If you cant rotate anything without getting lighting problems.
I will post any progress tomorrow
Heres my normal,
Cleaned the swarm cache and validated, also tested 4 of the unreal normal maps onto my model and still had the same issue, turning the normal map off also does not fix it.
So not sure its that,
Are you saying that i need a unique normal map per rotated model? isnt that a bit overkill having 4 rotated normal maps for one texture? or am i misunderstanding!
Thank you for your help! i really really appreciate it! and i will try my best to fix it today
thanks again!
and, as people have said in other threads, it's better to just make a bigger piece of ground than do this. Or not put your seam across a smooth section of the texture - put it where there's a natural seam in the object.
So you only need the one normal map in this instance. If you wanted to rotate it only 90 degrees you would need a new one since you would be swapping the green and red channels.
No rotation here, and it works fine
Here is after i rotated the top left model 90 degrees and as you can see the highlight has moved, if i mirror a model that works ok its just 90 degree rotations.
Sorry for any confusion! but thanks again and i hope this is a bit more clear.
When you rotate 180 degrees your only changing your norms on 1 axis so you fix it by mirroring.
I believe UDK's specular calculations is somehow tied to UVs. Haven't tried myself but you could actually try flipping UVs instead of flipping maps.
Such scenarios are better avoided though
Also, does the problem present itself on other models FROM the stock models in the game?
I believe (if I can remember correctly) that this is intended by Epic. You have to remember that unless using fully dynamic lights you don't have real time specularity. From what I understand, UDK uses a light vector with 3 channels. If they had used 4 channels instead of 3 this problem wouldn't exist. I believe it was too costly. This is the same reason why you can't flip UVs on the vertical axis for meshes with mirrored geometry.
So my suggestion for you, is to not rotate flat pieces. Build them differently, so you don't have to rotate them. You could build a larger mesh, or more variants that line up with each other. You could also try using a dominant light instead of a static light and the issue will most likely go away or at least lessen the issue.
Here's the same issue he's having, top and bottom fixed using proper normal orientation.
What happens is when you generate static lighting it picks 3 vectors from the surface (somewhat randomly) and computes the lighting intensity from each with what is generally the strongest light effecting the mesh. (it's more complex than this, but this is artist friendly). That generates the lightmap texture that DOESN'T include specular data. Specularity is calculated at runtime using all 3 vectors. Those vectors are based on the model's space, so if you rotate the model the vectors rotate. This means that rotated meshes compute specularity differently.
This CAN be fixed by using a dominant directional light (which looks like that's what you're using Deadly). Dominant lights reduces it down to 1 vector and is not mesh orientation specific, I believe.
Theoretically, you could try to make up for the vectors being different by shifting the vectors in the normal map. But, creating different normal maps for just 1 mesh is not ideal from a memory standpoint.
You could also potentially have different models that are rotated in max/maya and imported into UDK. Again, not an ideal solution for performance reasons.
Also if you don't want to use the lightmap specular then you can just turn it off in the material in the misc rollout > allow lightmap specular. You don't have to be stuck using dominant lights as a 'fix'.
Here, I will post some pics, and let you guys look over them, and see if you can discover what is wrong.
I was trying to figure out the reason they are using a basic shader with a physical material, and not a exclusive mat for each model. But, I finally figured it out.
Here is the mesh.
Here is the Material Instance Constant.
And the Physical Material with the Textures there.
And here is the simple material shader they use for most of the modular stone models.
I am still trying to break all this down because it is new to me. I have always just worked with Exclusive mats, and shaders. But this seems to do the job better, and with less overhead.
Also, if you notice, you can rotate the model anyway you want, and the shadows and Specular always act correctly.
If anyone else uses this work flow or knows more about it, please enlighten us? I would love to know the benefits this has to the game, and the modular meshes.
Sadly no, the lightmass specular is still wrong. It's just not in your face when you have a diffuse/spec map on it.
Thanks again for all your time!
I'm stuck too - can't rotate modular stuff.
Even if you rotated your Normal Map in the material, it will show up correctly.
Care to show an example then? I tested this extensively and what your saying is completely incorrect.
Not sure if importation/exportation option play a role, since I export everything as an ASE with 1 smoothing group import.
EDIT: I just realized that maybe my information could be wrong, since I have a custom material setup with a Blinn based Specular, not sure if this adds to anything.
Does your custom mat exclude the lightmap spec?
I feel like I've tried every possible approach, but no matter what I do the specular still shows up wrong.
I can make the normal show up just fine by switching the Red and Green channels. Though I noticed that if I used the normal as the diffuse, there are slight variations in the colors between the unedited normal map and the edited.
Could you throw up a screen shot so we can see what your doing?
Placed 4 bsp cubes next to each other. Applied Material 1:
The result looks like this:
Then I proceed to rotate 1 BSP face, make the 2nd material and apply it to the rotated face:
Now at this point it actually looks fine, but as soon as I bake the light information, it doesn't work anymore.
Notice that the green color is slightly off compared to the other boxes.
I ended up at the same place you are which seems to be an issue with how UDK appends the channels. It looks fine in the mat editor but never worked for me either. The only way I've made it work was by using another normal map completely.
This tutorial by Chris Albeluhn explains it quite well.
[IMG][/img]