x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Translucent Material Function - Layered Car Paint Shader

Hey everybody,

I am building a multi layered car paint shader, which includes three layers: Base coat, metallic, and clear coat. So far I have made good progress on the first two layers. The one that is giving me trouble is the gloss.

I am unable to make a translucent material function, to act as the clear coat, which will be blended on top of the other two layers.

When I plug in vector for opacity in a material function, it does not affect the transparency. Normal materials require you to change the blend mode in the details box of the shader, to create a translucent material. There is no translucently drop down in the details box of a material function. Is there a method could use to make the material function behave as translucent glass?

Product Version: Not Selected
Tags:
more ▼

asked Apr 15 '14 at 03:29 PM in Rendering

Stimpanzee gravatar image

Stimpanzee
24 2 5 8

Jacky gravatar image Jacky ♦ Apr 15 '14 at 03:39 PM

You can't get that coating effect by merging translucent and opaque in the same material. You'll have to fake it in the same opaque material somehow.

Stimpanzee gravatar image Stimpanzee Apr 15 '14 at 07:26 PM

Interesting, I was hoping there was a stock way around it. I did discover a technique using a seperate piece of geometry for the clear coat. Once I get home I'll do some tests and post up some images. It was looking promising!

Jacky gravatar image Jacky ♦ Apr 15 '14 at 07:32 PM

Yeah, you can use a duplicate of the mesh on top of the original one to give the coating effect but it would require some crazy work to do for a whole car. :\

What does your material setup look like so far?

Stimpanzee gravatar image Stimpanzee Apr 15 '14 at 09:11 PM

It's interesting, because I am using the same geometry with the painted materials, added the clear coat shader to it to the duplicated geometry, and there hasn't been any of the negative effects I would have expected. No Z fighting or other artifacts.

My shaders are a little messy because of all the experimenting. Eventually I will clean them up and optimize, add parameters for instancing as well. alt text This first shader is the gloss clear coat, being added to the duplicated mesh. It's fairly simple with added grunge and orange peel normal map. alt text This second material is handling two shaders, the base color, and a metallic shader for the paint flake. The individual flakes are being driven by the alpha blend. I was originally going to use this layering technique for the entire shader, but because the clear coat didn't work out, I think I will condense these three shaders into one material. Although blending two materials into a third makes adjustment simpler, I don't think it's worth having all the materials separated.

glossshader.jpg (222.2 kB)
othertwo.jpg (303.7 kB)
Stimpanzee gravatar image Stimpanzee Apr 15 '14 at 09:20 PM

alt text These are the results so far. Still needs a lot of work. But I think I will be going forward using this technique. If I get it looking good enough, I'll put together a tutorial for my process.

withbothshaders.jpg (294.3 kB)
Jacky gravatar image Jacky ♦ Apr 15 '14 at 09:36 PM

Have you considered using Fresnel? You can have effects like these and push the reflections to the edges if you play around with it:

alt text

alt text

You can also use your flake texture again as a mask to Lerp between that fresnel roughness branch and another value.

Edit: The bike looks awesome, btw. :)

carpaint_1.jpg (115.4 kB)
carpaint_2.jpg (116.4 kB)
Stimpanzee gravatar image Stimpanzee Apr 16 '14 at 03:34 PM

Cool! I will have to give that a shot today.

And thanks on the bike! I am developing a Cafe Racer game. I'm keeping up a blog here: caferaces.com

Stimpanzee gravatar image Stimpanzee May 02 '14 at 01:57 PM

I've not had much time to work, but I have been able to produce some good looking results! The fresnel helps complement the look of some of the features. alt text

full.jpg (293.9 kB)
(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hey man,

this looks quite cool (but also familiar if you followed the Marmoset Toolbag2 discussions over on polycount^^)

Actually I am working on the same thing as you so I just wanted to share some thoughts. :)

First of all, I think your shaders look really nice and you have been able to really stretch what is possible with translucency right now. I also tried it, but I threw it away for the following reasons:

-no good reflection support for translucent materials (no caption actor blending + low rez quality, no SSR support) -no support for specular highlights from light sources

The specular highlights together with SSR are the most important things not working atm, so I never really got the desired results. However, I would like to get back to it as soon as has Epic upgraded their translucent shader model to be rendered forward so we will get all this working.

However, this will also make it way more expensive because of the second rendering pass.

So I tried my second way with which I was able to get very convincing results. However, please note that the paint shader is far from being finished (actually I am way further down the road than you will be able to see in the images, so I have to update the thread :D)

Feel free to check out my post over at the Unreal forums to see my results:

https://forums.unrealengine.com/showthread.php?2945-Material-testing-and-car-rendering

What I tried with the second technique is quite interesting to work on and its also a lot of fun :D Basically I mask the roughness with fresnels and flake textures and also some fresnel on the base color and metallic to get the impression of multilayered carpaint.

So I have flakes that have super low roughness to give that sharp reflection, and they also add to the metallic and the in betweens have a higher roughness to give that more smooth feeling combined with fresnels and clever masking.

As mentioned, the screens are a bit outdated, but you can see in which direction it is going. ;)

