Download

Creating a carbon fiber shader?

Hi all

I’m sure this is a simple answer. Basically I want to create a latered carbon fiber shader. One shader being a normal mapped carbon fiber. The second being a gloss coat with NO normal map. I want to blend the two with a lerp using Fresnel.

Im very new to unreal but I think I have two routes.

A clear coat shader. My issue here being how to have a normal map for one layer and no normal map for the other?

Second route is a layered shared, however I am having issues here also.

Attached is a screen shot of my layered shader.

shader.JPG

Any help on this would be hugely appreciated.

Many thanks Will.

This actually requires a code change. Current clearcoat only has ONE normal map. You could fake the bottom one by just using a manual cubemap but it will not respond to lighting changes or shadowing or dynamic lights with that method.

To get accurate lighting from both layers you need to add a new input into the Gbuffer to get the second normal map and modify some shading model code.

I actually have this working in a local build and talked a bit about it in this thread:
https://forums.unrealengine.com/showthread.php?4107-Interesting-post-from-AnswerHub-on-how-to-setup-a-Layer-Car-Paint-shader&p=393800&viewfull=1#post393800

There is a decent chance that this feature will be integrated next year sometime around Jan/Feb (it is shelved and needs code review by a dedicated rendering engineer). If you don’t want to wait I suppose I could post the necessary code.

You’ll need to use this method.

https://www.youtube.com/watch?v=lV-Ql1zqMCM

This isn’t for Tesla Motors is it?

Hi both

Firstly thank you very much for your replies. Its a great help and gives me a starting route. Its also goodto see this may be introduced as standard in a later version of unreal.

Its a shame how complicated it looks like it is to create what, coming from Vray and Unity (skyshop+shader forge), it seems really easy to create this type of shader. Im very new to unreal so probably everything seems a bit more complicated for now.

Anyway, thanks again for the help, much appreciated!

Cheers

Will

SO after watching this tutorial the result is not exactly correct. He is masking based on the clear coat reflection values which is not correct. its why out side the horizon line the shader looks like it has no clear coat. Thanks you for posting still though, it was a good watch.

That material is just a very basic trick, the top layer is a simple manual cubemap in the shader. That means its basically unlit as far as shading goes, the clearcoat has no specular from lights in the world and will not respond to any environmental changes or screen space reflections. It is a trick that may work for a simple scene like a garage though. To use in a game would be difficult since the cubemap would have no parallax and it would appear not to move past reflections.

With forward rendering this is very easy since you can just access light vector in any material and write any custom response. Same for offline rendering. With deferred, you have to pass everything you may want to do with lighting into one giant material essentially, so every little feature drags down the speed of the whole ship. With forward it is different since you could have just one super crazy lighting material and it wouldn’t spread its cost elsewhere. But generally deferred gets us more flexibility for lighting and helps in many other ways.

https://youtube.com/watch?v=mH6DnSk1KEA

This is my results with 4.11 (with fake clear coat).

And, I wanna say that current ClearCoat model with ONE normal map input is useless in many situations, you need to make separate normal input for ClearCoat layer, or just simply use geometry normal for it as an option.
I wounder why is it not implemented in correct way. I assume that it is very easy to implement and should be not more expensive.

I did these code changes a while back but they have not been integrated into the main branch yet. They were used for a recent mclaren GDC demo though so that means there is a good chance it will be merged back to main.

https://www.youtube.com/watch?v=0oZfvoG6qYQ

Jump to around the 1:42 mark.

There is some cost. The second normal has to be converted to an octahedron and written to the gbuffer data and then converted back in the deferred side. The cost is not crazy but is there. And then it uses up the only two remaining gbuffer channels so you pay some cost in flexibility as well. For that reason it was implemented as a project setting.

Here is a shot showing how it can mimic anisotropy fairly well:
2016-03-10.png

2016-02-11.png

We also used the bottom normal to add some very subtle flakes to the bottom coat. This was used in conjunction with some roughness variation textures that were jittered with camera motion. We had photos from actual samples to tweak from like this which was pretty neat:

2016-03-02 (1).png

keep in mind the sparkles on our material were scaled way down since were were mapping to a car, not the tiny sample models that were in the reference photos. What is shown there is something a bit in between and they had to be scaled down way smaller for the final 4k demo resolution.

By using the jittered roughness mask as a very minor basecolor mask, we could give the sparkles some coloration as well. It was a bit of a trick that worked but you have to look very close to the 4k tv to see it.

Hopefully this will get merged to main for 4.13 or so. If anybody is dying to do it before then we could probably post the changes somewhere like github.

Your McLaren video is great! Awesome scene setup.

This is my carpaint flakes WIP shader.
https://youtube.com/watch?v=A5l4qSl6sOM

Can you tell us or upload somewhere how you change source of ClearCoat to add second (or just vertex normal) input for normal?

Hello, Im trying to make a car paint shader in UE4. Turning on the forward renderer destorys the clear coat duel normal shader model so i want to use a similar technique to the one in the video. Can you please advise to what you meant by “With forward rendering this is very easy since you can just access light vector in any material and write any custom response”

Hello, Im trying to make a car paint shader in UE4. Turning on the forward renderer destorys the clear coat duel normal shader model so i want to use a similar technique to the one in the video. Can you please advise to what you meant by “With forward rendering this is very easy since you can just access light vector in any material and write any custom response”

Hello, Im trying to make a car paint shader in UE4. Turning on the forward renderer destorys the clear coat duel normal shader model so i want to use a similar technique to the one in the video. Can you please advise to what you meant by “With forward rendering this is very easy since you can just access light vector in any material and write any custom response”