PDA

View Full Version : Car paint with nodes



Thomas M.
10-08-2008, 05:30 AM
Hi,

I'm still on 9.2 and wanted to make a node tutorial for beginners. Actually I got of track and started to develop a car paint shader. I don't know how good the one in 9.5 is, but usually I like to have total control. This is just a start. I'm not responsible for the model (sorry, can't credit the modeler), only the paint. If there is someone who can point me to docs describing the reflectance values of the metal coating, clean coat or give me additional information about the nature of car paint I'll be more than happy to add these into the node tree. If someone is willing to host a video, I'll make one as soon the shader is more or less finished. Some samples are attached. Only HDR lighting with fprime.

Cheers
Thomas

Thomas M.
10-08-2008, 05:35 AM
Here are the pics with a racetrack hdri.

Thomas M.
10-08-2008, 05:39 AM
... and two more with an alley hdri.

3DGFXStudios
10-08-2008, 07:26 AM
you need to fix your smoothing angles to get rid of all the strange reflecting edges...

SplineGod
10-08-2008, 07:34 AM
I would host the video here:
www.vfxcast.com

Thomas M.
10-08-2008, 07:36 AM
Thanks, Larry.

The smoothing angles don't matter to me right now too much. I just needed to have a car shaped object to check the general behaviour of the node shading. But I'll check next time what's going on there.

MooseDog
10-08-2008, 09:01 AM
Wikipedia: BRDF (http://en.wikipedia.org/wiki/Bidirectional_reflectance_distribution_function)

hope this helps. lots of talk of vectors, reflectance, irradiance and surface normals. seems to be the sort of stuff nodes do reallt well at.

SplineGod
10-08-2008, 09:03 AM
lions and tigers and vectors oh my! ;)

Thomas M.
10-08-2008, 10:14 AM
Anybody tried to simulate this stuff properly in LW? I guess if one could get hold of the reflectivity numbers and diffuse amounts it should be possible to get closer than just trying. Maya does have these shaders, right? How does the LW shader compare? Is it just layered energy conserving reflectivity + diffuse + Fresnel and a few flakes or is it better?

MooseDog
10-08-2008, 11:12 AM
personally, i'd be willing to bet that if newtek released a shader called cook-torrance, the coders, or at least somebody, did the in-depth research on the math.

there's always the possibility that your own research could lead you to something better or different. the community benefits, just like your hi-res tutorial (which i've referenced and used several times!). (as far as trying it myself, 1+1=3, right? :) )

Tobian
10-08-2008, 11:20 AM
I did something similar a while back on Preset Central http://www.presetcentral.com/preset/browse/ download it and see what you think. It's mostly energy conserving, but you do need both reflection and specular lights to make it properly work.

I did briefly experiment with reflection based specular noise, but it's tricky to drive the reflection noisiness additively, in a realistic way.

It's pseudo energy conserving, as the sprinkles are additive to the whole thing, but they could be tied in to the diffuse channel if you wanted.

Thomas M.
10-08-2008, 11:36 AM
Hi Tobian,

I did indeed take a look at your shader. What I missed is a second reflective surface beneath the coat. I included this in my shader tree. In order to get different reflective amounts on each layer (different blur) I set reflection to 100% and used mixer nodes with black in the foreground to control the amount via gradients.

I wonder if somebody measured the reflective amount of the outer coat and put the data on the web. The clean coat seems to be the smaller trouble.

Tobian
10-08-2008, 12:13 PM
Ahh ok, though I expect that will be pretty slow GAH! :)

Have you experimented with reflection interpolation/layering several Delta based surfaces?

Thomas M.
10-08-2008, 02:20 PM
No materials shaders here, just simple nodes as it's still 9.2 I'm using. so the interpolation isn't available anyhow.

Thomas M.
10-09-2008, 03:34 AM
Just found this paper:

http://www.graphics.cornell.edu/pubs/2004/WLT04b.pdf

Tobian
10-09-2008, 03:57 AM
Interesting, though also a bit over my head. Graphs are one thing, mathematical formulas are another :D I guess it would be quite possible to recreate many of the other shading models within LW, but you'd likely to have to hand-code your shader to match those mathematical formulae (such as the various diffuse and specular shading models now in LW.

