•      Sign In
• Create Account

# Car Shader

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1dpadam450  Members   -  Reputation: 772

Like
0Likes
Like

Posted 14 April 2013 - 08:30 PM

I'm working on a car model right now and when I finish I want to get a good shader applied to it. I'm trying to get my head around it.

http://www.fotos.org/galeria/data/504/2007-Ford-Mustang-GT-fvl.jpg

What I can't wrap my head around is: It is not just a multiply (modulate) Because:
CubeMap*Black = Black.

So there are parts that reflect 90-100 percent color reflection (Green tree reflection from a black paint, sky, clouds). But yet it is not a 90-100 percent reflection everywhere because you can see there is black when the reflection would not be black. Same thing if the paint is red.

It appears as if surface normals pointing towards your eye appear to reflect less of a cubemap

http://img2.netcarshow.com/Ford-Mustang_GT_2000_800x600_wallpaper_03.jpg

Now in this image above, You see the horizon/tree line reflection in the bumper have no real color. There are some trees reflected in the back by the gas tank area and again they reflect no color.

Sponsor:

### #2dpadam450  Members   -  Reputation: 772

Like
0Likes
Like

Posted 14 April 2013 - 09:00 PM

I guess the view angle is fresnel. But It still doesn't make sense that those reflections are not showing up green in the second image.

### #3Hodgman  Moderators   -  Reputation: 22433

Like
0Likes
Like

Posted 14 April 2013 - 11:59 PM

Yes, the strength of the reflection is dependent on Fresnel (which depends on the IOR/spec-mask of the material), and the reflections are added over all the other shading, not multiplied.

The trees do reflect green, it's just that the reflection there is quite weak compared the the amount of red light that's also coming for those areas, so the subtle green appears washed out in the camera. Keep in mind that the objects in that image are probably objectively 1000 times darker than the sky, when it comes to measuring them as light sources, so in the reflection, you can only really make out the sky and silhouettes of objects blocking the sky.

Car paint is actually very complex to simulate realistically. The most basic version is a white (colourless) specular reflection added over a Lambert diffuse surface -- which represents the wax/clear-coat, and the underlying surface.

In a more involved shader, you've got several different specular reflections -- the clear-coat, the surface of the paint, and microscopic metal flakes (in metallic paints). The first one will be white, but the other specular reflections may be coloured.

-------
clear coat
--------
paint
--------
+  x  \  /  -  x flecks of coloured metals suspended in the paint
--------
more paint
--------
opaque primer
--------
underlying metal surface (not visible)

Edited by Hodgman, 15 April 2013 - 12:05 AM.

### #4MJP  Moderators   -  Reputation: 8525

Like
0Likes
Like

Posted 15 April 2013 - 01:19 AM

If you want to start to understand the basics components that add up to the overall look of that car, then you'll need a crash course in reflectance. Reflectance is determining what light reflects off a surface in a particular direction based on the light hitting the surface as well as the properties of the surface itself. I'd recommend reading through this course from SIGGRAPH 2006, or the intro to this course from SIGGRAPH 2010. Real-Time Rendering 3rd edition also covers a lot of the same material, if you have access to that.

For perfectly smooth/mirror surfaces that produce non-blurry reflections (such as the top layer of car paint) the reflectance is mostly governed by Fresnel's laws. You have some light that reflects off in the perfect reflection direction, and some that refracts into the surface. The amount reflected depends on the properties of the material as well as the incident angle of the reflection, but in general the reflection amount will increase as the angle of incidence increases. This is why the reflection on the car is stronger at glancing angles, where the reflected light is nearly perpendicular to the surface normal.

The rest of the look of car paint comes from the light that refracts into the surface and then comes out again. Some of it might be scattered inside of homogeneous media, partially absorbed by pigments, and then leave the surface in many random directions. This light is usually modeled by simple diffuse terms, which aren't view-dependent. Some of it may also hit the microscopic metal flags that Hodgman referred to, which produce "blurry" specular reflections due to the random orientation of the flakes in the material. This sort of phenomena is typically approximated with microfacet BRDF's, which model a surface being made up of tiny fresnel reflectors whose normal directions are distributed about the overall surface normal according to a probability distribution function

So like Hodgman said...it's a bit complicated. I would suggest getting the mirror reflections with fresnel working (use schlick's approximation) combined with some basic diffuse, and at that point it will start to look like a car.

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS