aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Media/SampleRenderer/4
diff options
context:
space:
mode:
authorgit perforce import user <a@b>2016-10-25 12:29:14 -0600
committerSheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees>2016-10-25 18:56:37 -0500
commit3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch)
treefa6485c169e50d7415a651bf838f5bcd0fd3bfbd /PhysX_3.4/Media/SampleRenderer/4
downloadphysx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.tar.xz
physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.zip
Initial commit:
PhysX 3.4.0 Update @ 21294896 APEX 1.4.0 Update @ 21275617 [CL 21300167]
Diffstat (limited to 'PhysX_3.4/Media/SampleRenderer/4')
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/fonts/arial_black.binbin0 -> 1050868 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/concrete_debris.xml7
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/debug_texture.xml9
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/destruction_moistconcrete.xml8
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/destruction_plaster.xml8
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/destruction_plaster_interior.xml7
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/destruction_targetwall.xml8
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/destruction_targetwall_interior.xml8
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/destruction_wood.xml8
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/destruction_wood_2x4.xml8
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/destruction_wood_2x4_interior.xml7
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/fancy_cloth.xml10
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/material_turb1.xml9
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/mouse_cursor.xml8
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/outlinetext.xml8
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/particle_dust.xml9
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/particle_fog.xml8
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/particle_smoke.xml9
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/particle_sphere.xml10
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/particle_water.xml12
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/simple_cloth.xml7
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/simple_diffuse_alpha.xml8
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit.xml7
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit_alpha.xml11
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit_color.xml6
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit_uniform_alpha.xml13
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit_uniform_color.xml8
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/simple_unlit.xml6
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/tablet_buttons.xml7
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/tablet_sticks.xml8
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/materials/wood_debris.xml7
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/fancy_cloth_diffuse.cg21
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/lines.cg14
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/material_diffuse.cg33
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/outlinetext.cg39
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/particle_fog.cg24
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/pointsprite_diffuse.cg24
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/pointsprite_diffuse2.cg31
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/pointsprite_normal.cg24
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/primitives.cg14
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/primitives_lighting.cg23
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/sample_diffuse_and_texture.cg24
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/sample_diffuse_no_texture.cg19
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/screenquad.cg23
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple.cg15
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_alpha.cg19
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_color.cg15
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse.cg19
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_alpha.cg19
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_fog.cg20
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_multitex.cg24
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_multitex_heightmap.cg26
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_normal.cg21
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_normal_5.cg21
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_normal_5t.cg29
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_normal_5x.cg20
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_tiled.cg19
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_uniform_color.cg23
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_uniform_colors.cg21
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_lightmap.cg21
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_skydome.cg19
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_test.cg24
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_turbulence.cg33
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_uniform_color.cg19
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_uniform_color_normal.cg23
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_uniform_colors.cg18
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_unlit_bitangents.cg15
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_unlit_normals.cg15
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_unlit_tangents.cg15
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/tablet_buttons.cg13
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/tablet_sticks.cg21
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/text.cg23
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/include/config.cg111
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/include/defines.cg144
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/include/fragment_entry.cg109
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/include/fragment_entry_fog.cg105
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/include/fragment_entry_skydome.cg96
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/include/globals.cg102
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/include/lighting.cg108
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/include/noise.cg199
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/include/phong_lighting.cg63
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/include/tessellation.cg186
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/include/tessellation_entry.cg309
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/tessellation/procedural_noise.cg15
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/tessellation/texture_noise.cg24
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/tessellation/wrinkle.cg312
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/lines.cg19
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/mouse.cg58
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/particle_fog.cg66
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/pointsprite.cg165
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/pointsprite2.cg76
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/primitives.cg20
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/primitives_lighting.cg25
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/screenquad.cg36
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/skeletalmesh_1bone.cg75
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/skeletalmesh_4bone.cg70
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/skydome.cg82
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/staticmesh.cg82
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/staticmesh_lightmap.cg83
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/staticmesh_simple.cg70
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/staticmesh_spheremap.cg99
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/tablet_buttons.cg11
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/tablet_sticks.cg28
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/text.cg35
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/turbulencesprites.cg72
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/BrickInt_d.tgabin0 -> 786476 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/Brick_Cracked_d.tgabin0 -> 3145772 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/GTC_Wall_D.ddsbin0 -> 699192 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/GTC_Wall_N.ddsbin0 -> 699192 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/GrayRock_Tileable_D.ddsbin0 -> 43832 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/GrayRock_Tileable_N.ddsbin0 -> 349652 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/Moai_d.ddsbin0 -> 1398256 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/Moai_i.ddsbin0 -> 1398256 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/MoistConcrete01D.ddsbin0 -> 349680 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/MoistConcrete01N.ddsbin0 -> 1398228 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/OldPineWoodD.ddsbin0 -> 349680 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/OldPineWoodN.ddsbin0 -> 1398228 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/Plaster_Tileable.ddsbin0 -> 43832 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/SoftParticle.ddsbin0 -> 16512 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/TileWall.ddsbin0 -> 5592560 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/Wood_Tileable.ddsbin0 -> 43832 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/billboard_sphere_normals.ddsbin0 -> 65664 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/control.ddsbin0 -> 349680 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/debug_pattern.ddsbin0 -> 349680 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/gravel_diffuse.ddsbin0 -> 699192 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/grid.ddsbin0 -> 1398228 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/grid_bordered.ddsbin0 -> 1398228 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/knit_1d.ddsbin0 -> 349680 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/knit_1n.ddsbin0 -> 1398228 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/mouse.ddsbin0 -> 4224 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/particles_heightmap_lightmap.ddsbin0 -> 22000 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/rock_diffuse.ddsbin0 -> 699192 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/shortGrass_diffuse.ddsbin0 -> 699192 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/smoke.ddsbin0 -> 349680 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/steak.ddsbin0 -> 131200 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/test.ddsbin0 -> 87536 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/ui_knob_dxt3.ddsbin0 -> 87536 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/ui_knob_dxt3.tgabin0 -> 262162 bytes
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/textures/water.ddsbin0 -> 349680 bytes
139 files changed, 4187 insertions, 0 deletions
diff --git a/PhysX_3.4/Media/SampleRenderer/4/fonts/arial_black.bin b/PhysX_3.4/Media/SampleRenderer/4/fonts/arial_black.bin
new file mode 100644
index 00000000..5b2c2201
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/fonts/arial_black.bin
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/concrete_debris.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/concrete_debris.xml
new file mode 100644
index 00000000..f29261f3
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/concrete_debris.xml
@@ -0,0 +1,7 @@
+<material type="lit">
+ <shader name="vertex">vertex/staticmesh.cg</shader>
+ <shader name="fragment">fragment/simple_diffuse.cg</shader>
+ <variables>
+ <sampler2D name="diffuseTexture">textures/GrayRock_Tileable_D.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/debug_texture.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/debug_texture.xml
new file mode 100644
index 00000000..e3a94a4e
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/debug_texture.xml
@@ -0,0 +1,9 @@
+<material type="lit">
+ <shader name="vertex">vertex/staticmesh.cg</shader>
+ <shader name="vertex">vertex/skeletalmesh_4bone.cg</shader>
+ <shader name="fragment">fragment/simple_diffuse_uniform_color.cg</shader>
+ <variables>
+ <sampler2D name="diffuseTexture">textures/debug_pattern.dds</sampler2D>
+ <float4 name="diffuseColor">1.0 1.0 1.0 1.0</float4>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_moistconcrete.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_moistconcrete.xml
new file mode 100644
index 00000000..2e6ee684
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_moistconcrete.xml
@@ -0,0 +1,8 @@
+<material type="lit">
+ <shader name="vertex">vertex/skeletalmesh_1bone.cg</shader>
+ <shader name="fragment">fragment/simple_diffuse_normal.cg</shader>
+ <variables>
+ <sampler2D name="diffuseTexture">textures/MoistConcrete01D.dds</sampler2D>
+ <sampler2D name="normalTexture">textures/MoistConcrete01N.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_plaster.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_plaster.xml
new file mode 100644
index 00000000..d5c094dc
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_plaster.xml
@@ -0,0 +1,8 @@
+<material type="lit">
+ <shader name="vertex">vertex/skeletalmesh_1bone.cg</shader>
+ <shader name="fragment">fragment/simple_diffuse_normal.cg</shader>
+ <variables>
+ <sampler2D name="diffuseTexture">textures/GTC_Wall_D.dds</sampler2D>
+ <sampler2D name="normalTexture">textures/GTC_Wall_N.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_plaster_interior.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_plaster_interior.xml
new file mode 100644
index 00000000..3edacdb6
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_plaster_interior.xml
@@ -0,0 +1,7 @@
+<material type="lit">
+ <shader name="vertex">vertex/skeletalmesh_1bone.cg</shader>
+ <shader name="fragment">fragment/simple_diffuse.cg</shader>
+ <variables>
+ <sampler2D name="diffuseTexture">textures/Plaster_Tileable.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_targetwall.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_targetwall.xml
new file mode 100644
index 00000000..d5c094dc
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_targetwall.xml
@@ -0,0 +1,8 @@
+<material type="lit">
+ <shader name="vertex">vertex/skeletalmesh_1bone.cg</shader>
+ <shader name="fragment">fragment/simple_diffuse_normal.cg</shader>
+ <variables>
+ <sampler2D name="diffuseTexture">textures/GTC_Wall_D.dds</sampler2D>
+ <sampler2D name="normalTexture">textures/GTC_Wall_N.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_targetwall_interior.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_targetwall_interior.xml
new file mode 100644
index 00000000..fb95afb3
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_targetwall_interior.xml
@@ -0,0 +1,8 @@
+<material type="lit">
+ <shader name="vertex">vertex/skeletalmesh_1bone.cg</shader>
+ <shader name="fragment">fragment/simple_diffuse_normal.cg</shader>
+ <variables>
+ <sampler2D name="diffuseTexture">textures/GrayRock_Tileable_D.dds</sampler2D>
+ <sampler2D name="normalTexture">textures/GrayRock_Tileable_N.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_wood.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_wood.xml
new file mode 100644
index 00000000..18d7d976
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_wood.xml
@@ -0,0 +1,8 @@
+<material type="lit">
+ <shader name="vertex">vertex/skeletalmesh_1bone.cg</shader>
+ <shader name="fragment">fragment/simple_diffuse_normal.cg</shader>
+ <variables>
+ <sampler2D name="diffuseTexture">textures/OldPineWoodD.dds</sampler2D>
+ <sampler2D name="normalTexture">textures/OldPineWoodN.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_wood_2x4.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_wood_2x4.xml
new file mode 100644
index 00000000..d5c094dc
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_wood_2x4.xml
@@ -0,0 +1,8 @@
+<material type="lit">
+ <shader name="vertex">vertex/skeletalmesh_1bone.cg</shader>
+ <shader name="fragment">fragment/simple_diffuse_normal.cg</shader>
+ <variables>
+ <sampler2D name="diffuseTexture">textures/GTC_Wall_D.dds</sampler2D>
+ <sampler2D name="normalTexture">textures/GTC_Wall_N.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_wood_2x4_interior.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_wood_2x4_interior.xml
new file mode 100644
index 00000000..10321947
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/destruction_wood_2x4_interior.xml
@@ -0,0 +1,7 @@
+<material type="lit">
+ <shader name="vertex">vertex/skeletalmesh_1bone.cg</shader>
+ <shader name="fragment">fragment/simple_diffuse.cg</shader>
+ <variables>
+ <sampler2D name="diffuseTexture">textures/Wood_Tileable.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/fancy_cloth.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/fancy_cloth.xml
new file mode 100644
index 00000000..bbd385b4
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/fancy_cloth.xml
@@ -0,0 +1,10 @@
+<material type="lit">
+ <shader name="vertex">vertex/staticmesh.cg</shader>
+ <shader name="fragment">fragment/fancy_cloth_diffuse.cg</shader>
+ <alphaTestFunc>GREATER</alphaTestFunc>
+ <alphaTestRef>0.9</alphaTestRef>
+ <variables>
+ <sampler2D name="diffuseTexture">textures/knit_1d.dds</sampler2D>
+ <sampler2D name="normalTexture">textures/knit_1n.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/material_turb1.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/material_turb1.xml
new file mode 100644
index 00000000..98022ff6
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/material_turb1.xml
@@ -0,0 +1,9 @@
+<material type="unlit">
+ <shader name="vertex">vertex/turbulencesprites.cg</shader>
+ <shader name="fragment">fragment/simple_turbulence.cg</shader>
+ <alphaTestFunc>GREATER_EQUAL</alphaTestFunc>
+ <alphaTestRef>0.5</alphaTestRef>
+ <variables>
+ <sampler2D name="diffuseTexture">APEX/0.9/turbulence/textures/smoke.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/mouse_cursor.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/mouse_cursor.xml
new file mode 100644
index 00000000..bebeed30
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/mouse_cursor.xml
@@ -0,0 +1,8 @@
+<material type="unlit">
+ <shader name="vertex">vertex/mouse.cg</shader>
+ <shader name="fragment">fragment/simple_diffuse.cg</shader>
+ <blending>true</blending>
+ <variables>
+ <sampler2D name="diffuseTexture">textures/mouse.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/outlinetext.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/outlinetext.xml
new file mode 100644
index 00000000..add81861
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/outlinetext.xml
@@ -0,0 +1,8 @@
+<material type="unlit">
+ <shader name="vertex">vertex/staticmesh.cg</shader>
+ <shader name="fragment">fragment/outlinetext.cg</shader>
+ <blending>true</blending>
+ <variables>
+ <sampler2D name="diffuseTexture">textures/test.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/particle_dust.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/particle_dust.xml
new file mode 100644
index 00000000..86fff04f
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/particle_dust.xml
@@ -0,0 +1,9 @@
+<material type="unlit">
+ <shader name="vertex">vertex/pointsprite.cg</shader>
+ <shader name="fragment">fragment/pointsprite_diffuse.cg</shader>
+ <blending>true</blending>
+ <variables>
+ <float name="particleSize">1.5</float>
+ <sampler2D name="diffuseTexture">textures/SoftParticle.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/particle_fog.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/particle_fog.xml
new file mode 100644
index 00000000..6f4ac01c
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/particle_fog.xml
@@ -0,0 +1,8 @@
+<material type="unlit">
+ <shader name="vertex">vertex/particle_fog.cg</shader>
+ <shader name="fragment">fragment/particle_fog.cg</shader>
+ <blending>true</blending>
+ <variables>
+ <sampler2D name="diffuseTexture">textures/SoftParticle.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/particle_smoke.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/particle_smoke.xml
new file mode 100644
index 00000000..f5912849
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/particle_smoke.xml
@@ -0,0 +1,9 @@
+<material type="unlit">
+ <shader name="vertex">vertex/pointsprite.cg</shader>
+ <shader name="fragment">fragment/pointsprite_diffuse2.cg</shader>
+ <blending>true</blending>
+ <variables>
+ <float name="particleSize">3.5</float>
+ <sampler2D name="diffuseTexture">textures/smoke.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/particle_sphere.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/particle_sphere.xml
new file mode 100644
index 00000000..11c2f042
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/particle_sphere.xml
@@ -0,0 +1,10 @@
+<material type="lit">
+ <shader name="vertex">vertex/pointsprite.cg</shader>
+ <shader name="fragment">fragment/pointsprite_normal.cg</shader>
+ <alphaTestFunc>GREATER</alphaTestFunc>
+ <alphaTestRef>0.5</alphaTestRef>
+ <variables>
+ <float name="particleSize">0.1</float>
+ <sampler2D name="normalTexture">textures/billboard_sphere_normals.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/particle_water.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/particle_water.xml
new file mode 100644
index 00000000..bf9d602d
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/particle_water.xml
@@ -0,0 +1,12 @@
+<material type="unlit">
+ <shader name="vertex">vertex/pointsprite.cg</shader>
+ <shader name="fragment">fragment/pointsprite_diffuse2.cg</shader>
+ <blending>true</blending>
+ <variables>
+ <float name="particleSize">2.0</float>
+ <sampler2D name="diffuseTexture">textures/SoftParticle.dds</sampler2D>
+ </variables>
+</material>
+
+
+
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/simple_cloth.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/simple_cloth.xml
new file mode 100644
index 00000000..319bffd1
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/simple_cloth.xml
@@ -0,0 +1,7 @@
+<material type="lit">
+ <shader name="vertex">vertex/staticmesh.cg</shader>
+ <shader name="fragment">fragment/simple_diffuse.cg</shader>
+ <variables>
+ <sampler2D name="diffuseTexture">textures/knit_1d.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/simple_diffuse_alpha.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/simple_diffuse_alpha.xml
new file mode 100644
index 00000000..e6388582
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/simple_diffuse_alpha.xml
@@ -0,0 +1,8 @@
+<material type="unlit">
+ <shader name="vertex">vertex/staticmesh.cg</shader>
+ <shader name="fragment">fragment/simple_alpha.cg</shader>
+ <blending>true</blending>
+ <variables>
+ <sampler2D name="diffuseTexture">textures/test.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit.xml
new file mode 100644
index 00000000..4942de8a
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit.xml
@@ -0,0 +1,7 @@
+<material type="lit">
+ <shader name="vertex">vertex/staticmesh.cg</shader>
+ <shader name="vertex">vertex/skeletalmesh_1bone.cg</shader>
+ <shader name="fragment">fragment/simple.cg</shader>
+ <variables>
+ </variables>
+</material> \ No newline at end of file
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit_alpha.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit_alpha.xml
new file mode 100644
index 00000000..6f5ff3a3
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit_alpha.xml
@@ -0,0 +1,11 @@
+<material type="lit">
+ <shader name="vertex">vertex/staticmesh.cg</shader>
+ <shader name="fragment">fragment/simple.cg</shader>
+ <blending>
+ true
+ <srcBlendFunc>ONE</srcBlendFunc>
+ <dstBlendFunc>ONE</dstBlendFunc>
+ </blending>
+ <variables>
+ </variables>
+</material> \ No newline at end of file
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit_color.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit_color.xml
new file mode 100644
index 00000000..7bb18f69
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit_color.xml
@@ -0,0 +1,6 @@
+<material type="lit">
+ <shader name="vertex">vertex/staticmesh.cg</shader>
+ <shader name="fragment">fragment/simple_color.cg</shader>
+ <variables>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit_uniform_alpha.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit_uniform_alpha.xml
new file mode 100644
index 00000000..edd5978c
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit_uniform_alpha.xml
@@ -0,0 +1,13 @@
+<material type="lit">
+ <shader name="vertex">vertex/staticmesh.cg</shader>
+ <shader name="fragment">fragment/simple_uniform_colors.cg</shader>
+ <blending>
+ true
+ <srcBlendFunc>ONE</srcBlendFunc>
+ <dstBlendFunc>ONE</dstBlendFunc>
+ </blending>
+ <variables>
+ <float4 name="diffuseColor">0.5 0.5 0.5 1.0</float4>
+ <float4 name="specularColor">0.2 0.2 0.2 64.0</float4>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit_uniform_color.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit_uniform_color.xml
new file mode 100644
index 00000000..b559fea3
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/simple_lit_uniform_color.xml
@@ -0,0 +1,8 @@
+<material type="lit">
+ <shader name="vertex">vertex/staticmesh.cg</shader>
+ <shader name="fragment">fragment/simple_uniform_colors.cg</shader>
+ <variables>
+ <float4 name="diffuseColor">0.6 0.6 0.6 1.0</float4>
+ <float4 name="specularColor">0.2 0.2 0.2 64.0</float4>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/simple_unlit.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/simple_unlit.xml
new file mode 100644
index 00000000..20afa7b0
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/simple_unlit.xml
@@ -0,0 +1,6 @@
+<material type="unlit">
+ <shader name="vertex">vertex/staticmesh.cg</shader>
+ <shader name="fragment">fragment/simple_color.cg</shader>
+ <variables>
+ </variables>
+</material> \ No newline at end of file
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/tablet_buttons.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/tablet_buttons.xml
new file mode 100644
index 00000000..22bb8d6d
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/tablet_buttons.xml
@@ -0,0 +1,7 @@
+<material type="unlit">
+ <shader name="vertex">vertex/tablet_buttons.cg</shader>
+ <shader name="fragment">fragment/tablet_buttons.cg</shader>
+ <blending>true</blending>
+ <variables>
+ </variables>
+</material> \ No newline at end of file
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/tablet_sticks.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/tablet_sticks.xml
new file mode 100644
index 00000000..4b7aaf98
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/tablet_sticks.xml
@@ -0,0 +1,8 @@
+<material type="unlit">
+ <shader name="vertex">vertex/tablet_sticks.cg</shader>
+ <shader name="fragment">fragment/tablet_sticks.cg</shader>
+ <blending>true</blending>
+ <variables>
+ <sampler2D name="diffuseTexture">textures/ui_knob_dxt3.dds</sampler2D>
+ </variables>
+</material> \ No newline at end of file
diff --git a/PhysX_3.4/Media/SampleRenderer/4/materials/wood_debris.xml b/PhysX_3.4/Media/SampleRenderer/4/materials/wood_debris.xml
new file mode 100644
index 00000000..469b2828
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/materials/wood_debris.xml
@@ -0,0 +1,7 @@
+<material type="lit">
+ <shader name="vertex">vertex/staticmesh.cg</shader>
+ <shader name="fragment">fragment/simple_diffuse.cg</shader>
+ <variables>
+ <sampler2D name="diffuseTexture">textures/Wood_Tileable.dds</sampler2D>
+ </variables>
+</material>
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/fancy_cloth_diffuse.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/fancy_cloth_diffuse.cg
new file mode 100644
index 00000000..7714a24e
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/fancy_cloth_diffuse.cg
@@ -0,0 +1,21 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(diffuseTexture)
+DECLARE_TEXTURE(normalTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor = tex2D(diffuseTexture, params.texcoord0.xy);
+ half4 normalTextureColor = tex2D(normalTexture, params.texcoord0.xy);
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = diffuseTextureColor.rgb;
+ mout.alpha = lerp(normalTextureColor.a, 1, params.texcoord1.r);
+ mout.emissiveColor = 0;
+ mout.specularColor = diffuseTextureColor.a;
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = normalTextureColor.xyz*2-1;
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/lines.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/lines.cg
new file mode 100644
index 00000000..2a40b7eb
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/lines.cg
@@ -0,0 +1,14 @@
+struct FragmentParameters
+{
+#if !defined(GLSL_COMPILER)
+ half4 screenSpacePosition : SV_POSITION;
+#else
+ half4 screenSpacePosition : POSITION;
+#endif
+ half4 color : COLOR;
+};
+
+half4 fmain(FragmentParameters params) : COLOR0
+{
+ return params.color;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/material_diffuse.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/material_diffuse.cg
new file mode 100644
index 00000000..a706e45c
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/material_diffuse.cg
@@ -0,0 +1,33 @@
+// fragment shader that takes in a diffuse texture and some material parameters.
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(diffuseTexture)
+
+BEGIN_CBUFFER(cbMaterialDiffuse)
+CONST_TYPE float4 diffuseColor;
+CONST_TYPE float3 emissiveColor;
+CONST_TYPE float3 specularColor;
+CONST_TYPE float specularPower;
+END_CBUFFER(cbMaterialDiffuse)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor = (half4)tex2D(diffuseTexture, params.texcoord0.xy);
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = diffuseTextureColor.rgb * (half3)diffuseColor.rgb;
+ mout.alpha = diffuseTextureColor.a * (half)diffuseColor.a;
+
+ //float3 eyeToSurf = normalize(g_eyePosition-params.worldSpacePosition);
+
+ //mout.emissiveColor = 1-pow(saturate(dot(normalize(g_eyePosition-params.worldSpacePosition),2)), params.worldSpaceNormal);//emissiveColor * saturate(dot(-g_eyeDirection, params.worldSpaceNormal));
+ mout.emissiveColor = (half3)emissiveColor;
+
+ mout.specularColor = (half3)specularColor;
+ mout.specularPower = (half)specularPower;
+ mout.tangentSpaceNormal = half3(0,0,1);
+
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/outlinetext.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/outlinetext.cg
new file mode 100644
index 00000000..a579a450
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/outlinetext.cg
@@ -0,0 +1,39 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(diffuseTexture)
+
+uniform const float3 outlineColor = {0.0, 0.0, 0.0};
+uniform const float invTexWidth = 1.0/1024.0;
+uniform const float invTexHeight = 1.0/1024.0;
+
+// should replace the blur with a separable version or some such
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor = tex2D(diffuseTexture, params.texcoord0.xy);
+
+ half coeffs[9]= { 1.0/16.0, 2.0/16.0, 1.0/16.0,
+ 2.0/16.0, 4.0/16.0, 2.0/16.0,
+ 1.0/16.0, 2.0/16.0, 1.0/16.0 };
+
+ float accum = 0.0;
+ accum += tex2D(diffuseTexture, params.texcoord0.xy + half2(-invTexWidth, -invTexHeight)).a * coeffs[0];
+ accum += tex2D(diffuseTexture, params.texcoord0.xy + half2( 0, -invTexHeight)).a * coeffs[1];
+ accum += tex2D(diffuseTexture, params.texcoord0.xy + half2(invTexWidth, -invTexHeight)).a * coeffs[2];
+ accum += tex2D(diffuseTexture, params.texcoord0.xy + half2(-invTexWidth, 0 )).a * coeffs[3];
+ accum += diffuseTextureColor.a * coeffs[4];
+ accum += tex2D(diffuseTexture, params.texcoord0.xy + half2(invTexWidth, 0 )).a * coeffs[5];
+ accum += tex2D(diffuseTexture, params.texcoord0.xy + half2(-invTexWidth, invTexHeight)).a * coeffs[6];
+ accum += tex2D(diffuseTexture, params.texcoord0.xy + half2( 0, invTexHeight)).a * coeffs[7];
+ accum += tex2D(diffuseTexture, params.texcoord0.xy + half2(invTexWidth, invTexHeight)).a * coeffs[8];
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = lerp(outlineColor, params.color.rgb, diffuseTextureColor.a);
+ mout.alpha = diffuseTextureColor.a*params.color.a + accum;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(1,1,1); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/particle_fog.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/particle_fog.cg
new file mode 100644
index 00000000..38871af1
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/particle_fog.cg
@@ -0,0 +1,24 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(diffuseTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+#if defined(PX_X360) && defined(RENDERER_FRAGMENT)
+ half4 diffuseTextureColor = tex2D(diffuseTexture, params.spriteTexCoord.xy);
+#else
+ half4 diffuseTextureColor = tex2D(diffuseTexture, params.texcoord0.xy);
+#endif
+ float density = params.color.r;
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = lerp(1, 0.4, density);
+ mout.alpha = diffuseTextureColor.a*(density*0.1);
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(1,1,1); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/pointsprite_diffuse.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/pointsprite_diffuse.cg
new file mode 100644
index 00000000..bfaf23bd
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/pointsprite_diffuse.cg
@@ -0,0 +1,24 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(diffuseTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ SurfaceMaterial mout;
+#if defined(PX_X360) && defined(RENDERER_FRAGMENT)
+ half4 diffuseTextureColor = tex2D(diffuseTexture, float2(params.spriteTexCoord.x, params.spriteTexCoord.y));
+#else
+ half4 diffuseTextureColor = (half4)tex2D(diffuseTexture, float2(params.texcoord0.x, params.texcoord0.y));
+#endif
+
+ mout.alpha = diffuseTextureColor.a * params.color.a;
+ mout.diffuseColor = diffuseTextureColor.rgb * params.color.rgb;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(1,1,1);
+ mout.specularPower = 0;
+ mout.tangentSpaceNormal = half3(0,0,1);
+
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/pointsprite_diffuse2.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/pointsprite_diffuse2.cg
new file mode 100644
index 00000000..e9b3e90a
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/pointsprite_diffuse2.cg
@@ -0,0 +1,31 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(diffuseTexture)
+BEGIN_CBUFFER(cbDiffuse)
+CONST_TYPE float4 diffuseColor;
+END_CBUFFER(cbDiffuse)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ SurfaceMaterial mout;
+#if defined(PX_X360) && defined(RENDERER_FRAGMENT)
+ half4 diffuseTextureColor = tex2D(diffuseTexture, float2(params.spriteTexCoord.x, params.spriteTexCoord.y));
+#else
+ #if defined (RENDERER_GXM)
+ half4 diffuseTextureColor = (half4)tex2D(diffuseTexture, float2(params.spriteTexCoord.x, params.spriteTexCoord.y));
+ #else
+ half4 diffuseTextureColor = (half4)tex2D(diffuseTexture, float2(params.texcoord0.x, params.texcoord0.y));
+ #endif
+#endif
+
+ mout.alpha = half(diffuseTextureColor.a * diffuseColor.a * params.color.a);
+ mout.diffuseColor = half3(diffuseTextureColor.rgb * diffuseColor.rgb);
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(1,1,1);
+ mout.specularPower = 0;
+ mout.tangentSpaceNormal = half3(0,0,1);
+
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/pointsprite_normal.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/pointsprite_normal.cg
new file mode 100644
index 00000000..42bc61dc
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/pointsprite_normal.cg
@@ -0,0 +1,24 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(normalTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ SurfaceMaterial mout;
+
+#if defined(PX_X360) && defined(RENDERER_FRAGMENT)
+ half4 normalTextureColor = tex2D(normalTexture, float2(params.spriteTexCoord.x, 1-params.spriteTexCoord.y));
+#else
+ half4 normalTextureColor = (half4)tex2D(normalTexture, float2(params.texcoord0.x, 1-params.texcoord0.y));
+#endif
+ mout.alpha = normalTextureColor.a;
+ mout.diffuseColor = params.color.rgb;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(1,1,1); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = normalTextureColor.rgb*2-1;
+
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/primitives.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/primitives.cg
new file mode 100644
index 00000000..2a40b7eb
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/primitives.cg
@@ -0,0 +1,14 @@
+struct FragmentParameters
+{
+#if !defined(GLSL_COMPILER)
+ half4 screenSpacePosition : SV_POSITION;
+#else
+ half4 screenSpacePosition : POSITION;
+#endif
+ half4 color : COLOR;
+};
+
+half4 fmain(FragmentParameters params) : COLOR0
+{
+ return params.color;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/primitives_lighting.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/primitives_lighting.cg
new file mode 100644
index 00000000..677a4355
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/primitives_lighting.cg
@@ -0,0 +1,23 @@
+#include <globals.cg>
+
+struct FragmentParameters
+{
+#if !defined(GLSL_COMPILER)
+ half4 screenSpacePosition : SV_POSITION;
+#else
+ half4 screenSpacePosition : POSITION;
+#endif
+ half3 worldSpacePosition : TEXCOORD1;
+ half3 worldSpaceNormal : TEXCOORD2;
+ half4 color : COLOR;
+};
+
+half4 fmain(FragmentParameters params) : COLOR0
+{
+ half3 lightColor = (half3)g_lightColor * (half)g_lightIntensity;
+ half3 diffuseColor = (half)saturate(dot(params.worldSpaceNormal, -g_lightDirection)) * lightColor;
+ float3 surfToEye = normalize(params.worldSpacePosition - g_eyePosition);
+ float specularPower = 5.0;
+ half3 specularColor = (half)pow(saturate(dot(reflect(-g_lightDirection, params.worldSpaceNormal), surfToEye)), specularPower) * lightColor;
+ return params.color * half4(diffuseColor + specularColor, 1);
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/sample_diffuse_and_texture.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/sample_diffuse_and_texture.cg
new file mode 100644
index 00000000..aa887ab1
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/sample_diffuse_and_texture.cg
@@ -0,0 +1,24 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+BEGIN_CBUFFER(cbDiffuse)
+CONST_TYPE float4 diffuseColor;
+END_CBUFFER(cbDiffuse)
+
+DECLARE_TEXTURE(diffuseTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor = half4(tex2D(diffuseTexture, params.texcoord0.xy));
+
+ SurfaceMaterial mout;
+// mout.diffuseColor = diffuseTextureColor.rgb * diffuseColor;
+ mout.diffuseColor = diffuseTextureColor.rgb;
+ mout.alpha = half(diffuseColor.a);
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/sample_diffuse_no_texture.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/sample_diffuse_no_texture.cg
new file mode 100644
index 00000000..f7a0e24c
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/sample_diffuse_no_texture.cg
@@ -0,0 +1,19 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+BEGIN_CBUFFER(cbDiffuse)
+CONST_TYPE float4 diffuseColor;
+END_CBUFFER(cbDiffuse)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ SurfaceMaterial mout;
+ mout.diffuseColor = half3(diffuseColor.rgb);
+ mout.alpha = half(diffuseColor.a);
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/screenquad.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/screenquad.cg
new file mode 100644
index 00000000..ae8067dc
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/screenquad.cg
@@ -0,0 +1,23 @@
+
+struct FragmentParameters
+{
+ float4 worldSpacePosition : TEXCOORD4;
+ float2 texcoord0 : TEXCOORD0;
+ half4 color : COLOR;
+};
+
+struct Fragment
+{
+ half4 color : COLOR0;
+};
+
+//uniform const sampler2D diffuseTexture;
+
+Fragment fmain(FragmentParameters params)
+{
+ Fragment fout;
+// half4 diffuseTextureColor = tex2D(diffuseTexture, params.texcoord0.xy);
+// fout.color = diffuseTextureColor * params.color;
+ fout.color = params.color;
+ return fout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple.cg
new file mode 100644
index 00000000..7346e7d8
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple.cg
@@ -0,0 +1,15 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ SurfaceMaterial mout;
+ mout.diffuseColor = 0.5;
+ mout.alpha = 1;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_alpha.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_alpha.cg
new file mode 100644
index 00000000..25ffcab0
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_alpha.cg
@@ -0,0 +1,19 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(diffuseTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor = (half4)tex2D(diffuseTexture, params.texcoord0.xy);
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = params.color.rgb;
+ mout.alpha = diffuseTextureColor.a*params.color.a;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(1,1,1); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_color.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_color.cg
new file mode 100644
index 00000000..0a0277f6
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_color.cg
@@ -0,0 +1,15 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ SurfaceMaterial mout;
+ mout.diffuseColor = params.color.rgb;
+ mout.alpha = 1;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse.cg
new file mode 100644
index 00000000..cfe7212a
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse.cg
@@ -0,0 +1,19 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(diffuseTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor = (half4)tex2D(diffuseTexture, params.texcoord0.xy);
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = diffuseTextureColor.rgb;
+ mout.alpha = diffuseTextureColor.a;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_alpha.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_alpha.cg
new file mode 100644
index 00000000..e89b6599
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_alpha.cg
@@ -0,0 +1,19 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(diffuseTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor = (half4)tex2D(diffuseTexture, params.texcoord0.xy);
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = diffuseTextureColor.rgb*params.color.rgb;
+ mout.alpha = diffuseTextureColor.a *params.color.a;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(1,1,1); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_fog.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_fog.cg
new file mode 100644
index 00000000..e82e3451
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_fog.cg
@@ -0,0 +1,20 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry_fog.cg>
+
+DECLARE_TEXTURE(diffuseTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor = (half4)tex2D(diffuseTexture, params.texcoord0.xy);
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = diffuseTextureColor.rgb;
+ mout.alpha = diffuseTextureColor.a;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_multitex.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_multitex.cg
new file mode 100644
index 00000000..457ea4a6
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_multitex.cg
@@ -0,0 +1,24 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(diffuseTexture0)
+DECLARE_TEXTURE(diffuseTexture1)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor0 = (half4)tex2D(diffuseTexture0, params.texcoord0.xy);
+ half4 diffuseTextureColor1 = (half4)tex2D(diffuseTexture1, params.texcoord1.xy);
+
+ // selects texture depending on world normal steepness of height map
+ half4 diffuseTextureColor = half4(diffuseTextureColor0*0.75 + diffuseTextureColor1*0.25);
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = diffuseTextureColor.rgb;
+ mout.alpha = diffuseTextureColor.a;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_multitex_heightmap.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_multitex_heightmap.cg
new file mode 100644
index 00000000..5ce01c68
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_multitex_heightmap.cg
@@ -0,0 +1,26 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(diffuseTexture0)
+DECLARE_TEXTURE(diffuseTexture1)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor0 = (half4)tex2D(diffuseTexture0, params.texcoord0.xy);
+ half4 diffuseTextureColor1 = (half4)tex2D(diffuseTexture1, params.texcoord0.xy);
+
+ // selects texture depending on world normal steepness of height map
+ float3 normal = normalize(params.worldSpaceNormal);
+ float tex0weight = saturate((normal.y-0.5)*3.0);
+ half4 diffuseTextureColor = half4(diffuseTextureColor0*tex0weight + diffuseTextureColor1*(1.0-tex0weight));
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = diffuseTextureColor.rgb;
+ mout.alpha = diffuseTextureColor.a;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_normal.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_normal.cg
new file mode 100644
index 00000000..dc47aee5
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_normal.cg
@@ -0,0 +1,21 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(diffuseTexture)
+DECLARE_TEXTURE(normalTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor = (half4)tex2D(diffuseTexture, params.texcoord0.xy);
+ half4 normalTextureColor = (half4)tex2D(normalTexture, params.texcoord0.xy);
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = diffuseTextureColor.rgb;
+ mout.alpha = diffuseTextureColor.a;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = (normalTextureColor.xyz-0.5) * 2.0;
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_normal_5.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_normal_5.cg
new file mode 100644
index 00000000..7c45559e
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_normal_5.cg
@@ -0,0 +1,21 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(diffuseTexture)
+//DECLARE_TEXTURE(normalTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor = (half4)tex2D(diffuseTexture, params.texcoord0.xy);
+ //half4 normalTextureColor = (half4)tex2D(normalTexture, params.texcoord0.xy * 4);
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = diffuseTextureColor.rgb;
+ mout.alpha = 1;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_normal_5t.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_normal_5t.cg
new file mode 100644
index 00000000..2949605d
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_normal_5t.cg
@@ -0,0 +1,29 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(diffuseTexture1)
+DECLARE_TEXTURE(diffuseTexture2)
+//DECLARE_TEXTURE(normalTexture)
+
+CONST_TYPE float blendFactor;
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor1 = (half4)tex2D(diffuseTexture1, params.texcoord0.xy);
+ half4 diffuseTextureColor2 = (half4)tex2D(diffuseTexture2, params.texcoord0.xy);
+ /*half2 nuvs = (half2)params.texcoord0.xy * 5;
+ half4 normalTextureColor = (half4)tex2D(normalTexture, nuvs);*/
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = diffuseTextureColor1.rgb * (1.0 - (half)blendFactor) + diffuseTextureColor2.rgb * (half)blendFactor;
+ mout.alpha = 1;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ /*mout.specularColor = half3(normalTextureColor.a, normalTextureColor.a, normalTextureColor.a);
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = (normalTextureColor.xyz-0.5) * 2.0;*/
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_normal_5x.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_normal_5x.cg
new file mode 100644
index 00000000..410b6db4
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_normal_5x.cg
@@ -0,0 +1,20 @@
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(diffuseTexture)
+DECLARE_TEXTURE(normalTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor = (half4)tex2D(diffuseTexture, params.texcoord0.xy);
+ half4 normalTextureColor = (half4)tex2D(normalTexture, params.texcoord0.xy);
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = diffuseTextureColor.rgb;
+ mout.alpha = 1;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(normalTextureColor.a, normalTextureColor.a, normalTextureColor.a);
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = (normalTextureColor.xyz-0.5) * 2.0;
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_tiled.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_tiled.cg
new file mode 100644
index 00000000..ffa8c834
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_tiled.cg
@@ -0,0 +1,19 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(diffuseTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor = tex2D(diffuseTexture, params.texcoord0.xy*3);
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = diffuseTextureColor.rgb;
+ mout.alpha = diffuseTextureColor.a;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(1.5,1.5,1.5); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_uniform_color.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_uniform_color.cg
new file mode 100644
index 00000000..a93b49b8
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_uniform_color.cg
@@ -0,0 +1,23 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+BEGIN_CBUFFER(cbDiffuse)
+CONST_TYPE float4 diffuseColor;
+END_CBUFFER(cbDiffuse)
+
+DECLARE_TEXTURE(diffuseTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor = half4(tex2D(diffuseTexture, params.texcoord0.xy));
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = diffuseTextureColor.rgb * half3(diffuseColor.rgb);
+ mout.alpha = half(diffuseColor.a);
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_uniform_colors.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_uniform_colors.cg
new file mode 100644
index 00000000..017334f4
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_diffuse_uniform_colors.cg
@@ -0,0 +1,21 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+uniform const float4 diffuseColor;
+uniform const float4 specularColor;
+DECLARE_TEXTURE(diffuseTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor = half4(tex2D(diffuseTexture, params.texcoord0.xy));
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = diffuseTextureColor.rgb * half3(diffuseColor.rgb);
+ mout.alpha = half(diffuseColor.a);
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(specularColor.rgb);
+ mout.specularPower = half(specularColor.a);
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_lightmap.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_lightmap.cg
new file mode 100644
index 00000000..39959574
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_lightmap.cg
@@ -0,0 +1,21 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry_fog.cg>
+
+DECLARE_TEXTURE(diffuseTexture)
+DECLARE_TEXTURE(lightmapTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor = (half4)tex2D(diffuseTexture, params.texcoord0.xy);
+ half4 lightmapTextureColor = (half4)tex2D(lightmapTexture, params.texcoord1.xy);
+ SurfaceMaterial mout;
+ mout.diffuseColor = diffuseTextureColor.rgb*lightmapTextureColor.rgb*2;
+ mout.alpha = diffuseTextureColor.a;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_skydome.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_skydome.cg
new file mode 100644
index 00000000..c05d9682
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_skydome.cg
@@ -0,0 +1,19 @@
+#include <phong_lighting.cg>
+#include <fragment_entry_skydome.cg>
+
+DECLARE_TEXTURE(skydomeTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 skydomeTextureColor = (half4)tex2D(skydomeTexture, params.texcoord0.xy);
+ SurfaceMaterial mout;
+ mout.diffuseColor = half3(skydomeTextureColor.xyz * (skydomeTextureColor.a) + g_fogColorAndDistance.xyz * (1.0-skydomeTextureColor.a));
+ //skydomeTextureColor.rgb;
+ mout.alpha = skydomeTextureColor.a;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0,0,0); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 1;
+ mout.tangentSpaceNormal = half3(0,0,1);
+
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_test.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_test.cg
new file mode 100644
index 00000000..25eee4d8
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_test.cg
@@ -0,0 +1,24 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+BEGIN_CBUFFER(cbDiffuse)
+CONST_TYPE float3 diffuseColor;
+END_CBUFFER(cbDiffuse)
+
+DECLARE_TEXTURE(diffuseTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor = tex2D(diffuseTexture, params.texcoord0.xy);
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = diffuseTextureColor.rgb * diffuseColor;
+// mout.diffuseColor = diffuseColor;
+ mout.alpha = 1.0;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_turbulence.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_turbulence.cg
new file mode 100644
index 00000000..de9d1f82
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_turbulence.cg
@@ -0,0 +1,33 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(diffuseTexture)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 diffuseTextureColor = tex2D(diffuseTexture, params.texcoord0.xy);
+
+ SurfaceMaterial mout;
+
+ // calculate eye-space sphere normal from texture coordinates
+ float3 N;
+ N.xy = params.texcoord0.xy*float2(2.0, -2.0) + float2(-1.0, 1.0);
+ float r2 = dot(N.xy, N.xy);
+ if (r2 > 0.5) discard; // kill pixels outside circle
+ N.z = sqrt(1.0-r2);
+
+ mout.diffuseColor = params.color.xyz*diffuseTextureColor.rgb;
+
+ mout.alpha = clamp(1.0 - r2,0.0,1.0);//saturate(1.0 - r2);
+ //alpha *= diffuseTextureColor.a;
+
+
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(1,1,1); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
+
+
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_uniform_color.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_uniform_color.cg
new file mode 100644
index 00000000..e3d5c4ca
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_uniform_color.cg
@@ -0,0 +1,19 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+BEGIN_CBUFFER(cbDiffuse)
+CONST_TYPE float4 diffuseColor;
+END_CBUFFER(cbDiffuse)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ SurfaceMaterial mout;
+ mout.diffuseColor = half3(diffuseColor.xyz);
+ mout.alpha = half(diffuseColor.a);
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_uniform_color_normal.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_uniform_color_normal.cg
new file mode 100644
index 00000000..c4a0361f
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_uniform_color_normal.cg
@@ -0,0 +1,23 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+DECLARE_TEXTURE(diffuseTexture)
+DECLARE_TEXTURE(normalTexture)
+BEGIN_CBUFFER(cbDiffuse)
+CONST_TYPE float4 diffuseColor;
+END_CBUFFER(cbDiffuse)
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ half4 normalTextureColor = (half4)tex2D(normalTexture, params.texcoord0.xy);
+
+ SurfaceMaterial mout;
+ mout.diffuseColor = half3(diffuseColor.xyz);
+ mout.alpha = half(diffuseColor.a);
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = (normalTextureColor.xyz-0.5) * 2.0;
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_uniform_colors.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_uniform_colors.cg
new file mode 100644
index 00000000..c67ea95d
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_uniform_colors.cg
@@ -0,0 +1,18 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+uniform const float4 diffuseColor;
+uniform const float4 specularColor;
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ SurfaceMaterial mout;
+ mout.diffuseColor = half3(diffuseColor.xyz);
+ mout.alpha = half(diffuseColor.a);
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(specularColor.rgb); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = half(specularColor.a);
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_unlit_bitangents.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_unlit_bitangents.cg
new file mode 100644
index 00000000..55c3c01d
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_unlit_bitangents.cg
@@ -0,0 +1,15 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ SurfaceMaterial mout;
+ mout.diffuseColor = (half3(params.worldSpaceBinormal) + half3(1.0, 1.0, 1.0)) / 2.0;
+ mout.alpha = 1.0;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_unlit_normals.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_unlit_normals.cg
new file mode 100644
index 00000000..91a8bb5d
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_unlit_normals.cg
@@ -0,0 +1,15 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ SurfaceMaterial mout;
+ mout.diffuseColor = (half3(params.worldSpaceNormal) + half3(1.0, 1.0, 1.0)) / 2.0;
+ mout.alpha = 1.0;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_unlit_tangents.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_unlit_tangents.cg
new file mode 100644
index 00000000..dd8bb2eb
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/simple_unlit_tangents.cg
@@ -0,0 +1,15 @@
+
+#include <phong_lighting.cg>
+#include <fragment_entry.cg>
+
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
+{
+ SurfaceMaterial mout;
+ mout.diffuseColor = (half3(params.worldSpaceTangent) + half3(1.0, 1.0, 1.0)) / 2.0;
+ mout.alpha = 1.0;
+ mout.emissiveColor = 0;
+ mout.specularColor = half3(0.2,0.2,0.2); // TODO: make this a constant parameter set by the material.
+ mout.specularPower = 16;
+ mout.tangentSpaceNormal = half3(0,0,1);
+ return mout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/tablet_buttons.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/tablet_buttons.cg
new file mode 100644
index 00000000..8d9f3f35
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/tablet_buttons.cg
@@ -0,0 +1,13 @@
+struct Fragment
+{
+ float4 color : COLOR0;
+};
+
+uniform const float4 diffuseColor;
+
+Fragment fmain()
+{
+ Fragment fout;
+ fout.color = diffuseColor;
+ return fout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/tablet_sticks.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/tablet_sticks.cg
new file mode 100644
index 00000000..d6a0cf96
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/tablet_sticks.cg
@@ -0,0 +1,21 @@
+
+struct FragmentParameters
+{
+ float4 worldSpacePosition : TEXCOORD4;
+ float2 texcoord0 : TEXCOORD0;
+ half4 color : COLOR;
+};
+
+struct Fragment
+{
+ half4 color : COLOR0;
+};
+
+uniform const sampler2D diffuseTexture;
+
+Fragment fmain(FragmentParameters params)
+{
+ Fragment fout;
+ fout.color = half4(tex2D(diffuseTexture, params.texcoord0.xy));
+ return fout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/text.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/text.cg
new file mode 100644
index 00000000..cc47674c
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/fragment/text.cg
@@ -0,0 +1,23 @@
+#include <defines.cg>
+
+struct FragmentParameters
+{
+ float4 worldSpacePosition : TEXCOORD4;
+ float2 texcoord0 : TEXCOORD0;
+ half4 color : COLOR;
+};
+
+struct Fragment
+{
+ half4 color : COLOR0;
+};
+
+DECLARE_TEXTURE(diffuseTexture)
+
+Fragment fmain(FragmentParameters params)
+{
+ Fragment fout;
+ half4 diffuseTextureColor = half4(tex2D(diffuseTexture, params.texcoord0.xy));
+ fout.color = diffuseTextureColor * params.color;
+ return fout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/include/config.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/config.cg
new file mode 100644
index 00000000..51098d19
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/config.cg
@@ -0,0 +1,111 @@
+
+#ifndef CONFIG_H
+#define CONFIG_H
+
+// The VFACE register sign indicates if the face is backfacing or not.
+// The Renderer will define this if its supported...
+#if !defined(ENABLE_VFACE)
+ #define ENABLE_VFACE 0
+#endif
+
+// When true, ENABLE_COLOR_SWIZZLE_SUPPORT provides dynamic
+// color swizzling support from rgb/bgr -> bgr/rgb
+// if g_bSwizzleColor is true
+// This prevents the need for CPU color swizzling on platforms
+// expecting a color format different from that provided
+#if !defined(ENABLE_COLOR_SWIZZLE_SUPPORT)
+ #define ENABLE_COLOR_SWIZZLE_SUPPORT 0
+#endif
+
+// The D3D compiler will #define this as TANGENT!!
+#ifndef SEMANTIC_TANGENT
+#define SEMANTIC_TANGENT TEXCOORD5
+#endif
+
+#define SEMANTIC_INSTANCE_T TEXCOORD8
+#define SEMANTIC_INSTANCE_X TEXCOORD9
+#define SEMANTIC_INSTANCE_Y TEXCOORD10
+#define SEMANTIC_INSTANCE_Z TEXCOORD11
+
+#define SEMANTIC_INSTANCE_UV TEXCOORD12
+#define SEMANTIC_INSTANCE_LOCAL TEXCOORD13
+
+#define SEMANTIC_DISPLACEMENT TEXCOORD14
+#define SEMANTIC_DISPLACEMENT_FLAGS TEXCOORD15
+
+#define SEMANTIC_SPRITE_ROT_SCALEX_SCALEY TEXCOORD14
+
+#define SEMANTIC_BONEINDEX TEXCOORD6
+
+#if !defined(RENDERER_DISPLACED)
+#define RENDERER_DISPLACED 0
+#endif
+#if !defined(ENABLE_TESSELLATION)
+#define ENABLE_TESSELLATION 0
+#endif
+
+// Parameters passed from the vertex shader to the fragment shader.
+struct FragmentParameters
+{
+ float3 worldSpacePosition : TEXCOORD4;
+ float3 worldSpaceNormal : TEXCOORD5;
+ float3 worldSpaceTangent : TEXCOORD6;
+ float3 worldSpaceBinormal : TEXCOORD7;
+#if defined(PX_X360) && defined(RENDERER_FRAGMENT)
+ float2 spriteTexCoord : SPRITETEXCOORD;
+#endif
+#if defined (RENDERER_GXM)
+ float2 spriteTexCoord : SPRITECOORD;
+#endif
+ float4 texcoord0 : TEXCOORD0;
+ float4 texcoord1 : TEXCOORD1;
+ float4 texcoord2 : TEXCOORD2;
+#if !defined (RENDERER_WIN8ARM)
+ float4 texcoord3 : TEXCOORD3;
+#endif
+ half4 color : COLOR;
+};
+
+// Material information for a given fragment.
+struct SurfaceMaterial
+{
+ half3 diffuseColor;
+ half alpha;
+ half3 emissiveColor;
+ half3 specularColor;
+ half specularPower;
+ half3 tangentSpaceNormal;
+};
+
+// Lighting information for a given fragment.
+struct Lighting
+{
+ half3 diffuseColor;
+ half3 specularColor;
+};
+
+// Final output for a Forward Rendered Fragment.
+struct Fragment
+{
+ half4 color : COLOR0;
+};
+
+// Final output for a Deferred Rendered Fragment.
+struct DeferredFragment
+{
+ // TODO: COLOR0 alpha should be the alpha value... not emissiveIntensity.
+ half4 diffuseColor : COLOR0; // rgb=diffuseColor
+ half4 emissiveColor : COLOR1; // rgb=emissiveColor
+ half4 worldSpaceNormalAndSpecularPower : COLOR2; // rgb=worldSpaceNormal, a=specularPower
+};
+
+
+
+// user implemented functions...
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params);
+
+// lighting functions...
+Lighting computeLighting(const FragmentParameters params, const SurfaceMaterial material);
+
+
+#endif
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/include/defines.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/defines.cg
new file mode 100644
index 00000000..a275fb90
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/defines.cg
@@ -0,0 +1,144 @@
+#ifndef DEFINES_CG
+#define DEFINES_CG
+
+#define __in(argType, argName, argSemantic) argType argName : argSemantic
+
+#ifdef RENDERER_GNM
+#define JOIN2(a, b) a##b
+#define JOIN(a, b) JOIN2(a, b)
+
+#define BEGIN_CBUFFER(name)
+#define END_CBUFFER(name)
+#define CONST_TYPE
+#define DECLARE_TEXTURE(textureName) Texture2D textureName; SamplerState JOIN(textureName,SamplerState);
+#define DECLARE_TEXTURE_3D(textureName) Texture3D textureName; SamplerState JOIN(textureName,SamplerState);
+#define tex2D(textureName,textureCoord) textureName.Sample(JOIN(textureName,SamplerState), textureCoord)
+#define tex2Dproj(textureName,textureCoord) textureName.Sample(JOIN(textureName,SamplerState), textureCoord.xy).x <=
+
+#define __in_opt(argType, argName, argSemantic) , __in(argType, argName, argSemantic)
+
+#define COLOR0 S_TARGET_OUTPUT
+#define half3 float3
+#define half4 float4
+#define half float
+
+#elif !defined(RENDERER_D3D11)
+
+#define BEGIN_CBUFFER(name)
+#define END_CBUFFER(name)
+#define CONST_TYPE uniform const
+#define DECLARE_TEXTURE(name) uniform const sampler2D name;
+#define DECLARE_TEXTURE_3D(name) uniform const sampler3D name;
+
+#define __in_opt(argType, argName, argSemantic) , __in(argType, argName, argSemantic)
+
+#else /* !defined(RENDERER_D3D11) */
+
+#define JOIN2(a, b) a##b
+#define JOIN(a, b) JOIN2(a, b)
+
+#define BEGIN_CBUFFER(name) cbuffer name {
+#define END_CBUFFER(name) }
+#define CONST_TYPE
+#define DECLARE_TEXTURE(textureName) Texture2D textureName; SamplerState JOIN(textureName,SamplerState);
+#define DECLARE_TEXTURE_3D(textureName) Texture3D textureName; SamplerState JOIN(textureName,SamplerState);
+#define tex2D(textureName,textureCoord) textureName.Sample(JOIN(textureName,SamplerState), textureCoord)
+#define tex2Dproj(textureName,textureCoord) textureName.Sample(JOIN(textureName,SamplerState), textureCoord.xy).x <= textureCoord.z ? 0 : 1
+
+#define __in_opt2(argType, argName, argSemantic) JOIN(__in_,argSemantic) (argType, argName, argSemantic)
+#define __in_opt(argType, argName, argSemantic) __in_opt2(argType, argName, argSemantic)
+
+#if defined(USE_ALL) || defined(RENDERER_FRAGMENT)
+#define USE_POSITION 1
+#define USE_NORMAL 1
+#define USE_TANGENT 1
+#define USE_TEXCOORD0 1
+#define USE_TEXCOORD1 1
+#define USE_TEXCOORD2 1
+#define USE_TEXCOORD3 1
+#define USE_COLOR 1
+#define USE_BONE 1
+#endif
+
+#define __in_POSITION(a,b,c) __in(a, b, c)
+
+// These semantics are required, not optional, when specified in a shader argument list
+#define __in_TEXCOORD6(a,b,c) , __in(a, b, c)
+#define __in_TEXCOORD7(a,b,c) , __in(a, b, c)
+#define __in_TEXCOORD8(a,b,c) , __in(a, b, c)
+#define __in_TEXCOORD9(a,b,c) , __in(a, b, c)
+#define __in_TEXCOORD10(a,b,c) , __in(a, b, c)
+#define __in_TEXCOORD11(a,b,c) , __in(a, b, c)
+//#define __in_TEXCOORD12(a,b,c) , __in(a, b, c) // Optional instance semantic for uv offsets
+//#define __in_TEXCOORD13(a,b,c) , __in(a, b, c) // Optional instance semantic for local offsets
+#define __in_TEXCOORD14(a,b,c) , __in(a, b, c)
+//#define __in_TEXCOORD15(a,b,c) , __in(a, b, c) // Optional displacement semantic
+#define __in_TEXCOORD16(a,b,c) , __in(a, b, c)
+#define __in_TEXCOORD17(a,b,c) , __in(a, b, c)
+
+#if USE_NORMAL
+#define __in_NORMAL(a,b,c) , __in(a, b, c)
+#else
+#define __in_NORMAL(a,b,c)
+#define localSpaceNormal float3(1,0,0)
+#endif
+#if USE_TANGENT
+#define __in_TANGENT(a,b,c) , __in(a, b, c)
+#define __in_TEXCOORD5(a,b,c) , __in(a, b, c)
+#else
+#define __in_TANGENT(a,b,c)
+#define __in_TEXCOORD5(a,b,c)
+#define localSpaceTangent float4(1,0,0,1)
+#endif
+#if USE_TEXCOORD0
+#define __in_TEXCOORD0(a,b,c) , __in(a, b, c)
+#else
+#define __in_TEXCOORD0(a,b,c)
+#define vertexTexcoord0 float4(0,0,0,0)
+#endif
+#if USE_TEXCOORD1
+#define __in_TEXCOORD1(a,b,c) , __in(a, b, c)
+#else
+#define __in_TEXCOORD1(A,B,C)
+#define vertexTexcoord1 float4(0,0,0,0)
+#endif
+#if USE_TEXCOORD2
+#define __in_TEXCOORD2(a,b,c) , __in(a, b, c)
+#else
+#define __in_TEXCOORD2(a,b,c)
+#define vertexTexcoord2 float4(0,0,0,0)
+#endif
+#if USE_TEXCOORD3
+#define __in_TEXCOORD3(a,b,c) , __in(a, b, c)
+#else
+#define __in_TEXCOORD3(a,b,c)
+#define vertexTexcoord3 float4(0,0,0,0)
+#endif
+#if USE_COLOR
+#define __in_COLOR(a,b,c) , __in(a, b, c)
+#else
+#define __in_COLOR(a,b,c)
+#define vertexColor half4(0,0,0,0)
+#endif
+#if USE_TEXCOORD12
+#define __in_TEXCOORD12(a,b,c) , __in(a, b, c)
+#else
+#define __in_TEXCOORD12(a,b,c)
+#define instanceUVOffset float2(0,0)
+#endif
+#if USE_TEXCOORD13
+#define __in_TEXCOORD13(a,b,c) , __in(a, b, c)
+#else
+#define __in_TEXCOORD13(a,b,c)
+#define instanceLocalOffset float3(0,0,0)
+#endif
+#if USE_TEXCOORD15
+#define __in_TEXCOORD15(a,b,c) , __in(a, b, c)
+#else
+#define __in_TEXCOORD15(a,b,c)
+#define vertexFlagsDisp 0
+#endif
+
+#endif /* !defined(RENDERER_D3D11) */
+
+#endif
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/include/fragment_entry.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/fragment_entry.cg
new file mode 100644
index 00000000..9cf25342
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/fragment_entry.cg
@@ -0,0 +1,109 @@
+
+#ifndef FRAGMENT_ENTRY_CG
+#define FRAGMENT_ENTRY_CG
+
+#include <config.cg>
+
+BEGIN_CBUFFER(cbShade)
+CONST_TYPE float shadeMode;
+END_CBUFFER(cbShade)
+
+#if !defined(ENABLE_VFACE)
+#define ENABLE_VFACE 0
+#endif
+
+// define the platform specific semantic for the facing register
+#if defined(RENDERER_PS3)
+#define FACE_SEMANTIC FACE
+#else
+#define FACE_SEMANTIC VFACE
+#endif
+
+#if defined(PASS_UNLIT)
+ Fragment fmain(FragmentParameters params)
+ {
+ Fragment fout;
+ SurfaceMaterial material = computeSurfaceMaterial(params);
+ fout.color = half4(material.diffuseColor, material.alpha);
+ return fout;
+ }
+#elif defined(PASS_AMBIENT_LIGHT) || defined(PASS_POINT_LIGHT) || defined(PASS_DIRECTIONAL_LIGHT) || defined(PASS_SPOT_LIGHT) || defined(PASS_SPOT_LIGHT_NO_SHADOW)
+ Fragment fmain(FragmentParameters params
+ #if ENABLE_VFACE
+ ,float vface : FACE_SEMANTIC
+ #endif
+ )
+ {
+ #if !ENABLE_VFACE
+ float vface = 1.0;
+ #endif
+ #if ENABLE_VFACE_SCALE
+ vface *= g_vfaceScale;
+ #endif
+
+ Fragment fout;
+ float3x3 tangentBasis = float3x3(params.worldSpaceTangent, params.worldSpaceBinormal, params.worldSpaceNormal);
+ SurfaceMaterial material = computeSurfaceMaterial(params);
+
+ float3 bumpNormal = mul(material.tangentSpaceNormal, tangentBasis);
+
+#if defined(NO_SUPPORT_DDX_DDY)
+//#if !defined(GLSL_COMPILER)
+ params.worldSpaceNormal = sign(vface) * normalize(bumpNormal);
+//#endif
+#else
+ // emulate flat shading by taking the derivative of position with respective to screen dx and dy and taking the cross product
+ float3 faceNormal = cross(ddy(params.worldSpacePosition.xyz), ddx(params.worldSpacePosition.xyz));
+
+# ifdef RENDERER_PS3
+ // ddy flipped on ps3
+ faceNormal *= -1.0;
+# endif
+
+ // select bump or face normal based on shade mode
+ params.worldSpaceNormal = sign(vface) * normalize(lerp(bumpNormal, faceNormal, shadeMode));
+#endif // NO_SUPPORT_DDX_DDY
+
+ Lighting lighting = computeLighting(params, material);
+ float3 diffuseColor = material.diffuseColor * lighting.diffuseColor;
+ float3 emissiveColor = material.emissiveColor + material.specularColor * lighting.specularColor;
+ fout.color = half4(diffuseColor + emissiveColor, material.alpha);
+ //fout.color = half4(params.worldSpaceNormal, 1); // renders normals.
+
+ // Fog
+ //float depth = length(params.worldSpacePosition - g_eyePosition);
+ //float fogBlend = min(1.0f, depth/g_fogColorAndDistance.w);
+ //fout.color.xyz = half3(fout.color.xyz * (1.0f-fogBlend) + g_fogColorAndDistance.xyz * fogBlend);
+
+ return fout;
+ }
+#elif defined(PASS_NORMALS)
+ Fragment fmain(FragmentParameters params)
+ {
+ Fragment fout;
+ SurfaceMaterial material = computeSurfaceMaterial(params);
+ fout.color = half4(0,1,0,material.alpha);
+ return fout;
+ }
+#elif defined(PASS_DEPTH)
+ Fragment fmain(FragmentParameters params)
+ {
+ Fragment fout;
+ SurfaceMaterial material = computeSurfaceMaterial(params);
+ float depth = length(params.worldSpacePosition - g_eyePosition);
+ fout.color = half4((half)depth,(half)depth,(half)depth,material.alpha);
+ return fout;
+ }
+#elif defined(PASS_DEFERRED)
+ DeferredFragment fmain(FragmentParameters params)
+ {
+ DeferredFragment fout;
+ SurfaceMaterial material = computeSurfaceMaterial(params);
+ fout.diffuseColor = half4(material.diffuseColor, 0);
+ fout.emissiveColor = half4(material.emissiveColor, 0);
+ fout.worldSpaceNormalAndSpecularPower = half4(params.worldSpaceNormal, material.specularPower);
+ return fout;
+ }
+#endif
+
+#endif
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/include/fragment_entry_fog.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/fragment_entry_fog.cg
new file mode 100644
index 00000000..d21017fc
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/fragment_entry_fog.cg
@@ -0,0 +1,105 @@
+
+#ifndef FRAGMENT_ENTRY_CG
+#define FRAGMENT_ENTRY_CG
+
+#include <config.cg>
+
+BEGIN_CBUFFER(cbShade)
+CONST_TYPE float shadeMode;
+END_CBUFFER(cbShade)
+
+#if !defined(ENABLE_VFACE)
+#define ENABLE_VFACE 0
+#endif
+
+// define the platform specific semantic for the facing register
+#if defined(RENDERER_PS3)
+#define FACE_SEMANTIC FACE
+#else
+#define FACE_SEMANTIC VFACE
+#endif
+
+#if defined(PASS_UNLIT)
+ Fragment fmain(FragmentParameters params)
+ {
+ Fragment fout;
+ SurfaceMaterial material = computeSurfaceMaterial(params);
+ fout.color = half4(material.diffuseColor, material.alpha);
+ return fout;
+ }
+#elif defined(PASS_AMBIENT_LIGHT) || defined(PASS_POINT_LIGHT) || defined(PASS_DIRECTIONAL_LIGHT) || defined(PASS_SPOT_LIGHT) || defined(PASS_SPOT_LIGHT_NO_SHADOW)
+ Fragment fmain(FragmentParameters params
+ #if ENABLE_VFACE
+ ,float vface : FACE_SEMANTIC
+ #endif
+ )
+ {
+ #if !ENABLE_VFACE
+ float vface = 1.0;
+ #endif
+ #if ENABLE_VFACE_SCALE
+ vface *= g_vfaceScale;
+ #endif
+
+ Fragment fout;
+ float3x3 tangentBasis = float3x3(params.worldSpaceTangent, params.worldSpaceBinormal, params.worldSpaceNormal);
+ SurfaceMaterial material = computeSurfaceMaterial(params);
+
+ float3 bumpNormal = mul(material.tangentSpaceNormal, tangentBasis);
+
+#ifndef NO_SUPPORT_DDX_DDY
+ // emulate flat shading by taking the derivative of position with respective to screen dx and dy and taking the cross product
+ float3 faceNormal = cross(ddy(params.worldSpacePosition.xyz), ddx(params.worldSpacePosition.xyz));
+
+#ifdef RENDERER_PS3
+ // ddy flipped on ps3
+ faceNormal *= -1.0;
+#endif
+
+ // select bump or face normal based on shade mode
+ params.worldSpaceNormal = sign(vface) * normalize(lerp(bumpNormal, faceNormal, shadeMode));
+#endif // NO_SUPPORT_DDX_DDY
+
+ Lighting lighting = computeLighting(params, material);
+ float3 diffuseColor = material.diffuseColor * lighting.diffuseColor;
+ float3 emissiveColor = material.emissiveColor + material.specularColor * lighting.specularColor;
+ fout.color = half4(diffuseColor + emissiveColor, material.alpha);
+ //fout.color = half4(params.worldSpaceNormal, 1); // renders normals.
+
+ // Fog
+ float depth = length(params.worldSpacePosition - g_eyePosition);
+ float fogBlend = min(1.0f, depth/g_fogColorAndDistance.w);
+ fout.color.xyz = half3(fout.color.xyz * (1.0f-fogBlend) + g_fogColorAndDistance.xyz * fogBlend);
+
+ return fout;
+ }
+#elif defined(PASS_NORMALS)
+ Fragment fmain(FragmentParameters params)
+ {
+ Fragment fout;
+ SurfaceMaterial material = computeSurfaceMaterial(params);
+ fout.color = half4(0,1,0,material.alpha);
+ return fout;
+ }
+#elif defined(PASS_DEPTH)
+ Fragment fmain(FragmentParameters params)
+ {
+ Fragment fout;
+ SurfaceMaterial material = computeSurfaceMaterial(params);
+ float depth = length(params.worldSpacePosition - g_eyePosition);
+ fout.color = half4((half)depth,(half)depth,(half)depth,material.alpha);
+ return fout;
+ }
+#elif defined(PASS_DEFERRED)
+ DeferredFragment fmain(FragmentParameters params)
+ {
+ DeferredFragment fout;
+ SurfaceMaterial material = computeSurfaceMaterial(params);
+ fout.diffuseColor = half4(material.diffuseColor, 0);
+ fout.emissiveColor = half4(material.emissiveColor, 0);
+ fout.worldSpaceNormalAndSpecularPower = half4(params.worldSpaceNormal, material.specularPower);
+ return fout;
+ }
+#endif
+
+#endif
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/include/fragment_entry_skydome.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/fragment_entry_skydome.cg
new file mode 100644
index 00000000..d1145cb6
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/fragment_entry_skydome.cg
@@ -0,0 +1,96 @@
+
+#ifndef FRAGMENT_ENTRY_CG
+#define FRAGMENT_ENTRY_CG
+
+#include <config.cg>
+
+BEGIN_CBUFFER(cbShade)
+CONST_TYPE float shadeMode;
+END_CBUFFER(cbShade)
+
+#if !defined(ENABLE_VFACE)
+#define ENABLE_VFACE 0
+#endif
+
+// define the platform specific semantic for the facing register
+#if defined(RENDERER_PS3)
+#define FACE_SEMANTIC FACE
+#else
+#define FACE_SEMANTIC VFACE
+#endif
+
+#if defined(PASS_UNLIT)
+ Fragment fmain(FragmentParameters params)
+ {
+ Fragment fout;
+ SurfaceMaterial material = computeSurfaceMaterial(params);
+ fout.color = half4(material.diffuseColor, material.alpha);
+ return fout;
+ }
+#elif defined(PASS_AMBIENT_LIGHT) || defined(PASS_POINT_LIGHT) || defined(PASS_DIRECTIONAL_LIGHT) || defined(PASS_SPOT_LIGHT) || defined(PASS_SPOT_LIGHT_NO_SHADOW)
+ Fragment fmain(FragmentParameters params
+ #if ENABLE_VFACE
+ ,float vface : FACE_SEMANTIC
+ #endif
+ )
+ {
+ #if !ENABLE_VFACE
+ float vface = 1.0;
+ #endif
+ #if ENABLE_VFACE_SCALE
+ vface *= g_vfaceScale;
+ #endif
+
+ Fragment fout;
+ float3x3 tangentBasis = float3x3(params.worldSpaceTangent, params.worldSpaceBinormal, params.worldSpaceNormal);
+ SurfaceMaterial material = computeSurfaceMaterial(params);
+
+ float3 bumpNormal = mul(material.tangentSpaceNormal, tangentBasis);
+
+#ifndef NO_SUPPORT_DDX_DDY
+ // emulate flat shading by taking the derivative of position with respective to screen dx and dy and taking the cross product
+ float3 faceNormal = cross(ddy(params.worldSpacePosition.xyz), ddx(params.worldSpacePosition.xyz));
+
+#ifdef RENDERER_PS3
+ // ddy flipped on ps3
+ faceNormal *= -1.0;
+#endif
+
+ // select bump or face normal based on shade mode
+ params.worldSpaceNormal = sign(vface) * normalize(lerp(bumpNormal, faceNormal, shadeMode));
+#endif // NO_SUPPORT_DDX_DDY
+
+ fout.color = half4(material.diffuseColor.x,material.diffuseColor.y,material.diffuseColor.z,1);
+
+ return fout;
+ }
+#elif defined(PASS_NORMALS)
+ Fragment fmain(FragmentParameters params)
+ {
+ Fragment fout;
+ SurfaceMaterial material = computeSurfaceMaterial(params);
+ fout.color = half4(0,1,0,material.alpha);
+ return fout;
+ }
+#elif defined(PASS_DEPTH)
+ Fragment fmain(FragmentParameters params)
+ {
+ Fragment fout;
+ SurfaceMaterial material = computeSurfaceMaterial(params);
+ float depth = length(params.worldSpacePosition - g_eyePosition);
+ fout.color = half4((half)depth,(half)depth,(half)depth,material.alpha);
+ return fout;
+ }
+#elif defined(PASS_DEFERRED)
+ DeferredFragment fmain(FragmentParameters params)
+ {
+ DeferredFragment fout;
+ SurfaceMaterial material = computeSurfaceMaterial(params);
+ fout.diffuseColor = half4(material.diffuseColor, 0);
+ fout.emissiveColor = half4(material.emissiveColor, 0);
+ fout.worldSpaceNormalAndSpecularPower = half4(params.worldSpaceNormal, material.specularPower);
+ return fout;
+ }
+#endif
+
+#endif
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/include/globals.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/globals.cg
new file mode 100644
index 00000000..682ab70f
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/globals.cg
@@ -0,0 +1,102 @@
+
+#ifndef GLOBALS_CG
+#define GLOBALS_CG
+
+#ifdef RENDERER_PS3
+#define MAX_BONES 50
+#else
+#define MAX_BONES 60
+#endif
+
+#if !defined(MAX_LIGHTS)
+#define MAX_LIGHTS 1
+#endif
+
+#include <defines.cg>
+
+BEGIN_CBUFFER(cbMesh0)
+CONST_TYPE float4x4 g_MVP;
+END_CBUFFER(cbMesh0)
+
+BEGIN_CBUFFER(cbMesh)
+CONST_TYPE float4x4 g_modelMatrix;
+CONST_TYPE float4x4 g_modelViewMatrix;
+CONST_TYPE float4x4 g_modelViewProjMatrix;
+END_CBUFFER(cbMesh)
+
+BEGIN_CBUFFER(cbFrame)
+CONST_TYPE float4x4 g_viewMatrix;
+CONST_TYPE float4x4 g_projMatrix;
+CONST_TYPE float3 g_eyePosition;
+CONST_TYPE float3 g_eyeDirection;
+END_CBUFFER(cbFrame)
+
+BEGIN_CBUFFER(cbFrameInv)
+CONST_TYPE float4x4 g_invViewProjMatrix;
+END_CBUFFER(cbFrameInv)
+
+#if defined USE_VTF
+CONST_TYPE sampler2D g_boneTexture; // Vertex texture to hold bone matrices
+#endif
+
+BEGIN_CBUFFER(cbBones)
+CONST_TYPE float4x4 g_boneMatrices[MAX_BONES]; // TODO: change this to a float4x3 (a transposed 3x4) so we can pack more bones in...
+#if defined USE_VTF
+CONST_TYPE int g_boneTextureHeight; // Bone texture height
+#endif
+END_CBUFFER(cbBones)
+
+BEGIN_CBUFFER(cbFog)
+CONST_TYPE float4 g_fogColorAndDistance;
+END_CBUFFER(cbFog)
+
+BEGIN_CBUFFER(cbAmbient)
+CONST_TYPE float3 g_ambientColor;
+END_CBUFFER(cbAmbient)
+
+BEGIN_CBUFFER(cbLight)
+CONST_TYPE float3 g_lightColor;
+CONST_TYPE float3 g_lightDirection;
+CONST_TYPE float3 g_lightPosition;
+CONST_TYPE float g_lightIntensity;
+CONST_TYPE float g_lightInnerRadius;
+CONST_TYPE float g_lightOuterRadius;
+CONST_TYPE float g_lightInnerCone;
+CONST_TYPE float g_lightOuterCone;
+END_CBUFFER(cbLight)
+
+BEGIN_CBUFFER(cbScale)
+#if ENABLE_VFACE_SCALE
+ CONST_TYPE float g_vfaceScale;
+#endif
+END_CBUFFER(cbScale)
+
+// D3D11 expects rgba
+#if ENABLE_COLOR_SWIZZLE_SUPPORT
+BEGIN_CBUFFER(cbSwizzleColor)
+CONST_TYPE int g_bSwizzleColor;
+END_CBUFFER(cbSwizzleColor)
+half4 swizzle(half4 inColor) { return g_bSwizzleColor ? inColor.zyxw : inColor; }
+#else
+half4 swizzle(half4 inColor) { return inColor; }
+#endif
+
+#if defined(RENDERER_D3D11)
+// D3D11 screen coordinates differ from GL/DX9
+BEGIN_CBUFFER(cbView2D)
+CONST_TYPE float4x4 g_viewMatrix2D;
+END_CBUFFER(cbView2D)
+#else
+static const float4x4 g_viewMatrix2D = {{1,0,0,0},{0,1,0,0},{0,0,1,0},{0,0,0,1}};
+#endif
+
+#if defined(PASS_SPOT_LIGHT)
+ // TODO: Make this less hacky, have a PASS_SUPPORTS_SHADOWS #define
+ #define PASS_SUPPORTS_SHADOWS
+ DECLARE_TEXTURE(g_lightShadowMap);
+ BEGIN_CBUFFER(cbLightShadow)
+ CONST_TYPE float4x4 g_lightShadowMatrix;
+ END_CBUFFER(cbLightShadow)
+#endif
+
+#endif
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/include/lighting.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/lighting.cg
new file mode 100644
index 00000000..705c9e12
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/lighting.cg
@@ -0,0 +1,108 @@
+
+#ifndef LIGHTING_CG
+#define LIGHTING_CG
+
+#include <config.cg>
+#include <globals.cg>
+
+// Internal Lighting functions...
+Lighting computeAmbientLight( const FragmentParameters params, const SurfaceMaterial material);
+Lighting computeDirectionalLight(const FragmentParameters params, const SurfaceMaterial material);
+Lighting computePointLight( const FragmentParameters params, const SurfaceMaterial material);
+Lighting computeSpotLight( const FragmentParameters params, const SurfaceMaterial material);
+
+#if defined(PASS_SUPPORTS_SHADOWS)
+#define NUM_SHADOW_OFFSETS 32
+static float2 shadowMapOffsets[NUM_SHADOW_OFFSETS] =
+{
+ float2( 0.024439,-0.191747), float2( 0.127369, 0.462646), float2( 0.769628,-0.291028), float2(-0.684950, 0.518250),
+ float2( 0.019485, 0.303360), float2(-0.234805,-0.278718), float2(-0.679808,-0.717623), float2(-0.004622,-0.000659),
+ float2(-0.128309,-0.515931), float2( 0.497521, 0.347996), float2( 0.197836,-0.405042), float2(-0.576391,-0.192435),
+ float2( 0.379497, 0.355307), float2( 0.642894,-0.338695), float2( 0.368096, 0.394195), float2(-0.024818,-0.234009),
+ float2(-0.487682, 0.608270), float2( 0.822138, 0.568698), float2(-0.184849, 0.191561), float2( 0.020395,-0.012156),
+ float2(-0.647774,-0.197404), float2(-0.681738,-0.615919), float2(-0.418447,-0.412937), float2( 0.632155, 0.357966),
+ float2(-0.742742,-0.038003), float2(-0.759170,-0.569653), float2(-0.508216, 0.317101), float2( 0.547166,-0.267258),
+ float2(-0.134347, 0.070130), float2(-0.210947,-0.774648), float2( 0.751069, 0.026197), float2(-0.595643,-0.277915),
+};
+#endif
+
+float computeShadowTerm(const FragmentParameters params)
+{
+ float shadowMask = 1;
+#if defined(PASS_SUPPORTS_SHADOWS) && ENABLE_SHADOWS
+ const float shadowDepthBias = 0.02;
+ const float depthBias = 0.00006;
+
+#if 0
+
+ float4 lsp = mul(float4(params.worldSpacePosition, 1), g_lightShadowMatrix);
+ lsp = float4(float2(0.5,-0.5)*lsp.xy/lsp.w + 0.5, lsp.z/lsp.w - depthBias, 1);
+ shadowMask = tex2Dproj(g_lightShadowMap, lsp).x;
+#elif 1
+
+ const float shadowOffsetScale = 0.005;
+ float4 lsp = mul(float4(params.worldSpacePosition, 1), g_lightShadowMatrix);
+ lsp = float4(float2(0.5,-0.5)*lsp.xy/lsp.w + 0.5, lsp.z/lsp.w - depthBias, 1);
+ shadowMask = 0;
+ for(int i=0; i<NUM_SHADOW_OFFSETS; i++)
+ {
+ float4 texcoord = lsp+float4(shadowMapOffsets[i]*shadowOffsetScale, 0,0);
+ shadowMask += tex2Dproj(g_lightShadowMap, texcoord).x;
+ }
+ shadowMask /= NUM_SHADOW_OFFSETS;
+
+#else
+
+ const float fragmentDepth = length(g_lightPosition-params.worldSpacePosition)-shadowDepthBias;
+ float4 lsp = mul(float4(params.worldSpacePosition, 1), g_lightShadowMatrix);
+ lsp = float4(float2(0.5,-0.5)*lsp.xy/lsp.w + 0.5, lsp.z/lsp.w - depthBias, 1);
+ const float shadowOffsetScale = 0.002;
+
+ float4 shadowSpacePosition = mul(float4(params.worldSpacePosition, 1), g_lightShadowMatrix);
+ float2 shadowUV = float2(0.5,-0.5) * shadowSpacePosition.xy / shadowSpacePosition.w + float2(0.5, 0.5);
+ for(int i=0; i<NUM_SHADOW_OFFSETS/4; i++)
+ {
+ float4 shadowMapColor;
+ shadowMapColor.r = tex2D(g_lightShadowMap, (shadowUV+shadowMapOffsets[i*4+0]*shadowOffsetScale)).r;
+ shadowMapColor.g = tex2D(g_lightShadowMap, (shadowUV+shadowMapOffsets[i*4+1]*shadowOffsetScale)).r;
+ shadowMapColor.b = tex2D(g_lightShadowMap, (shadowUV+shadowMapOffsets[i*4+2]*shadowOffsetScale)).r;
+ shadowMapColor.a = tex2D(g_lightShadowMap, (shadowUV+shadowMapOffsets[i*4+3]*shadowOffsetScale)).r;
+ for(int j=0; j<4; j++)
+ {
+ if(shadowMapColor[j] < lsp.z)
+ {
+ shadowMask -= (1.0f/NUM_SHADOW_OFFSETS);
+ }
+ }
+ }
+
+#endif
+
+#endif
+ return shadowMask;
+}
+
+Lighting computeLighting(const FragmentParameters params, const SurfaceMaterial material)
+{
+ Lighting lout;
+
+#if defined(PASS_AMBIENT_LIGHT)
+ lout = computeAmbientLight(params, material);
+#elif defined(PASS_DIRECTIONAL_LIGHT)
+ lout = computeDirectionalLight(params, material);
+#elif defined(PASS_POINT_LIGHT)
+ lout = computePointLight(params, material);
+#elif defined(PASS_SPOT_LIGHT) || defined(PASS_SPOT_LIGHT_NO_SHADOW)
+ lout = computeSpotLight(params, material);
+#endif
+
+ const float shadowTerm = computeShadowTerm(params);
+ lout.diffuseColor *= (half)shadowTerm;
+ lout.specularColor *= (half)shadowTerm;
+
+ lout.diffuseColor += (half3)g_ambientColor * material.diffuseColor;
+
+ return lout;
+}
+
+#endif
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/include/noise.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/noise.cg
new file mode 100644
index 00000000..bae4f792
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/noise.cg
@@ -0,0 +1,199 @@
+#ifndef NOISE_CG
+#define NOISE_CG
+
+#include <config.cg>
+
+////////////////////////////////////////////////////////////////////////
+
+static uint permutation[] = { 151,160,137,91,90,15,
+ 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,
+ 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,
+ 88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166,
+ 77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,
+ 102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196,
+ 135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123,
+ 5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,
+ 223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9,
+ 129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228,
+ 251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107,
+ 49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254,
+ 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180
+};
+
+// gradients for 3d noise
+static float3 g[] = {
+ 1,1,0,
+ -1,1,0,
+ 1,-1,0,
+ -1,-1,0,
+ 1,0,1,
+ -1,0,1,
+ 1,0,-1,
+ -1,0,-1,
+ 0,1,1,
+ 0,-1,1,
+ 0,1,-1,
+ 0,-1,-1,
+ 1,1,0,
+ 0,-1,1,
+ -1,1,0,
+ 0,-1,-1,
+};
+
+// Functions
+int permSample(uint i) {
+ return permutation[i % 256];
+}
+
+float4 permSample2D(float2 p) {
+ p *= 256;
+ int A = permSample(p.x) + p.y;
+ int AA = permSample(A);
+ int AB = permSample(A + 1);
+ int B = permSample(p.x + 1) + p.y;
+ int BA = permSample(B);
+ int BB = permSample(B + 1);
+ return float4(AA, AB, BA, BB) / 255.0;
+}
+
+float3 gradSample(float p) {
+ return g[ p*16 ];
+}
+
+float3 permGradSample(float p) {
+ return g[ permutation[p*256] % 16 ];
+}
+
+float3 fade(float3 t) {
+ return t * t * t * (t * (t * 6 - 15) + 10);
+}
+
+float perm(float x) {
+ return permSample(x);
+}
+
+float4 perm2d(float2 p) {
+ return permSample2D(p);
+}
+
+float grad(float x, float3 p) {
+ return dot(gradSample(x), p);
+}
+
+float gradperm(float x, float3 p) {
+ return dot(permGradSample(x), p);
+}
+
+// 3D noise
+#if 0
+
+// original version
+float inoise(float3 p)
+{
+ float3 P = fmod(floor(p), 256.0); // FIND UNIT CUBE THAT CONTAINS POINT
+ p -= floor(p); // FIND RELATIVE X,Y,Z OF POINT IN CUBE.
+ float3 f = fade(p); // COMPUTE FADE CURVES FOR EACH OF X,Y,Z.
+
+ P = P / 256.0;
+ const float one = 1.0 / 256.0;
+
+ // HASH COORDINATES OF THE 8 CUBE CORNERS
+ float A = perm(P.x) + P.y;
+ float4 AA;
+ AA.x = perm(A) + P.z;
+ AA.y = perm(A + one) + P.z;
+ float B = perm(P.x + one) + P.y;
+ AA.z = perm(B) + P.z;
+ AA.w = perm(B + one) + P.z;
+
+ // AND ADD BLENDED RESULTS FROM 8 CORNERS OF CUBE
+ return lerp( lerp( lerp( grad(perm(AA.x ), p ),
+ grad(perm(AA.z ), p + float3(-1, 0, 0) ), f.x),
+ lerp( grad(perm(AA.y ), p + float3(0, -1, 0) ),
+ grad(perm(AA.w ), p + float3(-1, -1, 0) ), f.x), f.y),
+
+ lerp( lerp( grad(perm(AA.x+one), p + float3(0, 0, -1) ),
+ grad(perm(AA.z+one), p + float3(-1, 0, -1) ), f.x),
+ lerp( grad(perm(AA.y+one), p + float3(0, -1, -1) ),
+ grad(perm(AA.w+one), p + float3(-1, -1, -1) ), f.x), f.y), f.z);
+}
+
+#else
+
+// optimized version
+float inoise(float3 p)
+{
+ float3 P = fmod(floor(p), 256.0); // FIND UNIT CUBE THAT CONTAINS POINT
+ p -= floor(p); // FIND RELATIVE X,Y,Z OF POINT IN CUBE.
+ float3 f = fade(p); // COMPUTE FADE CURVES FOR EACH OF X,Y,Z.
+
+ P = P / 256.0;
+ const float one = 1.0 / 256.0;
+
+ // HASH COORDINATES OF THE 8 CUBE CORNERS
+ float4 AA = perm2d(P.xy) + P.z;
+
+ // AND ADD BLENDED RESULTS FROM 8 CORNERS OF CUBE
+ return lerp( lerp( lerp( gradperm(AA.x, p ),
+ gradperm(AA.z, p + float3(-1, 0, 0) ), f.x),
+ lerp( gradperm(AA.y, p + float3(0, -1, 0) ),
+ gradperm(AA.w, p + float3(-1, -1, 0) ), f.x), f.y),
+
+ lerp( lerp( gradperm(AA.x+one, p + float3(0, 0, -1) ),
+ gradperm(AA.z+one, p + float3(-1, 0, -1) ), f.x),
+ lerp( gradperm(AA.y+one, p + float3(0, -1, -1) ),
+ gradperm(AA.w+one, p + float3(-1, -1, -1) ), f.x), f.y), f.z);
+}
+
+#endif
+
+static const float PI = 3.14159265f;
+
+float3 inoiseOffset(float3 p)
+{
+ float offsetX = inoise(p.xzy * g_tessUVScale.x);
+ float offsetY = inoise(p * g_tessUVScale.x);
+ float offsetZ = (offsetX + offsetY) * .5;
+ return float3(offsetX, offsetY, offsetZ);
+}
+
+// utility functions
+// calculate gradient of noise (expensive!)
+float3 inoiseGradient(float3 p, float d)
+{
+ float f0 = inoise(p);
+ float fx = inoise(p + float3(d, 0, 0));
+ float fy = inoise(p + float3(0, d, 0));
+ float fz = inoise(p + float3(0, 0, d));
+ return float3(fx - f0, fy - f0, fz - f0) / d;
+}
+
+// utility functions
+// calculate gradient of noise (expensive!)
+float3 inoiseNormal(float3 p, float3 n)
+{
+ float3 nN = normalize(n);
+ float theta = abs(acos(dot(nN, float3(1,0,0))));
+ float3 xAxis, zAxis;
+ if (theta > .001 && theta < (PI * 1.999)) {
+ zAxis = cross(nN, float3(1, 0, 0));
+ xAxis = cross(zAxis, nN);
+ }
+ else {
+ xAxis = cross(float3(0, 0, 1), nN);
+ zAxis = cross(xAxis, nN);
+ }
+
+ float3 pX = p + xAxis;
+ float3 pZ = p + zAxis;
+
+ float3 f0 = inoiseOffset(p) + p;
+ float3 fx = inoiseOffset(pX) + pX;
+ float3 fz = inoiseOffset(pZ) + pZ;
+ float3 dx = fx - f0;
+ float3 dz = fz - f0;
+
+ return normalize(cross(dx, dz));
+}
+
+#endif
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/include/phong_lighting.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/phong_lighting.cg
new file mode 100644
index 00000000..2c2fa52c
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/phong_lighting.cg
@@ -0,0 +1,63 @@
+
+#ifndef PHONG_LIGHTING_CG
+#define PHONG_LIGHTING_CG
+
+#include <config.cg>
+#include <globals.cg>
+#include <lighting.cg>
+
+Lighting computeAmbientLight(const FragmentParameters params, const SurfaceMaterial material)
+{
+ Lighting lout;
+ lout.diffuseColor = 0;
+ lout.specularColor = 0;
+ return lout;
+}
+
+Lighting computeDirectionalLight(const FragmentParameters params, const SurfaceMaterial material)
+{
+ Lighting lout;
+ half3 lightColor = (half3)g_lightColor * (half)g_lightIntensity;
+ lout.diffuseColor = (half)saturate(dot(params.worldSpaceNormal, -g_lightDirection)) * lightColor;
+ float3 surfToEye = normalize(params.worldSpacePosition - g_eyePosition);
+ lout.specularColor = (half)pow(saturate(dot(reflect(-g_lightDirection, params.worldSpaceNormal), surfToEye)), material.specularPower) * lightColor;
+ return lout;
+}
+
+Lighting computePointLight(const FragmentParameters params, const SurfaceMaterial material)
+{
+ Lighting lout;
+ lout.diffuseColor = 0;
+ lout.specularColor = 0;
+ return lout;
+}
+
+Lighting computeSpotLight(const FragmentParameters params, const SurfaceMaterial material)
+{
+ Lighting lout;
+
+ half3 lightColor =(half3)g_lightColor * (half)g_lightIntensity;
+
+ float3 surfToEye = normalize(params.worldSpacePosition - g_eyePosition);
+ float3 surfToLight = g_lightPosition - params.worldSpacePosition;
+ float distance = length(surfToLight);
+ surfToLight *= 1 / distance; // is just doing a normalize faster?
+
+ float attenuation = 0;
+ if(distance < g_lightInnerRadius) attenuation = 1;
+ else if(distance < g_lightOuterRadius) attenuation = 1 - ((distance - g_lightInnerRadius) / (g_lightOuterRadius - g_lightInnerRadius));
+
+ float conedot = dot(-g_lightDirection, surfToLight);
+ if(conedot < g_lightOuterCone) attenuation = 0;
+ else if(conedot < g_lightInnerCone) attenuation *= (conedot - g_lightOuterCone) / (g_lightInnerCone - g_lightOuterCone);
+
+ float diffuse = saturate(dot(params.worldSpaceNormal, surfToLight));
+ float specular = pow(saturate(dot(reflect(surfToLight, params.worldSpaceNormal), surfToEye)), material.specularPower);
+
+ lout.diffuseColor = ((half)attenuation * (half)diffuse * lightColor);
+ lout.specularColor = ((half)attenuation * (half)specular * lightColor);
+
+ return lout;
+}
+
+#endif
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/include/tessellation.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/tessellation.cg
new file mode 100644
index 00000000..212b09e3
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/tessellation.cg
@@ -0,0 +1,186 @@
+#ifndef TESSELLATION_CG
+#define TESSELLATION_CG
+
+#include <config.cg>
+#include <globals.cg>
+
+#if !defined(ADAPTIVE_TESSELLATION)
+#define ADAPTIVE_TESSELLATION 1
+#endif
+
+#if !defined(WEIGHTED_TESSELLATION)
+#define WEIGHTED_TESSELLATION 1
+#endif
+
+#if !defined(ENABLE_EXTRA_SEMANTICS)
+#define ENABLE_EXTRA_SEMANTICS 1
+#endif
+
+#if !defined(ENABLE_INTERIOR_DISTANCE)
+#define ENABLE_INTERIOR_DISTANCE 1
+#endif
+
+#if ENABLE_TESSELLATION==0
+
+//--------------------------------------------------------------------------------------
+// Vertex Shader Output
+//--------------------------------------------------------------------------------------
+
+struct VertexOut
+{
+ FragmentParameters params;
+ float4 screenSpacePosition : POSITION;
+};
+
+#else
+
+struct VertexOut
+{
+ FragmentParameters params;
+ float4 screenSpacePosition : POSITION;
+#if ENABLE_EXTRA_SEMANTICS
+ float4 localPosition : SEMANTIC_MODEL_POSITION;
+ uint flagsDisp : SEMANTIC_DISPLACEMENT_FLAGS;
+ float4 modelMatrix[4] : SEMANTIC_MODEL_MATRIX;
+#endif
+};
+
+//--------------------------------------------------------------------------------------
+// Constants
+//--------------------------------------------------------------------------------------
+
+BEGIN_CBUFFER(cbTessellation)
+// x = Edge Factor
+// y = Inside factor
+// z = Distance factor where (1 - (z/x)) clamps distance LOD
+// w = Optional screen-space factor
+CONST_TYPE float4 g_tessFactor : packoffset(c0);
+
+// x = Min distance for LOD scaling
+// y = Max distance for LOD scaling
+CONST_TYPE float2 g_tessMinMaxDistance : packoffset(c1);
+
+// x = Height scaling factor
+// y = Height bias (applied before scaling)
+CONST_TYPE float2 g_tessHeightScaleAndBias : packoffset(c1.z);
+
+// x = U scaling factor
+// y = V scaling factor
+CONST_TYPE float2 g_tessUVScale : packoffset(c2);
+
+END_CBUFFER(cbTessellation)
+
+
+//--------------------------------------------------------------------------------------
+// Static Constants
+//--------------------------------------------------------------------------------------
+
+static const uint X_FLAG = 0;
+static const uint Y_FLAG = 1;
+static const uint Z_FLAG = 2;
+static const uint AXIS_MASK = 3;//X_FLAG | Y_FLAG | Z_FLAG;
+static const uint FIXED_FLAG = 4;
+static const uint INTERIOR_FLAG = 8;
+
+//--------------------------------------------------------------------------------------
+// Functions
+//--------------------------------------------------------------------------------------
+
+float getDisplacementWeight(uint uFlags)
+{
+ return (uFlags & FIXED_FLAG) ? 0.f : 1.f;
+}
+
+uint getDisplacementAxis(uint uFlags)
+{
+ return uFlags & AXIS_MASK;
+}
+
+bool isEdgeInterior(uint uFlags)
+{
+ return uFlags & INTERIOR_FLAG;
+}
+
+/*
+float getInteriorDistance(float3 vEdgeFactors, float3 vBaryCoords)
+{
+ float3 vEdgeCoords = float3(1,1,1) -
+ normalize(float3(vBaryCoords.x + vBaryCoords.y,
+ vBaryCoords.y + vBaryCoords.z,
+ vBaryCoords.z + vBaryCoords.x) * .5);
+ if(vEdgeFactors.x > 0.)
+ vEdgeCoords.x = 0.;
+ if(vEdgeFactors.y > 0.)
+ vEdgeCoords.y = 0.;
+ if(vEdgeFactors.z > 0.)
+ vEdgeCoords.z = 0.;
+
+ return sqrt(max(vEdgeCoords.x, max(vEdgeCoords.y, vEdgeCoords.z)));
+}*/
+
+float getInteriorDistance(float3 edgeFactors, float3 baryCoords)
+{
+ // Calculate distance from triangle exterior [0...1]
+ float3 vInteriorDistance = sqrt(baryCoords*edgeFactors);
+ //float3 vInteriorDistance = baryCoords*edgeFactors;
+ vInteriorDistance += float3(1,1,1) - edgeFactors;
+ return clamp(min(min(vInteriorDistance.x, vInteriorDistance.y), vInteriorDistance.z), 0, 1);
+ //float fInteriorDistance = 3.f * min(min(fU+input.EdgeFactors.x, fV+input.EdgeFactors.y), fW+input.EdgeFactors.z);
+ //float fInteriorDistance = 3.f * min(min(fU, fV), fW);
+}
+
+// Distance between point and line segment defined by p0 -> p1
+float computeDistance(float3 worldSpacePosition, float3 p0, float3 p1)
+{
+ float3 v = p1 - p1;
+ float3 w = worldSpacePosition - p0;
+
+ float c1 = dot(w,v);
+ if ( c1 <= 0 )
+ return distance(worldSpacePosition, p0);
+
+ float c2 = dot(v,v);
+ if ( c2 <= c1 )
+ return distance(worldSpacePosition, p1);
+
+ float b = c1 / c2;
+ return distance(worldSpacePosition, p0 + b * v);
+}
+
+// LOD distance based on viewpoint
+float computeDistance(float3 worldSpacePosition, float3 eyePosition)
+{
+ // Min and max distance should be chosen according to scene quality requirements
+ const float fMinDistance = g_tessMinMaxDistance.x;//x5.0f;
+ const float fMaxDistance = g_tessMinMaxDistance.y;//100.f;
+
+ // Calculate distance between vertex and camera, and a vertex distance factor issued from it
+ float fDistance = distance( worldSpacePosition.xyz, eyePosition );
+ return 1.0 - clamp( ( ( fDistance - fMinDistance ) / ( fMaxDistance - fMinDistance ) ),
+ 0.0,
+ 1.0 - g_tessFactor.z/g_tessFactor.x);
+}
+
+float3 pointInPlane(in float3 n, in float3 p, in float3 pPlane)
+{
+ return p - dot(n, p - pPlane) * n;
+}
+
+float3 computeBarycentricCoordinates(in float3 p, in float3 n, in float3 a, in float3 b, in float3 c)
+{
+ float3 pProj = pointInPlane(n, p, a);
+
+ float abc = dot(n, cross(b-a, c-a));
+ float pbc = dot(n, cross(b-pProj, c-pProj));
+ float pca = dot(n, cross(c-pProj, a-pProj));
+
+ float x0 = pbc / abc;
+ float x1 = pca / abc;
+ float x2 = 1.0f - x0 - x1;
+
+ return float3(x0, x1, x2);
+}
+
+#endif /* ENABLE_TESSELLATION==1 */
+
+#endif \ No newline at end of file
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/include/tessellation_entry.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/tessellation_entry.cg
new file mode 100644
index 00000000..3b777565
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/tessellation_entry.cg
@@ -0,0 +1,309 @@
+#ifndef TESSELLATION_ENTRY_CG
+#define TESSELLATION_ENTRY_CG
+
+#define ENABLE_EXTRA_SEMANTICS 1
+#include <tessellation.cg>
+#include <config.cg>
+
+//--------------------------------------------------------------------------------------
+// Functions
+//--------------------------------------------------------------------------------------
+
+// To be defined by the user
+void computeOffsetAndNormal(in float3 vLocalPos, in float3 vFaceNormal, in float3 vBaryCoords,
+ inout float3 vOffset, inout float3 vNormal);
+
+//--------------------------------------------------------------------------------------
+// Structures
+//--------------------------------------------------------------------------------------
+
+struct HullConstOut
+{
+ float Edges[3] : SV_TessFactor;
+ float Inside : SV_InsideTessFactor;
+ float3 EdgeFactors : POSITION3;
+ bool3 EdgeInterior : SEMANTIC_INTERIOR;
+ float4x4 ModelMatrix : SEMANTIC_MODEL_MATRIX;
+};
+
+struct HullControlOut
+{
+ FragmentParameters params;
+ float3 vWorldPos : SV_POSITION;
+ float3 vLocalPos : SEMANTIC_DISPLACEMENT_POSITION;
+ float fWeightDisp : SEMANTIC_DISPLACEMENT_WEIGHT;
+ uint uAxis : SEMANTIC_DISPLACEMENT_AXIS;
+};
+
+struct DomainOut
+{
+ FragmentParameters params;
+ float4 screenSpacePosition : SV_POSITION;
+};
+
+//--------------------------------------------------------------------------------------
+// Hull shader
+//--------------------------------------------------------------------------------------
+HullConstOut ConstantsHS( InputPatch<VertexOut, 3> inputPatch, uint uPID : SV_PrimitiveID )
+{
+ HullConstOut output = (HullConstOut)0;
+ float4 vEdgeTessellationFactors = g_tessFactor.xxxy;
+ float3 vEdgeFactor;
+ bool3 vInterior;
+
+#if 0
+ vEdgeFactor.x = distance(inputPatch[1].params.worldSpacePosition.xyz, inputPatch[2].params.worldSpacePosition.xyz);
+ vEdgeFactor.y = distance(inputPatch[2].params.worldSpacePosition.xyz, inputPatch[0].params.worldSpacePosition.xyz);
+ vEdgeFactor.z = distance(inputPatch[1].params.worldSpacePosition.xyz, inputPatch[0].params.worldSpacePosition.xyz);
+ if( (vEdgeFactor.x > vEdgeFactor.y) && (vEdgeFactor.x > vEdgeFactor.z) ) { vEdgeFactor = float3(0.,1.,1.); vInterior.x = true; }
+ else if( (vEdgeFactor.y > vEdgeFactor.x) && (vEdgeFactor.y > vEdgeFactor.z) ) { vEdgeFactor = float3(1.,0.,1.); vInterior.y = true; }
+ else { vEdgeFactor = float3(1.,1.,0.); vInterior.z = true; }
+#elif 1
+ // Assume all edges are exterior
+ vInterior = bool3(false, false, false);
+ vEdgeFactor = float3(1., 1., 1.);
+ // For some stupid reason, odd primitives have a different vertex order
+ if (uPID % 2 == 0)
+ {
+ vInterior[0] = isEdgeInterior(inputPatch[1].flagsDisp);
+ vInterior[1] = isEdgeInterior(inputPatch[2].flagsDisp);
+ vInterior[2] = isEdgeInterior(inputPatch[0].flagsDisp);
+ }
+ else
+ {
+ vInterior[0] = isEdgeInterior(inputPatch[2].flagsDisp);
+ vInterior[1] = isEdgeInterior(inputPatch[0].flagsDisp);
+ vInterior[2] = isEdgeInterior(inputPatch[1].flagsDisp);
+ }
+ // If the edge is interior, it will not be used to calculate "inner" distance
+ if(vInterior[0]) vEdgeFactor[0] = 0.;
+ if(vInterior[1]) vEdgeFactor[1] = 0.;
+ if(vInterior[2]) vEdgeFactor[2] = 0.;
+#elif 0
+// bool3 vbInterior;
+// vbInterior.x = isInterior(inputPatch[0].flagsDisp);
+// vbInterior.y = isInterior(inputPatch[1].flagsDisp);
+// vbInterior.z = isInterior(inputPatch[2].flagsDisp);
+// if( vbInterior.x && vbInterior.y && vbInterior.z ) vEdgeFactor = float3(0.,0.,0.);
+// else if( vbInterior.y && vbInterior.z ) { vEdgeFactor = float3(0.,1.,1.); vInterior.x = true; }
+// else if( vbInterior.z && vbInterior.x ) { vEdgeFactor = float3(1.,0.,1.); vInterior.y = true; }
+// else if( vbInterior.x && vbInterior.y ) { vEdgeFactor = float3(1.,1.,0.); vInterior.z = true; }
+// else vEdgeFactor = float3(1.,1.,1.);
+#elif 0
+// if( vbInterior.y && vbInterior.z ) { vEdgeFactor = float3(0.,1.,1.); vInterior.x = true; }
+// else if( vbInterior.z && vbInterior.x ) { vEdgeFactor = float3(1.,0.,1.); vInterior.y = true; }
+// else if( vbInterior.x && vbInterior.y ) { vEdgeFactor = float3(1.,1.,0.); vInterior.z = true; }
+// else vEdgeFactor = float3(1.,1.,1.);
+#endif
+
+#if ADAPTIVE_TESSELLATION
+
+ float3 distanceFactor;
+ distanceFactor.x = computeDistance(inputPatch[0].params.worldSpacePosition.xyz, g_eyePosition);
+ distanceFactor.y = computeDistance(inputPatch[1].params.worldSpacePosition.xyz, g_eyePosition);
+ distanceFactor.z = computeDistance(inputPatch[2].params.worldSpacePosition.xyz, g_eyePosition);
+
+ /*
+ // Only apply LOD if the screen space triangle size is below a given threshold
+ float3 ab = inputPatch[0].screenSpacePosition.xyz - inputPatch[1].screenSpacePosition.xyz;
+ float3 ac = inputPatch[0].screenSpacePosition.xyz - inputPatch[2].screenSpacePosition.xyz;
+ float3 abCrossAc = cross(ab,ac);
+ float area2 = dot(abCrossAc, abCrossAc);
+ if (area2 < g_tessFactor.w)
+ */
+ {
+ // Calculate edge scale factor from vertex scale factor: simply compute
+ // average tess factor between the two vertices making up an edge
+ vEdgeTessellationFactors.x = 0.5 * ( distanceFactor.y + distanceFactor.z);
+ vEdgeTessellationFactors.y = 0.5 * ( distanceFactor.z + distanceFactor.x);
+ vEdgeTessellationFactors.z = 0.5 * ( distanceFactor.x + distanceFactor.y);
+ vEdgeTessellationFactors.w = vEdgeTessellationFactors.x;
+
+ // Multiply them by global tessellation factor
+ vEdgeTessellationFactors *= g_tessFactor.xxxy;
+ }
+
+#endif
+
+ // Assign tessellation levels
+ output.Edges[0] = vEdgeTessellationFactors.x;
+ output.Edges[1] = vEdgeTessellationFactors.y;
+ output.Edges[2] = vEdgeTessellationFactors.z;
+ output.Inside = vEdgeTessellationFactors.w;
+ output.EdgeFactors = vEdgeFactor;
+ output.EdgeInterior = vInterior;
+ output.ModelMatrix = float4x4(inputPatch[0].modelMatrix[0],
+ inputPatch[0].modelMatrix[1],
+ inputPatch[0].modelMatrix[2],
+ inputPatch[0].modelMatrix[3]);
+
+ return output;
+}
+
+[domain("tri")]
+[partitioning("fractional_odd")]
+[outputtopology("triangle_cw")]
+[outputcontrolpoints(3)]
+[patchconstantfunc("ConstantsHS")]
+[maxtessfactor(15.0)]
+HullControlOut hmain( InputPatch<VertexOut, 3> inputPatch, uint uCPID : SV_OutputControlPointID )
+{
+ HullControlOut output;
+
+ output.params = inputPatch[uCPID].params;
+ output.vWorldPos = inputPatch[uCPID].params.worldSpacePosition;
+ output.vLocalPos = inputPatch[uCPID].localPosition.xyz;
+ output.fWeightDisp = getDisplacementWeight(inputPatch[uCPID].flagsDisp);
+ output.uAxis = getDisplacementAxis(inputPatch[uCPID].flagsDisp);
+
+ return output;
+}
+
+//--------------------------------------------------------------------------------------
+// Domain Shader
+//--------------------------------------------------------------------------------------
+[domain("tri")]
+DomainOut dmain( HullConstOut input,
+ float3 BarycentricCoordinates : SV_DomainLocation,
+ const OutputPatch<HullControlOut, 3> inputPatch )
+{
+ DomainOut output;
+
+ float fU = BarycentricCoordinates.x;
+ float fV = BarycentricCoordinates.y;
+ float fW = BarycentricCoordinates.z;
+
+ // Interpolate world space position with barycentric coordinates
+ float3 vWorldPos = fU * inputPatch[0].vWorldPos +
+ fV * inputPatch[1].vWorldPos +
+ fW * inputPatch[2].vWorldPos;
+
+ // Interpolate world space normal and renormalize it
+ float3 vNormal = fU * inputPatch[0].params.worldSpaceNormal +
+ fV * inputPatch[1].params.worldSpaceNormal +
+ fW * inputPatch[2].params.worldSpaceNormal;
+ vNormal = normalize( vNormal );
+
+ // Interpolate world space normal and renormalize it
+ float3 vBiNormal = fU * inputPatch[0].params.worldSpaceBinormal +
+ fV * inputPatch[1].params.worldSpaceBinormal+
+ fW * inputPatch[2].params.worldSpaceBinormal;
+ output.params.worldSpaceBinormal = normalize( vBiNormal );
+
+ // Interpolate world space tangent and renormalize it
+ float3 vTangent = fU * inputPatch[0].params.worldSpaceTangent +
+ fV * inputPatch[1].params.worldSpaceTangent +
+ fW * inputPatch[2].params.worldSpaceTangent;
+ output.params.worldSpaceTangent = normalize( vTangent );
+
+ // Interpolate color
+ output.params.color = (half)fU * inputPatch[0].params.color +
+ (half)fV * inputPatch[1].params.color +
+ (half)fW * inputPatch[2].params.color;
+
+ // Interpolate local space position with barycentric coordinates
+ float3 vLocalPos = fU * inputPatch[0].vLocalPos +
+ fV * inputPatch[1].vLocalPos +
+ fW * inputPatch[2].vLocalPos;
+
+ // Transform world space normal into local coordinates
+ float3 vLocalNormal = normalize(mul(transpose((float3x3)input.ModelMatrix), vNormal));
+
+ // Interpolate the displacement weight with barycentric coordinates
+#if 1
+ float fWeightDisp = fU * inputPatch[0].fWeightDisp +
+ fV * inputPatch[1].fWeightDisp +
+ fW * inputPatch[2].fWeightDisp;
+#else
+ float3 vWeightDisp = float3(fU * (1 - inputPatch[0].fWeightDisp),
+ fV * (1 - inputPatch[1].fWeightDisp),
+ fW * (1 - inputPatch[2].fWeightDisp));
+ float fWeightDisp = 1. - max(vWeightDisp.x, max(vWeightDisp.y, vWeightDisp.z));
+#endif
+
+#if ENABLE_INTERIOR_DISTANCE
+ // Compute the interior weight as a function of distance from the shorterst 2 edges
+ float fWeightInterior = getInteriorDistance(input.EdgeFactors, BarycentricCoordinates);
+
+ // Compose the weight as a combination of the two with range [0,1], and scale by a global factor
+ float fWeight = sqrt(fWeightDisp) * .5 + fWeightInterior *.5;
+#else
+ float fWeight = sqrt(fWeightDisp);
+#endif
+ fWeight = clamp(fWeight, 0, 1);
+
+ // Call user defined displacement function
+ float3 vOffset;
+ float3 vOffsetNormal;
+ computeOffsetAndNormal(vLocalPos, vLocalNormal, BarycentricCoordinates,
+ vOffset, vOffsetNormal);
+
+#if ENABLE_INTERIOR_DISTANCE
+ // Restricts interior offsets to those projected along the face normal, and scale
+ vOffset = (vOffset.xyz * (1.f - fWeightInterior)) +
+ (dot(vOffset.xyz, vLocalNormal) * vLocalNormal * ( fWeightInterior));
+#endif
+
+ // Transform the computed offset into world space
+ vOffset = mul((float3x3)input.ModelMatrix, vOffset);
+ vOffsetNormal = mul((float3x3)input.ModelMatrix, vOffsetNormal);
+
+ // Compute the final world space position
+ vWorldPos += vOffset * fWeight * g_tessHeightScaleAndBias.x;;
+
+ output.params.worldSpacePosition = vWorldPos;
+
+ // Compute the final world space normal
+ output.params.worldSpaceNormal = normalize(vNormal*(1-fWeight) + vOffsetNormal*fWeight);
+
+ // Recompute the barycentric coordinates at the displaced location
+ float3 newBarys = computeBarycentricCoordinates(vWorldPos, vNormal, inputPatch[0].vWorldPos, inputPatch[1].vWorldPos, inputPatch[2].vWorldPos);
+ fU = newBarys.x;
+ fV = newBarys.y;
+ fW = newBarys.z;
+
+ // Interpolate texcoords with the new barycentric coordinates
+ output.params.texcoord0 = fU * inputPatch[0].params.texcoord0 +
+ fV * inputPatch[1].params.texcoord0 +
+ fW * inputPatch[2].params.texcoord0;
+ output.params.texcoord1 = fU * inputPatch[0].params.texcoord1 +
+ fV * inputPatch[1].params.texcoord1 +
+ fW * inputPatch[2].params.texcoord1;
+ output.params.texcoord2 = fU * inputPatch[0].params.texcoord2 +
+ fV * inputPatch[1].params.texcoord2 +
+ fW * inputPatch[2].params.texcoord2;
+ output.params.texcoord3 = fU * inputPatch[0].params.texcoord3 +
+ fV * inputPatch[1].params.texcoord3 +
+ fW * inputPatch[2].params.texcoord3;
+
+ // Shader Debuggging
+ //output.params.color = half4((half)abs(vTexcoordYDisp.y), (half)0, 0, 0);
+ //output.params.color = half4((half)fWeight, 0, 0, 0);
+ //output.params.color = half4((half)input.EdgeFactors.x, (half)input.EdgeFactors.y, (half)input.EdgeFactors.z, 0);
+ //half4 color[3]; color[0] = color[1] = color[2] = half4(0,0,0,1);
+ //if( input.EdgeInterior.x ) { color[0].x = 1.; color[1].x = 1.; }
+ //if( input.EdgeInterior.y ) { color[1].y = 1.; color[2].y = 1.; }
+ //if( input.EdgeInterior.z ) { color[2].z = 1.; color[0].z = 1.; }
+ /*if( input.EdgeInterior.x ) { color[1].x = 1.; color[2].x = 1.; }
+ if( input.EdgeInterior.y ) { color[2].x = 1.; color[0].x = 1.; }
+ if( input.EdgeInterior.z ) { color[0].x = 1.; color[1].x = 1.; }
+ output.params.color = (half)fU * color[0] + (half)fV * color[1] + (half)fW * color[2];*/
+ //output.params.color = half4((half)isInterior(input[0].EdgeFactors.x, (half)input.EdgeFactors.y, (half)input.EdgeFactors.z, 0);
+ //output.params.color = half4((half)vModelNormal.x, (half)vModelNormal.y, (half)vModelNormal.z, 0);
+ //output.params.color = half4((half)vModelPos.x, (half)vModelPos.y, (half)vModelPos.z, 0);
+ //output.params.color = half4((half)s, (half)t, 0, 0);
+ //output.params.color = half4((half)fU, (half)fV, (half)fW, 0);
+ //output.params.color = half4((half)vOffset.x, (half)vOffset.y, (half)vOffset.z, 0);
+ //output.params.color = half4((half)fWeightInterior, (half)fWeightInterior, (half)fWeightInterior, 0);
+ //output.params.color = half4((half)fWeightDisp, (half)fWeightDisp, (half)fWeightDisp, 0);
+ /*output.params.color = half4((half)fU * inputPatch[0].fWeightDisp +
+ (half)fV * inputPatch[1].fWeightDisp +
+ (half)fW * inputPatch[2].fWeightDisp, 0, 0, 1);*/
+
+ // Transform world position with viewprojection matrix
+ output.screenSpacePosition = mul(g_projMatrix, mul(g_viewMatrix, float4(vWorldPos.xyz, 1.0)));
+
+ return output;
+}
+
+#endif
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/tessellation/procedural_noise.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/tessellation/procedural_noise.cg
new file mode 100644
index 00000000..86cf4282
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/tessellation/procedural_noise.cg
@@ -0,0 +1,15 @@
+#include <tessellation_entry.cg>
+#include <noise.cg>
+
+//--------------------------------------------------------------------------------------
+// Functions
+//--------------------------------------------------------------------------------------
+
+void computeOffsetAndNormal(in float3 vLocalPos, in float3 vFaceNormal, in float3 vBaryCoords,
+ inout float3 vOffset, inout float3 vNormal)
+{
+ vOffset = inoiseOffset(vLocalPos);
+ vNormal = vFaceNormal;
+ //vNormal = inoiseNormal(vLocalPos, vFaceNormal);
+}
+
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/tessellation/texture_noise.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/tessellation/texture_noise.cg
new file mode 100644
index 00000000..2c23c83e
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/tessellation/texture_noise.cg
@@ -0,0 +1,24 @@
+#include <tessellation_entry.cg>
+
+//--------------------------------------------------------------------------------------
+// Textures
+//--------------------------------------------------------------------------------------
+DECLARE_TEXTURE_3D(displacementTexture)
+
+//--------------------------------------------------------------------------------------
+// Functions
+//--------------------------------------------------------------------------------------
+
+void computeOffsetAndNormal(in float3 localPos, in float3 faceNormal, in float3 baryCoords,
+ inout float3 vOffset, inout float3 vNormal)
+{
+ // There is a slight discrepancy between procedural and textured
+ // noise, easily fixed by a constant multiplier
+ static const float multiplier = .35;
+ float4 texOffset = displacementTexture.SampleLevel(displacementTextureSamplerState, localPos * g_tessUVScale.x, 0);
+ vOffset = texOffset.xyz * multiplier;
+
+ // TODO: use iNoiseNormal
+ vNormal = faceNormal;
+}
+
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/tessellation/wrinkle.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/tessellation/wrinkle.cg
new file mode 100644
index 00000000..59fbed43
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/tessellation/wrinkle.cg
@@ -0,0 +1,312 @@
+#ifndef TESSELLATION_ENTRY_CG
+#define TESSELLATION_ENTRY_CG
+
+#include <config.cg>
+#include <globals.cg>
+
+uniform const float wavelength;
+uniform const float amplitude;
+uniform const float tessellation = 5.0f;
+uniform const float compressionMin = 0.05f;
+uniform const float compressionMax = 0.2f;
+uniform const float harmonics = 0.0f;
+
+DECLARE_TEXTURE(profile)
+
+//--------------------------------------------------------------------------------------
+// Structures
+//--------------------------------------------------------------------------------------
+
+struct VertexOut
+{
+ FragmentParameters params;
+ float4 screenSpacePosition : POSITION;
+};
+
+struct HullConstOut
+{
+ float Edges[3] : SV_TessFactor;
+ float Inside : SV_InsideTessFactor;
+
+};
+
+struct HullControlOut
+{
+ float3 b300 : SEMANTIC_PN_COEFF0;
+ float3 b030 : SEMANTIC_PN_COEFF1;
+ float3 b003 : SEMANTIC_PN_COEFF2;
+ float3 b210 : SEMANTIC_PN_COEFF3;
+ float3 b120 : SEMANTIC_PN_COEFF4;
+ float3 b021 : SEMANTIC_PN_COEFF5;
+ float3 b012 : SEMANTIC_PN_COEFF6;
+ float3 b102 : SEMANTIC_PN_COEFF7;
+ float3 b201 : SEMANTIC_PN_COEFF8;
+ float3 b111 : SEMANTIC_PN_COEFF9;
+ float3 normal[3] : SEMANTIC_PN_COEFF10;
+ float3 tangent[3] : SEMANTIC_PN_COEFF13;
+ float3 binormal[3] : SEMANTIC_PN_COEFF16;
+ float4 compression[3] : SEMANTIC_PN_COEFF19;
+ float4 texcoord[3] : SEMANTIC_PN_COEFF22;
+};
+
+struct DomainOut
+{
+ FragmentParameters params;
+ float4 screenSpacePosition : SV_POSITION;
+};
+
+
+//--------------------------------------------------------------------------------------
+// Hull shader
+//--------------------------------------------------------------------------------------
+HullConstOut ConstantsHS( InputPatch<VertexOut, 3> inputPatch, uint uPID : SV_PrimitiveID )
+{
+ HullConstOut output = (HullConstOut)0;
+// float4 vEdgeTessellationFactors = g_tessFactor.xxxy;
+// float3 vEdgeFactor;
+// bool3 vInterior;
+
+ // Assign tessellation levels
+ output.Edges[0] = tessellation;
+ output.Edges[1] = tessellation;
+ output.Edges[2] = tessellation;
+ output.Inside = tessellation;
+
+ return output;
+}
+
+[domain("tri")]
+[partitioning("fractional_odd")]
+[outputtopology("triangle_cw")]
+[outputcontrolpoints(1)]
+[patchconstantfunc("ConstantsHS")]
+[maxtessfactor(15.0)]
+HullControlOut hmain( InputPatch<VertexOut, 3> inputPatch, uint uCPID : SV_OutputControlPointID )
+{
+ HullControlOut oPatch;
+
+ const float3 v1 = inputPatch[0].params.worldSpacePosition;
+ const float3 v2 = inputPatch[1].params.worldSpacePosition;
+ const float3 v3 = inputPatch[2].params.worldSpacePosition;
+
+ const float3 n1 = inputPatch[0].params.worldSpaceNormal;
+ const float3 n2 = inputPatch[1].params.worldSpaceNormal;
+ const float3 n3 = inputPatch[2].params.worldSpaceNormal;
+
+ // Set the control points of the output patch
+ oPatch.b300 = v1;
+ oPatch.b030 = v2;
+ oPatch.b003 = v3;
+
+ float w12 = dot(v2-v1, n1);
+ float w21 = dot(v1-v2, n2);
+ float w23 = dot(v3-v2, n2);
+ float w32 = dot(v2-v3, n3);
+ float w31 = dot(v1-v3, n3);
+ float w13 = dot(v3-v1, n1);
+
+ oPatch.b210 = (2.0f*v1 + v2 - w12*n1)/3.0f;
+ oPatch.b120 = (2.0f*v2 + v1 - w21*n2)/3.0f;
+ oPatch.b021 = (2.0f*v2 + v3 - w23*n2)/3.0f;
+ oPatch.b012 = (2.0f*v3 + v2 - w32*n3)/3.0f;
+ oPatch.b102 = (2.0f*v3 + v1 - w31*n3)/3.0f;
+ oPatch.b201 = (2.0f*v1 + v3 - w13*n1)/3.0f;
+
+ float3 e = (oPatch.b210 + oPatch.b120 + oPatch.b021 + oPatch.b012 + oPatch.b102 + oPatch.b201) / 6.0f;
+ float3 v = (v1 + v2 + v3) / 3.0f;
+
+ oPatch.b111 = e + (e-v)/2.0f;
+
+ oPatch.normal[0] = n1;
+ oPatch.normal[1] = n2;
+ oPatch.normal[2] = n3;
+
+ oPatch.tangent[0] = inputPatch[0].params.worldSpaceTangent;
+ oPatch.tangent[1] = inputPatch[1].params.worldSpaceTangent;
+ oPatch.tangent[2] = inputPatch[2].params.worldSpaceTangent;
+
+ oPatch.binormal[0] = inputPatch[0].params.worldSpaceBinormal;
+ oPatch.binormal[1] = inputPatch[1].params.worldSpaceBinormal;
+ oPatch.binormal[2] = inputPatch[2].params.worldSpaceBinormal;
+
+ oPatch.compression[0] = float4(swizzle(inputPatch[0].params.color));
+ oPatch.compression[1] = float4(swizzle(inputPatch[1].params.color));
+ oPatch.compression[2] = float4(swizzle(inputPatch[2].params.color));
+
+ oPatch.texcoord[0] = inputPatch[0].params.texcoord0;
+ oPatch.texcoord[1] = inputPatch[1].params.texcoord0;
+ oPatch.texcoord[2] = inputPatch[2].params.texcoord0;
+
+ return oPatch;
+}
+
+//--------------------------------------------------------------------------------------
+// Domain Shader
+//--------------------------------------------------------------------------------------
+
+float cube(float x) { return x*x*x; }
+float sqr(float x) { return x*x; }
+
+float wrinkleProfile(float theta, float r)
+{
+ // standard sinusoid (biased above surface)
+ //return cos(theta)*0.5f + 0.5f;
+
+ // squared sinusoid
+ //return sqr(cos(theta))*0.5f + 0.5f;
+
+ // cubed sinusoid
+ return cube(cos(theta))*0.5f + 0.5f;
+
+ // harmonic frequency
+ //return lerp(cos(theta), 0.5f*cos(2.0f*theta), r*harmonics)*0.5f + 0.5f;
+
+ // texture profile
+ //const float k2Pi = 6.2831853f;
+ //return profile.SampleLevel(profileSamplerState, float2(theta/k2Pi, 0.5f), 0.0f).x;
+}
+
+float wrinkleProfileDeriv(float theta, float r)
+{
+ // standard sinusoid
+ //return -sin(theta)*0.5f;
+
+ // squared sinusoid
+ //return -2.0f*cos(theta)*sin(theta)*0.5f;
+
+ // cubed sinusoid
+ return -3.0f*sqr(cos(theta))*sin(theta)*0.5f;
+
+ // harmonic frequency
+ //return 0.5f*lerp(-sin(theta), -sin(2.0f*theta), r*harmonics);
+
+ /*
+ // texture based
+ const float k2Pi = 6.2831853f;
+
+ // approximate texture profile derivative with finite differences
+ float h1 = profile.SampleLevel(profileSamplerState, float2(theta/k2Pi, 0.5f), 0.0f, int2(-1, 0)).x;
+ float h2 = profile.SampleLevel(profileSamplerState, float2(theta/k2Pi, 0.5f), 0.0f, int2( 1, 0)).x;
+
+ return (h2-h1)*256.0f/(k2Pi*2.0f);
+ */
+}
+
+float frequencyFunc(float compression, float baseFrequency)
+{
+ const float k2Pi = 6.2831853f;
+
+ // decrease wavelength as compression increases
+ //return k2Pi/baseWavelength;
+ //return k2Pi/(max(sqr(1.0f-compression), 0.2f)*baseWavelength);
+ //return k2Pi*max(baseWavelength*compression, 0.1f*baseWavelength);
+ return k2Pi*lerp(baseFrequency*0.1f, baseFrequency, compression);
+}
+
+float amplitudeFunc(float compression)
+{
+ // proportional to compression
+ return compression;
+
+ // parabola with zeros at 0, 1
+ //return 1.0f - sqr(compression*2.0f-1.0f);
+}
+
+float wrinkleFunc(float3 vertex, float3 vertexCompression, float3 x, float baseFrequency, float phaseOffset, float scale, out float3 dhdx)
+{
+ // project test point onto axis of compression
+ float r = length(vertexCompression);
+ if (r < 0.001f)
+ {
+ dhdx = 0.0f;
+ return 0.0f;
+ }
+ float3 axis = vertexCompression/r;
+
+ const float frequency = frequencyFunc(r, baseFrequency);
+ const float amplitude = amplitudeFunc(r)*scale/frequency;
+
+ float theta = frequency*dot(axis, x-vertex) + phaseOffset;
+
+ // normal offset
+ dhdx = amplitude*frequency*axis*wrinkleProfileDeriv(theta, r);
+
+ // height offset
+ return amplitude*wrinkleProfile(theta, r);
+}
+
+float interpolate1d(float a, float b, float c, float u, float v, float w)
+{
+ return a*u + b*v + c*w;
+}
+
+float3 interpolate3d(float3 a, float3 b, float3 c, float u, float v, float w)
+{
+ return a*u + b*v + c*w;
+}
+
+[domain("tri")]
+DomainOut dmain( HullConstOut input,
+ float3 BarycentricCoordinates : SV_DomainLocation,
+ const OutputPatch<HullControlOut, 1> oPatch )
+{
+ DomainOut output;
+
+ // ordering from the original paper
+ float u = BarycentricCoordinates.y;
+ float v = BarycentricCoordinates.z;
+ float w = BarycentricCoordinates.x;
+
+ float3 x = oPatch[0].b300*w*w*w +
+ oPatch[0].b030*u*u*u +
+ oPatch[0].b003*v*v*v +
+ oPatch[0].b210*3.0f*w*w*u +
+ oPatch[0].b120*3.0f*w*u*u +
+ oPatch[0].b201*3.0f*w*w*v +
+ oPatch[0].b021*3.0f*u*u*v +
+ oPatch[0].b102*3.0f*w*v*v +
+ oPatch[0].b012*3.0f*u*v*v +
+ oPatch[0].b111*6.0f*w*u*v;
+
+ // normal ordering
+ u = BarycentricCoordinates.x;
+ v = BarycentricCoordinates.y;
+ w = BarycentricCoordinates.z;
+
+ float3 n1;
+ float3 n2;
+ float3 n3;
+
+ float lambda = 1.0f/wavelength;
+
+ float h1 = wrinkleFunc(oPatch[0].b300, oPatch[0].compression[0].xyz, x, lambda, oPatch[0].compression[0].w, amplitude, n1);
+ float h2 = wrinkleFunc(oPatch[0].b030, oPatch[0].compression[1].xyz, x, lambda, oPatch[0].compression[1].w, amplitude, n2);
+ float h3 = wrinkleFunc(oPatch[0].b003, oPatch[0].compression[2].xyz, x, lambda, oPatch[0].compression[2].w, amplitude, n3);
+
+ float h = interpolate1d(h1, h2, h3, u, v, w);
+
+ float3 n = normalize(interpolate3d(oPatch[0].normal[0], oPatch[0].normal[1], oPatch[0].normal[2], u, v, w));
+
+ // artificallly strengthen normal displacement to enhance wrinkles
+ const float kNormalScale = 2.0f;
+
+ output.params.worldSpacePosition = x + h*n;
+ output.params.worldSpaceNormal = normalize(n - kNormalScale*interpolate3d(n1, n2, n3, u, v, w));
+ output.params.worldSpaceTangent = 0.0f;//interpolate3d(oPatch[0].tangent[1], oPatch[0].tangent[2], oPatch[0].tangent[0], u, v, w);
+ output.params.worldSpaceBinormal = 0.0f;//interpolate3d(oPatch[0].binormal[1], oPatch[0].binormal[2], oPatch[0].binormal[0], u, v, w);
+
+ output.params.texcoord0 = oPatch[0].texcoord[0]*u + oPatch[0].texcoord[1]*v + oPatch[0].texcoord[2]*w;
+ output.params.texcoord1 = 0.0;
+ output.params.texcoord2 = 0.0;
+ output.params.texcoord3 = 0.0;
+ //output.params.color.xyz = half3(h, h, h);
+ //output.params.color.w = 1.0;
+ output.params.color = 1.0;
+
+ // Transform world position with viewprojection matrix
+ output.screenSpacePosition = mul(g_projMatrix, mul(g_viewMatrix, float4(output.params.worldSpacePosition, 1.0)));
+
+ return output;
+}
+
+#endif
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/lines.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/lines.cg
new file mode 100644
index 00000000..7fd688eb
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/lines.cg
@@ -0,0 +1,19 @@
+#include <config.cg>
+#include <globals.cg>
+
+struct VertexOut
+{
+ float4 screenSpacePosition : POSITION;
+ half4 color : COLOR;
+};
+
+VertexOut vmain(__in(float4, localSpacePosition, POSITION)
+ __in_opt(half4, vertexColor, COLOR))
+{
+ VertexOut vout;
+ float4x4 vpm = mul(g_projMatrix, g_viewMatrix);
+ vout.screenSpacePosition = mul(vpm, localSpacePosition);
+ vout.color = vertexColor;
+
+ return vout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/mouse.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/mouse.cg
new file mode 100644
index 00000000..d56e1c97
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/mouse.cg
@@ -0,0 +1,58 @@
+
+#include <config.cg>
+#include <globals.cg>
+
+struct VertexOut
+{
+ FragmentParameters params;
+ float4 screenSpacePosition : POSITION;
+};
+
+VertexOut vmain(__in(float4, localSpacePosition, POSITION)
+ __in_opt(float3, localSpaceNormal, NORMAL)
+ __in_opt(float4, localSpaceTangent, SEMANTIC_TANGENT)
+ __in_opt(float4, vertexTexcoord0, TEXCOORD0)
+ __in_opt(float4, vertexTexcoord1, TEXCOORD1)
+ __in_opt(float4, vertexTexcoord2, TEXCOORD2)
+ __in_opt(float4, vertexTexcoord3, TEXCOORD3)
+ __in_opt(half4, vertexColor, COLOR)
+ #if RENDERER_INSTANCED
+ , __in(float3, instanceOffset, SEMANTIC_INSTANCE_T)
+ , __in(float3, instanceNormalX, SEMANTIC_INSTANCE_X)
+ , __in(float3, instanceNormalY, SEMANTIC_INSTANCE_Y)
+ , __in(float3, instanceNormalZ, SEMANTIC_INSTANCE_Z)
+ #endif
+ )
+{
+ VertexOut vout;
+
+ float4x4 modelMatrix;
+#if RENDERER_INSTANCED
+ modelMatrix = mul(g_modelMatrix, transpose(float4x4(float4(instanceNormalX, 0), float4(instanceNormalY, 0), float4(instanceNormalZ, 0), float4(instanceOffset, 1))));
+#else
+ modelMatrix = g_modelMatrix;
+#endif
+
+ float4x4 mvm = mul(g_viewMatrix, modelMatrix);
+ float4 epos = mul( mvm, localSpacePosition );
+ float4x4 mvpm = mul(g_projMatrix, mvm);
+ vout.screenSpacePosition = mul(mvpm, localSpacePosition);
+
+ vout.params.worldSpacePosition = mul(modelMatrix, localSpacePosition).xyz;
+ vout.params.worldSpaceNormal = normalize(mul(modelMatrix, float4(localSpaceNormal, 0)).xyz);
+ vout.params.worldSpaceTangent = normalize(mul(modelMatrix, float4(localSpaceTangent.xyz, 0)).xyz);
+ vout.params.worldSpaceBinormal = cross(vout.params.worldSpaceNormal, vout.params.worldSpaceTangent) * localSpaceTangent.w;
+
+ vout.params.texcoord0 = vertexTexcoord0;
+ vout.params.texcoord1 = vertexTexcoord1;
+ vout.params.texcoord2 = vertexTexcoord2;
+#if !defined (RENDERER_WIN8ARM)
+ vout.params.texcoord3 = vertexTexcoord3;
+#endif
+ vout.params.color = vertexColor;
+
+ vout.screenSpacePosition.w = epos.z;
+ vout.screenSpacePosition.xy *= epos.z;
+
+ return vout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/particle_fog.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/particle_fog.cg
new file mode 100644
index 00000000..e7663be5
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/particle_fog.cg
@@ -0,0 +1,66 @@
+
+#include <config.cg>
+#include <globals.cg>
+
+struct VertexOut
+{
+ FragmentParameters params;
+ float4 screenSpacePosition : POSITION;
+ float pointSize : PSIZE;
+};
+
+BEGIN_CBUFFER(cbParticlesFog)
+CONST_TYPE float windowWidth;
+END_CBUFFER(cbParticlesFog)
+
+VertexOut vmain(__in(float4, localSpacePosition, POSITION)
+ __in_opt(float3, localSpaceNormal, NORMAL)
+ __in_opt(float4, localSpaceTangent, SEMANTIC_TANGENT)
+ __in_opt(float4, vertexTexcoord0, TEXCOORD0)
+ __in_opt(float4, vertexTexcoord1, TEXCOORD1)
+ __in_opt(float4, vertexTexcoord2, TEXCOORD2)
+ __in_opt(float4, vertexTexcoord3, TEXCOORD3)
+ __in_opt(half4, vertexColor, COLOR)
+ #if RENDERER_INSTANCED
+ , __in(float3, instanceOffset, SEMANTIC_INSTANCE_T)
+ , __in(float3, instanceNormalX, SEMANTIC_INSTANCE_X)
+ , __in(float3, instanceNormalY, SEMANTIC_INSTANCE_Y)
+ , __in(float3, instanceNormalZ, SEMANTIC_INSTANCE_Z)
+ #endif
+ )
+{
+ VertexOut vout;
+
+ float4x4 modelMatrix;
+#if RENDERER_INSTANCED
+ modelMatrix = transpose(float4x4(float4(instanceNormalX, 0), float4(instanceNormalY, 0), float4(instanceNormalZ, 0), float4(instanceOffset, 1)));
+#else
+ modelMatrix = g_modelMatrix;
+#endif
+
+ float4x4 mvm = mul(g_viewMatrix, modelMatrix);
+ float4x4 mvpm = mul(g_projMatrix, mvm);
+ vout.screenSpacePosition = mul(mvpm, localSpacePosition);
+
+ vout.params.worldSpacePosition = mul(g_modelMatrix, localSpacePosition).xyz;
+ vout.params.worldSpaceNormal = normalize(mul(modelMatrix, float4(localSpaceNormal, 0)).xyz);
+ vout.params.worldSpaceTangent = normalize(mul(g_modelMatrix, float4(localSpaceTangent.xyz, 0)).xyz);
+ vout.params.worldSpaceBinormal = cross(vout.params.worldSpaceNormal, vout.params.worldSpaceTangent) * localSpaceTangent.w;
+
+ vout.params.texcoord0 = vertexTexcoord0;
+ vout.params.texcoord1 = vertexTexcoord1;
+ vout.params.texcoord2 = vertexTexcoord2;
+#if !defined (RENDERER_WIN8ARM)
+ vout.params.texcoord3 = vertexTexcoord3;
+#endif
+ vout.params.color = vertexTexcoord1;
+
+ // saturate density range...
+ const float minDensity = 900;
+ const float maxDensity = 2500;
+ vout.params.color.r = sqrt(saturate((vout.params.color.r - minDensity) / (maxDensity-minDensity)));
+
+ vout.pointSize = (g_projMatrix[0][0] / vout.screenSpacePosition.w) * (windowWidth / 2.0) * 1.0;// * (1-0.5*vout.params.color.r);
+
+ return vout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/pointsprite.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/pointsprite.cg
new file mode 100644
index 00000000..49257f50
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/pointsprite.cg
@@ -0,0 +1,165 @@
+#include <config.cg>
+#include <globals.cg>
+
+struct VertexOut
+{
+ FragmentParameters params;
+#if defined(RENDERER_D3D11) && !defined(RENDERER_WIN8ARM)
+ float4 screenSpacePosition : SV_POSITION;
+ float4 rotScaleXScaleY : SEMANTIC_SPRITE_ROT_SCALEX_SCALEY;
+#else
+ float4 screenSpacePosition : POSITION;
+#endif
+ float pointSize : PSIZE;
+};
+
+BEGIN_CBUFFER(cbPointSprite)
+CONST_TYPE float windowWidth;
+CONST_TYPE float particleSize;
+CONST_TYPE int hasRotation;
+CONST_TYPE int hasScale;
+#if USE_VTF
+CONST_TYPE sampler2D positionTexture;
+CONST_TYPE sampler2D colorTexture;
+CONST_TYPE sampler2D transformTexture;
+CONST_TYPE float vertexTextureWidth;
+CONST_TYPE float vertexTextureHeight;
+#endif
+END_CBUFFER(cbPointSprite)
+
+VertexOut vmain(
+ #if USE_VTF
+ __in(float, particleIndex, POSITION)
+ #else
+ __in(float4, localSpacePosition, POSITION)
+ #endif
+ __in_opt(half4, vertexColor, COLOR)
+ __in_opt(float3, localSpaceNormal, NORMAL)
+ __in_opt(float4, localSpaceTangent, SEMANTIC_TANGENT)
+ __in_opt(float4, vertexTexcoord0, TEXCOORD0)
+ __in_opt(float4, vertexTexcoord1, TEXCOORD1)
+ __in_opt(float4, vertexTexcoord2, TEXCOORD2)
+ __in_opt(float4, vertexTexcoord3, TEXCOORD3)
+ #if RENDERER_INSTANCED
+ , __in(float3, instanceOffset, SEMANTIC_INSTANCE_T)
+ , __in(float3, instanceNormalX, SEMANTIC_INSTANCE_X)
+ , __in(float3, instanceNormalY, SEMANTIC_INSTANCE_Y)
+ , __in(float3, instanceNormalZ, SEMANTIC_INSTANCE_Z)
+ #endif
+ )
+{
+ VertexOut vout;
+
+#if defined(USE_VTF)
+ float f = floor(particleIndex/vertexTextureWidth);
+ float4 tcx = float4((particleIndex - f * vertexTextureWidth) / vertexTextureWidth, f / vertexTextureHeight, 0, 0);
+ float4 pos = tex2Dlod(positionTexture, tcx);
+#else
+ float4 pos = localSpacePosition;
+#endif
+
+#if !defined(GLSL_COMPILER)
+ float4x4 modelMatrix;
+#if RENDERER_INSTANCED
+ modelMatrix = mul(g_modelMatrix, transpose(float4x4(float4(instanceNormalX, 0), float4(instanceNormalY, 0), float4(instanceNormalZ, 0), float4(instanceOffset, 1))));
+#else
+ modelMatrix = g_modelMatrix;
+#endif
+#endif
+
+#if !defined(GLSL_COMPILER)
+ float4x4 mvm = mul(g_viewMatrix, modelMatrix);
+ float4x4 mvpm = mul(g_projMatrix, mvm);
+ vout.screenSpacePosition = mul(mvpm, pos);
+ vout.params.worldSpacePosition = mul(modelMatrix, pos).xyz;
+#else
+ vout.screenSpacePosition = mul(g_MVP, pos);
+ vout.params.worldSpacePosition = mul(g_modelMatrix, pos).xyz;
+#endif
+
+#if !defined(GLSL_COMPILER)
+ float3 tbz = normalize(vout.params.worldSpacePosition - g_eyePosition);
+ float3 tbx = cross(float3(0,1,0), tbz);
+
+ vout.params.worldSpaceNormal = tbz;//normalize(mul(modelMatrix, float4(localSpaceNormal, 0)).xyz);
+ vout.params.worldSpaceTangent = tbx;//normalize(mul(g_modelMatrix, float4(localSpaceTangent.xyz, 0)).xyz);
+ vout.params.worldSpaceBinormal = cross(vout.params.worldSpaceNormal, vout.params.worldSpaceTangent) * localSpaceTangent.w;
+#else
+#if !defined(PASS_UNLIT)
+ float3 tbz = normalize(vout.params.worldSpacePosition - g_eyePosition);
+ vout.params.worldSpaceNormal = tbz;//normalize(mul(modelMatrix, float4(localSpaceNormal, 0)).xyz);
+#endif
+#endif
+
+ vout.params.texcoord0 = vertexTexcoord0;
+#if !defined(GLSL_COMPILER)
+ vout.params.texcoord1 = vertexTexcoord1;
+ vout.params.texcoord2 = vertexTexcoord2;
+#if !defined (RENDERER_WIN8ARM)
+ vout.params.texcoord3 = vertexTexcoord3;
+#endif
+#endif
+
+#if defined(USE_VTF)
+ vout.params.color = swizzle((half4)tex2Dlod(colorTexture, tcx));
+#else
+ vout.params.color = swizzle(vertexColor);
+#endif
+
+#if defined(RENDERER_D3D11) && !defined(RENDERER_WIN8ARM)
+ vout.pointSize = particleSize * .75;
+ vout.rotScaleXScaleY = float4(hasRotation ? vertexTexcoord3.x : 0,
+ hasScale ? localSpaceTangent.xy : float2(1,1),
+ 0);
+#else
+ vout.pointSize = (g_projMatrix[0][0] / vout.screenSpacePosition.w) * windowWidth * particleSize * .5;
+#endif
+ return vout;
+}
+
+#if defined(RENDERER_D3D11) && !defined(RENDERER_WIN8ARM)
+
+struct GeomOut
+{
+ FragmentParameters params;
+ float4 screenSpacePosition : SV_POSITION;
+ float pointSize : PSIZE;
+};
+
+[maxvertexcount(4)]
+void gmain( point VertexOut sprite[1], inout TriangleStream<GeomOut> triStream )
+{
+ GeomOut v;
+ v.params = sprite[0].params;
+ v.pointSize = sprite[0].pointSize;
+
+ const float4 pos = sprite[0].screenSpacePosition;
+ const float rad = sprite[0].pointSize;
+ const float theta = sprite[0].rotScaleXScaleY[0];
+ const float radX = sprite[0].rotScaleXScaleY[1] * rad;
+ const float radY = sprite[0].rotScaleXScaleY[2] * rad;
+
+ float sinTheta, cosTheta;
+ sincos(theta, sinTheta, cosTheta);
+ const float2x2 rot = {cosTheta, -sinTheta,
+ sinTheta, cosTheta};
+
+ v.screenSpacePosition = pos + float4(mul(rot, float2(-radX, -radY)), 0, 0);
+ v.params.texcoord0 = float4(0,1,0,0);
+ triStream.Append(v);
+
+ v.screenSpacePosition = pos + float4(mul(rot, float2(-radX, radY)), 0, 0);
+ v.params.texcoord0 = float4(0,0,0,0);
+ triStream.Append(v);
+
+ v.screenSpacePosition = pos + float4(mul(rot, float2( radX, -radY)), 0, 0);
+ v.params.texcoord0 = float4(1,1,0,0);
+ triStream.Append(v);
+
+ v.screenSpacePosition = pos + float4(mul(rot, float2( radX, radY)), 0, 0);
+ v.params.texcoord0 = float4(1,0,0,0);
+ triStream.Append(v);
+
+ triStream.RestartStrip();
+}
+#endif
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/pointsprite2.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/pointsprite2.cg
new file mode 100644
index 00000000..b0a1c4ed
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/pointsprite2.cg
@@ -0,0 +1,76 @@
+
+#include <config.cg>
+#include <globals.cg>
+
+struct VertexOut
+{
+ FragmentParameters params;
+#if defined(RENDERER_D3D11) && !defined(RENDERER_WIN8ARM)
+ // D3D11 Required input for geometry shader
+ float4 screenSpacePosition : SV_POSITION;
+#else
+ float4 screenSpacePosition : POSITION;
+#endif
+ float pointSize : PSIZE;
+};
+
+BEGIN_CBUFFER(cbPointSprite)
+CONST_TYPE float windowWidth;
+CONST_TYPE float particleSize;
+END_CBUFFER(cbPointSprite)
+
+float clampedGraph(float value, float vmin, float vmax)
+{
+ return saturate((value - vmin) / (vmax-vmin));
+}
+
+VertexOut vmain(__in(float4, localSpacePosition, POSITION)
+ __in_opt(half4, vertexColor, COLOR)
+ __in_opt(float3, localSpaceNormal, NORMAL)
+ __in_opt(float4, localSpaceTangent, SEMANTIC_TANGENT)
+ __in_opt(float4, vertexTexcoord0, TEXCOORD0)
+ __in_opt(float4, vertexTexcoord1, TEXCOORD1)
+ __in_opt(float4, vertexTexcoord2, TEXCOORD2)
+ __in_opt(float4, vertexTexcoord3, TEXCOORD3)
+ #if RENDERER_INSTANCED
+ , __in(float3, instanceOffset, SEMANTIC_INSTANCE_T)
+ , __in(float3, instanceNormalX, SEMANTIC_INSTANCE_X)
+ , __in(float3, instanceNormalY, SEMANTIC_INSTANCE_Y)
+ , __in(float3, instanceNormalZ, SEMANTIC_INSTANCE_Z)
+ #endif
+ )
+{
+ VertexOut vout;
+
+ float4x4 modelMatrix;
+#if RENDERER_INSTANCED
+ modelMatrix = transpose(float4x4(float4(instanceNormalX, 0), float4(instanceNormalY, 0), float4(instanceNormalZ, 0), float4(instanceOffset, 1)));
+#else
+ modelMatrix = g_modelMatrix;
+#endif
+
+ float4x4 mvm = mul(g_viewMatrix, modelMatrix);
+ float4x4 mvpm = mul(g_projMatrix, mvm);
+ vout.screenSpacePosition = mul(mvpm, localSpacePosition);
+
+ vout.params.worldSpacePosition = mul(modelMatrix, localSpacePosition).xyz;
+
+ float3 tbz = normalize(vout.params.worldSpacePosition - g_eyePosition);
+ float3 tbx = cross(float3(0,1,0), tbz);
+
+ vout.params.worldSpaceNormal = tbz;//normalize(mul(modelMatrix, float4(localSpaceNormal, 0)).xyz);
+ vout.params.worldSpaceTangent = tbx;//normalize(mul(g_modelMatrix, float4(localSpaceTangent.xyz, 0)).xyz);
+ vout.params.worldSpaceBinormal = cross(vout.params.worldSpaceNormal, vout.params.worldSpaceTangent) * localSpaceTangent.w;
+
+ vout.params.texcoord0 = vertexTexcoord0;
+ vout.params.texcoord1 = vertexTexcoord1;
+ vout.params.texcoord2 = vertexTexcoord2;
+#if !defined (RENDERER_WIN8ARM)
+ vout.params.texcoord3 = vertexTexcoord3;
+#endif
+ vout.params.color = vertexColor;
+
+ vout.pointSize = (particleSize * particleSize) / (vout.screenSpacePosition.w * vout.screenSpacePosition.w);
+
+ return vout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/primitives.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/primitives.cg
new file mode 100644
index 00000000..c9f442db
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/primitives.cg
@@ -0,0 +1,20 @@
+#include <config.cg>
+#include <globals.cg>
+
+struct VertexOut
+{
+ float4 screenSpacePosition : POSITION;
+ half4 color : COLOR;
+};
+
+VertexOut vmain(__in(float4, localSpacePosition, POSITION)
+ __in_opt(half4, vertexColor, COLOR)
+ __in_opt(float3, localSpaceNormal, NORMAL))
+{
+ VertexOut vout;
+ float4x4 vpm = mul(g_projMatrix, g_viewMatrix);
+ vout.screenSpacePosition = mul(vpm, localSpacePosition);
+ vout.screenSpacePosition.z -= 0.005; // hack to avoid z-fighting
+ vout.color = vertexColor;
+ return vout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/primitives_lighting.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/primitives_lighting.cg
new file mode 100644
index 00000000..210cf646
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/primitives_lighting.cg
@@ -0,0 +1,25 @@
+#include <config.cg>
+#include <globals.cg>
+
+struct VertexOut
+{
+ float4 screenSpacePosition : POSITION;
+ float3 worldSpacePosition : TEXCOORD1;
+ float3 worldSpaceNormal : TEXCOORD2;
+ half4 color : COLOR;
+};
+
+VertexOut vmain(__in(float4, localSpacePosition, POSITION)
+ __in_opt(float3, localSpaceNormal, NORMAL)
+ __in_opt(half4, vertexColor, COLOR))
+{
+ VertexOut vout;
+ float4x4 vpm = mul(g_projMatrix, g_viewMatrix);
+ vout.screenSpacePosition = mul(vpm, localSpacePosition);
+ vout.screenSpacePosition.z -= 0.005; // hack to avoid z-fighting
+ vout.worldSpaceNormal = localSpaceNormal;
+ vout.worldSpacePosition = localSpacePosition.xyz;
+ vout.color = vertexColor;
+
+ return vout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/screenquad.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/screenquad.cg
new file mode 100644
index 00000000..30703740
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/screenquad.cg
@@ -0,0 +1,36 @@
+
+// Parameters passed from the vertex shader to the fragment shader.
+struct QuadFragmentParameters
+{
+ float4 worldSpacePosition : TEXCOORD4;
+ float2 texcoord0 : TEXCOORD0;
+ half4 color : COLOR;
+};
+
+#include <config.cg>
+#include <globals.cg>
+
+struct VertexOut
+{
+ QuadFragmentParameters params;
+ float4 screenSpacePosition : POSITION;
+};
+
+VertexOut vmain(__in(float4, localSpacePosition, POSITION)
+ __in_opt(half4, vertexColor, COLOR)
+ __in_opt(float3, localSpaceNormal, NORMAL)
+ __in_opt(float4, localSpaceTangent, SEMANTIC_TANGENT)
+ __in_opt(float4, vertexTexcoord0, TEXCOORD0)
+ __in_opt(float4, vertexTexcoord1, TEXCOORD1)
+ __in_opt(float4, vertexTexcoord2, TEXCOORD2)
+ __in_opt(float4, vertexTexcoord3, TEXCOORD3))
+{
+ VertexOut vout;
+
+ vout.screenSpacePosition = float4(mul(g_viewMatrix2D, float4(localSpacePosition.xyz,1)).xyz, localSpacePosition.w);
+ vout.params.worldSpacePosition = vout.screenSpacePosition;
+ vout.params.texcoord0 = vertexTexcoord0.xy;
+ vout.params.color = vertexColor;
+
+ return vout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/skeletalmesh_1bone.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/skeletalmesh_1bone.cg
new file mode 100644
index 00000000..9fea0b2e
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/skeletalmesh_1bone.cg
@@ -0,0 +1,75 @@
+
+#include <config.cg>
+#include <globals.cg>
+#include <tessellation.cg>
+
+VertexOut vmain(__in(float4, localSpacePosition, POSITION)
+ __in_opt(float3, localSpaceNormal, NORMAL)
+ __in_opt(float4, localSpaceTangent, SEMANTIC_TANGENT)
+ __in_opt(float4, vertexTexcoord0, TEXCOORD0)
+ __in_opt(float4, vertexTexcoord1, TEXCOORD1)
+ __in_opt(float4, vertexTexcoord2, TEXCOORD2)
+ __in_opt(float4, vertexTexcoord3, TEXCOORD3)
+ __in_opt(half4, vertexColor, COLOR)
+ , __in(int, boneIndex, SEMANTIC_BONEINDEX)
+ #if RENDERER_DISPLACED
+ __in_opt(uint, vertexFlagsDisp, SEMANTIC_DISPLACEMENT_FLAGS)
+ #endif
+ )
+{
+ VertexOut vout;
+
+#if defined USE_VTF
+ float4x4 boneMatrix;
+ const float boneTextureIdx = ((float)boneIndex + 0.5f) / g_boneTextureHeight;
+ boneMatrix[0] = tex2Dlod(g_boneTexture, float4(0.5f / 4.f, boneTextureIdx, 0, 0));
+ boneMatrix[1] = tex2Dlod(g_boneTexture, float4(1.5f / 4.f, boneTextureIdx, 0, 0));
+ boneMatrix[2] = tex2Dlod(g_boneTexture, float4(2.5f / 4.f, boneTextureIdx, 0, 0));
+ boneMatrix[3] = tex2Dlod(g_boneTexture, float4(3.5f / 4.f, boneTextureIdx, 0, 0));
+#else
+ float4x4 boneMatrix = g_boneMatrices[boneIndex];
+#endif
+
+ float4 skinnedPosition = mul(boneMatrix, localSpacePosition);
+ float3 skinnedNormal = mul(boneMatrix, float4(localSpaceNormal, 0)).xyz;
+#if !defined(GLSL_COMPILER)
+ float3 skinnedTangent = mul(boneMatrix, float4(localSpaceTangent.xyz, 0)).xyz;
+#endif
+
+#if !defined(GLSL_COMPILER)
+ float4x4 mvpm = mul(g_projMatrix, g_modelViewMatrix); // TODO: should use g_modelViewProjMatrix....
+ vout.screenSpacePosition = mul(mvpm, skinnedPosition);
+#else
+ vout.screenSpacePosition = mul(g_MVP, skinnedPosition);
+#endif
+
+#if !defined(GLSL_COMPILER)
+ vout.params.worldSpacePosition = mul(g_modelMatrix, skinnedPosition).xyz;
+ vout.params.worldSpaceNormal = normalize(mul(g_modelMatrix, float4(skinnedNormal, 0)).xyz);
+ vout.params.worldSpaceTangent = normalize(mul(g_modelMatrix, float4(skinnedTangent, 0)).xyz);
+ vout.params.worldSpaceBinormal = cross(vout.params.worldSpaceTangent, vout.params.worldSpaceNormal) * localSpaceTangent.w;
+#else
+ vout.params.worldSpacePosition = mul(g_modelMatrix, skinnedPosition).xyz;
+ vout.params.worldSpaceNormal = normalize(mul(g_modelMatrix, float4(skinnedNormal, 0)).xyz);
+#endif
+
+ vout.params.texcoord0 = vertexTexcoord0;
+ vout.params.texcoord1 = vertexTexcoord1;
+ vout.params.texcoord2 = vertexTexcoord2;
+#if !defined (RENDERER_WIN8ARM)
+ vout.params.texcoord3 = vertexTexcoord3;
+#endif
+ vout.params.color = swizzle(vertexColor);
+
+#if RENDERER_DISPLACED
+ vout.localPosition = localSpacePosition;
+ vout.flagsDisp = vertexFlagsDisp;
+ float4x4 modelBoneMatrix = mul(g_modelMatrix, boneMatrix);
+ vout.modelMatrix[0] = modelBoneMatrix[0];
+ vout.modelMatrix[1] = modelBoneMatrix[1];
+ vout.modelMatrix[2] = modelBoneMatrix[2];
+ vout.modelMatrix[3] = modelBoneMatrix[3];
+#endif
+
+ return vout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/skeletalmesh_4bone.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/skeletalmesh_4bone.cg
new file mode 100644
index 00000000..63f2af66
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/skeletalmesh_4bone.cg
@@ -0,0 +1,70 @@
+
+#include <config.cg>
+#include <globals.cg>
+
+struct VertexOut
+{
+ FragmentParameters params;
+ float4 screenSpacePosition : POSITION;
+};
+
+float4x4 accumulate_skin(float4 boneIndices0,
+ float4 boneWeights0)
+{
+ float4x4 result = boneWeights0.x * g_boneMatrices[boneIndices0.x];
+ result = result + boneWeights0.y * g_boneMatrices[boneIndices0.y];
+ result = result + boneWeights0.z * g_boneMatrices[boneIndices0.z];
+ result = result + boneWeights0.w * g_boneMatrices[boneIndices0.w];
+ return result;
+}
+
+VertexOut vmain(__in(float4, localSpacePosition, POSITION)
+ __in_opt(float3, localSpaceNormal, NORMAL)
+ __in_opt(float4, localSpaceTangent, SEMANTIC_TANGENT)
+ __in_opt(float4, vertexTexcoord0, TEXCOORD0)
+ __in_opt(float4, vertexTexcoord1, TEXCOORD1)
+ __in_opt(float4, vertexTexcoord2, TEXCOORD2)
+ __in_opt(float4, vertexTexcoord3, TEXCOORD3)
+ __in_opt(half4, vertexColor, COLOR)
+ , __in(int4, boneIndices, TEXCOORD6)
+ , __in(float4, boneWeights, TEXCOORD7))
+{
+ VertexOut vout;
+
+ float4x4 boneMatrix = accumulate_skin(boneIndices, boneWeights);
+ float4 skinnedPosition = mul(boneMatrix, localSpacePosition);
+ float3 skinnedNormal = (mul(boneMatrix, float4(localSpaceNormal, 0))).xyz;
+#if !defined(GLSL_COMPILER)
+ float3 skinnedTangent = (mul(boneMatrix, float4(localSpaceTangent.xyz, 0))).xyz;
+#endif
+
+ skinnedPosition.w = 1;
+ skinnedNormal = normalize(skinnedNormal);
+#if !defined(GLSL_COMPILER)
+ skinnedTangent = normalize(skinnedTangent);
+#endif
+
+#if !defined(GLSL_COMPILER)
+ float4x4 mvpm = mul(g_projMatrix, g_modelViewMatrix); // TODO: should use g_modelViewProjMatrix....
+ vout.screenSpacePosition = mul(mvpm, skinnedPosition);
+#else
+ vout.screenSpacePosition = mul(g_MVP, skinnedPosition);
+#endif
+
+ vout.params.worldSpacePosition = mul(g_modelMatrix, skinnedPosition).xyz;
+ vout.params.worldSpaceNormal = normalize(mul(g_modelMatrix, float4(skinnedNormal, 0)).xyz);
+#if !defined(GLSL_COMPILER)
+ vout.params.worldSpaceTangent = normalize(mul(g_modelMatrix, float4(skinnedTangent, 0)).xyz);
+ vout.params.worldSpaceBinormal = cross(vout.params.worldSpaceNormal, vout.params.worldSpaceTangent) * localSpaceTangent.w;
+#endif
+
+ vout.params.texcoord0 = vertexTexcoord0;
+ vout.params.texcoord1 = vertexTexcoord1;
+ vout.params.texcoord2 = vertexTexcoord2;
+#if !defined (RENDERER_WIN8ARM)
+ vout.params.texcoord3 = vertexTexcoord3;
+#endif
+ vout.params.color = swizzle(vertexColor);
+
+ return vout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/skydome.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/skydome.cg
new file mode 100644
index 00000000..d4acd053
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/skydome.cg
@@ -0,0 +1,82 @@
+
+#include <config.cg>
+#include <globals.cg>
+#include <tessellation.cg>
+
+VertexOut vmain(__in(float4, localSpacePosition, POSITION)
+ __in_opt(float3, localSpaceNormal, NORMAL)
+ __in_opt(float4, localSpaceTangent, SEMANTIC_TANGENT)
+ __in_opt(float4, vertexTexcoord0, TEXCOORD0)
+ __in_opt(float4, vertexTexcoord1, TEXCOORD1)
+ __in_opt(float4, vertexTexcoord2, TEXCOORD2)
+ __in_opt(float4, vertexTexcoord3, TEXCOORD3)
+ __in_opt(half4, vertexColor, COLOR)
+ #if RENDERER_INSTANCED
+ , __in(float3, instanceOffset, SEMANTIC_INSTANCE_T)
+ , __in(float3, instanceNormalX, SEMANTIC_INSTANCE_X)
+ , __in(float3, instanceNormalY, SEMANTIC_INSTANCE_Y)
+ , __in(float3, instanceNormalZ, SEMANTIC_INSTANCE_Z)
+ __in_opt(float2, instanceUVOffset, SEMANTIC_INSTANCE_UV)
+ __in_opt(float3, instanceLocalOffset, SEMANTIC_INSTANCE_LOCAL)
+ #endif
+ #if RENDERER_DISPLACED
+ __in_opt(uint, vertexFlagsDisp, SEMANTIC_DISPLACEMENT_FLAGS)
+ #endif
+ )
+{
+ VertexOut vout;
+
+#if !defined(GLSL_COMPILER)
+ float4x4 modelMatrix;
+#if RENDERER_INSTANCED
+ modelMatrix = mul(g_modelMatrix, transpose(float4x4(float4(instanceNormalX, 0), float4(instanceNormalY, 0), float4(instanceNormalZ, 0), float4(instanceOffset, 1))));
+#else
+ modelMatrix = g_modelMatrix;
+#endif
+#endif
+
+#if !defined(GLSL_COMPILER)
+ float4x4 mvm = mul(g_viewMatrix, modelMatrix);
+ float4x4 mvpm = mul(g_projMatrix, mvm);
+ vout.screenSpacePosition = mul(mvpm, localSpacePosition);
+#else
+ vout.screenSpacePosition = mul(g_MVP, localSpacePosition);
+#endif
+
+#if !defined(GLSL_COMPILER)
+ vout.params.worldSpacePosition = mul(modelMatrix, localSpacePosition).xyz;
+ vout.params.worldSpaceNormal = normalize(mul(modelMatrix, float4(localSpaceNormal, 0)).xyz);
+ vout.params.worldSpaceTangent = normalize(mul(modelMatrix, float4(localSpaceTangent.xyz, 0)).xyz);
+ vout.params.worldSpaceBinormal = cross(vout.params.worldSpaceNormal, vout.params.worldSpaceTangent) * localSpaceTangent.w;
+#else
+ vout.params.worldSpacePosition = mul(g_modelMatrix, localSpacePosition).xyz;
+ vout.params.worldSpaceNormal = float4(0,1,0,0);
+#endif
+#if RENDERER_INSTANCED
+ vout.params.texcoord0 = vertexTexcoord0 + float4(instanceUVOffset, 0, 0);
+#else
+ vout.params.texcoord0 = vertexTexcoord0;
+#endif
+#if !defined(GLSL_COMPILER)
+ vout.params.texcoord1 = vertexTexcoord1;
+ vout.params.texcoord2 = vertexTexcoord2;
+#if !defined (RENDERER_WIN8ARM)
+ vout.params.texcoord3 = vertexTexcoord3;
+#endif
+#endif
+ vout.params.color = vertexColor;
+
+#if RENDERER_DISPLACED
+ vout.localPosition = localSpacePosition;
+#if RENDERER_INSTANCED
+ vout.localPosition += instanceLocalOffset;
+#endif
+ vout.flagsDisp = vertexFlagsDisp;
+ vout.modelMatrix[0] = modelMatrix[0];
+ vout.modelMatrix[1] = modelMatrix[1];
+ vout.modelMatrix[2] = modelMatrix[2];
+ vout.modelMatrix[3] = modelMatrix[3];
+#endif
+
+ return vout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/staticmesh.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/staticmesh.cg
new file mode 100644
index 00000000..f5760f2c
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/staticmesh.cg
@@ -0,0 +1,82 @@
+
+#include <config.cg>
+#include <globals.cg>
+#include <tessellation.cg>
+
+VertexOut vmain(__in(float4, localSpacePosition, POSITION)
+ __in_opt(float3, localSpaceNormal, NORMAL)
+ __in_opt(float4, localSpaceTangent, SEMANTIC_TANGENT)
+ __in_opt(float4, vertexTexcoord0, TEXCOORD0)
+ __in_opt(float4, vertexTexcoord1, TEXCOORD1)
+ __in_opt(float4, vertexTexcoord2, TEXCOORD2)
+ __in_opt(float4, vertexTexcoord3, TEXCOORD3)
+ __in_opt(half4, vertexColor, COLOR)
+ #if RENDERER_INSTANCED
+ , __in(float3, instanceOffset, SEMANTIC_INSTANCE_T)
+ , __in(float3, instanceNormalX, SEMANTIC_INSTANCE_X)
+ , __in(float3, instanceNormalY, SEMANTIC_INSTANCE_Y)
+ , __in(float3, instanceNormalZ, SEMANTIC_INSTANCE_Z)
+ __in_opt(float2, instanceUVOffset, SEMANTIC_INSTANCE_UV)
+ __in_opt(float3, instanceLocalOffset, SEMANTIC_INSTANCE_LOCAL)
+ #endif
+ #if RENDERER_DISPLACED
+ __in_opt(uint, vertexFlagsDisp, SEMANTIC_DISPLACEMENT_FLAGS)
+ #endif
+ )
+{
+ VertexOut vout;
+
+#if !defined(GLSL_COMPILER)
+ float4x4 modelMatrix;
+#if RENDERER_INSTANCED
+ modelMatrix = mul(g_modelMatrix, transpose(float4x4(float4(instanceNormalX, 0), float4(instanceNormalY, 0), float4(instanceNormalZ, 0), float4(instanceOffset, 1))));
+#else
+ modelMatrix = g_modelMatrix;
+#endif
+#endif
+
+#if !defined(GLSL_COMPILER)
+ float4x4 mvm = mul(g_viewMatrix, modelMatrix);
+ float4x4 mvpm = mul(g_projMatrix, mvm);
+ vout.screenSpacePosition = mul(mvpm, localSpacePosition);
+#else
+ vout.screenSpacePosition = mul(g_MVP, localSpacePosition);
+#endif
+
+#if !defined(GLSL_COMPILER)
+ vout.params.worldSpacePosition = mul(modelMatrix, localSpacePosition).xyz;
+ vout.params.worldSpaceNormal = normalize(mul(modelMatrix, float4(localSpaceNormal, 0)).xyz);
+ vout.params.worldSpaceTangent = normalize(mul(modelMatrix, float4(localSpaceTangent.xyz, 0)).xyz);
+ vout.params.worldSpaceBinormal = cross(vout.params.worldSpaceNormal, vout.params.worldSpaceTangent) * localSpaceTangent.w;
+#else
+ vout.params.worldSpacePosition = mul(g_modelMatrix, localSpacePosition).xyz;
+ vout.params.worldSpaceNormal = normalize(mul(g_modelMatrix, float4(localSpaceNormal, 0)).xyz);
+#endif
+#if RENDERER_INSTANCED
+ vout.params.texcoord0 = vertexTexcoord0 + float4(instanceUVOffset, 0, 0);
+#else
+ vout.params.texcoord0 = vertexTexcoord0;
+#endif
+#if !defined(GLSL_COMPILER)
+ vout.params.texcoord1 = vertexTexcoord1;
+ vout.params.texcoord2 = vertexTexcoord2;
+#if !defined (RENDERER_WIN8ARM)
+ vout.params.texcoord3 = vertexTexcoord3;
+#endif
+#endif
+ vout.params.color = swizzle(vertexColor);
+
+#if RENDERER_DISPLACED
+ vout.localPosition = localSpacePosition;
+#if RENDERER_INSTANCED
+ vout.localPosition += instanceLocalOffset;
+#endif
+ vout.flagsDisp = vertexFlagsDisp;
+ vout.modelMatrix[0] = modelMatrix[0];
+ vout.modelMatrix[1] = modelMatrix[1];
+ vout.modelMatrix[2] = modelMatrix[2];
+ vout.modelMatrix[3] = modelMatrix[3];
+#endif
+
+ return vout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/staticmesh_lightmap.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/staticmesh_lightmap.cg
new file mode 100644
index 00000000..f0069fbc
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/staticmesh_lightmap.cg
@@ -0,0 +1,83 @@
+
+#include <config.cg>
+#include <globals.cg>
+#include <tessellation.cg>
+
+VertexOut vmain(__in(float4, localSpacePosition, POSITION)
+ __in_opt(float3, localSpaceNormal, NORMAL)
+ __in_opt(float4, localSpaceTangent, SEMANTIC_TANGENT)
+ __in_opt(float4, vertexTexcoord0, TEXCOORD0)
+ __in_opt(float4, vertexTexcoord1, TEXCOORD1)
+ __in_opt(float4, vertexTexcoord2, TEXCOORD2)
+ __in_opt(float4, vertexTexcoord3, TEXCOORD3)
+ __in_opt(half4, vertexColor, COLOR)
+ #if RENDERER_INSTANCED
+ , __in(float3, instanceOffset, SEMANTIC_INSTANCE_T)
+ , __in(float3, instanceNormalX, SEMANTIC_INSTANCE_X)
+ , __in(float3, instanceNormalY, SEMANTIC_INSTANCE_Y)
+ , __in(float3, instanceNormalZ, SEMANTIC_INSTANCE_Z)
+ __in_opt(float2, instanceUVOffset, SEMANTIC_INSTANCE_UV)
+ __in_opt(float3, instanceLocalOffset, SEMANTIC_INSTANCE_LOCAL)
+ #endif
+ #if RENDERER_DISPLACED
+ __in_opt(uint, vertexFlagsDisp, SEMANTIC_DISPLACEMENT_FLAGS)
+ #endif
+ )
+{
+ VertexOut vout;
+
+#if !defined(GLSL_COMPILER)
+ float4x4 modelMatrix;
+#if RENDERER_INSTANCED
+ modelMatrix = mul(g_modelMatrix, transpose(float4x4(float4(instanceNormalX, 0), float4(instanceNormalY, 0), float4(instanceNormalZ, 0), float4(instanceOffset, 1))));
+#else
+ modelMatrix = g_modelMatrix;
+#endif
+#endif
+
+#if !defined(GLSL_COMPILER)
+ float4x4 mvm = mul(g_viewMatrix, modelMatrix);
+ float4x4 mvpm = mul(g_projMatrix, mvm);
+ vout.screenSpacePosition = mul(mvpm, localSpacePosition);
+#else
+ vout.screenSpacePosition = mul(g_MVP, localSpacePosition);
+#endif
+
+#if !defined(GLSL_COMPILER)
+ vout.params.worldSpacePosition = mul(modelMatrix, localSpacePosition).xyz;
+ vout.params.worldSpaceNormal = float4(0,1,0,0); //normalize(mul(modelMatrix, float4(localSpaceNormal, 0)).xyz);
+ vout.params.worldSpaceTangent = normalize(mul(modelMatrix, float4(localSpaceTangent.xyz, 0)).xyz);
+ vout.params.worldSpaceBinormal = cross(vout.params.worldSpaceNormal, vout.params.worldSpaceTangent) * localSpaceTangent.w;
+#else
+ vout.params.worldSpacePosition = mul(g_modelMatrix, localSpacePosition).xyz;
+ vout.params.worldSpaceNormal = float4(0,1,0,0); //normalize(mul(g_modelMatrix, float4(localSpaceNormal, 0)).xyz);
+#endif
+#if RENDERER_INSTANCED
+ vout.params.texcoord0 = vertexTexcoord0 + float4(instanceUVOffset, 0, 0);
+#else
+ vout.params.texcoord0 = vertexTexcoord0;
+ vout.params.texcoord1 = vertexTexcoord1;
+#endif
+#if !defined(GLSL_COMPILER)
+ vout.params.texcoord1 = vertexTexcoord1;
+ vout.params.texcoord2 = vertexTexcoord2;
+#if !defined (RENDERER_WIN8ARM)
+ vout.params.texcoord3 = vertexTexcoord3;
+#endif
+#endif
+ vout.params.color = vertexColor;
+
+#if RENDERER_DISPLACED
+ vout.localPosition = localSpacePosition;
+#if RENDERER_INSTANCED
+ vout.localPosition += instanceLocalOffset;
+#endif
+ vout.flagsDisp = vertexFlagsDisp;
+ vout.modelMatrix[0] = modelMatrix[0];
+ vout.modelMatrix[1] = modelMatrix[1];
+ vout.modelMatrix[2] = modelMatrix[2];
+ vout.modelMatrix[3] = modelMatrix[3];
+#endif
+
+ return vout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/staticmesh_simple.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/staticmesh_simple.cg
new file mode 100644
index 00000000..e0ee8778
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/staticmesh_simple.cg
@@ -0,0 +1,70 @@
+
+#include <config.cg>
+#include <globals.cg>
+#include <tessellation.cg>
+
+VertexOut vmain(__in(float4, localSpacePosition, POSITION)
+ __in_opt(float3, localSpaceNormal, NORMAL)
+ __in_opt(float4, localSpaceTangent, SEMANTIC_TANGENT)
+ __in_opt(float4, vertexTexcoord0, TEXCOORD0)
+ __in_opt(float4, vertexTexcoord1, TEXCOORD1)
+ __in_opt(float4, vertexTexcoord2, TEXCOORD2)
+ __in_opt(float4, vertexTexcoord3, TEXCOORD3)
+ __in_opt(half4, vertexColor, COLOR)
+ #if RENDERER_INSTANCED
+ , __in(float4, instanceTCol0, SEMANTIC_INSTANCE_T)
+ , __in(float4, instanceTCol1, SEMANTIC_INSTANCE_X)
+ , __in(float4, instanceTCol2, SEMANTIC_INSTANCE_Y)
+ , __in(float4, instanceTCol3, SEMANTIC_INSTANCE_Z)
+ __in_opt(float2, instanceUVOffset, SEMANTIC_INSTANCE_UV)
+ __in_opt(float3, instanceLocalOffset, SEMANTIC_INSTANCE_LOCAL)
+ #endif
+ #if RENDERER_DISPLACED
+ __in_opt(uint, vertexFlagsDisp, SEMANTIC_DISPLACEMENT_FLAGS)
+ #endif
+ )
+{
+ VertexOut vout;
+
+ float4x4 modelMatrix;
+#if RENDERER_INSTANCED
+ modelMatrix = mul(g_modelMatrix, transpose(float4x4(instanceTCol0, instanceTCol1, instanceTCol2, instanceTCol3)));
+#else
+ modelMatrix = g_modelMatrix;
+#endif
+
+ float4x4 mvm = mul(g_viewMatrix, modelMatrix);
+ float4x4 mvpm = mul(g_projMatrix, mvm);
+ vout.screenSpacePosition = mul(mvpm, localSpacePosition);
+
+ vout.params.worldSpacePosition = mul(modelMatrix, localSpacePosition).xyz;
+ vout.params.worldSpaceNormal = normalize(mul(modelMatrix, float4(localSpaceNormal, 0)).xyz);
+ vout.params.worldSpaceTangent = normalize(mul(modelMatrix, float4(localSpaceTangent.xyz, 0)).xyz);
+ vout.params.worldSpaceBinormal = cross(vout.params.worldSpaceNormal, vout.params.worldSpaceTangent) * localSpaceTangent.w;
+
+#if RENDERER_INSTANCED
+ vout.params.texcoord0 = vertexTexcoord0 + float4(instanceUVOffset, 0, 0);
+#else
+ vout.params.texcoord0 = vertexTexcoord0;
+#endif
+ vout.params.texcoord1 = vertexTexcoord1;
+ vout.params.texcoord2 = vertexTexcoord2;
+#if !defined (RENDERER_WIN8ARM)
+ vout.params.texcoord3 = vertexTexcoord3;
+#endif
+ vout.params.color = vertexColor;
+
+#if RENDERER_DISPLACED
+ vout.localPosition = localSpacePosition;
+#if RENDERER_INSTANCED
+ vout.localPosition += instanceLocalOffset;
+#endif
+ vout.flagsDisp = vertexFlagsDisp;
+ vout.modelMatrix[0] = modelMatrix[0];
+ vout.modelMatrix[1] = modelMatrix[1];
+ vout.modelMatrix[2] = modelMatrix[2];
+ vout.modelMatrix[3] = modelMatrix[3];
+#endif
+
+ return vout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/staticmesh_spheremap.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/staticmesh_spheremap.cg
new file mode 100644
index 00000000..da4d5ab8
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/staticmesh_spheremap.cg
@@ -0,0 +1,99 @@
+
+#include <config.cg>
+#include <globals.cg>
+#include <tessellation.cg>
+
+VertexOut vmain(__in(float4, localSpacePosition, POSITION)
+ __in_opt(float3, localSpaceNormal, NORMAL)
+ __in_opt(float4, localSpaceTangent, SEMANTIC_TANGENT)
+ __in_opt(float4, vertexTexcoord0, TEXCOORD0)
+ __in_opt(float4, vertexTexcoord1, TEXCOORD1)
+ __in_opt(float4, vertexTexcoord2, TEXCOORD2)
+ __in_opt(float4, vertexTexcoord3, TEXCOORD3)
+ __in_opt(half4, vertexColor, COLOR)
+ #if RENDERER_INSTANCED
+ , __in(float3, instanceOffset, SEMANTIC_INSTANCE_T)
+ , __in(float3, instanceNormalX, SEMANTIC_INSTANCE_X)
+ , __in(float3, instanceNormalY, SEMANTIC_INSTANCE_Y)
+ , __in(float3, instanceNormalZ, SEMANTIC_INSTANCE_Z)
+ __in_opt(float2, instanceUVOffset, SEMANTIC_INSTANCE_UV)
+ __in_opt(float3, instanceLocalOffset, SEMANTIC_INSTANCE_LOCAL)
+ #endif
+ #if RENDERER_DISPLACED
+ __in_opt(uint, vertexFlagsDisp, SEMANTIC_DISPLACEMENT_FLAGS)
+ #endif
+ )
+{
+ VertexOut vout;
+
+ vout.screenSpacePosition = 0;
+ vout.params.worldSpacePosition = 0;
+ vout.params.worldSpaceNormal = 0;
+ vout.params.worldSpaceTangent = 0;
+ vout.params.worldSpaceBinormal = 0;
+ vout.params.texcoord0 = 0;
+ vout.params.texcoord1 = 0;
+ vout.params.texcoord2 = 0;
+#if !defined (RENDERER_WIN8ARM)
+ vout.params.texcoord3 = 0;
+#endif
+ vout.params.color = 0;
+
+//#if !defined(GLSL_COMPILER)
+ float4x4 modelMatrix;
+#if RENDERER_INSTANCED
+ modelMatrix = mul(g_modelMatrix, transpose(float4x4(float4(instanceNormalX, 0), float4(instanceNormalY, 0), float4(instanceNormalZ, 0), float4(instanceOffset, 1))));
+#else
+ modelMatrix = g_modelMatrix;
+#endif
+//#endif
+
+ float4x4 mvm = mul(g_viewMatrix, modelMatrix);
+#if !defined(GLSL_COMPILER)
+ float4x4 mvpm = mul(g_projMatrix, mvm);
+ vout.screenSpacePosition = mul(mvpm, localSpacePosition);
+#else
+ vout.screenSpacePosition = mul(g_MVP, localSpacePosition);
+#endif
+
+#if !defined(GLSL_COMPILER)
+ vout.params.worldSpacePosition = mul(modelMatrix, localSpacePosition).xyz;
+ vout.params.worldSpaceNormal = normalize(mul(modelMatrix, float4(localSpaceNormal, 0)).xyz);
+ vout.params.worldSpaceTangent = normalize(mul(modelMatrix, float4(localSpaceTangent.xyz, 0)).xyz);
+ vout.params.worldSpaceBinormal = cross(vout.params.worldSpaceNormal, vout.params.worldSpaceTangent) * localSpaceTangent.w;
+#else
+ vout.params.worldSpacePosition = mul(g_modelMatrix, localSpacePosition).xyz;
+ vout.params.worldSpaceNormal = normalize(mul(g_modelMatrix, float4(localSpaceNormal, 0)).xyz);
+#endif
+#if RENDERER_INSTANCED
+ vout.params.texcoord0 = vertexTexcoord0 + float4(instanceUVOffset, 0, 0);
+#else
+ vout.params.texcoord0 = vertexTexcoord0;
+ float4 v = normalize(mul(mvm, localSpacePosition));
+ float4 n = normalize(mul(mvm, float4(localSpaceNormal, 0)));
+ float3 r = reflect(v.xyz, n.xyz);
+ float m = sqrt(2 * (r.z + 1));
+ vout.params.texcoord1 = float4(r.x/m + 0.5, r.y/m + 0.5, 0.0, 0.0) * 0.5;
+#endif
+#if !defined(GLSL_COMPILER)
+ vout.params.texcoord2 = vertexTexcoord2;
+#if !defined (RENDERER_WIN8ARM)
+ vout.params.texcoord3 = vertexTexcoord3;
+#endif
+#endif
+ vout.params.color = swizzle(vertexColor);
+
+#if RENDERER_DISPLACED
+ vout.localPosition = localSpacePosition;
+#if RENDERER_INSTANCED
+ vout.localPosition += instanceLocalOffset;
+#endif
+ vout.flagsDisp = vertexFlagsDisp;
+ vout.modelMatrix[0] = modelMatrix[0];
+ vout.modelMatrix[1] = modelMatrix[1];
+ vout.modelMatrix[2] = modelMatrix[2];
+ vout.modelMatrix[3] = modelMatrix[3];
+#endif
+
+ return vout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/tablet_buttons.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/tablet_buttons.cg
new file mode 100644
index 00000000..dc2a908c
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/tablet_buttons.cg
@@ -0,0 +1,11 @@
+struct VertexOut
+{
+ float4 screenSpacePosition : POSITION;
+};
+
+VertexOut vmain(float4 localSpacePosition : POSITION)
+{
+ VertexOut vout;
+ vout.screenSpacePosition = localSpacePosition;
+ return vout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/tablet_sticks.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/tablet_sticks.cg
new file mode 100644
index 00000000..947af4c0
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/tablet_sticks.cg
@@ -0,0 +1,28 @@
+// Parameters passed from the vertex shader to the fragment shader.
+struct FragmentParameters
+{
+ float4 worldSpacePosition : TEXCOORD4;
+ float2 texcoord0 : TEXCOORD0;
+ half4 color : COLOR;
+};
+
+#include <globals.cg>
+
+struct VertexOut
+{
+ FragmentParameters params;
+ float4 screenSpacePosition : POSITION;
+};
+
+VertexOut vmain(__in(float4, localSpacePosition, POSITION)
+ __in_opt(half4, vertexColor, COLOR)
+ __in_opt(float4, texcoord0, TEXCOORD0))
+{
+ VertexOut vout;
+
+ vout.screenSpacePosition = localSpacePosition + g_modelMatrix[0];
+ vout.params.worldSpacePosition = localSpacePosition;
+ vout.params.texcoord0 = texcoord0.xy;
+ vout.params.color = vertexColor;
+ return vout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/text.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/text.cg
new file mode 100644
index 00000000..2c6db76d
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/text.cg
@@ -0,0 +1,35 @@
+// Parameters passed from the vertex shader to the fragment shader.
+struct TextFragmentParameters
+{
+ float4 worldSpacePosition : TEXCOORD4;
+ float2 texcoord0 : TEXCOORD0;
+ half4 color : COLOR;
+};
+
+#include <config.cg>
+#include <globals.cg>
+
+struct VertexOut
+{
+ TextFragmentParameters params;
+ float4 screenSpacePosition : POSITION;
+};
+
+VertexOut vmain(__in(float4, localSpacePosition, POSITION)
+ __in_opt(half4, vertexColor, COLOR)
+ __in_opt(float3, localSpaceNormal, NORMAL)
+ __in_opt(float4, localSpaceTangent, SEMANTIC_TANGENT)
+ __in_opt(float4, vertexTexcoord0, TEXCOORD0)
+ __in_opt(float4, vertexTexcoord1, TEXCOORD1)
+ __in_opt(float4, vertexTexcoord2, TEXCOORD2)
+ __in_opt(float4, vertexTexcoord3, TEXCOORD3))
+{
+ VertexOut vout;
+ vout.screenSpacePosition = float4(mul(g_viewMatrix2D, float4(localSpacePosition.xyz,1)).xyz, localSpacePosition.w);
+ vout.params.worldSpacePosition = vout.screenSpacePosition;
+ vout.params.texcoord0 = vertexTexcoord0.xy;
+ vout.params.color = vertexColor;
+
+ return vout;
+}
+
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/turbulencesprites.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/turbulencesprites.cg
new file mode 100644
index 00000000..ac39e0ff
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/vertex/turbulencesprites.cg
@@ -0,0 +1,72 @@
+
+#include <config.cg>
+#include <globals.cg>
+
+struct VertexOut
+{
+ FragmentParameters params;
+ float4 screenSpacePosition : POSITION;
+};
+
+VertexOut vmain(__in(float4, localSpacePosition, POSITION)
+ __in_opt(half4, vertexColor, COLOR)
+ __in_opt(float3, localSpaceNormal, NORMAL)
+ __in_opt(float4, localSpaceTangent, SEMANTIC_TANGENT)
+ __in_opt(float4, vertexTexcoord0, TEXCOORD0)
+ __in_opt(float4, vertexTexcoord1, TEXCOORD1)
+ __in_opt(float4, vertexTexcoord2, TEXCOORD2)
+ __in_opt(float4, vertexTexcoord3, TEXCOORD3)
+ , __in(float3, instancePosition, TEXCOORD8)
+ , __in(float4, instanceVelocity, TEXCOORD9)
+ )
+{
+ VertexOut vout;
+
+ float4x4 modelMatrix = g_modelMatrix;
+/*
+#if RENDERER_INSTANCED
+ modelMatrix = transpose(float4x4(float4(instanceNormalX, 0), float4(instanceNormalY, 0), float4(instanceNormalZ, 0), float4(instanceOffset, 1)));
+#else
+ modelMatrix = g_modelMatrix;
+#endif*/
+
+ float4 worldSpacePos = float4(0.05,0.05,0.05,1)*localSpacePosition.xyzw;//mul( modelMatrix, localSpacePosition);
+
+ worldSpacePos.xyz += instancePosition.xyz;
+
+
+ float4x4 vpm = mul(g_projMatrix, g_viewMatrix);
+ vout.screenSpacePosition = mul(vpm, worldSpacePos);
+
+ vout.params.worldSpacePosition = mul(modelMatrix, localSpacePosition).xyz;
+ vout.params.worldSpaceNormal = normalize(mul(modelMatrix, float4(localSpaceNormal, 0)).xyz);
+ vout.params.worldSpaceTangent = normalize(mul(modelMatrix, float4(localSpaceTangent.xyz, 0)).xyz);
+ vout.params.worldSpaceBinormal = cross(vout.params.worldSpaceNormal, vout.params.worldSpaceTangent) * localSpaceTangent.w;
+
+ vout.params.texcoord0 = vertexTexcoord0;
+ vout.params.texcoord1 = vertexTexcoord1;
+ vout.params.texcoord2 = vertexTexcoord2;
+#if !defined (RENDERER_WIN8ARM)
+ vout.params.texcoord3 = vertexTexcoord3;
+#endif
+
+/*
+ vout.params.color.xyz = saturate((instanceVelocity.xyz / float3(6,6,6)) + float3(1,1,1));
+ vout.params.color.w = 1;
+
+ if(instanceVelocity.w > 0.75)
+ vout.params.color *= float4(1,0,0,1);
+ else if(instanceVelocity.w > 0.5)
+ vout.params.color *= float4(1,0,1,1);
+ else if(instanceVelocity.w > 0.25)
+ vout.params.color *= float4(0,1,1,1);
+ else
+ vout.params.color *= float4(0,0,1,1);
+
+*/
+ //simpler colors for debugging
+ vout.params.color.xyz = float3(1*instanceVelocity.w,0,0);
+ vout.params.color.w = 1;
+
+ return vout;
+}
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/BrickInt_d.tga b/PhysX_3.4/Media/SampleRenderer/4/textures/BrickInt_d.tga
new file mode 100644
index 00000000..99700019
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/BrickInt_d.tga
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/Brick_Cracked_d.tga b/PhysX_3.4/Media/SampleRenderer/4/textures/Brick_Cracked_d.tga
new file mode 100644
index 00000000..24f3b1e5
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/Brick_Cracked_d.tga
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/GTC_Wall_D.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/GTC_Wall_D.dds
new file mode 100644
index 00000000..eae20cc3
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/GTC_Wall_D.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/GTC_Wall_N.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/GTC_Wall_N.dds
new file mode 100644
index 00000000..95d4869d
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/GTC_Wall_N.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/GrayRock_Tileable_D.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/GrayRock_Tileable_D.dds
new file mode 100644
index 00000000..7fd5d2ae
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/GrayRock_Tileable_D.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/GrayRock_Tileable_N.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/GrayRock_Tileable_N.dds
new file mode 100644
index 00000000..83a15cab
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/GrayRock_Tileable_N.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/Moai_d.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/Moai_d.dds
new file mode 100644
index 00000000..8a3748c8
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/Moai_d.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/Moai_i.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/Moai_i.dds
new file mode 100644
index 00000000..ebabd027
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/Moai_i.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/MoistConcrete01D.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/MoistConcrete01D.dds
new file mode 100644
index 00000000..2c4cc906
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/MoistConcrete01D.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/MoistConcrete01N.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/MoistConcrete01N.dds
new file mode 100644
index 00000000..b188eb49
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/MoistConcrete01N.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/OldPineWoodD.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/OldPineWoodD.dds
new file mode 100644
index 00000000..a64c8a1b
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/OldPineWoodD.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/OldPineWoodN.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/OldPineWoodN.dds
new file mode 100644
index 00000000..79eea919
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/OldPineWoodN.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/Plaster_Tileable.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/Plaster_Tileable.dds
new file mode 100644
index 00000000..dc252c71
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/Plaster_Tileable.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/SoftParticle.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/SoftParticle.dds
new file mode 100644
index 00000000..ee4340f3
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/SoftParticle.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/TileWall.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/TileWall.dds
new file mode 100644
index 00000000..3f9c9657
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/TileWall.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/Wood_Tileable.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/Wood_Tileable.dds
new file mode 100644
index 00000000..5d1c1b75
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/Wood_Tileable.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/billboard_sphere_normals.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/billboard_sphere_normals.dds
new file mode 100644
index 00000000..806d6611
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/billboard_sphere_normals.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/control.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/control.dds
new file mode 100644
index 00000000..9f500a69
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/control.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/debug_pattern.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/debug_pattern.dds
new file mode 100644
index 00000000..e03ba758
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/debug_pattern.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/gravel_diffuse.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/gravel_diffuse.dds
new file mode 100644
index 00000000..873292e9
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/gravel_diffuse.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/grid.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/grid.dds
new file mode 100644
index 00000000..f9ffc1e9
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/grid.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/grid_bordered.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/grid_bordered.dds
new file mode 100644
index 00000000..5bc324f4
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/grid_bordered.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/knit_1d.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/knit_1d.dds
new file mode 100644
index 00000000..3747842e
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/knit_1d.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/knit_1n.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/knit_1n.dds
new file mode 100644
index 00000000..d456f5d4
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/knit_1n.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/mouse.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/mouse.dds
new file mode 100644
index 00000000..5884ee47
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/mouse.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/particles_heightmap_lightmap.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/particles_heightmap_lightmap.dds
new file mode 100644
index 00000000..df33dadf
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/particles_heightmap_lightmap.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/rock_diffuse.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/rock_diffuse.dds
new file mode 100644
index 00000000..7c5028ad
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/rock_diffuse.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/shortGrass_diffuse.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/shortGrass_diffuse.dds
new file mode 100644
index 00000000..32e5c927
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/shortGrass_diffuse.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/smoke.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/smoke.dds
new file mode 100644
index 00000000..58a0791d
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/smoke.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/steak.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/steak.dds
new file mode 100644
index 00000000..bb03dc44
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/steak.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/test.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/test.dds
new file mode 100644
index 00000000..515ec898
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/test.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/ui_knob_dxt3.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/ui_knob_dxt3.dds
new file mode 100644
index 00000000..9d8a7fc1
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/ui_knob_dxt3.dds
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/ui_knob_dxt3.tga b/PhysX_3.4/Media/SampleRenderer/4/textures/ui_knob_dxt3.tga
new file mode 100644
index 00000000..4f9876af
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/ui_knob_dxt3.tga
Binary files differ
diff --git a/PhysX_3.4/Media/SampleRenderer/4/textures/water.dds b/PhysX_3.4/Media/SampleRenderer/4/textures/water.dds
new file mode 100644
index 00000000..c84a4a27
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/textures/water.dds
Binary files differ