Recently I spotted a node which had some drop down (preprogrammed) Fresnel values for transparent materials. it would also be nice if you had some metal values as well, so you could just plug them into your Fresnel node, and pug that into reflection, and voila simple metals :)

While I only really glossed over it, that paper didn't seem to deal with the physical modeling of 'gloss coats' and how one would be added to another. My gut reaction would be you would simply 'screen' them together (as in Photoshop screen) as additive would result in values above 100%, which of course is none energy conserving. then take the inverted outputs of both and feed that into your diffuse model, which would lower that diffuse further. It would seem excessive to have 2 seperate diffuse shaders combined. There's further complication, as we don't know what the physical properties of paint are, especially since paint with flecks in it also has a thirtd specular/reflectance model, and the issues of normals.

My Sprinkles shader has such a model actually http://www.presetcentral.com/preset/81/ with 2 separate reflectance models, one for the gloss coat, and one with modified normals, for the incidence/anisotropy effects of particulates suspended in the paint. It's probably a bit of a hack, but might give you some ideas?

gerardstrada
10-09-2008, 03:52 PM
Several optical effects that happens at microscopic level are better achieved in CGI by faking the final effect (with tricks/gradients/available shaders). But knowing the nature of the phenomena can help a lot.

About the fresnel effect in the document linked for example, we can see those curves (fig. 1) for dielectric and metal materials and they are clearly representable through LW gradients. Settings would be something like this:

Dielectric:

1st parameter: Value:100% / parameter: 0.0
2nd parameter: Value: 50% / parameter: 10
3rth parameter: Value: 10% / parameter: 30
4rth parameter: Value: 4% / parameter: 60
5th parameter: Value: 3.3% / parameter: 90

http://imagic.ddgenvivo.tv/forums/reflections/dielectricgradient.png
Notice the effect is pretty similar to real LW dielectric material


Metal:

1st parameter: Value:100% / parameter: 0.0
2nd parameter: Value: 58% / parameter: 10
3rth parameter: Value: 60% / parameter: 30
4rth parameter: Value: 52% / parameter: 50
5th parameter: Value: 62% / parameter: 90

http://imagic.ddgenvivo.tv/forums/reflections/conductorgradient.png
fresnel effect is very similar to real LW conductor material

Btw, you might want to look for the term Iriodin. I've had access to some privileged documentation of Merck about 2 Schicht-Lackierung. Papers (from 1983) are very extensive and there's not much info about optical parameters, but there's info about the nature of how these pigments work out. This product provides that pearlescence finish in automotive paints.



Gerardo

Tobian
10-09-2008, 04:22 PM
Intriguing, and yes, I love the maths Fresnel function, just a shame it doesn't have some 'presets' for various dielectric and metalic surfaces, or a node which does that :)

Incidentally what settings did you use for conductor there?

gerardstrada
10-09-2008, 04:59 PM
Since purpose was only fresnel reflectance, I played only with a greish color and Specularity: Color Value 140, Specularity: 100% (uncheck orenayar) and gamma corrected the output (2.2).

Btw, is possible to mix/adjust LW materials with the so useful Material Blender node form Michael Wolf (Very useful for customized car paint shading).



Gerardo

gerardstrada
10-12-2008, 08:13 PM
If there is someone who can point me to docs describing the reflectance values of the metal coating, clean coat or give me additional information about the nature of car paint I'll be more than happy to add these into the node tree.

Some notes from Iriodin documents could be useful for your car paint shader (or for anyone who need to setup a carpaint shader):

Pearlescent pigments were initially made with herring flakes. Nowadays this effect is made with inorganic pigments. Microscopically, the pigment core is like tiny plates/flakes of transparent mica, a substance of low refractive index (1.5 - 1.6), surrounded by a transparent metal oxide or oxides, which have relatively high refractive indices, in the order of 2.5. The end result is a platelet shaped pigment of a totally inorganic structure that possesses a pearlescence and/or iridescence perspective, similar to what we see in nature (pearls, insides of animal shells, the skins of insects, feathers of birds and so on).

