life on the bleeding edge: more secretslife on the...

134
Life on the Bleeding Edge: More Secrets Life on the Bleeding Edge: More Secrets of the NVIDIA Demo Team Eugene dEon © 2008 NVIDIA Corporation. Eugene d Eon

Upload: others

Post on 10-Jun-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Life on the Bleeding Edge: More SecretsLife on the Bleeding Edge: More Secrets of the NVIDIA Demo Team

Eugene d’Eon

© 2008 NVIDIA Corporation.

Eugene d Eon

Page 2: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Run the Demo

© 2008 NVIDIA Corporation.

Page 3: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Concept Artworkp

© 2008 NVIDIA Corporation.

Page 4: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Concept Artworkp

© 2008 NVIDIA Corporation.

Page 5: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Concept Artworkp

© 2008 NVIDIA Corporation.

Page 6: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Concept Artworkp

© 2008 NVIDIA Corporation.

Page 7: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Concept Artworkp

© 2008 NVIDIA Corporation.

Page 8: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Skin Shadingg

© 2008 NVIDIA Corporation.

Page 9: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Skin Shadingg

• Same shader as the Human Head demo

© 2008 NVIDIA Corporation.

Page 10: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Skin Shadingg

• Same shader as the Human Head demo

• Doug Jones’s assets transformed into the warriorthe warrior

© 2008 NVIDIA Corporation.

Page 11: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Skin Shadingg

• Same shader as the Human Head demo

• Doug Jones’s assets transformed into the warriorthe warrior

• New capture for the medusa face

© 2008 NVIDIA Corporation.

Page 12: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Reusing Assetsg

• Much of the realism of the Human Head demo comes from the high gresolution face mesh

• We were successful at reusing the fine• We were successful at reusing the fine detail for a different face

© 2008 NVIDIA Corporation.

Page 13: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Reusing Assets: Colorg

Human Head democolor map

Warriorcolor map

© 2008 NVIDIA Corporation.

p p

Page 14: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Reusing Assets: Normalg

Scar displacement from Zbrush adds to originalnormals from the Human Head demo

© 2008 NVIDIA Corporation.

Page 15: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Reusing Assets: Resultg

© 2008 NVIDIA Corporation.

Page 16: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Reusing Assets: Resultg

© 2008 NVIDIA Corporation.

Page 17: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Acquiring New Assetsq g

• Female Medusa face:– New die cast and scan

© 2008 NVIDIA Corporation.

Page 18: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Acquiring New Assetsq g

• Female Medusa face:– New die cast and scan– New color map acquisition

© 2008 NVIDIA Corporation.

Page 19: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Acquiring New Assetsq g

• Female Medusa face:– New die cast and scan– New color map acquisition

Also captured lower resolution morph– Also captured lower resolution morph targets

© 2008 NVIDIA Corporation.

Page 20: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Acquiring New Assetsq g

© 2008 NVIDIA Corporation.

Page 21: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Acquiring New Assetsq g

© 2008 NVIDIA Corporation.

Page 22: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Kenneth Wiatrak’s studio

• Five high resolution synchronized cameras

• Also captures low resolution geometry

© 2008 NVIDIA Corporation.

Page 23: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Kenneth Wiatrak’s studio

© 2008 NVIDIA Corporation.

Page 24: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Kenneth Wiatrak’s studio

• Five high resolution photos• Projected onto high resolution mesh by• Projected onto high resolution mesh by

XYZRGB• Combine to produce final high

resolution color map© 2008 NVIDIA Corporation.

p

Page 25: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Medusa’s Face

© 2008 NVIDIA Corporation.

Page 26: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Medusa’s Face

© 2008 NVIDIA Corporation.

Page 27: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Medusa’s Face

© 2008 NVIDIA Corporation.

Page 28: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Kenneth Wiatrak’s studio

© 2008 NVIDIA Corporation.

Page 29: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Kenneth Wiatrak’s studio

• Became a reference for the creation of the 65 facial blend shapesthe 65 facial blend shapes

• Weren’t able to use the color maps

