Hi all.
I looking for make a material with anisotropy effect.
Like this:
I know how to do that in UDK but i dont know with UE4…
Some one can help me please?
Anisotropic materials are currently not supported in UE4. But you can try to fake it using TXAA and maskmaps. There’s an demo for this in the Content Examples project on Marketplace.
…
i will look at the Content in Exemple project.
Thanks for your reply !
Hey guys! Any update about doing this anisotropy effect? I’m struggling to find a way to do but can’t find it, I looked everywhere on the internet and nothing! Please tell me that you managed to make it! :rolleyes:
It seems the G-buffer used in UE4’s deferred rendering needs more information than what is currently allocated. I’m sure sooner or later UE4 will offer it as an alternative option, much in the same way they allow toggling of a normal underneath the clear coat, and the addition of more color information for subsurface scattering materials. Presently, anisotropy has to be simulated by shifting normals of the surface into multiple directions per-pixel to give the illusion that light is spread over the surface. Obviously this illusion is not perfect.
Could you expand on this please, I’d love to know more.
I think in the Materials Examples there is an experimental approach to anisotropy. Using the Temporal AA Dither material node you can get a dithered pattern over your material. Each pixel can then be shifted across the surface in a certain direction. So a brushed material with vertical streaks will have the normals tilted horizontally over the surface, leaving longer streaks. I don’t have my project in front of me right now, but I was able to get it to work. Unfortunately the more you stretch, the lower your roughness, and the lower your screen resolution is, the worse it looks. Getting some of that stretched lighting effect is really nice, though!
You can also add noise that is directionally blurred to your normal map.
That solution doesn’t work as well for a couple reasons:
- Noise gets softer and blurred when mipmapped in the distance. And removing mipmapping just causes the result to be heavily pixellated.
- The noise is mapped to the object, so scales larger when zoomed in: in reality, the fibers on an anisotropic surface are so thin and small this phenomenon does not appear to happen.
Ideally, UE4’s renderer should just know the direction to skew lighting, but until we get proper G-buffer support for this, it won’t happen. Any workaround manipulating normals ought to happen in screenspace at a high resolution on a per-pixel level.
It’s not a solution, it’s a work around…
Then, that workaround doesn’t work so well. I tried it before to get a brushed metal anisotropic effect myself, but it just didn’t give the expected result.
Looking further into this issue, apparently the hair model has anisotropy built-in! I’ll try messing with it and seeing what I can get. There is documentation on the shader, but it’s a bit skewed to an explanation of the effect rather than how to set it up properly. There’s a lot in the material that’s specifically driven for hair, unfortunately
That statement is baldly misleading.
Firstly, you have light vectors in a deferred shading. I can’t image what made you think, that you can shade a surface without having light vector. Nope, you can’t.
Secondly, you do not need forward rendering for anisotropic shading model. It can be done with deferred and was actually used in production before. All you’d require is a additional gBuffer space.
While it is not that much of hassle to get anisotropic shading model running(can’t make it in material editor alone, sadly), one would inevitably run into a number of complications, ranging from getting anisotropic reflections to minimizing performance impact.
For what it takes, various fakery methods, will generally be preferable. One of the methods was mentioned by earlier mariomguy. Alternatively, you could make fake anisotropic specular for one directional light in the material itself, by adjusting material’s per pixel normals to reflect the light straight into the camera, depending on some kind of anisotropy map.
Check the Automotive Materials sample (free download at Marketplace using Launcher), there is a material function called MF_BrakeRotor_Radial_Iron that “fakes” the aniso effect with normals and they provide the textures for the radial part used in the bottom, but there is no texture provided for the lateral. There is a way to procedurally generate both and I was sure that I had them anywhere but I failed in finding them, anyway a little thing that it will not fake of course the the blurry starting to appear moving from center, but even scalling the textures I found the result still good.
It is at least the best you can have for free and not much trouble.
I think you can get anisotropic highlights by writing a custom shading model. You just need to figure out how to fit things in the GBuffer.
Ward’s anisotropic model
https://en.wikibooks.org/wiki/GLSL_P…/Brushed_Metal
Far cry 4 - slides 12-21
https://www.gdcvault.com/play/102223…e-World-of-Far
These ones are for unreal engine
http://oliverm-h.blogspot.com/2013/0…materials.html
https://docs.unrealengine.com/udk/Th…cLighting.html
Yeah problem there is UE4’s cubemaps don’t support anistropic materials. No engine’s does right now. So you’d be stuck with entirely realtime lighting.
I removed my previous posts because I felt that I was just repeating the same thing over and over again. To simplify things:
If you are trying to compute the anisotropy inside the material, you’ll need the light vector; which you cannot obtain until after the gbuffer phase is over or you’ll have to run a second light pass during the gbuffer phase(doesn’t have to be a super complete pass or anything, can be heavily simplified if needed). In which case, you’ll hog a lot more cycles.
If you’re trying to compute the anisotropy during the lighting phase, you’ll need extra gbuffer information in order to compute it correctly. In which case, you’ll hog a lot more bandwidth.
If you don’t want to do either, you’ll have to run the shader in forward. In which case, you’ll pay a very high cost if your model is being lit by many light sources.
But here’s a good read on what I was talking about earlier with having to do two lighting passes (if you want to stick with deferred and don’t want to add in additional gbuffer channels):
Read around page 78.
This is why I suggested just doing it with an MPC because it’s kind of a half-solution. That way the material would have some of the the light’s information and could calculate things, without having to run a second light pass and without having to take the fat gbuffer route. You’d have to run some level BP math to track key lights around the player and average out things like the light vectors, intensities, falloffs, and so on. So you’d be offloading a little bit of work to the CPU and yeah, it can be a little slow at updating the materials this way, but it would probably work.
Started playing around trying to implement anisotropic highlights. Varying the roughness.
Frenetic Pony:
I am going to try and use a modified reflection direction, a method used in far cry 4.
Ironic Paradox:
Thanks for the insight. I think the two lighting pass looks interesting, but looks it is too complicated for me. Maybe I will try out the material approach later.
The problem with the FC4 method is that they use a really weird method for their normals. They pack the normal, binormal and tangent into a 10:10:10:2 format, by using some filtering and converting back/forth with quaternions. It eats a ton of extra cycles and bandwidth, is pretty **** lossy, but allows them to have the information for the lighting pass (it’s method #2 on my list from last post). It’s pretty much like if you had to run three separate gbuffer normal passes, except they pack three sets of normals inside of 32 bits, to do it all in one normal pass, instead of one set of normals in a 24.
If you’re trying to dive into it, I’d suggest checking out the BRDF.ush in the shaders folder. Within it, look for the anisotropic ggx section.
// Anisotropic GGX
// [Burley 2012, "Physically-Based Shading at Disney"]
float D_GGXaniso( float RoughnessX, float RoughnessY, float NoH, float3 H, float3 X, float3 Y )
{
float ax = RoughnessX * RoughnessX;
float ay = RoughnessY * RoughnessY;
float XoH = dot( X, H );
float YoH = dot( Y, H );
float d = XoH*XoH / (ax*ax) + YoH*YoH / (ay*ay) + NoH*NoH;
return 1 / ( PI * ax*ay * d*d );
}
You’d have to do some digging around to verify:
I think the H term is the half vector between the light and the view, so it should be something like H = normalize(L+V) or whatever the variables are labelled as
N would be your normal
NoH would be normalize(dot(N,H))
RoughnessX/Y would be your tangent/binormal vector information
X/Y would be your tangent/binormal surface roughness values
I might have the roughnessx/y and x/y stuff backwards, but it should be the basic gist.
Something along those lines. You’d have to edit the material so that it’s roughness input takes a vector2(making sure to assign the channels to the right variables), as well as deal with the normal non-sense.
And one more thing: The main reason why you need all three normals is because a regular normal just points outward and it’s tangent/binormals would be undefined. Even if you had two of the three, the third could exist in two positions (left or right, 90degrees from it’s counterpart). That’s why you need all three, so that it can “spin” on the normal and have angular directionality for the anisotropy. Deferred rendering just goes by the pixels within the buffers and no longer has access to the models in order to check their tan/bi normals, hence why it takes three sets of normals. This is why it’s usually just done in forward rendering.
Ironic Paradox:
Thank you for the information. I was using Ward’s model in the first image my previous post. I am curious as to where they use this D_GGXaniso function?
As far as parameterization goes I see that some offline renderers use anisotropy and an ‘angle/rotation’ map was wondering if you know anything about that? I think it would be easier to create grayscale maps.
http://support.nextlimit.com/display…ace+Properties
https://blenderartists.org/forum/sho…for-anisotropy
I switched to the GGX anisotropic function.