Would love to get some feedback as well and will update the thread soon with new stuff :)

Cheers!

more ▼

answered May 05 '14 at 03:33 PM

Daedalus51 gravatar image

Daedalus51
61 2 3 7

Stimpanzee gravatar image Stimpanzee May 05 '14 at 05:10 PM

Hey there,

I'm glad to hear that I'm not the only one hitting walls while creating car paint shaders. I haven't had much time to condense my multi-layerd shader into a singal shader, but it does seem like a strong method for getting, good looking results at the moment.

I don't have the chops for coding my own shaders, but I like the idea of using multi layered shaders to simulate car paint. I believe it is the correct path for simulating the most accurate surface. Using the physically based rendering system to its fullest.

That being said, the limitations of the stock shader systems is preventing the material from reaching the point where it is: versatile, performs well, and reflects light correctly.

My shader system's greatest shortcoming is real-time reflections on dynamic lights. Because the 3D capture actor doesn't update in real time, reflections with dynamic lights are pretty much impossible - at least with my limited knowledge of the engine right now.

I know Forza team did not use real-time reflections for their entire paint shader. They used blended capture maps for all the undercoats. The only surface that used real-time reflections was their clear coat.The session about Forza shaders at GDC 2014 by Arthur Shek was extremely enlightening. If you have access to the Vault, you should definitely give it a watch.

Right now I'm working with what Epic is offering, but I agree with you: to get these shaders really looking right, we need the translucent materials to be improved. I imagine it will take some time for that to happen. But I have faith in the UE4 dev team. UE4 has given us so much cool new stuff to work with, I don't mind waiting for a bit, or taking the initiative to start coding my own shaders.

Good luck with your project! I will keep an eye on your post and any progress you make.

Best of Luck!

-Vince

Here is a shot of my latest progress on my material.
alt text

newfull.jpg (501.3 kB)
Ixiguis gravatar image Ixiguis May 05 '14 at 06:32 PM

Regarding real time reflection, yes it is possible!

Add a Scene Capture Cube component to the vehicle actor.

Create a TextureRenderTargetCube on the content browser, and assign the Scene Capture Cube component to update that texture.

On the material, add the TextureRenderTargetCube and as its UVs, add a Reflection Vector node. Connect this texture to the material's Emissive.

There is an example of this in the Content Examples, I think it's on the Reflections map.

Stimpanzee gravatar image Stimpanzee May 05 '14 at 07:25 PM

Awesome! Similar to Unreal 3 then. I will have to give this a shot sometime soon. Thanks!

I need to play around with the content examples more often.

Ixiguis gravatar image Ixiguis May 05 '14 at 06:33 PM

Oh, I forgot to mention: in a full scene, this is very heavy for performance. I'm using 64 for my cube capture size (default is 256) and the performance drop is noticeable.

Daedalus51 gravatar image Daedalus51 May 05 '14 at 06:46 PM

Hey man

thanks a lot! I still think your stuff looks awesome for what can be achieved right now, but you are totally right with the shader limitations.

However, dont get confused with the layered materials ;) Its not a multilayered material^^ Epic uses this term because they layer multiple material functions that have features of real materials into one material, but its actually quite far off of a multilayered mat^^ (you can basically just lerp them on a per pixel level, but you can not really do see-through stuff)

Like you encountered as well, you can not use different base shaders. A real multilayered BRDF however can do that because it can calculate transmission/translucency in one layer and can then render different shader characteristics below it.

Most of the newer car racing games do exactly that: they use a layered BRDF. There is also stuff on the net about this...TriAce for exampled shared some research papers on multilayered BRDFs and David Miranda was able to custom code HLSL shaders using their approach for Unreal 3. However, UE4 doesnt support custom lighting due to g-buffer constraints/limitations, so the actual shader slots (opaque, translucent etc.) are hardcoded. You could for example drop one of these and implement your own custom BRDF, but that requires quite some sick knowledge of that stuff xD

And btw...IMO I dont think that the cars in forza look that good^^ Their paint shader is pretty weak compared to others and the cars still have that kind of plastic feel to them, so I dont know what exactly they are doing wrong/different^^ I would say that GT has way better paint shaders and they even looked better on PS2. What I would aim for now when it comes to quality is definitely project cars, that thing just always blows my mind when I see it :D

Thanks a lot for you feedback and opinions! Highly appreciated! :)

PS: what you could do for realtime reflections, add render to texture to the player vehicle (only this one^^) but thats very cheaty

Stimpanzee gravatar image Stimpanzee May 05 '14 at 07:48 PM

Thanks for the detailed info. I am by no means, a shader guy. I have a lot to learn with materials and UE4 in general.

I don't know if I would ever have the drive to learn the skills to code my own layered BRDF system, but I sure wouldn't mind having one. I'm curious what the performance cost some of these modern shader systems are.

Gran Turismo has always been my favorite as well. It's quality and attention to detail is pretty much unmatched.

Daedalus51 gravatar image Daedalus51 May 05 '14 at 06:57 PM

Hey man,

