3 views

Uploaded by Wagner de Souza

Oat-Tatarchuk-Isidoro-Layered Car Paint Shader Print

- 3DCreative Magazine Issue 004 December 2005
- Textures Mapping
- Log Isaac
- Texture Mapping
- Gradient 9-5 and 9-6 Mo
- FBX Exporter User Guide
- Assassin s Creed 4 Digital Dragons 2014 No Notes
- Geographical Information System
- 9780240809533_cs
- Control Charts
- Dx9Optimization
- fxaa_readme.txt
- Glsl Chapter 1
- Creo 2.0 Books With Multi Course [Hrs].pdf
- Recommended Settings X-Plane10
- ISCEbutnotInsarApp
- Shao-Hung
- Liste Touts Les Tutus
- Aaditya,Danu,Ritika
- Computer

You are on page 1of 5

Chris Oat Natalya Tatarchuk John Isidoro

ATI Research ATI Research ATI Research

Figure 1: Two-tone, suspended micro-flake car paint rendered in real-time using an HLSL Pixel

Shader in DirectX9.0.

auto body paint is usually applied in layered stages and often includes dye layers, clear

coat layers, and metallic flakes suspended in enamel. The result of these successive paint

layers is a surface that exhibits complex light interactions, giving the car a smooth, glossy

and sparkly finish. The car model shown here uses a relatively low number of polygons

but employs a high precision normal map generated by an appearance preserving

simplification algorithm (visit http://www.ati.com/developer/ for more information on the

ATI Normal Mapper Tool). Due to the pixel shader operations performed across the

smoothly changing surfaces (such as the hood of the car), a 16-bit per channel normal

map is necessary.

The first step in this pixel shader is normal decompression. Since the normals are

stored in surface local coordinates (a.k.a. tangent space), we can assume that the z

component of the normals will be positive. Thus, we can store x and y in two channels of

a 16-16 texture map and derive z in the pixel shader from +sqrt(1 x2 y2 ). This gives us

much higher precision than a traditional 8-8-8-8 normal map (even 10 or 11 bits per

channel is not enough for this particular shader) for the same memory footprint.

1

Layered Car Paint Shader

Figure 2: Two-tone, micro-flake, clear coat and final lighting on side rear-view mirror.

Base Color

The normal decompression described above is performed on a surface normal

map which is generated from an appearance preserving simplification process (N) and a

high frequency normalized vector noise map (Nn) which is repeated across the surface.

These two normals are used to compute two perturbed normals which are used to

simulate the two-toned nature of the paint as well as the microflake suspended in an inner

coat of the paint.

Figure 3: Metallic micro-flakes, suspended in clear enamel, are applied over a base paint coat (dye

layer) and results in subsurface light scattering.

2

2

From ShaderX Shader Programming Tips and Tricks with DirectX 9

aN n +bN

Ns = where a < b

aN n +bN

cN n + dN

N ss = where c = d

cN n + dN

The coefficients a, b, c and d above are constant input parameters to the pixel shader

which determine the distributions of the perturbed normals. The magnitude of these

perturbed normals determines the width of the region in which the micro-flake is readily

visible. The two normals are dotted with the view vector and used as parameters in the

following polynomial, which determines the color of the base coat and strength of the

micro-flake term:

The first three terms of this polynomial perform the blend between the two tones of the

paint. The fourth term adds an extra layer of sparkle for the micro-flakes contribution.

Constants c0, c1, and c2 correspond to the base paint colors while c3 corresponds to the

micro-flake color.

The final step in rendering the painted areas of the car is the inclusion of the clear

coat through the addition of an environment map as shown below.

Figure 4: Top face of HDR cubic environment map (left) RGB Channels (right) Alpha Channel.

3

Layered Car Paint Shader

One interesting aspect of the clear coat term is the decision to store the

environment map in an RGBScale form to simulate high dynamic range in a low memory

footprint. The alpha channel of the texture, shown on the right in figure 4, represents

1/16th of the true range of the data while the RGB, shown on the left, represents the

normalized color. In the pixel shader, the alpha channel and RGB channels are multiplied

together and multiplied by eight to reconstruct a cheap form of HDR reflectance. This is

multiplied by a subtle Fresnel term before being added to the lighting terms described

above.

The full HLSL pixel shader for the car paint and trim is shown below.

struct PsInput

{

float2 Tex : TEXCOORD0;

float3 Tangent : TEXCOORD1;

float3 Binormal : TEXCOORD2;

float3 Normal : TEXCOORD3;

float3 View : TEXCOORD4;

float3 SparkleTex : TEXCOORD5;

};