© 2008 NVIDIA Corporation.

Page 30: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Skin shader

SStart

© 2008 NVIDIA Corporation.

Page 31: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Skin shader

SStart blur

© 2008 NVIDIA Corporation.

Page 32: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Skin shader

S …Start blur blur blur

© 2008 NVIDIA Corporation.

Page 33: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Skin shader

S …Start blur blur blur

Stretch maps

© 2008 NVIDIA Corporation.

Page 34: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Skin shader

S …Start blur blur blur

Linearcombination

Stretch maps

© 2008 NVIDIA Corporation.

Page 35: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Skin shader

S …Start blur blur blur

Linearcombination

texture mapping

Stretch maps

© 2008 NVIDIA Corporation.

Page 36: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Skin shader

S …Start blur blur blur

Linearcombination

texture mapping

Stretch maps

Final pass: combine blurs + specular

© 2008 NVIDIA Corporation.

Page 37: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Skin Shader Optimizationsp

• Reuse blur targets for multiple skin surfaces

© 2008 NVIDIA Corporation.

Page 38: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Skin Shader Optimizationsp

• Reuse blur targets for multiple skin surfaces

• skinDetailScale

© 2008 NVIDIA Corporation.

Page 39: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Skin Shader Optimizationsp

• Reuse blur targets for multiple skin surfaces

• skinDetailScaleT t li hti t 1024 1024 f– Texture space lighting at 1024x1024 for close up shots

© 2008 NVIDIA Corporation.

Page 40: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Skin Shader Optimizationsp

• Reuse blur targets for multiple skin surfaces

• skinDetailScaleT t li hti t 1024 1024 f– Texture space lighting at 1024x1024 for close up shots

– Reduce viewport in renderpasses to be % of total for

© 2008 NVIDIA Corporation.

Page 41: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Skin Shader Optimizationsp

• Reuse blur targets for multiple skin surfaces

• skinDetailScaleT t li hti t 1024 1024 f– Texture space lighting at 1024x1024 for close up shots

– Reduce viewport in renderpasses to be % of total for

• Texture space lighting pass• Each iterative blur pass

© 2008 NVIDIA Corporation.

• Facial shadow pass

Page 42: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Skin shader

S …Start blur blur blur

Linearcombination

texture mapping

Stretch maps

Final pass: combine blurs + specular

© 2008 NVIDIA Corporation.

Page 43: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Skin Shader Optimizationsp

• skinDetailScale determined– Per shot (for Medusa)( )– Per frame based on bounded sphere

projection on screenprojection on screen• Significant performance gain

© 2008 NVIDIA Corporation.

Page 44: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• Alternate form of bump mapping

© 2008 NVIDIA Corporation.

Page 45: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• Alternate form of bump mapping• Store only single-channelStore only single channel

displacement value over surface

© 2008 NVIDIA Corporation.

Page 46: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• Alternate form of bump mapping• Store only single-channelStore only single channel

displacement value over surfaceE h f t b i d d• Each fragment being rendered accesses the displacement map 3 times

© 2008 NVIDIA Corporation.

Page 47: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• Alternate form of bump mapping• Store only single-channelStore only single channel

displacement value over surfaceE h f t b i d d• Each fragment being rendered accesses the displacement map 3 times

• Decide where to look in the• Decide where to look in the displacement map based on the

t i f th bj t© 2008 NVIDIA Corporation.

current view of the object

Page 48: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• Use ddx and ddy of the texture coordinates to consider the displacement:

© 2008 NVIDIA Corporation.

Page 49: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• Use ddx and ddy of the texture coordinates to consider the displacement:

One pixel to the right– One pixel to the right– One pixel up

© 2008 NVIDIA Corporation.

Page 50: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• Use ddx and ddy of the texture coordinates to consider the displacement:

One pixel to the right– One pixel to the right– One pixel up

• Helps reduce aliasing– Wide spacing in displacement map:Wide spacing in displacement map:

• Appropriate mip level of the displacement map

© 2008 NVIDIA Corporation.

p

Page 51: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• How do we compute the new normal?