This effect is conformed through several layers/mixtures:

-----------------------------------


Clear -coat (about 30 Ám)


-----------------------------------
Metallic-base coat/ Mica-base coat
(about 15 Ám)

-----------------------------------
Filler (about 10 Ám)
-----------------------------------
Primer (about 10 Ám)
-----------------------------------
Corrosion Protection (about 10 Ám)
-----------------------------------


for CGI, we could recognize 3 components:

-Clear coat (dielectric component)
- sourrounding transparent metal oxide and flakes of transparent mica (it provides the pearly finish - might be dielectric/conductor material mix)
- substrate layer (the paint-matte color of base)


For us, the resultant general color, means that a white substrate color overpainted with a paint containing only a white pearlescent pigment results in a pearlwhite paint. However, if the substrate color is for example red, and we paint the same white pearl paint over it, the resultant color observed will be a pearlescent pastel rose colour. With a black substrate color, the result will be a metallic silver. then, we can assume the relationship between these layers is additive (screen mode, as Tobian has pointed out).

According to the documentation, final effect of pearlescent pigments depends exclusively on the unblocked passage of light through the pigment, the refracting of the light at each laminate layer (composed by parallel plates), the back reflection at each layer boundary, and most importantly the color of the reflected light radiating from the substrate.

Interference pigments change from one colour to the other by varying the angle of viewing. Complementary color change. However, when they are painted over a coloured substrate or are mixed with other colors, only the interference color will predominate in a very strong way, additionally to the color with which it's mixed.

In the pearlescent/iridiscent phenomena, a constant alternation between low and high refractive indices is important. Especially since the outer layer of the pigment is of a high refractive index and the paint substance that will eventually encapsulate the pigment must have another degree of refractive index to maintain the effect's balance.

The level of the glossy effect (shiny or silky) can be determined through the size and distribution of the particles (tiny plates) of the pigment that we indeed can see in car paints (this could be achieved by Crust procedural texture, maybe). The thickness of them is in the order of 0.4-0.5 Ám (0Ám for our purpose) and their width and length can be as large as 5-200 Ám.

Larger the diameter of the particle, less hiding power (opacity) of the paint, but high glossiness (lustre). Now, smaller sizes (5-25 Ám) produce a silk finish; the medium (30-100 Ám) satin to high gloss finish; the very large (100-200 Ám) glitter or flitter effects.

In automotive colors, particle size ranges of 5-25Ám and 10-40Ám are commonly used. These two particle size distributions allow the achievement of optimum results with regard to lustre and hiding power. 10-40Ám exhibit better pearl lustre, but less hiding power (opacity) than 5-25Ám. Here however the lustre is reduced.

About colors composition:

-Silver white pigments are made with mica and titanium dioxide. Darker the substrate layer, more cold and metallic the specular reflection.
-Structure for interference pigments are the same that silver white pigments, but the titanium dioxide layer (about 2.5- 2.6 IOR) is thicker. In this way we get a spectrum, in which is possible a positive interference of visible light waves. Defined thickness provide interference pigments of determined colors.
-Golden or metallic pigments are in fact not metallic, but they are amazingly similar. Golden pigments are composed by a mica core covered by a layer of titanium dioxide and another of metal oxide.
-Green pigments are composed with mica and a layer of chromium dioxide and another of titanium dioxide.
-Bronze, cooper and red pigments are composed with mica and metal oxide.

Lustre in silver white pigments is higher than the other ones. In practice however, a typical automotive 'mica finish' contains the following components:

-Pearl lustre pigment (about 60%)
-Transparent organic or inorganic pigment (about 35%)
-Carbon black (about 2%)
-Possibly aluminium pigment (maximum 3%)

The ratio of individual componets may vary. In some cases, where the effect of pure pearl lustre pigment is desired (or other special effects), it's necessary to apply a three-coat-finish. This means a high-hiding (very opaque) plain shade has to be applied on the filler. On top of that plain shade, the base coat (which contains only mica pigments) is sprayed, and finally the clear coat.

The automotive mica color three-coat-finish scheme would be like this:

-----------------------------------

Clear -coat

-----------------------------------

Mica-base coat (only mica pigments)

-----------------------------------

Solid-Color

-----------------------------------
Filler
-----------------------------------
Primer
-----------------------------------
Corrosion Protection
-----------------------------------




i hope you do a blog one day Gerardo :)

By the extension of some of my posts, that would be too expensive :D



Gerardo

Thomas M.
10-13-2008, 02:38 AM
Thanks so far to everybody.

I just wanted to post my current set-up. Sorry for the handwriting, but my Wacom is fixed to two screens currently, so it looks a bit strange. Any questions are welcome. The main idea is to set reflection to 100% and change the amount of reflectivity per layer via a mixer node.

Cheers
Thomas

Tobian
10-13-2008, 07:43 AM
That makes my eyes hurt :D I would have thought it was better to use a cook torrence specular shading model as this is more physically accurate. Also while Dponts Fresnel is cool, I am not sure what benefit it has over the maths->scalar->Fresnel node, ot looks physically similar in the preview.

Not sure what the benefit of making your reflectance is 100% and toning the reflection shading via the reflection colour, but then it's probably 6 and 2 3's :D

You're also going to have to look at a way to simulate the micro-particle colour shifting phenomenon, probably just an incidence/Fresnel driven colour banding. The problem I usually had with that was choosing the colours, as there is no pearelscent node. Actually that might be a project for someone - a pre-made 'rainbow' gradient, but meant to be physically accurate, like the thin film shader?!

Thomas M.
10-13-2008, 08:38 AM
I felt that cook torance just looks awful, though phong alone is much too smooth (corrected via function). Phong nicely spreads over the whole car in backlight conditions, blinn just stays too small and sharp.

Since the amount of reflection isn't part of the reflection node, I don't see any other way to set the reflection amount for each layer individually. Any suggestions though are welcome.

The color shift isn't included yet. That's true.

gerardstrada
10-14-2008, 04:04 AM
ISince the amount of reflection isn't part of the reflection node, I don't see any other way to set the reflection amount for each layer individually. Any suggestions though are welcome.

The color shift isn't included yet. That's true.


Yes, reflection node should have an intensity parameter as well. The only - limited - way that I know to adjust this, is by driving the reflection amount with the TintReflections parameter (white=100% / black=0%). We can input a reflection node into specular shading (and don't need 100% on reflection channel), but is not recommendable for multipass rendering or if you are planning to input a gradient there, for the iridiscent effect.

Your specular setup looks interesting (have to look into it with more detail), and the 'amount of light beneath coat' part looks smart in your current setup, but do you think the clamp node is really needed? (assuming the gradient go from 255 to 0). I've noticed Screen mode brings odd results with floating point values in reflection nodes mix.

Btw, according to what we can see in the Iriodin documentation, the parallel flakes has a back reflection at each layer boundary, by depending on their size and distribution, they provide (besides other effects), that soft reflections appearance. This effect is less notorious at glazing angles, and as far as I understand from the documentation, it's inherent from this coating. If we assume the Reflection Paint node is the metallic/mica reflections, and the Reflections Coat node is the Clear Coat reflections, the effect mentioned before might be achieved with an incidence angle gradient in Blur parameter in Reflection Paint node, maybe.

For the diffuse setup part, do you think it would viable in your current setup, to drive the substrate color by the OrenNayar shading, and the color of the mica/metallic coating by the Lambert shading? diffuse shading for clear-coat wouldn't be necessary, I guess.

Interesting car paint setup so far.



Gerardo

Thomas M.
10-14-2008, 05:42 AM
The color reflection way you described doesn't work here, as the colors needs to simulate the metallic effect, describe a quality of the reflection and can't be used for the amount of reflection.

The two diffuse layers are just there to experiment which shading model works better.

Cheers
Thomas

benhaines
10-20-2008, 09:05 AM
For anyone else looking for car presets... these are the two PresetCentral.com has sofar:

http://www.presetcentral.com/preset/140/

http://www.presetcentral.com/preset/132/

Thomas, any chance you'd be prepared to share the preset on PresetCentral.com?

Thanks