{

// fetch from the incoming normal map:

float3 vNormal = tex2D( normalMap, i.Tex );

// Scale and bias fetched normal to move into [-1.0, 1.0] range:

vNormal = 2.0f * vNormal - 1.0f;

// vector noise map which is repeated across the surface.

// Fetching the value from it for each pixel allows us to

// compute perturbed normal for the surface to simulate

// appearance of micro-flakes suspended in the coat of paint:

float3 vFlakesNormal = tex2D(microflakeNMap, i.SparkleTex);

// Don't forget to bias and scale to shift color into [-1.0, 1.0] range:

vFlakesNormal = 2 * vFlakesNormal - 1.0;

// the coat of paint. To compute the surface normal for the first layer,

// the following formula is used:

// Np1 = ( a * Np + b * N ) / || a * Np + b * N || where a << b

//

float3 vNp1 =

microflakePerturbationA * vFlakesNormal + normalPerturbation * vNormal ;

// To compute the surface normal for the second layer of micro-flakes, which

// is shifted with respect to the first layer of micro-flakes, we use this formula:

// Np2 = ( c * Np + d * N ) / || c * Np + d * N || where c == d

float3 vNp2 = microflakePerturbation * ( vFlakesNormal + vNormal ) ;

// This vector is normalized in the pixel shader to ensure higher precision of

// the resulting view vector. For this highly detailed visual effect normalizing

// the view vector in the vertex shader and simply interpolating it is insufficient

// and produces artifacts.

float3 vView = normalize( View );

// Transform the surface normal into world space (in order to compute reflection

4

2

From ShaderX Shader Programming Tips and Tricks with DirectX 9

float3x3 mTangentToWorld = transpose( float3x3( Tangent, Binormal, Normal ) );

float3 vNormalWorld = normalize( mul( mTangentToWorld, vNormal ));

// Compute reflection vector resulted from the clear coat of paint on the metallic

// surface:

float fNdotV = saturate(dot( vNormalWorld, vView));

float3 vReflection = 2 * vNormalWorld * fNdotV - vView;

// Here we just use a constant gloss value to bias reading from the environment

// map, however, in the real demo we use a gloss map which specifies which

// regions will have reflection slightly blurred.

float fEnvBias = glossLevel;

float4 envMap = texCUBEbias( showroomMap, float4( vReflection, fEnvBias ) );

// Premultiply by alpha:

envMap.rgb = envMap.rgb * envMap.a;

envMap.rgb *= brightnessFactor;

// Compute modified Fresnel term for reflections from the first layer of

// microflakes. First transform perturbed surface normal for that layer into

// world space and then compute dot product of that normal with the view vector:

float3 vNp1World = normalize( mul( mTangentToWorld, vNp1) );

float fFresnel1 = saturate( dot( vNp1World, vView ));

// Compute modified Fresnel term for reflections from the second layer of

// microflakes. Again, transform perturbed surface normal for that layer into

// world space and then compute dot product of that normal with the view vector:

float3 vNp2World = normalize( mul( mTangentToWorld, vNp2 ));

float fFresnel2 = saturate( dot( vNp2World, vView ));

float fFresnel1Sq = fFresnel1 * fFresnel1;

fFresnel1Sq * paintColorMid +

fFresnel1Sq * fFresnel1Sq * paintColor2 +

pow( fFresnel2, 16 ) * flakeLayerColor;

float fEnvContribution = 1.0 - 0.5 * fNdotV;

float4 finalColor;

finalColor.a = 1.0;

finalColor.rgb = envMap * fEnvContribution + paintColor;

return finalColor;

}

Conclusion

This shader was developed using empirically gathered phenomenological

illumination characteristics rather than actual physical material attributes. Many different

car paint swatches were observed under various lighting conditions, this shader strives to

reproduce the observed characteristics of those swatches. This chapter demonstrates a

compelling simulation for the illumination of car paint using a real-time pixel shader.

- 3DCreative Magazine Issue 004 December 2005Uploaded byacatrineis1532
- Textures MappingUploaded bychhavish
- Log IsaacUploaded byRicardo Hoyos Arias
- Texture MappingUploaded byayeshsekar
- Gradient 9-5 and 9-6 MoUploaded byankitsaneet
- FBX Exporter User GuideUploaded byPlinkerton
- Assassin s Creed 4 Digital Dragons 2014 No NotesUploaded byPatricia Largo
- Geographical Information SystemUploaded byAyobami Emmanuel Edun
- 9780240809533_csUploaded byLisa Johnson
- Control ChartsUploaded byquark_kuark
- Dx9OptimizationUploaded bySangyong Yun
- fxaa_readme.txtUploaded byCarlos Alexandre Vieira
- Glsl Chapter 1Uploaded byverthex20992828
- Creo 2.0 Books With Multi Course [Hrs].pdfUploaded bytis
- Recommended Settings X-Plane10Uploaded byIuri Santana
- ISCEbutnotInsarAppUploaded bySyach Roel
- Shao-HungUploaded byoviroger
- Liste Touts Les TutusUploaded byrandfran
- Aaditya,Danu,RitikaUploaded byNancy Tess
- ComputerUploaded bypamjames
- An Open Source Software to Generate Animated Fish Models for Behaviorual StudiesUploaded byJonathan England
- Erd ConceptsUploaded byJoshua Brosas
- a1Uploaded by1plus12
- DB Test 23April2019Uploaded byMo Shah
- Review Object and System Model Generation for CTUploaded byAtavar
- Lecture Conv1Uploaded bySatyaki Chakraborty
- 58b8eef6bc97fa1cdb7fUploaded byapi-441441400
- MinE 407_Lab_Manual_3Uploaded bymdurşen
- 20-462.pdfUploaded byasd
- Graphic Design SillimanUploaded byapi-3849675