ucenter

v

© 2008 NVIDIA Corporation.

Page 52: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• How do we compute the new normal?

over

upucenter

up

v

© 2008 NVIDIA Corporation.

Page 53: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• How do we compute the new normal?

over

upucenter

up

v

© 2008 NVIDIA Corporation.

Page 54: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• How do we compute the new normal?

over

upucenter

up

vtanNormal=cross( over - center, up – center )

© 2008 NVIDIA Corporation.

Page 55: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• Advantages– 1/3 storage of a texture-space normal g p

map

© 2008 NVIDIA Corporation.

Page 56: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• Advantages– 1/3 storage of a texture-space normal g p

map– Normal map plugin can blur the detail ofNormal map plugin can blur the detail of

the displacement map

© 2008 NVIDIA Corporation.

Page 57: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• Advantages– 1/3 storage of a texture-space normal g p

map– Normal map plugin can blur the detail ofNormal map plugin can blur the detail of

the displacement mapMIP mapping displacement makes sense– MIP mapping displacement makes sense

© 2008 NVIDIA Corporation.

Page 58: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• Advantages– 1/3 storage of a texture-space normal g p

map– Normal map plugin can blur the detail ofNormal map plugin can blur the detail of

the displacement mapMIP mapping displacement makes sense– MIP mapping displacement makes sense

– MIP mapping normals doesn’t

© 2008 NVIDIA Corporation.

Page 59: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• Advantages– 1/3 storage of a texture-space normal g p

map– Normal map plugin can blur the detail ofNormal map plugin can blur the detail of

the displacement mapMIP mapping displacement makes sense– MIP mapping displacement makes sense

– MIP mapping normals doesn’t– Anisotropic filtering

© 2008 NVIDIA Corporation.

Page 60: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• Advantages– 1/3 storage of a texture-space normal g p

map– Normal map plugin can blur the detail ofNormal map plugin can blur the detail of

the displacement mapMIP mapping displacement makes sense– MIP mapping displacement makes sense

– MIP mapping normals doesn’t– Anisotropic filtering– Reduced aliasing

© 2008 NVIDIA Corporation.

g

Page 61: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• Allows for multiple displacement maps to combine

++

© 2008 NVIDIA Corporation.

Page 62: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• Allows for multiple displacement maps to combine

++

© 2008 NVIDIA Corporation.

Page 63: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

• Allows for multiple displacement maps to combine

++

© 2008 NVIDIA Corporation.

Page 64: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingfloat normalTap = dispTex.Sample(TrilinearClamp, g2f.tex.xy);float2 uv_offset_over = ddx( g2f.tex );

p p pp g

float2 uv_offset_up = ddy( g2f.tex );float normalTapOver = dispTex.Sample(TrilinearClamp, g2f.tex.xy +

uv_offset_over);float normalTapUp = dispTex.Sample(TrilinearClamp, g2f.tex.xy +

uv_offset_up);

fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementHeight * normalTap;float displacementOver = displacementHeight * normalTapOver;float displacementUp = displacementHeight * normalTapUp;