just a small update, this is where I am at right now with my paint shader. Just keep in mind that this is showed on a unfinished highpoly model with superbad quick UVs :D (flakes texture has stretching etc^^) alt text alt text alt text

Jacky gravatar image Jacky ♦ May 05 '14 at 07:13 PM

Just for the sake of contribution i gave it a go and here's the results;

alt text

alt text

and two more here;

https://www.dropbox.com/s/lo143tqa7lkshee/paint%20%281%29.jpg https://www.dropbox.com/s/mbaff6xqrr44vov/paint%20%282%29.jpg

And the material setup;

https://www.dropbox.com/s/onrx3pwebrak7p5/carpaint_3.JPG

I'm not sure what you mean by real time reflections from dynamic lights not working though, Stimpanzee. Screen space reflections work as expected with dynamic objects, sometimes you may see black surfaces because of the screen space behaviour when you use fully dynamic lighting. You may also consider using a skylight too, and even go for LPV if you havent tried it already.

Stimpanzee gravatar image Stimpanzee May 05 '14 at 08:06 PM

These shots look awesome! 60s Challenger in the desert, very cool. Edit: 1970 Challenger

I tried a similar approach with my shader, initially. What I wasn't able simulate a convincing flake sparkle without a layered material. Adding a normal map to the flake gave the entire surface a bumpy appearance. Although, it might be possible to use a fresnel on the normal map to achieve the sparkle on the flake, but not to give the entire surface a bumpy appearance. I will have to play around with that concept some.

I need to do more research and testing for reflections on transparent materials. I have received a lot good information on this post. Now I just need to do some experimenting.

I definitely need to look into LPV. Real-time GI is something I would love to implement.

Thanks, -Vince

Jacky gravatar image Jacky ♦ May 05 '14 at 08:22 PM

I actually thought about the normal map but i'm not sure if it is worth it. you need a normal map with high enough resolution that particles would be visible at 1:1 scale. And then when you tile it enough times to get the metallic paritcles look it may start to get blurry and not worth using it. Some more modification can be done to the roughness noise map to get that sparkly look though but i dont have anything in mind yet. I'll keep posting as i find out more about this.

Btw, you guys may want to keep this thread updated too since not everyone follows AnswerHub:

https://forums.unrealengine.com/showthread.php?4107-Interesting-post-from-AnswerHub-on-how-to-setup-a-Layer-Car-Paint-shader

Stimpanzee gravatar image Stimpanzee May 06 '14 at 08:13 PM

I agree. The sparkle effect on a typical metallic paint is fairly negligible, at least with my testing so far. I have to keep testing myself but generally you wouldn't be able to see the effect unless the camera was extremely close to the surface.

On the other hand, the sparkle effect on large flake paint should be obvious and embellished. Notice the flake in this image, of a flaked hotrod. alt text Aluminium flakes in the paint are reflecting light where there are no highlights in the clear coat, indicating that the flake's surface angle is irregular. In the flesh, the sparkle effect is pronounced. This is the effect I'm looking to emulate.

Thanks for linking the thread on the forums, Jacky! I didn't know about it. I will begin to update my progress there. This post has gotten a little complicated to follow.

Jacky gravatar image Jacky ♦ May 06 '14 at 09:00 PM

Oh, now i see how it can be worth it. I've been thinking of modern car paints with smaller flakes which tend to be more uniform. :) In this case you may want to consider creating the normal map of a galvanized metal surface, which can give the irregularity we see here i think, and mask it with a cloudy alpha to randomize the tiling. But we still need to figure out how to get rid of the normal bump in larger angles.

Stimpanzee gravatar image Stimpanzee May 15 '14 at 02:37 PM

Here is an image of my most recent progress. More to see at: https://forums.unrealengine.com/showthread.php?4107-Interesting-post-from-AnswerHub-on-how-to-setup-a-Layer-Car-Paint-shader

alt text

Edit: Fixed the link!

Stimpanzee gravatar image Stimpanzee May 05 '14 at 07:49 PM

Looks good! I would love to see what it looks like being rendered on my machine. Pictures don't do it justice.

Jacky gravatar image Jacky ♦ May 05 '14 at 08:08 PM

I think he means the following...since he is using the translucent second shell, he doesnt get SSR because they are not supported yet...so it looks like no dynamic stuff is reflecting ;)

Ahh, ok. :)

Glad you like it guys. I'm not going for a metallic paint originally(you can see more here: https://forums.unrealengine.com/showthread.php?3980-Vanishing-Point-(Not-the-97-remake!) ) and while HDR looks good, it ruins the interior lighting so i eliminated both the skylight and ambient cubemap and now i'm using LPV for lighting and it will look even better when the environment gets more crowded. :)

Daedalus51 gravatar image Daedalus51 May 05 '14 at 08:15 PM

If you mean mine, just right click them --> show image, then you will at least get the full rez :D

Daedalus51 gravatar image Daedalus51 May 05 '14 at 07:25 PM

I think he means the following...since he is using the translucent second shell, he doesnt get SSR because they are not supported yet...so it looks like no dynamic stuff is reflecting ;)

BTW...nice results Jacky! would love to see this without this crazy post and a nice HDR image ^_^

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question