- Digital Painting TwoUploaded byWagner de Souza
- Essential CG Lighting Techniques_(Darren Brooker)Uploaded byWagner de Souza
- 3dmax Modeling for GamesUploaded byWagner de Souza
- Next-Generation-Post-Processing-in-Call-of-Duty-Advanced-Warfare-v18.pptxUploaded byWagner de Souza
- 1 000 Steampunk Creations Neo Victorian Fashion Gear and ArtUploaded byDerek Lewis
- Game Developer Magazine - April 2011Uploaded byWagner de Souza
- Miku TutorialUploaded byJohnathan Keku
- Aviation Factfile - Concept AircraftUploaded byWagner de Souza
- s2011secretscryengine3tech-110822143022-phpapp01Uploaded byWagner de Souza
- CreatureBox Sketchbook CollectionUploaded byGergely
- Deconstructing the Elements With 3ds Max - Second EditionUploaded byFernan D. Pérez
- The 800 Info 50 Robots to Draw and PaintUploaded byJoan Orlando Rivera
- Crysis 2 Nano Edition ArtbookUploaded byWagner de Souza
- Focal Press - Essential CG Lighting TechniquesUploaded byWagner de Souza
- Ryse Gdc 2014 AbdenourB ChrisEUploaded byWagner de Souza
- Simantov Judd Uncharted 2 Character PipelineUploaded byJeremy Tabor
- DICE Bps12 5MajorChallenges AnderssonUploaded byWagner de Souza
- Cosmic.motors.daniel.simonUploaded byAlex Freeman
- Cosmic.motors.daniel.simonUploaded byAlex Freeman
- PBR_Guide_Vol.2Uploaded byWagner de Souza
- Siggraph2007SurfsUpCourseNotesUploaded byMirthyn
- GDC2012 Mastering DirectX11 With UnityUploaded byWagner de Souza
- 3ds Max Modeling_Bots, Mechs, And Droids_(Jon Weimer)Uploaded byWagner de Souza
- PBR Guide Vol.1 - UnknownUploaded bywocukav1122
- ZBrush Getting StartedUploaded byWagner de Souza
- ZBrush Getting StartedUploaded byWagner de Souza
- Topology eBookUploaded byChelous Inspired
- Animation Insiders eBookUploaded byDave Fleischer
- Warplanes of the Luftwaffe 1939-1945Uploaded byWagner de Souza
- Fake SubdsUploaded byWagner de Souza

- Database Systems a Practical Approach to Design Implementation and Management 6th Edition Connolly Solutions ManualUploaded bya176696165
- SQL Vs. NOSQL.pdfUploaded byAnonymous OBgW3Ce
- Practice a Ssgn 3Uploaded byGurmeet Kadian
- Chapter 2 Quiz3Uploaded byjon12345jon
- lec22.pdfUploaded bydinesh
- Transactional CodesUploaded byvinsap
- ZK 5 EssentialsUploaded bySupardi Salmoe
- 376019193 Informatica PowerCenter PDFUploaded byNagesh Reddy
- Web Intelligence on SAP Implementation Best PracticesUploaded byPradeep Errapothu
- Code CoverageUploaded byKowsick Prasad K
- Adaptive Query ProcessingUploaded byxmldeveloper
- Cbs UnattendUploaded byRsam Samr
- Signalling Issues in ImsUploaded bysali2801
- SMTP Test Plan - V2Uploaded byHoria Călin
- 2 3 TierUploaded bySitesh Singh
- AWR REPORTUploaded byKamalakshi Raj
- Design BootcampUploaded byskmetaly
- 18681642 Resume Software EngineerUploaded bykumar.sira
- Efm Oam Tutorial 2004-03-31Uploaded byfelipe-rechia-9727
- Hackers NewsUploaded byNitish Jadia
- cayf12e_ppt_01.pptxUploaded byRodey Vincent
- COMPUTER_PPT.pptxUploaded byJsmBhanot
- CSC128 - MINI PROJECT : Bookstore Management SystemUploaded byAhmad Adam
- JD Edwards EnterpriseOne Tools Configurable Network Computing Implementation Guide.pdfUploaded bySuresh Konal Yzag
- PureDisk Best PracticesUploaded byamsreeku
- XML_PB_DOMUploaded byvideo95
- Microprocessor VivaUploaded byhrrameshhr
- weigh_scale.txtUploaded byRaza Hassan
- 3 Bab Scp 41Uploaded byDahal Binay
- Virtual ConnectUploaded byDion Bruce