float3 tanNormalBump = normalize( -cross( float3( uv_offset_over.x, uv_offset_over.y, ( displacementOver - displacementCenter ) ),

fl t3( ff t ff t ( float3( uv_offset_up.x, uv_offset_up.y, ( displacementUp - displacementCenter ) ) ) );

float3 Nbump normalize( T * tanNormalBump x + B * tanNormalBump y + N *

© 2008 NVIDIA Corporation.

float3 Nbump = normalize( T * tanNormalBump.x + B * tanNormalBump.y + N * tanNormalBump.z );

Page 65: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Screen-space bump mappingp p pp g

© 2008 NVIDIA Corporation.

Page 66: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Rainbow Boas

A ti t t d thi f d l© 2008 NVIDIA Corporation.

Artist requested this for medusa scales…

Page 67: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Cause?

• Two conflicting explanations on the web

© 2008 NVIDIA Corporation.

Page 68: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Cause?

• Two conflicting explanations on the web– Thin-film interference amongst many

scale layersscale layers

© 2008 NVIDIA Corporation.

Page 69: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Cause?

• Two conflicting explanations on the web– Thin-film interference amongst many

scale layersscale layers– Natural diffraction gratings grow on the

scale surfacescale surface

© 2008 NVIDIA Corporation.

Page 70: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Took a Guess: Diffraction

• We tried diffraction and it looked pretty goodg

• Solution: GPU Gems 1: Jos Stam’s diffraction chapterdiffraction chapter

• Simple fragment shader computes a colored diffraction term

© 2008 NVIDIA Corporation.

Page 71: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Rainbow boa scale shader

Diffraction term

© 2008 NVIDIA Corporation.

Diffraction term

Page 72: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Rainbow boa scale shader

Diffraction term + diffuse term

© 2008 NVIDIA Corporation.

Diffraction term + diffuse term

Page 73: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Rainbow boa scale shader

Diffraction term + diffuse term + specular term

© 2008 NVIDIA Corporation.

Diffraction term + diffuse term + specular term

Page 74: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Crystalsy

© 2008 NVIDIA Corporation.

Page 75: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Crystal Appearancey pp

• Combination of refracted and reflected lightg

© 2008 NVIDIA Corporation.

Page 76: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Crystal Appearancey pp

• Combination of refracted and reflected lightg

• Reflected light is easy

© 2008 NVIDIA Corporation.

Page 77: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Crystal Appearancey pp

• Combination of refracted and reflected lightg

• Reflected light is easyR f t d li ht t• Refracted light: not so easy

© 2008 NVIDIA Corporation.

Page 78: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Previous work

• SIGGRAPH 2004– “Graphics Gems Revisited – Fast and p

Physically-Based Rendering of Gemstones”

• Stephane Guy, Cyril Soler

© 2008 NVIDIA Corporation.

Page 79: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Previous work

• SIGGRAPH 2004– “Graphics Gems Revisited – Fast and p

Physically-Based Rendering of Gemstones”

• Stephane Guy, Cyril Soler

• Very accurate images• Very accurate images• GPU implementation

© 2008 NVIDIA Corporation.

Page 80: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Previous work

• SIGGRAPH 2004– “Graphics Gems Revisited – Fast and p

Physically-Based Rendering of Gemstones”

• Stephane Guy, Cyril Soler

• Very accurate images• Very accurate images• GPU implementation• Fairly complex method

© 2008 NVIDIA Corporation.

Page 81: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Previous work

• SIGGRAPH 2004– “Graphics Gems Revisited – Fast and p

Physically-Based Rendering of Gemstones”

• Stephane Guy, Cyril Soler

• Very accurate images• Very accurate images• GPU implementation• Fairly complex method• If possible: find something cheaper

© 2008 NVIDIA Corporation.

• If possible: find something cheaper

Page 82: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Crystal Reflectancey

© 2008 NVIDIA Corporation.

Page 83: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Crystal Reflectancey

© 2008 NVIDIA Corporation.

Page 84: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Crystal Reflectancey

N

© 2008 NVIDIA Corporation.

Page 85: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Crystal Reflectancey

NR

© 2008 NVIDIA Corporation.

Page 86: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Crystal ReflectanceyCubemap lookup

NR

© 2008 NVIDIA Corporation.

Page 87: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Crystal ReflectanceyCubemap lookup

NR

Reflectance only

© 2008 NVIDIA Corporation.

Page 88: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Crystal ReflectanceyCubemap lookup

NR

Fresnel

© 2008 NVIDIA Corporation.

Page 89: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Crystal ReflectanceyCubemap lookup

NR

Fresnel

Fresnel attenuatedfl treflectance

© 2008 NVIDIA Corporation.

Page 90: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Fresnel terms// reflectance at normal incidence:float F0 = pow( (1.0 - index)/(1.0 + index), 2.0 );

© 2008 NVIDIA Corporation.

Page 91: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Fresnel terms// reflectance at normal incidence:float F0 = pow( (1.0 - index)/(1.0 + index), 2.0 );

// Schlick’s approximationfloat fresnelReflectance( float3 N, float3 V, float F0 ){{float base = 1.0 - dot( N, V );float exponential = pow( base, 5.0 );return exponential + F0 * ( 1.0 - exponential );

}

© 2008 NVIDIA Corporation.

Page 92: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Fresnel terms// reflectance at normal incidence:float F0 = pow( (1.0 - index)/(1.0 + index), 2.0 );

// Schlick’s approximationfloat fresnelReflectance( float3 N, float3 V, float F0 ){{float base = 1.0 - dot( N, V );float exponential = pow( base, 5.0 );return exponential + F0 * ( 1.0 - exponential );

}

// note:// fresnelTransmittance = 1 0 - fresnelReflectance

© 2008 NVIDIA Corporation.

// fresnelTransmittance = 1.0 - fresnelReflectance

Page 93: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Fresnel terms// NOTE: for crystal->air interactions useyfloat F0_out = pow( (index - 1.0)/(1.0 + index), 2.0 );

© 2008 NVIDIA Corporation.

Page 94: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Crystal Transmittancey

NR

T0

© 2008 NVIDIA Corporation.

Page 95: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Crystal Transmittancey

NR

T0

© 2008 NVIDIA Corporation.

float3 T0 = refract( -V, N, 1.0 / index );

Page 96: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Computing ray-crystal p g y yintersections

NR

T0 N1

p1

?

p1

© 2008 NVIDIA Corporation.

Page 97: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Computing ray-crystal p g y yintersections

• Avoid ray-tracing the exact crystal triangle set

© 2008 NVIDIA Corporation.

Page 98: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Computing ray-crystal p g y yintersections

• Avoid ray-tracing the exact crystal triangle set

• The crystal is roughly a sphereThe crystal is roughly a sphere

© 2008 NVIDIA Corporation.

Page 99: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Computing ray-crystal p g y yintersections

• Avoid ray-tracing the exact crystal triangle set

• The crystal is roughly a sphereThe crystal is roughly a sphere• Ray-sphere intersections are cheap

© 2008 NVIDIA Corporation.

Page 100: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Computing ray-crystal p g y yintersections

Use a simple

NR

T0p1

Use a simpleray-sphere intersection

to find p1p1 p

© 2008 NVIDIA Corporation.

Page 101: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Computing ray-crystal p g y yintersections

Cubemapl k

NR

T0p1

N1lookup

T1p1

© 2008 NVIDIA Corporation.

Page 102: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Computing ray-crystal p g y yintersections

Cubemapl k

NR

T0p1

N1lookup

T1p1

anotherFresnelFresnel

term

float3 T1 = refract( T0 N1 index );

© 2008 NVIDIA Corporation.

float3 T1 = refract( T0, -N1, index );fresnel1 = fresnelReflectance( N1, T0, F0_out );

Page 103: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Sphere Approximationp pp

T itt d li ht i t if© 2008 NVIDIA Corporation.

• Transmitted light is too uniform

Page 104: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Second Idea

Ch th l th h t

Second Idea

• Change the normals on the sphere to be faceted

© 2008 NVIDIA Corporation.

Page 105: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Second Idea

Ch th l th h t

Second Idea

• Change the normals on the sphere to be faceted

float3 facetNormal( float3 N, float facetSize ){{float3 scaledNormal = N * facetSize;

}

© 2008 NVIDIA Corporation.

Page 106: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Second Idea

Ch th l th h t

Second Idea

• Change the normals on the sphere to be faceted

float3 facetNormal( float3 N, float facetSize ){{float3 scaledNormal = N * facetSize;float3 scaleandround = float3( round( scaledNormal.x ), ( ( ),

round( scaledNormal.y ), round( scaledNormal.z ) );

}}

© 2008 NVIDIA Corporation.

Page 107: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Second Idea

Ch th l th h t

Second Idea

• Change the normals on the sphere to be faceted

float3 facetNormal( float3 N, float facetSize ){{float3 scaledNormal = N * facetSize;float3 scaleandround = float3( round( scaledNormal.x ), ( ( ),

round( scaledNormal.y ), round( scaledNormal.z ) );return normalize( scaleandround );

}}

© 2008 NVIDIA Corporation.

Page 108: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Faceted Normals

V il !© 2008 NVIDIA Corporation.

• Voila!

Page 109: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Faceted Normals

Ch th f t i t liki© 2008 NVIDIA Corporation.

• Change the facet_size to your liking

Page 110: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Further transmission

NR

T0 p1 N1

R1

© 2008 NVIDIA Corporation.

Page 111: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Further transmission

NR

T0 p1 N1

R1

p2pN2

© 2008 NVIDIA Corporation.

Page 112: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Further transmission

NR

T0 p1 N1

R1

p2pN2

© 2008 NVIDIA Corporation.

Cubemap lookup

Page 113: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Further transmission

etc…

NR

T0 p1 N1

R1

p2p2N2

© 2008 NVIDIA Corporation.

Page 114: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Colored Gemstones• Light travelling through the crystal is

absorbed based on distanceabsorbed based on distance

NR

T0 p1 N1

R1

p2pN2

© 2008 NVIDIA Corporation.

Page 115: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Colored Gemstones• Light travelling through the crystal is

absorbed based on distanceabsorbed based on distance

NR

T0 p1 N1

R1

p2

t2

pN2

© 2008 NVIDIA Corporation.

Attenuate by: exp( -t2 * absorp )

Page 116: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Final Crystal Reflectancey

result.xyz = specularLight;

© 2008 NVIDIA Corporation.

Page 117: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Final Crystal Reflectancey

result.xyz = specularLight + fresnel0 * cube0;

© 2008 NVIDIA Corporation.

Page 118: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Final Crystal Reflectancey

result.xyz = specularLight + fresnel0 * cube0 + ( 1.0 - fresnel0 ) * );

© 2008 NVIDIA Corporation.

Page 119: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Final Crystal Reflectancey

result.xyz = specularLight + fresnel0 * cube0 + ( 1.0 - fresnel0 ) * (exp( -t1 * absorp ) * ( ( 1.0 - fresnel1 ) * cube1))

);

© 2008 NVIDIA Corporation.

Page 120: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Final Crystal Reflectancey

result.xyz = specularLight + fresnel0 * cube0 + ( 1.0 - fresnel0 ) * (exp( -t1 * absorp ) * ( ( 1.0 - fresnel1 ) * cube1))

);

© 2008 NVIDIA Corporation.

Page 121: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Final Crystal Reflectancey

result.xyz = specularLight + fresnel0 * cube0 + ( 1.0 - fresnel0 ) * (exp( -t1 * absorp ) * ( ( 1.0 - fresnel1 ) * cube1))

);

© 2008 NVIDIA Corporation.

Page 122: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Final Crystal Reflectancey

result.xyz = specularLight + fresnel0 * cube0 + ( 1.0 - fresnel0 ) * (exp( -t1 * absorp ) * ( ( 1.0 - fresnel1 ) * cube1 +fresnel1 * exp( t2 * absorp ) * ( ( 1 0 fresnel2 ) * cube2fresnel1 exp( -t2 absorp ) ( ( 1.0 - fresnel2 ) cube2 ) )

););

© 2008 NVIDIA Corporation.

Page 123: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Final Crystal Reflectancey

result.xyz = specularLight + fresnel0 * cube0 + ( 1.0 - fresnel0 ) * (exp( -t1 * absorp ) * ( ( 1.0 - fresnel1 ) * cube1 +fresnel1 * exp( t2 * absorp ) * ( ( 1 0 fresnel2 ) * cube2 +fresnel1 exp( -t2 absorp ) ( ( 1.0 - fresnel2 ) cube2 +fresnel2 * exp( -t3 * absorp ) * ( ( 1.0 - fresnel3 ) * cube3 ) ) )) ) )

);

© 2008 NVIDIA Corporation.

Page 124: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Final Crystal Reflectancey

result.xyz = specularLight + fresnel0 * cube0 + ( 1.0 - fresnel0 ) * (exp( -t1 * absorp ) * ( ( 1.0 - fresnel1 ) * cube1 +fresnel1 * exp( t2 * absorp ) * ( ( 1 0 fresnel2 ) * cube2 +fresnel1 exp( -t2 absorp ) ( ( 1.0 - fresnel2 ) cube2 +fresnel2 * exp( -t3 * absorp ) * ( ( 1.0 - fresnel3 ) * cube3 +fresnel3 * exp( -t4 * absorp ) * ( ( 1.0 - fresnel4 ) * cube4 )p( p ) ( ( ) )) ) )

);

© 2008 NVIDIA Corporation.

Page 125: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Final Crystal Reflectancey

result.xyz = specularLight + fresnel0 * cube0 + ( 1.0 - fresnel0 ) * (exp( -t1 * absorp ) * ( ( 1.0 - fresnel1 ) * cube1 +fresnel1 * exp( t2 * absorp ) * ( ( 1 0 fresnel2 ) * cube2 +fresnel1 exp( -t2 absorp ) ( ( 1.0 - fresnel2 ) cube2 +fresnel2 * exp( -t3 * absorp ) * ( ( 1.0 - fresnel3 ) * cube3 +fresnel3 * exp( -t4 * absorp ) * ( ( 1.0 - fresnel4 ) * cube4 +p( p ) ( ( )fresnel4 * exp( -t5 * absorp ) * ( ( 1.0 - fresnel5 ) * cube5 ) )) ) )

);

© 2008 NVIDIA Corporation.

Page 126: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Final Crystal Reflectancey

result.xyz = specularLight + fresnel0 * cube0 + ( 1.0 - fresnel0 ) * (exp( -t1 * absorp ) * ( ( 1.0 - fresnel1 ) * cube1 +fresnel1 * exp( t2 * absorp ) * ( ( 1 0 fresnel2 ) * cube2 +fresnel1 exp( -t2 absorp ) ( ( 1.0 - fresnel2 ) cube2 +fresnel2 * exp( -t3 * absorp ) * ( ( 1.0 - fresnel3 ) * cube3 +fresnel3 * exp( -t4 * absorp ) * ( ( 1.0 - fresnel4 ) * cube4 +p( p ) ( ( )fresnel4 * exp( -t5 * absorp ) * ( ( 1.0 - fresnel5 ) * cube5 +fresnel5 * exp( -t6 * absorp ) * ( ( 1.0 - fresnel6 ) * cube6 ) ) )) ) )

);

© 2008 NVIDIA Corporation.

Page 127: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Final Crystal Reflectancey

+

reflectance

© 2008 NVIDIA Corporation.

Page 128: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Final Crystal Reflectancey

+ +

reflectance 1st transmittance

© 2008 NVIDIA Corporation.

Page 129: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Final Crystal Reflectancey

+ + +

reflectance 1st transmittance 2nd transmittance

© 2008 NVIDIA Corporation.

Page 130: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Final Crystal Reflectancey

+ + +

reflectance 1st transmittance 2nd transmittance 4th transmittance

© 2008 NVIDIA Corporation.

Page 131: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Final Crystal Reflectancey

+ + +

reflectance 1st transmittance 2nd transmittance 4th transmittance

+

6th transmittance

© 2008 NVIDIA Corporation.

Page 132: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Final Crystal Reflectancey

+ + +

reflectance 1st transmittance 2nd transmittance 4th transmittance

+ =

specular6th transmittance

© 2008 NVIDIA Corporation.

Page 133: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Final Crystal Reflectancey

+ + +

reflectance 1st transmittance 2nd transmittance 4th transmittance

+ =

final resultspecular6th transmittance

© 2008 NVIDIA Corporation.

Page 134: Life on the Bleeding Edge: More SecretsLife on the ...developer.download.nvidia.com/...DemoTeamSecrets.pdf · fl t di l tC t di l tH i ht * lTfloat displacementCenter = displacementH

Questions?

© 2008 NVIDIA Corporation.