aboutsummaryrefslogtreecommitdiff
path: root/KaplaDemo/externalIP/resources
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 /KaplaDemo/externalIP/resources
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 'KaplaDemo/externalIP/resources')
-rw-r--r--KaplaDemo/externalIP/resources/AABox.cgfx141
-rw-r--r--KaplaDemo/externalIP/resources/asteroid.obj2236
-rw-r--r--KaplaDemo/externalIP/resources/bullet.obj763
-rw-r--r--KaplaDemo/externalIP/resources/car02_diffuse.bmpbin0 -> 1572918 bytes
-rw-r--r--KaplaDemo/externalIP/resources/car2.rawbin0 -> 138615 bytes
-rw-r--r--KaplaDemo/externalIP/resources/car_window_diffuse.bmpbin0 -> 5862 bytes
-rw-r--r--KaplaDemo/externalIP/resources/checker_tex0.jpgbin0 -> 19401 bytes
-rw-r--r--KaplaDemo/externalIP/resources/checker_tex1.jpgbin0 -> 11305 bytes
-rw-r--r--KaplaDemo/externalIP/resources/checker_tex2.jpgbin0 -> 15839 bytes
-rw-r--r--KaplaDemo/externalIP/resources/checker_tex3.jpgbin0 -> 15028 bytes
-rw-r--r--KaplaDemo/externalIP/resources/checker_tex4.jpgbin0 -> 13040 bytes
-rw-r--r--KaplaDemo/externalIP/resources/crosshair.bmpbin0 -> 784440 bytes
-rw-r--r--KaplaDemo/externalIP/resources/fxaa.fs1416
-rw-r--r--KaplaDemo/externalIP/resources/fxaa.vs6
-rw-r--r--KaplaDemo/externalIP/resources/shaders/bloomH_fs.cpp24
-rw-r--r--KaplaDemo/externalIP/resources/shaders/bloomV_fs.cpp30
-rw-r--r--KaplaDemo/externalIP/resources/shaders/combine_fs.cpp529
-rw-r--r--KaplaDemo/externalIP/resources/shaders/combine_vs.cpp79
-rw-r--r--KaplaDemo/externalIP/resources/shaders/debris_fs.cpp309
-rw-r--r--KaplaDemo/externalIP/resources/shaders/debris_vs.cpp44
-rw-r--r--KaplaDemo/externalIP/resources/shaders/default_fs.cpp308
-rw-r--r--KaplaDemo/externalIP/resources/shaders/default_vs.cpp13
-rw-r--r--KaplaDemo/externalIP/resources/shaders/dof_fs.cpp38
-rw-r--r--KaplaDemo/externalIP/resources/shaders/dof_vs.cpp5
-rw-r--r--KaplaDemo/externalIP/resources/shaders/dust_fs.cpp123
-rw-r--r--KaplaDemo/externalIP/resources/shaders/dust_gs.cpp116
-rw-r--r--KaplaDemo/externalIP/resources/shaders/dust_vs.cpp19
-rw-r--r--KaplaDemo/externalIP/resources/shaders/filterh_fs.cpp15
-rw-r--r--KaplaDemo/externalIP/resources/shaders/filterv_fs.cpp17
-rw-r--r--KaplaDemo/externalIP/resources/shaders/filterv_vs.cpp5
-rw-r--r--KaplaDemo/externalIP/resources/shaders/passthrough_vs.cpp7
-rw-r--r--KaplaDemo/externalIP/resources/shaders/scene_fs.cpp313
-rw-r--r--KaplaDemo/externalIP/resources/shaders/scene_vs.cpp79
-rw-r--r--KaplaDemo/externalIP/resources/shaders/shadowdebug_fs.cpp8
-rw-r--r--KaplaDemo/externalIP/resources/ssao.fs45
-rw-r--r--KaplaDemo/externalIP/resources/ssao.vs7
-rw-r--r--KaplaDemo/externalIP/resources/stoneBump.bmpbin0 -> 12582966 bytes
-rw-r--r--KaplaDemo/externalIP/resources/stoneBump.jpgbin0 -> 1455360 bytes
-rw-r--r--KaplaDemo/externalIP/resources/terrain_ll2.bmpbin0 -> 12794 bytes
39 files changed, 6695 insertions, 0 deletions
diff --git a/KaplaDemo/externalIP/resources/AABox.cgfx b/KaplaDemo/externalIP/resources/AABox.cgfx
new file mode 100644
index 00000000..abff4091
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/AABox.cgfx
@@ -0,0 +1,141 @@
+//--------------------------------------------------------------------------------------
+// FroggyAA
+// Author: Tristan Lorach
+//
+// Implementation of different downsampling methods for supersampled AA
+//
+// Copyright (c) NVIDIA Corporation. All rights reserved.
+//--------------------------------------------------------------------------------------
+float2 SSTexelSize;
+float blendFactor = 1.0;
+sampler2D SSsampler = sampler_state
+{
+ minFilter = Linear;
+ magFilter = Linear;
+};
+sampler2D DepthSSsampler = sampler_state
+{
+ minFilter = Linear;
+ magFilter = Linear;
+};
+
+struct v2fConnector {
+ float4 projCoord : POSITION;
+ float2 tex : TEXCOORD0;
+};
+///////////////////////////////////////////////////////////////////////
+// Vertex programs
+///////////////////////////////////////////////////////////////////////
+void vpPassThrough(float4 P : POSITION, float4 tc : TEXCOORD0, out v2fConnector v2f)
+{
+ v2f.tex = tc.xy;
+ v2f.projCoord = P;
+}
+struct PixelOut
+{
+float4 color : COLOR;
+float depth : DEPTH;
+};
+///////////////////////////////////////////////////////////////////////
+// Fragment programs
+///////////////////////////////////////////////////////////////////////
+//
+// Simple down samling : just using the fact we are in between 4 texels.
+// so the HW will do a bilinear filtering of these 4 samples
+//
+PixelOut DownSample1( float2 tc : TEXCOORD0 )
+{
+ PixelOut pix;
+ pix.color = f4tex2D(SSsampler, tc);
+ pix.depth = f4tex2D(DepthSSsampler, tc).r;
+ return pix;
+}
+//
+// add 4 fetches around the original filtered one
+// each of the 4 additional fetches will also benefit from the HW bilinear filtering
+// the offsets are chosen to benefit from various texels in a specific % amout
+//
+PixelOut DownSample2( float2 tc : TEXCOORD0 )
+{
+ float4 tap0 = f4tex2D(SSsampler, tc);
+ float4 tap1 = f4tex2D(SSsampler, tc + SSTexelSize * float2( 0.4, 0.9 ));
+ float4 tap2 = f4tex2D(SSsampler, tc + SSTexelSize * float2( -0.4, -0.9 ));
+ float4 tap3 = f4tex2D(SSsampler, tc + SSTexelSize * float2( -0.9, 0.4 ));
+ float4 tap4 = f4tex2D(SSsampler, tc + SSTexelSize * float2( 0.9, -0.4 ));
+ float4 color = 0.2 * ( tap0 + tap1 + tap2 + tap3 + tap4 );
+
+ float tap0d = f4tex2D(DepthSSsampler, tc).r;
+ float tap1d = f4tex2D(DepthSSsampler, tc + SSTexelSize * float2( 0.4, 0.9 )).r;
+ float tap2d = f4tex2D(DepthSSsampler, tc + SSTexelSize * float2( -0.4, -0.9 )).r;
+ float tap3d = f4tex2D(DepthSSsampler, tc + SSTexelSize * float2( -0.9, 0.4 )).r;
+ float tap4d = f4tex2D(DepthSSsampler, tc + SSTexelSize * float2( 0.9, -0.4 )).r;
+ float depth = 0.2 * ( tap0d + tap1d + tap2d + tap3d + tap4d );
+
+ PixelOut pix;
+ pix.color = color;
+ pix.depth = depth;
+ return pix;
+}
+//
+// same process are the previous one
+// but we are using 2 kernels : one 'normal', one bigger (more blurry, then)
+// we will lerp from one to the other depending on downsampled alpha from the bigger kernel
+// this technique is good to blur 'high frequencies' marked by alpha =0,
+// i.e thin primitives, like lines or sharp triangles
+//
+float4 DownSample3( float2 tc : TEXCOORD0 ) : COLOR
+{
+ float4 color;
+
+ float4 tap0 = f4tex2D(SSsampler, tc);
+ float4 tap1 = f4tex2D(SSsampler, tc + SSTexelSize * float2( 0.4, 0.9 ));
+ float4 tap2 = f4tex2D(SSsampler, tc + SSTexelSize * float2( -0.4, -0.9 ));
+ float4 tap3 = f4tex2D(SSsampler, tc + SSTexelSize * float2( -0.9, 0.4 ));
+ float4 tap4 = f4tex2D(SSsampler, tc + SSTexelSize * float2( 0.9, -0.4 ));
+ color = 0.2 * ( tap0 + tap1 + tap2 + tap3 + tap4 );
+
+ float4 tap11 = f4tex2D(SSsampler, tc + SSTexelSize * float2( 0.9, 1.9 ));
+ float4 tap21 = f4tex2D(SSsampler, tc + SSTexelSize * float2( -0.9, -1.9 ));
+ float4 tap31 = f4tex2D(SSsampler, tc + SSTexelSize * float2( -1.9, 0.9 ));
+ float4 tap41 = f4tex2D(SSsampler, tc + SSTexelSize * float2( 1.9, -0.9 ));
+ float4 color2 = 0.2 * ( tap0 + tap11 + tap21 + tap31 + tap41 );
+
+ float mask = saturate(color2.w * 1);
+
+ color = lerp(color2, color, mask);
+ color.w = mask;
+
+ return color;
+}
+///////////////////////////////////////////////////////////////////////
+// Technique
+///////////////////////////////////////////////////////////////////////
+technique DownSample_Filter1
+{
+ pass drawFinal
+ {
+ DepthMask = true;
+ VertexProgram = compile arbvp1 vpPassThrough();
+ FragmentProgram = compile arbfp1 DownSample1();
+ }
+}
+technique DownSample_Filter2
+{
+ pass drawFinal
+ {
+ DepthMask = true;
+ VertexProgram = compile arbvp1 vpPassThrough();
+ FragmentProgram = compile arbfp1 DownSample2();
+ }
+}
+technique DownSample_Filter3
+{
+ pass drawFinal
+ {
+ DepthMask = true;
+ VertexProgram = compile arbvp1 vpPassThrough();
+ FragmentProgram = compile arbfp1 DownSample3();
+ }
+}
+
diff --git a/KaplaDemo/externalIP/resources/asteroid.obj b/KaplaDemo/externalIP/resources/asteroid.obj
new file mode 100644
index 00000000..cff31f86
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/asteroid.obj
@@ -0,0 +1,2236 @@
+# This file uses centimeters as units for non-parametric coordinates.
+
+v -0.319303 1.542687 7.397171
+v -0.455343 1.240727 7.436292
+v -0.516743 1.028863 7.445961
+v -0.416778 0.840251 7.438751
+v -0.154176 0.724180 7.411850
+v 0.334475 0.851265 7.361535
+v 0.854462 0.762993 7.316207
+v 1.048567 0.871305 7.293532
+v 1.058206 1.083186 7.284529
+v 0.854238 1.398838 7.284582
+v 0.323946 1.676290 7.324881
+v -0.570537 1.822381 7.356237
+v -1.623979 1.156783 7.462399
+v -1.640090 0.676316 7.476856
+v -1.412446 0.196369 7.455980
+v -0.572259 0.008901 7.408447
+v 0.805721 -0.036233 7.294342
+v 1.553626 0.020255 7.205359
+v 1.956157 0.420973 7.147177
+v 2.045662 0.933893 7.109221
+v 1.342175 1.575914 7.132065
+v -0.214831 2.367496 7.206610
+v -2.268329 2.243077 7.285572
+v -2.713917 1.402857 7.420873
+v -2.879995 0.531741 7.441960
+v -2.224272 -0.302257 7.416895
+v -0.280511 -0.847953 7.350688
+v 1.838208 -0.856845 7.176638
+v 2.754066 -0.573917 7.048883
+v 3.252858 0.003618 6.910089
+v 2.992760 0.940323 6.890471
+v 2.124113 1.938128 6.879646
+v 0.257427 2.664556 7.027810
+v -3.196976 2.780891 7.112842
+v -4.054727 1.726835 7.290055
+v -4.166911 0.670446 7.312834
+v -2.837524 -0.557955 7.291377
+v -0.590749 -1.480292 7.232038
+v 2.458212 -1.686084 6.991306
+v 4.378138 -1.192632 6.764812
+v 4.395495 -0.337972 6.657344
+v 4.017042 0.677917 6.577227
+v 2.681272 2.225033 6.613452
+v 0.205221 3.063408 6.823822
+v -4.228168 3.311659 6.854616
+v -5.403286 1.783702 7.050764
+v -5.611637 0.435457 7.054611
+v -3.374226 -0.892213 7.079348
+v -0.558738 -2.294036 6.940917
+v 2.926320 -2.380327 6.704813
+v 5.087218 -1.899318 6.451934
+v 5.958481 -1.006319 6.251475
+v 4.880528 0.163454 6.184881
+v 3.428560 2.482064 6.262001
+v 0.063209 3.665803 6.431329
+v -5.682743 3.863676 6.312958
+v -7.940393 1.559520 6.483439
+v -7.480890 -0.011491 6.545866
+v -6.128960 -1.992928 6.297774
+v -0.796307 -3.869766 6.350908
+v 3.033933 -4.608002 6.109905
+v 6.633204 -3.446207 5.692555
+v 7.706705 -1.969386 5.566951
+v 7.516179 -0.212763 5.357749
+v 4.496758 2.610512 5.513031
+v -0.654280 4.294017 5.765809
+v -8.299522 4.446577 5.351573
+v -11.375997 1.498652 5.504262
+v -9.733858 -0.681374 5.592931
+v -7.093473 -2.953145 5.615898
+v -2.537750 -4.923698 5.505332
+v 4.011851 -5.465779 5.135563
+v 7.883404 -4.790975 4.723849
+v 10.127824 -2.582119 4.341844
+v 9.352375 0.565587 4.401020
+v 5.501850 3.109244 4.413002
+v 0.110759 5.925332 4.764900
+v -9.423215 4.608919 4.659973
+v -12.572678 1.519551 4.916750
+v -11.924177 -0.429017 4.858028
+v -8.967061 -3.759067 4.820078
+v -3.005555 -5.827108 4.785896
+v 4.326295 -6.236854 4.391485
+v 8.876166 -5.383577 4.040013
+v -7.181659 6.373308 4.015545
+v -12.459185 2.176975 4.237568
+v -12.472583 -1.125291 4.068940
+v -9.817089 -4.227540 4.103537
+v -3.466324 -6.447009 4.050061
+v 4.983455 -7.096900 3.666477
+v 9.459876 -5.671104 3.309923
+v 10.700139 -2.516519 3.357767
+v 10.031800 0.459293 3.422522
+v 6.621281 4.365079 3.417884
+v 0.674419 6.582580 3.855100
+v -7.057590 6.692204 3.268155
+v -14.068922 2.201576 3.324503
+v -13.351077 -1.404695 3.366679
+v -10.296273 -4.524979 3.299139
+v -3.931664 -6.973515 3.239551
+v 5.168059 -7.644479 2.871732
+v 10.046614 -5.886609 2.532424
+v 11.252737 -2.973328 2.325660
+v 11.156148 0.252880 2.310940
+v 7.585489 4.575149 2.440791
+v 0.897016 6.937832 2.763340
+v -7.810978 6.815167 2.404191
+v -15.313469 2.053084 2.525443
+v -14.663754 -1.733361 2.488458
+v -11.223948 -4.750947 2.485860
+v -4.459486 -7.332393 2.420825
+v 4.776386 -8.026788 2.060925
+v 10.440313 -5.693345 1.703403
+v 11.216475 -3.387187 1.410107
+v 11.518414 -0.246955 1.554302
+v 8.250774 4.608585 1.609943
+v 0.830268 7.229711 1.937057
+v -8.402431 6.760853 1.592491
+v -14.374209 4.088394 1.749174
+v -16.938610 1.035810 1.746773
+v -15.904042 -2.307098 1.698241
+v -12.266919 -5.370361 1.645340
+v -5.402384 -7.694290 1.572795
+v 4.571247 -8.120050 1.228703
+v 9.773275 -6.171491 0.912964
+v 11.567163 -3.297400 0.602991
+v 11.531031 -0.242221 0.719937
+v 8.457923 4.612051 0.810316
+v 1.228488 7.523926 1.139942
+v -8.323143 6.691499 0.800012
+v -14.595851 3.941416 0.983155
+v -17.842211 0.874651 0.929674
+v -16.914871 -2.276246 0.914844
+v -12.544004 -5.440275 0.834491
+v -5.095380 -8.114738 0.726949
+v 4.528258 -8.242763 0.387763
+v 9.441567 -6.298835 0.036444
+v 11.106531 -3.624890 -0.034691
+v 11.692580 -0.557448 0.013597
+v 8.604479 4.177203 0.025091
+v 1.302712 7.381373 0.357278
+v -8.596941 6.302134 0.005758
+v -14.587085 3.729707 0.154670
+v -18.112549 1.114275 0.277879
+v -17.685345 -2.235166 0.108008
+v -13.350951 -5.525181 0.035323
+v -5.189292 -8.243999 -0.108471
+v 3.477517 -8.460855 -0.449840
+v 8.795218 -6.307397 -0.687767
+v 10.834823 -4.496114 -0.878505
+v 11.910597 -0.701663 -0.853216
+v 8.554847 3.787838 -0.779219
+v 1.021209 7.231377 -0.416548
+v -9.062927 6.012346 -0.698523
+v -14.737053 3.328589 -0.487604
+v -17.677486 0.666418 -0.511147
+v -18.408545 -1.832004 -0.474409
+v -14.130617 -5.758317 -0.674948
+v -6.003664 -8.193963 -0.820748
+v 2.732772 -8.263533 -1.150419
+v 8.139124 -6.363388 -1.461569
+v 10.736252 -4.545691 -1.511707
+v 11.966234 -0.995547 -1.582974
+v 8.356233 3.575293 -1.440488
+v 0.812740 7.161748 -1.122139
+v -9.193140 5.785440 -1.396723
+v -14.541883 3.002282 -1.244233
+v -17.148952 0.705110 -1.119918
+v -17.778959 -1.749220 -1.389057
+v -13.824330 -5.563354 -1.340214
+v -5.832449 -8.100270 -1.591108
+v 2.839169 -7.999876 -1.923729
+v 7.843525 -6.487057 -2.138085
+v 10.676665 -4.230295 -2.267632
+v 11.287283 -0.960332 -2.245953
+v 8.015679 3.532104 -2.154556
+v 0.228931 6.843470 -1.827832
+v -8.645967 5.606151 -2.318744
+v -13.656124 3.140221 -2.136266
+v -17.372313 0.040400 -2.203428
+v -16.238409 -2.147388 -2.084387
+v -13.031884 -5.153112 -2.342873
+v -5.330581 -7.799473 -2.445705
+v -2.244305 -8.397593 -2.976551
+v 3.041107 -7.594919 -2.901855
+v 8.368953 -5.722555 -3.198699
+v 10.265712 -3.861784 -3.175769
+v 10.298469 -0.468208 -3.294497
+v 7.982400 3.645728 -3.093250
+v -0.123104 6.723987 -2.746914
+v -11.964279 3.402108 -3.185901
+v -15.748495 0.578799 -3.229821
+v -14.967291 -1.979946 -3.143626
+v -10.984555 -4.508185 -3.312130
+v -6.792769 -6.373470 -3.558586
+v -1.531698 -7.759305 -3.769525
+v 3.869597 -7.399342 -3.997521
+v 8.020264 -5.007672 -4.137931
+v 9.792893 -2.998206 -4.227374
+v 9.820803 -0.165720 -4.181844
+v 8.048083 3.733921 -4.089506
+v 2.968808 6.157855 -3.878192
+v -5.945659 5.521102 -3.369118
+v -11.020019 3.034660 -4.120945
+v -14.437797 0.544995 -4.213166
+v -13.466816 -1.886707 -4.037323
+v -10.217655 -3.948634 -4.324700
+v -6.458300 -5.736298 -4.399187
+v -1.675883 -7.045105 -4.635405
+v 3.000010 -6.982284 -5.108957
+v 7.472322 -4.692624 -5.199863
+v 9.120305 -2.283749 -5.191432
+v 8.680166 -0.073547 -5.138978
+v 7.427792 3.885903 -5.048953
+v 3.003549 5.371137 -4.896614
+v -4.866423 4.952486 -4.357923
+v -10.211346 2.032532 -5.084544
+v -12.359005 0.200333 -5.096958
+v -11.327625 -1.969798 -5.096137
+v -9.718971 -4.066093 -5.097644
+v -4.571516 -5.509898 -5.435872
+v 1.962553 -5.800909 -5.907537
+v 6.036191 -4.416045 -6.124012
+v 8.427498 -2.317862 -6.190922
+v 7.624209 -0.280308 -5.974007
+v 5.819079 2.717243 -6.003164
+v 2.468472 4.170480 -5.873500
+v -4.834510 3.978666 -5.353692
+v -9.101614 1.572469 -5.881719
+v -10.809305 -0.456751 -5.730604
+v -10.415360 -2.042886 -5.799565
+v -7.627967 -3.655680 -6.067048
+v -4.752760 -4.622404 -6.209399
+v 1.164992 -5.149689 -6.605401
+v 5.337538 -4.058928 -6.872072
+v 7.886931 -2.165979 -6.832314
+v 7.384156 -1.059159 -6.916537
+v 7.321360 0.237952 -6.854177
+v 4.711974 2.131492 -6.848088
+v 1.988429 3.456031 -6.523299
+v -4.474339 3.415111 -6.126178
+v -8.103657 1.457768 -6.475069
+v -9.441264 -0.160490 -6.462680
+v -8.620929 -1.992684 -6.633933
+v -7.141864 -3.237716 -6.677267
+v -3.700842 -4.185804 -6.988729
+v 0.957898 -4.561051 -7.290165
+v 3.987794 -3.835166 -7.463488
+v 5.495860 -2.567980 -7.599520
+v 6.241370 -1.306905 -7.460617
+v 5.899672 -0.259447 -7.512131
+v 3.880891 1.269714 -7.374181
+v 0.686485 2.341060 -7.200394
+v -4.418891 2.506220 -6.788348
+v -6.732586 0.361668 -7.194319
+v -7.301064 -0.825929 -7.233202
+v -7.786131 -1.965185 -7.091953
+v -6.183830 -3.095872 -7.372139
+v -3.665900 -3.760844 -7.505378
+v -0.034318 -3.728440 -7.819226
+v 2.319578 -3.269571 -7.959056
+v 4.139924 -2.439134 -8.043041
+v 4.580693 -1.573338 -8.063372
+v 4.577606 -0.645053 -8.057693
+v 2.952733 0.672253 -7.897390
+v 0.683267 1.716074 -7.759254
+v -3.708826 1.577751 -7.432295
+v -4.717430 -0.058953 -7.866454
+v -5.915162 -1.010968 -7.759550
+v -5.664579 -2.058188 -7.841142
+v -5.170471 -2.641428 -7.870813
+v -3.490284 -2.982364 -8.039087
+v -0.808173 -2.936326 -8.201175
+v 1.088180 -2.588522 -8.346894
+v 2.578049 -2.044293 -8.437652
+v 3.123928 -1.425499 -8.457627
+v 3.042760 -0.776925 -8.435273
+v 1.962785 0.433581 -8.406386
+v 0.342970 1.007454 -8.280007
+v -2.798734 0.947218 -7.967093
+v -3.493794 -0.560034 -8.339588
+v -4.123434 -1.083119 -8.279150
+v -4.130139 -1.630147 -8.289884
+v -3.713477 -2.055894 -8.337495
+v -2.828441 -2.346796 -8.407148
+v -1.257987 -2.165491 -8.535490
+v 0.044302 -1.765315 -8.633146
+v 0.967333 -1.466840 -8.680346
+v 1.302728 -1.104186 -8.695992
+v 1.239585 -0.699219 -8.685509
+v 0.754038 -0.055876 -8.631254
+v -0.092655 0.367767 -8.567078
+v -2.232151 0.124238 -8.394958
+v -2.275070 -0.905642 -8.618620
+v -2.460802 -1.109497 -8.611135
+v -2.455931 -1.332056 -8.617181
+v -2.267492 -1.501777 -8.635727
+v -1.855297 -1.584276 -8.671798
+v -1.337924 -1.543844 -8.711473
+v -0.833418 -1.348916 -8.746536
+v -0.538589 -1.139050 -8.765634
+v -0.411941 -0.970436 -8.770660
+v -0.431876 -0.805755 -8.765155
+v -0.664235 -0.633382 -8.744685
+v -1.095262 -0.582591 -8.707457
+v -1.819589 -0.716089 -8.652013
+v -1.437445 -1.122713 -8.720066
+vt 0.126847 0.981818
+vt 0.218182 1.000000
+vt 0.240909 0.981818
+vt 0.254545 1.000000
+vt 0.294318 0.981818
+vt 0.318182 1.000000
+vt 0.359091 0.981818
+vt 0.390909 1.000000
+vt 0.440625 0.981818
+vt 0.556818 0.991477
+vt 0.618182 0.981818
+vt 0.645454 1.000000
+vt 0.679545 0.981818
+vt 0.700000 1.000000
+vt 0.739204 0.981818
+vt 0.772727 1.000000
+vt 0.837500 0.981818
+vt 0.872727 1.000000
+vt 0.946307 0.981818
+vt 0.990909 1.000000
+vt 1.000000 0.981818
+vt 0.126847 0.954545
+vt 1.000000 0.954545
+vt 0.240909 0.954545
+vt 0.294318 0.954545
+vt 0.359091 0.954545
+vt 0.440625 0.954545
+vt 0.555113 0.954545
+vt 0.618182 0.954545
+vt 0.679545 0.954545
+vt 0.739204 0.954545
+vt 0.837500 0.954545
+vt 0.946307 0.954545
+vt 0.126847 0.927273
+vt 0.240909 0.927273
+vt 0.294318 0.927273
+vt 0.359091 0.927273
+vt 0.440625 0.927273
+vt 0.555113 0.927273
+vt 0.618182 0.927273
+vt 0.679545 0.927273
+vt 0.739204 0.927273
+vt 0.837500 0.927273
+vt 0.946307 0.927273
+vt 1.000000 0.927273
+vt 0.126847 0.900000
+vt 1.000000 0.900000
+vt 0.240909 0.900000
+vt 0.294318 0.900000
+vt 0.359091 0.900000
+vt 0.440625 0.900000
+vt 0.555113 0.900000
+vt 0.618182 0.900000
+vt 0.679545 0.900000
+vt 0.739204 0.900000
+vt 0.837500 0.900000
+vt 0.946307 0.900000
+vt 0.126847 0.872727
+vt 0.240909 0.872727
+vt 0.294318 0.872727
+vt 0.359091 0.872727
+vt 0.440625 0.872727
+vt 0.555113 0.872727
+vt 0.618182 0.872727
+vt 0.679545 0.872727
+vt 0.739204 0.872727
+vt 0.837500 0.872727
+vt 0.946307 0.872727
+vt 1.000000 0.872727
+vt 0.119460 0.821591
+vt 1.000000 0.818182
+vt 0.240909 0.818182
+vt 0.294318 0.818182
+vt 0.359091 0.818182
+vt 0.440625 0.818182
+vt 0.555113 0.818182
+vt 0.618182 0.818182
+vt 0.679545 0.818182
+vt 0.739204 0.818182
+vt 0.837500 0.818182
+vt 0.946307 0.818182
+vt 0.126847 0.736364
+vt 1.000000 0.736364
+vt 0.240909 0.736364
+vt 0.294318 0.736364
+vt 0.359091 0.736364
+vt 0.440625 0.736364
+vt 0.555113 0.736364
+vt 0.618182 0.736364
+vt 0.679545 0.736364
+vt 0.739204 0.736364
+vt 0.837500 0.736364
+vt 0.946307 0.736364
+vt 0.126847 0.700000
+vt 1.000000 0.700000
+vt 0.240909 0.700000
+vt 0.294318 0.700000
+vt 0.359091 0.700000
+vt 0.440625 0.700000
+vt 0.555113 0.700000
+vt 0.618182 0.700000
+vt 0.072727 0.663637
+vt 1.000000 0.663637
+vt 0.210937 0.663637
+vt 0.294318 0.663637
+vt 0.359091 0.663637
+vt 0.440625 0.663637
+vt 0.555113 0.663637
+vt 0.618182 0.663637
+vt 0.679545 0.681818
+vt 0.739204 0.681818
+vt 0.837500 0.681818
+vt 0.946307 0.681818
+vt 0.072727 0.627273
+vt 1.000000 0.627273
+vt 0.210937 0.627273
+vt 0.294318 0.627273
+vt 0.359091 0.627273
+vt 0.440625 0.627273
+vt 0.555113 0.627273
+vt 0.618182 0.627273
+vt 0.679545 0.627273
+vt 0.739204 0.627273
+vt 0.837500 0.627273
+vt 0.946307 0.627273
+vt 0.072727 0.590909
+vt 1.000000 0.590909
+vt 0.210937 0.590909
+vt 0.294318 0.590909
+vt 0.359091 0.590909
+vt 0.440625 0.590909
+vt 0.555113 0.590909
+vt 0.618182 0.590909
+vt 0.679545 0.590909
+vt 0.739204 0.590909
+vt 0.837500 0.590909
+vt 0.946307 0.590909
+vt 0.072727 0.554546
+vt 1.000000 0.554546
+vt 0.157386 0.554546
+vt 0.222727 0.554546
+vt 0.294318 0.554546
+vt 0.359091 0.554546
+vt 0.440625 0.554546
+vt 0.555113 0.554546
+vt 0.618182 0.554546
+vt 0.679545 0.554546
+vt 0.739204 0.554546
+vt 0.837500 0.554546
+vt 0.946307 0.554546
+vt 0.072727 0.518182
+vt 1.000000 0.518182
+vt 0.157386 0.518182
+vt 0.222727 0.518182
+vt 0.294318 0.518182
+vt 0.359091 0.518182
+vt 0.440625 0.518182
+vt 0.555113 0.518182
+vt 0.618182 0.518182
+vt 0.679545 0.518182
+vt 0.739204 0.518182
+vt 0.837500 0.518182
+vt 0.946307 0.518182
+vt 0.072727 0.481818
+vt 1.000000 0.481818
+vt 0.157386 0.481818
+vt 0.222727 0.481818
+vt 0.294318 0.481818
+vt 0.359091 0.481818
+vt 0.440625 0.481818
+vt 0.555113 0.481818
+vt 0.618182 0.481818
+vt 0.679545 0.481818
+vt 0.739204 0.481818
+vt 0.837500 0.481818
+vt 0.946307 0.481818
+vt 0.072727 0.454546
+vt 0.157386 0.454546
+vt 0.222727 0.454546
+vt 0.294318 0.454546
+vt 0.359091 0.454546
+vt 0.440625 0.454546
+vt 0.555113 0.454546
+vt 0.618182 0.454546
+vt 0.679545 0.454546
+vt 0.739204 0.454546
+vt 0.837500 0.454546
+vt 0.946307 0.454546
+vt 1.000000 0.454546
+vt 0.072727 0.427273
+vt 1.000000 0.427273
+vt 0.157386 0.427273
+vt 0.222727 0.427273
+vt 0.294318 0.427273
+vt 0.359091 0.427273
+vt 0.440625 0.427273
+vt 0.555113 0.427273
+vt 0.618182 0.427273
+vt 0.679545 0.427273
+vt 0.739204 0.427273
+vt 0.837500 0.427273
+vt 0.946307 0.427273
+vt 0.072727 0.386364
+vt 1.000000 0.386364
+vt 0.157386 0.386364
+vt 0.222727 0.386364
+vt 0.294318 0.386364
+vt 0.359091 0.386364
+vt 0.440625 0.393182
+vt 0.474432 0.372728
+vt 0.555113 0.386364
+vt 0.618182 0.386364
+vt 0.679545 0.386364
+vt 0.739204 0.386364
+vt 0.837500 0.386364
+vt 0.946307 0.386364
+vt 0.072727 0.336364
+vt 0.157386 0.336364
+vt 0.222727 0.336364
+vt 0.294318 0.336364
+vt 0.359091 0.336364
+vt 0.406818 0.336364
+vt 0.474432 0.336364
+vt 0.555113 0.336364
+vt 0.618182 0.336364
+vt 0.679545 0.336364
+vt 0.739204 0.336364
+vt 0.837500 0.336364
+vt 0.915341 0.336364
+vt 0.988636 0.336364
+vt 0.072727 0.295455
+vt 0.157386 0.295455
+vt 0.222727 0.295455
+vt 0.294318 0.295455
+vt 0.359091 0.295455
+vt 0.406818 0.295455
+vt 0.474432 0.295455
+vt 0.555113 0.295455
+vt 0.618182 0.295455
+vt 0.679545 0.295455
+vt 0.739204 0.295455
+vt 0.837500 0.295455
+vt 0.915341 0.295455
+vt 0.988636 0.295455
+vt 0.072727 0.245455
+vt 0.157386 0.245455
+vt 0.222727 0.245455
+vt 0.294318 0.245455
+vt 0.359091 0.245455
+vt 0.440625 0.245455
+vt 0.555113 0.245455
+vt 0.618182 0.245455
+vt 0.679545 0.245455
+vt 0.739204 0.245455
+vt 0.837500 0.245455
+vt 0.915341 0.245455
+vt 0.988636 0.245455
+vt 0.072727 0.209091
+vt 0.157386 0.209091
+vt 0.222727 0.209091
+vt 0.294318 0.209091
+vt 0.359091 0.209091
+vt 0.440625 0.209091
+vt 0.555113 0.209091
+vt 0.618182 0.209091
+vt 0.679545 0.209091
+vt 0.720455 0.209091
+vt 0.757954 0.209091
+vt 0.837500 0.209091
+vt 0.915341 0.209091
+vt 0.988636 0.209091
+vt 0.072727 0.172727
+vt 0.157386 0.172727
+vt 0.222727 0.172727
+vt 0.294318 0.172727
+vt 0.359091 0.172727
+vt 0.440625 0.172727
+vt 0.555113 0.172727
+vt 0.618182 0.172727
+vt 0.679545 0.172727
+vt 0.720455 0.172727
+vt 0.757954 0.172727
+vt 0.837500 0.172727
+vt 0.915341 0.172727
+vt 0.988636 0.172727
+vt 0.072727 0.136364
+vt 0.157386 0.136364
+vt 0.222727 0.136364
+vt 0.294318 0.136364
+vt 0.359091 0.136364
+vt 0.440625 0.136364
+vt 0.555113 0.136364
+vt 0.618182 0.136364
+vt 0.679545 0.136364
+vt 0.720455 0.136364
+vt 0.757954 0.136364
+vt 0.837500 0.136364
+vt 0.915341 0.136364
+vt 0.988636 0.136364
+vt 0.072727 0.100000
+vt 0.157386 0.100000
+vt 0.222727 0.100000
+vt 0.294318 0.100000
+vt 0.359091 0.100000
+vt 0.440625 0.100000
+vt 0.555113 0.100000
+vt 0.618182 0.100000
+vt 0.679545 0.100000
+vt 0.720455 0.100000
+vt 0.757954 0.100000
+vt 0.837500 0.100000
+vt 0.915341 0.100000
+vt 0.988636 0.100000
+vt 0.072727 0.059092
+vt 0.168750 0.052273
+vt 0.222727 0.059092
+vt 0.294318 0.059092
+vt 0.359091 0.059092
+vt 0.440625 0.059092
+vt 0.555113 0.059092
+vt 0.618182 0.059092
+vt 0.679545 0.059092
+vt 0.720455 0.059092
+vt 0.757954 0.059092
+vt 0.837500 0.059092
+vt 0.915341 0.059092
+vt 0.988636 0.059092
+vt 0.072727 0.018182
+vt 0.167898 0.018182
+vt 0.222727 0.018182
+vt 0.294318 0.018182
+vt 0.359091 0.018182
+vt 0.440625 0.018182
+vt 0.555113 0.018182
+vt 0.618182 0.018182
+vt 0.679545 0.018182
+vt 0.720455 0.018182
+vt 0.757954 0.018182
+vt 0.837500 0.018182
+vt 0.915341 0.018182
+vt 0.988636 0.018182
+vt 0.109091 0.000000
+vt 0.181818 0.000000
+vt 0.254545 0.000000
+vt 0.318182 0.000000
+vt 0.390909 0.000000
+vt 0.509091 0.000000
+vt 0.590909 0.000000
+vt 0.645454 0.000000
+vt 0.700000 0.000000
+vt 0.727273 0.000000
+vt 0.772727 0.000000
+vt 0.872727 0.000000
+vt 0.954545 0.000000
+vn 0.100495 0.023118 0.994669
+vn 0.077468 0.117355 0.990064
+vn 0.064455 0.064246 0.995850
+vn 0.100495 0.023118 0.994669
+vn 0.064455 0.064246 0.995850
+vn 0.064219 0.009880 0.997887
+vn 0.100495 0.023118 0.994669
+vn 0.064219 0.009880 0.997887
+vn 0.073290 -0.013762 0.997216
+vn 0.100495 0.023118 0.994669
+vn 0.073290 -0.013762 0.997216
+vn 0.082070 -0.028922 0.996207
+vn 0.100495 0.023118 0.994669
+vn 0.115038 -0.002715 0.993357
+vn 0.128295 0.025670 0.991404
+vn 0.100495 0.023118 0.994669
+vn 0.128295 0.025670 0.991404
+vn 0.142418 0.076935 0.986812
+vn 0.100495 0.023118 0.994669
+vn 0.142418 0.076935 0.986812
+vn 0.150431 0.143167 0.978199
+vn 0.100495 0.023118 0.994669
+vn 0.150431 0.143167 0.978199
+vn 0.118985 0.150553 0.981416
+vn 0.100495 0.023118 0.994669
+vn 0.118985 0.150553 0.981416
+vn 0.077468 0.117355 0.990064
+vn 0.077468 0.117355 0.990064
+vn 0.022854 0.215090 0.976327
+vn -0.001439 0.090060 0.995935
+vn 0.064455 0.064246 0.995850
+vn 0.064455 0.064246 0.995850
+vn -0.001439 0.090060 0.995935
+vn 0.000245 -0.002658 0.999996
+vn 0.064219 0.009880 0.997887
+vn 0.064219 0.009880 0.997887
+vn 0.000245 -0.002658 0.999996
+vn 0.022064 -0.049839 0.998514
+vn 0.073290 -0.013762 0.997216
+vn 0.073290 -0.013762 0.997216
+vn 0.022064 -0.049839 0.998514
+vn 0.061351 -0.051570 0.996783
+vn 0.082070 -0.028922 0.996207
+vn 0.082070 -0.028922 0.996207
+vn 0.061351 -0.051570 0.996783
+vn 0.100691 -0.026406 0.994567
+vn 0.100495 0.023118 0.994669
+vn 0.100495 0.023118 0.994669
+vn 0.100691 -0.026406 0.994567
+vn 0.137568 -0.000018 0.990492
+vn 0.115038 -0.002715 0.993357
+vn 0.115038 -0.002715 0.993357
+vn 0.137568 -0.000018 0.990492
+vn 0.176882 0.031784 0.983719
+vn 0.128295 0.025670 0.991404
+vn 0.128295 0.025670 0.991404
+vn 0.176882 0.031784 0.983719
+vn 0.204572 0.119527 0.971527
+vn 0.142418 0.076935 0.986812
+vn 0.142418 0.076935 0.986812
+vn 0.204572 0.119527 0.971527
+vn 0.204284 0.237702 0.949613
+vn 0.150431 0.143167 0.978199
+vn 0.150431 0.143167 0.978199
+vn 0.204284 0.237702 0.949613
+vn 0.118108 0.285766 0.950994
+vn 0.118985 0.150553 0.981416
+vn 0.118985 0.150553 0.981416
+vn 0.118108 0.285766 0.950994
+vn 0.022854 0.215090 0.976327
+vn 0.077468 0.117355 0.990064
+vn 0.022854 0.215090 0.976327
+vn -0.002274 0.277222 0.960803
+vn -0.045244 0.106075 0.993328
+vn -0.001439 0.090060 0.995935
+vn -0.001439 0.090060 0.995935
+vn -0.045244 0.106075 0.993328
+vn -0.066738 -0.030366 0.997308
+vn 0.000245 -0.002658 0.999996
+vn 0.000245 -0.002658 0.999996
+vn -0.066738 -0.030366 0.997308
+vn -0.042550 -0.121401 0.991691
+vn 0.022064 -0.049839 0.998514
+vn 0.022064 -0.049839 0.998514
+vn -0.042550 -0.121401 0.991691
+vn 0.031620 -0.131227 0.990848
+vn 0.061351 -0.051570 0.996783
+vn 0.061351 -0.051570 0.996783
+vn 0.031620 -0.131227 0.990848
+vn 0.107202 -0.077271 0.991230
+vn 0.100691 -0.026406 0.994567
+vn 0.100691 -0.026406 0.994567
+vn 0.107202 -0.077271 0.991230
+vn 0.166603 0.011461 0.985958
+vn 0.137568 -0.000018 0.990492
+vn 0.137568 -0.000018 0.990492
+vn 0.166603 0.011461 0.985958
+vn 0.221610 0.083087 0.971589
+vn 0.176882 0.031784 0.983719
+vn 0.176882 0.031784 0.983719
+vn 0.221610 0.083087 0.971589
+vn 0.260330 0.169251 0.950569
+vn 0.204572 0.119527 0.971527
+vn 0.204572 0.119527 0.971527
+vn 0.260330 0.169251 0.950569
+vn 0.239015 0.293952 0.925454
+vn 0.204284 0.237702 0.949613
+vn 0.204284 0.237702 0.949613
+vn 0.239015 0.293952 0.925454
+vn 0.114796 0.365676 0.923636
+vn 0.118108 0.285766 0.950994
+vn 0.118108 0.285766 0.950994
+vn 0.114796 0.365676 0.923636
+vn -0.002274 0.277222 0.960803
+vn 0.022854 0.215090 0.976327
+vn -0.002274 0.277222 0.960803
+vn -0.033658 0.342590 0.938882
+vn -0.116463 0.128982 0.984784
+vn -0.045244 0.106075 0.993328
+vn -0.045244 0.106075 0.993328
+vn -0.116463 0.128982 0.984784
+vn -0.139530 -0.073173 0.987511
+vn -0.066738 -0.030366 0.997308
+vn -0.066738 -0.030366 0.997308
+vn -0.139530 -0.073173 0.987511
+vn -0.114779 -0.233531 0.965551
+vn -0.042550 -0.121401 0.991691
+vn -0.042550 -0.121401 0.991691
+vn -0.114779 -0.233531 0.965551
+vn -0.011341 -0.275108 0.961346
+vn 0.031620 -0.131227 0.990848
+vn 0.031620 -0.131227 0.990848
+vn -0.011341 -0.275108 0.961346
+vn 0.112206 -0.219645 0.969106
+vn 0.107202 -0.077271 0.991230
+vn 0.107202 -0.077271 0.991230
+vn 0.112206 -0.219645 0.969106
+vn 0.213766 -0.062833 0.974862
+vn 0.166603 0.011461 0.985958
+vn 0.166603 0.011461 0.985958
+vn 0.213766 -0.062833 0.974862
+vn 0.313951 0.143910 0.938469
+vn 0.221610 0.083087 0.971589
+vn 0.221610 0.083087 0.971589
+vn 0.313951 0.143910 0.938469
+vn 0.373491 0.263281 0.889487
+vn 0.260330 0.169251 0.950569
+vn 0.260330 0.169251 0.950569
+vn 0.373491 0.263281 0.889487
+vn 0.311234 0.384587 0.869038
+vn 0.239015 0.293952 0.925454
+vn 0.239015 0.293952 0.925454
+vn 0.311234 0.384587 0.869038
+vn 0.133446 0.475796 0.869374
+vn 0.114796 0.365676 0.923636
+vn 0.114796 0.365676 0.923636
+vn 0.133446 0.475796 0.869374
+vn -0.033658 0.342590 0.938882
+vn -0.002274 0.277222 0.960803
+vn -0.033658 0.342590 0.938882
+vn -0.090391 0.447310 0.889799
+vn -0.198279 0.144174 0.969484
+vn -0.116463 0.128982 0.984784
+vn -0.116463 0.128982 0.984784
+vn -0.198279 0.144174 0.969484
+vn -0.190955 -0.111243 0.975275
+vn -0.139530 -0.073173 0.987511
+vn -0.139530 -0.073173 0.987511
+vn -0.190955 -0.111243 0.975275
+vn -0.148707 -0.293027 0.944469
+vn -0.114779 -0.233531 0.965551
+vn -0.114779 -0.233531 0.965551
+vn -0.148707 -0.293027 0.944469
+vn -0.041861 -0.333263 0.941904
+vn -0.011341 -0.275108 0.961346
+vn -0.011341 -0.275108 0.961346
+vn -0.041861 -0.333263 0.941904
+vn 0.110333 -0.290679 0.950438
+vn 0.112206 -0.219645 0.969106
+vn 0.112206 -0.219645 0.969106
+vn 0.110333 -0.290679 0.950438
+vn 0.247018 -0.160606 0.955609
+vn 0.213766 -0.062833 0.974862
+vn 0.213766 -0.062833 0.974862
+vn 0.247018 -0.160606 0.955609
+vn 0.367028 0.115480 0.923014
+vn 0.313951 0.143910 0.938469
+vn 0.313951 0.143910 0.938469
+vn 0.367028 0.115480 0.923014
+vn 0.413735 0.297715 0.860342
+vn 0.373491 0.263281 0.889487
+vn 0.373491 0.263281 0.889487
+vn 0.413735 0.297715 0.860342
+vn 0.356460 0.485649 0.798173
+vn 0.311234 0.384587 0.869038
+vn 0.311234 0.384587 0.869038
+vn 0.356460 0.485649 0.798173
+vn 0.144882 0.655637 0.741046
+vn 0.133446 0.475796 0.869374
+vn 0.133446 0.475796 0.869374
+vn 0.144882 0.655637 0.741046
+vn -0.090391 0.447310 0.889799
+vn -0.033658 0.342590 0.938882
+vn -0.090391 0.447310 0.889799
+vn -0.141358 0.500314 0.854227
+vn -0.264422 0.121541 0.956718
+vn -0.198279 0.144174 0.969484
+vn -0.198279 0.144174 0.969484
+vn -0.264422 0.121541 0.956718
+vn -0.255014 -0.176738 0.950648
+vn -0.190955 -0.111243 0.975275
+vn -0.190955 -0.111243 0.975275
+vn -0.255014 -0.176738 0.950648
+vn -0.191625 -0.340410 0.920544
+vn -0.148707 -0.293027 0.944469
+vn -0.148707 -0.293027 0.944469
+vn -0.191625 -0.340410 0.920544
+vn -0.077288 -0.437424 0.895928
+vn -0.041861 -0.333263 0.941904
+vn -0.041861 -0.333263 0.941904
+vn -0.077288 -0.437424 0.895928
+vn 0.102442 -0.435700 0.894243
+vn 0.110333 -0.290679 0.950438
+vn 0.110333 -0.290679 0.950438
+vn 0.102442 -0.435700 0.894243
+vn 0.283122 -0.284057 0.916053
+vn 0.247018 -0.160606 0.955609
+vn 0.247018 -0.160606 0.955609
+vn 0.283122 -0.284057 0.916053
+vn 0.393939 -0.002011 0.919135
+vn 0.367028 0.115480 0.923014
+vn 0.367028 0.115480 0.923014
+vn 0.393939 -0.002011 0.919135
+vn 0.403766 0.280342 0.870851
+vn 0.413735 0.297715 0.860342
+vn 0.413735 0.297715 0.860342
+vn 0.403766 0.280342 0.870851
+vn 0.347546 0.529980 0.773520
+vn 0.356460 0.485649 0.798173
+vn 0.356460 0.485649 0.798173
+vn 0.347546 0.529980 0.773520
+vn 0.140290 0.692990 0.707165
+vn 0.144882 0.655637 0.741046
+vn 0.144882 0.655637 0.741046
+vn 0.140290 0.692990 0.707165
+vn -0.141358 0.500314 0.854227
+vn -0.090391 0.447310 0.889799
+vn -0.141358 0.500314 0.854227
+vn -0.218079 0.584029 0.781890
+vn -0.347630 0.109172 0.931255
+vn -0.264422 0.121541 0.956718
+vn -0.264422 0.121541 0.956718
+vn -0.347630 0.109172 0.931255
+vn -0.317864 -0.238723 0.917591
+vn -0.255014 -0.176738 0.950648
+vn -0.255014 -0.176738 0.950648
+vn -0.317864 -0.238723 0.917591
+vn -0.237695 -0.393132 0.888227
+vn -0.191625 -0.340410 0.920544
+vn -0.191625 -0.340410 0.920544
+vn -0.237695 -0.393132 0.888227
+vn -0.102351 -0.572123 0.813756
+vn -0.077288 -0.437424 0.895928
+vn -0.077288 -0.437424 0.895928
+vn -0.102351 -0.572123 0.813756
+vn 0.091973 -0.622392 0.777283
+vn 0.102442 -0.435700 0.894243
+vn 0.102442 -0.435700 0.894243
+vn 0.091973 -0.622392 0.777283
+vn 0.363614 -0.441733 0.820157
+vn 0.283122 -0.284057 0.916053
+vn 0.283122 -0.284057 0.916053
+vn 0.363614 -0.441733 0.820157
+vn 0.592150 -0.080736 0.801773
+vn 0.393939 -0.002011 0.919135
+vn 0.393939 -0.002011 0.919135
+vn 0.592150 -0.080736 0.801773
+vn 0.539783 0.330313 0.774291
+vn 0.403766 0.280342 0.870851
+vn 0.403766 0.280342 0.870851
+vn 0.539783 0.330313 0.774291
+vn 0.352331 0.515678 0.780986
+vn 0.347546 0.529980 0.773520
+vn 0.347546 0.529980 0.773520
+vn 0.352331 0.515678 0.780986
+vn 0.117021 0.663222 0.739218
+vn 0.140290 0.692990 0.707165
+vn 0.140290 0.692990 0.707165
+vn 0.117021 0.663222 0.739218
+vn -0.218079 0.584029 0.781890
+vn -0.141358 0.500314 0.854227
+vn -0.218079 0.584029 0.781890
+vn -0.361319 0.666769 0.651819
+vn -0.632473 0.209652 0.745670
+vn -0.347630 0.109172 0.931255
+vn -0.347630 0.109172 0.931255
+vn -0.632473 0.209652 0.745670
+vn -0.532771 -0.285311 0.796714
+vn -0.317864 -0.238723 0.917591
+vn -0.317864 -0.238723 0.917591
+vn -0.532771 -0.285311 0.796714
+vn -0.301865 -0.475847 0.826104
+vn -0.237695 -0.393132 0.888227
+vn -0.237695 -0.393132 0.888227
+vn -0.301865 -0.475847 0.826104
+vn -0.108276 -0.636388 0.763732
+vn -0.102351 -0.572123 0.813756
+vn -0.102351 -0.572123 0.813756
+vn -0.108276 -0.636388 0.763732
+vn 0.098093 -0.665718 0.739728
+vn 0.091973 -0.622392 0.777283
+vn 0.091973 -0.622392 0.777283
+vn 0.098093 -0.665718 0.739728
+vn 0.444841 -0.503892 0.740412
+vn 0.363614 -0.441733 0.820157
+vn 0.363614 -0.441733 0.820157
+vn 0.444841 -0.503892 0.740412
+vn 0.761009 -0.138160 0.633859
+vn 0.592150 -0.080736 0.801773
+vn 0.592150 -0.080736 0.801773
+vn 0.761009 -0.138160 0.633859
+vn 0.692401 0.341107 0.635789
+vn 0.539783 0.330313 0.774291
+vn 0.539783 0.330313 0.774291
+vn 0.692401 0.341107 0.635789
+vn 0.433461 0.610653 0.662733
+vn 0.352331 0.515678 0.780986
+vn 0.352331 0.515678 0.780986
+vn 0.433461 0.610653 0.662733
+vn 0.107799 0.729152 0.675809
+vn 0.117021 0.663222 0.739218
+vn 0.117021 0.663222 0.739218
+vn 0.107799 0.729152 0.675809
+vn -0.361319 0.666769 0.651819
+vn -0.218079 0.584029 0.781890
+vn -0.361319 0.666769 0.651819
+vn -0.291096 0.759827 0.581314
+vn -0.729455 0.425009 0.535969
+vn -0.361319 0.666769 0.651819
+vn -0.729455 0.425009 0.535969
+vn -0.632473 0.209652 0.745670
+vn -0.632473 0.209652 0.745670
+vn -0.729455 0.425009 0.535969
+vn -0.649964 -0.296407 0.699778
+vn -0.532771 -0.285311 0.796714
+vn -0.532771 -0.285311 0.796714
+vn -0.649964 -0.296407 0.699778
+vn -0.392640 -0.600087 0.696943
+vn -0.301865 -0.475847 0.826104
+vn -0.301865 -0.475847 0.826104
+vn -0.392640 -0.600087 0.696943
+vn -0.140718 -0.751235 0.644860
+vn -0.108276 -0.636388 0.763732
+vn -0.108276 -0.636388 0.763732
+vn -0.140718 -0.751235 0.644860
+vn 0.121342 -0.755815 0.643444
+vn 0.098093 -0.665718 0.739728
+vn 0.098093 -0.665718 0.739728
+vn 0.121342 -0.755815 0.643444
+vn 0.522971 -0.535057 0.663487
+vn 0.444841 -0.503892 0.740412
+vn 0.444841 -0.503892 0.740412
+vn 0.522971 -0.535057 0.663487
+vn 0.761009 -0.138160 0.633859
+vn 0.107799 0.729152 0.675809
+vn -0.291096 0.759827 0.581314
+vn -0.361319 0.666769 0.651819
+vn -0.291096 0.759827 0.581314
+vn -0.257163 0.858528 0.443618
+vn -0.551716 0.304937 0.776288
+vn -0.729455 0.425009 0.535969
+vn -0.729455 0.425009 0.535969
+vn -0.551716 0.304937 0.776288
+vn -0.527891 -0.286169 0.799649
+vn -0.649964 -0.296407 0.699778
+vn -0.649964 -0.296407 0.699778
+vn -0.527891 -0.286169 0.799649
+vn -0.402666 -0.643845 0.650633
+vn -0.392640 -0.600087 0.696943
+vn -0.392640 -0.600087 0.696943
+vn -0.402666 -0.643845 0.650633
+vn -0.168692 -0.829817 0.531928
+vn -0.140718 -0.751235 0.644860
+vn -0.140718 -0.751235 0.644860
+vn -0.168692 -0.829817 0.531928
+vn 0.148361 -0.889960 0.431232
+vn 0.121342 -0.755815 0.643444
+vn 0.121342 -0.755815 0.643444
+vn 0.148361 -0.889960 0.431232
+vn 0.648941 -0.639690 0.411913
+vn 0.522971 -0.535057 0.663487
+vn 0.522971 -0.535057 0.663487
+vn 0.648941 -0.639690 0.411913
+vn 0.891684 -0.142903 0.429510
+vn 0.761009 -0.138160 0.633859
+vn 0.761009 -0.138160 0.633859
+vn 0.891684 -0.142903 0.429510
+vn 0.829380 0.301128 0.470587
+vn 0.692401 0.341107 0.635789
+vn 0.692401 0.341107 0.635789
+vn 0.829380 0.301128 0.470587
+vn 0.530525 0.727395 0.435247
+vn 0.433461 0.610653 0.662733
+vn 0.433461 0.610653 0.662733
+vn 0.530525 0.727395 0.435247
+vn 0.160394 0.928882 0.333844
+vn 0.107799 0.729152 0.675809
+vn 0.107799 0.729152 0.675809
+vn 0.160394 0.928882 0.333844
+vn -0.257163 0.858528 0.443618
+vn -0.291096 0.759827 0.581314
+vn -0.257163 0.858528 0.443618
+vn -0.236772 0.861860 0.448482
+vn -0.512328 0.329250 0.793168
+vn -0.551716 0.304937 0.776288
+vn -0.551716 0.304937 0.776288
+vn -0.512328 0.329250 0.793168
+vn -0.452042 -0.280965 0.846591
+vn -0.527891 -0.286169 0.799649
+vn -0.527891 -0.286169 0.799649
+vn -0.452042 -0.280965 0.846591
+vn -0.346035 -0.600792 0.720631
+vn -0.402666 -0.643845 0.650633
+vn -0.402666 -0.643845 0.650633
+vn -0.346035 -0.600792 0.720631
+vn -0.165533 -0.846057 0.506741
+vn -0.168692 -0.829817 0.531928
+vn -0.168692 -0.829817 0.531928
+vn -0.165533 -0.846057 0.506741
+vn 0.161694 -0.954572 0.250296
+vn 0.148361 -0.889960 0.431232
+vn 0.148361 -0.889960 0.431232
+vn 0.161694 -0.954572 0.250296
+vn 0.693214 -0.712624 0.107801
+vn 0.648941 -0.639690 0.411913
+vn 0.648941 -0.639690 0.411913
+vn 0.693214 -0.712624 0.107801
+vn 0.963706 -0.220430 0.150605
+vn 0.891684 -0.142903 0.429510
+vn 0.891684 -0.142903 0.429510
+vn 0.963706 -0.220430 0.150605
+vn 0.935502 0.268852 0.229248
+vn 0.829380 0.301128 0.470587
+vn 0.829380 0.301128 0.470587
+vn 0.935502 0.268852 0.229248
+vn 0.594045 0.756981 0.272195
+vn 0.530525 0.727395 0.435247
+vn 0.530525 0.727395 0.435247
+vn 0.594045 0.756981 0.272195
+vn 0.154365 0.954585 0.254830
+vn 0.160394 0.928882 0.333844
+vn 0.160394 0.928882 0.333844
+vn 0.154365 0.954585 0.254830
+vn -0.236772 0.861860 0.448482
+vn -0.257163 0.858528 0.443618
+vn -0.236772 0.861860 0.448482
+vn -0.243752 0.949476 0.197690
+vn -0.540581 0.714845 0.443586
+vn -0.512328 0.329250 0.793168
+vn -0.512328 0.329250 0.793168
+vn -0.540581 0.714845 0.443586
+vn -0.637288 0.199809 0.744272
+vn -0.512328 0.329250 0.793168
+vn -0.637288 0.199809 0.744272
+vn -0.506904 -0.360871 0.782829
+vn -0.452042 -0.280965 0.846591
+vn -0.452042 -0.280965 0.846591
+vn -0.506904 -0.360871 0.782829
+vn -0.380190 -0.702367 0.601778
+vn -0.346035 -0.600792 0.720631
+vn -0.346035 -0.600792 0.720631
+vn -0.380190 -0.702367 0.601778
+vn -0.161909 -0.898625 0.407749
+vn -0.165533 -0.846057 0.506741
+vn -0.165533 -0.846057 0.506741
+vn -0.161909 -0.898625 0.407749
+vn 0.169868 -0.964910 0.200236
+vn 0.161694 -0.954572 0.250296
+vn 0.161694 -0.954572 0.250296
+vn 0.169868 -0.964910 0.200236
+vn 0.652980 -0.756222 -0.041793
+vn 0.693214 -0.712624 0.107801
+vn 0.693214 -0.712624 0.107801
+vn 0.652980 -0.756222 -0.041793
+vn 0.954113 -0.289026 -0.078305
+vn 0.963706 -0.220430 0.150605
+vn 0.963706 -0.220430 0.150605
+vn 0.954113 -0.289026 -0.078305
+vn 0.967790 0.251374 0.013939
+vn 0.935502 0.268852 0.229248
+vn 0.935502 0.268852 0.229248
+vn 0.967790 0.251374 0.013939
+vn 0.637268 0.770571 0.010468
+vn 0.594045 0.756981 0.272195
+vn 0.594045 0.756981 0.272195
+vn 0.637268 0.770571 0.010468
+vn 0.153227 0.988147 0.009366
+vn 0.154365 0.954585 0.254830
+vn 0.154365 0.954585 0.254830
+vn 0.153227 0.988147 0.009366
+vn -0.243752 0.949476 0.197690
+vn -0.236772 0.861860 0.448482
+vn -0.243752 0.949476 0.197690
+vn -0.246185 0.948171 -0.200912
+vn -0.552103 0.832991 0.036172
+vn -0.540581 0.714845 0.443586
+vn -0.540581 0.714845 0.443586
+vn -0.552103 0.832991 0.036172
+vn -0.799522 0.264462 0.539281
+vn -0.637288 0.199809 0.744272
+vn -0.637288 0.199809 0.744272
+vn -0.799522 0.264462 0.539281
+vn -0.652946 -0.457646 0.603508
+vn -0.506904 -0.360871 0.782829
+vn -0.506904 -0.360871 0.782829
+vn -0.652946 -0.457646 0.603508
+vn -0.427288 -0.815681 0.389986
+vn -0.380190 -0.702367 0.601778
+vn -0.380190 -0.702367 0.601778
+vn -0.427288 -0.815681 0.389986
+vn -0.164808 -0.948559 0.270323
+vn -0.161909 -0.898625 0.407749
+vn -0.161909 -0.898625 0.407749
+vn -0.164808 -0.948559 0.270323
+vn 0.176814 -0.980578 0.084874
+vn 0.169868 -0.964910 0.200236
+vn 0.169868 -0.964910 0.200236
+vn 0.176814 -0.980578 0.084874
+vn 0.600510 -0.786381 -0.144891
+vn 0.652980 -0.756222 -0.041793
+vn 0.652980 -0.756222 -0.041793
+vn 0.600510 -0.786381 -0.144891
+vn 0.916143 -0.384977 -0.111694
+vn 0.954113 -0.289026 -0.078305
+vn 0.954113 -0.289026 -0.078305
+vn 0.916143 -0.384977 -0.111694
+vn 0.974241 0.213543 -0.072488
+vn 0.967790 0.251374 0.013939
+vn 0.967790 0.251374 0.013939
+vn 0.974241 0.213543 -0.072488
+vn 0.621170 0.751202 -0.223259
+vn 0.637268 0.770571 0.010468
+vn 0.637268 0.770571 0.010468
+vn 0.621170 0.751202 -0.223259
+vn 0.144503 0.949170 -0.279633
+vn 0.153227 0.988147 0.009366
+vn 0.153227 0.988147 0.009366
+vn 0.144503 0.949170 -0.279633
+vn -0.246185 0.948171 -0.200912
+vn -0.243752 0.949476 0.197690
+vn -0.246185 0.948171 -0.200912
+vn -0.252933 0.932540 -0.257671
+vn -0.513717 0.823625 -0.240286
+vn -0.552103 0.832991 0.036172
+vn -0.552103 0.832991 0.036172
+vn -0.513717 0.823625 -0.240286
+vn -0.914312 0.388654 0.113935
+vn -0.799522 0.264462 0.539281
+vn -0.799522 0.264462 0.539281
+vn -0.914312 0.388654 0.113935
+vn -0.765352 -0.412423 0.494109
+vn -0.652946 -0.457646 0.603508
+vn -0.652946 -0.457646 0.603508
+vn -0.765352 -0.412423 0.494109
+vn -0.413441 -0.792905 0.447625
+vn -0.427288 -0.815681 0.389986
+vn -0.427288 -0.815681 0.389986
+vn -0.413441 -0.792905 0.447625
+vn -0.159268 -0.966738 0.200130
+vn -0.164808 -0.948559 0.270323
+vn -0.164808 -0.948559 0.270323
+vn -0.159268 -0.966738 0.200130
+vn 0.164785 -0.975025 -0.148905
+vn 0.176814 -0.980578 0.084874
+vn 0.176814 -0.980578 0.084874
+vn 0.164785 -0.975025 -0.148905
+vn 0.515038 -0.819366 -0.251744
+vn 0.600510 -0.786381 -0.144891
+vn 0.600510 -0.786381 -0.144891
+vn 0.515038 -0.819366 -0.251744
+vn 0.858318 -0.510509 -0.051683
+vn 0.916143 -0.384977 -0.111694
+vn 0.916143 -0.384977 -0.111694
+vn 0.858318 -0.510509 -0.051683
+vn 0.981585 0.178457 -0.068144
+vn 0.974241 0.213543 -0.072488
+vn 0.974241 0.213543 -0.072488
+vn 0.981585 0.178457 -0.068144
+vn 0.601982 0.749458 -0.275555
+vn 0.621170 0.751202 -0.223259
+vn 0.621170 0.751202 -0.223259
+vn 0.601982 0.749458 -0.275555
+vn 0.144631 0.943230 -0.298998
+vn 0.144503 0.949170 -0.279633
+vn 0.144503 0.949170 -0.279633
+vn 0.144631 0.943230 -0.298998
+vn -0.252933 0.932540 -0.257671
+vn -0.246185 0.948171 -0.200912
+vn -0.252933 0.932540 -0.257671
+vn -0.270432 0.921096 -0.280086
+vn -0.502652 0.767455 -0.397937
+vn -0.513717 0.823625 -0.240286
+vn -0.513717 0.823625 -0.240286
+vn -0.502652 0.767455 -0.397937
+vn -0.805969 0.452910 -0.381165
+vn -0.914312 0.388654 0.113935
+vn -0.914312 0.388654 0.113935
+vn -0.805969 0.452910 -0.381165
+vn -0.938144 -0.329163 -0.107412
+vn -0.765352 -0.412423 0.494109
+vn -0.765352 -0.412423 0.494109
+vn -0.938144 -0.329163 -0.107412
+vn -0.485657 -0.872084 0.060055
+vn -0.413441 -0.792905 0.447625
+vn -0.413441 -0.792905 0.447625
+vn -0.485657 -0.872084 0.060055
+vn -0.156037 -0.985936 -0.059861
+vn -0.159268 -0.966738 0.200130
+vn -0.159268 -0.966738 0.200130
+vn -0.156037 -0.985936 -0.059861
+vn 0.149988 -0.962305 -0.226875
+vn 0.164785 -0.975025 -0.148905
+vn 0.164785 -0.975025 -0.148905
+vn 0.149988 -0.962305 -0.226875
+vn 0.451082 -0.854166 -0.258698
+vn 0.515038 -0.819366 -0.251744
+vn 0.515038 -0.819366 -0.251744
+vn 0.451082 -0.854166 -0.258698
+vn 0.791922 -0.552408 -0.260203
+vn 0.858318 -0.510509 -0.051683
+vn 0.858318 -0.510509 -0.051683
+vn 0.791922 -0.552408 -0.260203
+vn 0.916178 0.170848 -0.362532
+vn 0.981585 0.178457 -0.068144
+vn 0.981585 0.178457 -0.068144
+vn 0.916178 0.170848 -0.362532
+vn 0.562781 0.724437 -0.398081
+vn 0.601982 0.749458 -0.275555
+vn 0.601982 0.749458 -0.275555
+vn 0.562781 0.724437 -0.398081
+vn 0.135392 0.936931 -0.322227
+vn 0.144631 0.943230 -0.298998
+vn 0.144631 0.943230 -0.298998
+vn 0.135392 0.936931 -0.322227
+vn -0.270432 0.921096 -0.280086
+vn -0.252933 0.932540 -0.257671
+vn -0.270432 0.921096 -0.280086
+vn -0.282580 0.911355 -0.299300
+vn -0.518829 0.761397 -0.388704
+vn -0.502652 0.767455 -0.397937
+vn -0.502652 0.767455 -0.397937
+vn -0.518829 0.761397 -0.388704
+vn -0.747894 0.399637 -0.530043
+vn -0.805969 0.452910 -0.381165
+vn -0.805969 0.452910 -0.381165
+vn -0.747894 0.399637 -0.530043
+vn -0.732271 -0.264371 -0.627604
+vn -0.938144 -0.329163 -0.107412
+vn -0.938144 -0.329163 -0.107412
+vn -0.732271 -0.264371 -0.627604
+vn -0.438562 -0.737287 -0.513878
+vn -0.485657 -0.872084 0.060055
+vn -0.485657 -0.872084 0.060055
+vn -0.438562 -0.737287 -0.513878
+vn -0.148376 -0.924110 -0.352144
+vn -0.156037 -0.985936 -0.059861
+vn -0.156037 -0.985936 -0.059861
+vn -0.148376 -0.924110 -0.352144
+vn 0.142905 -0.947039 -0.287569
+vn 0.149988 -0.962305 -0.226875
+vn 0.149988 -0.962305 -0.226875
+vn 0.142905 -0.947039 -0.287569
+vn 0.447579 -0.843455 -0.297082
+vn 0.451082 -0.854166 -0.258698
+vn 0.451082 -0.854166 -0.258698
+vn 0.447579 -0.843455 -0.297082
+vn 0.753100 -0.468254 -0.462145
+vn 0.791922 -0.552408 -0.260203
+vn 0.791922 -0.552408 -0.260203
+vn 0.753100 -0.468254 -0.462145
+vn 0.840735 0.193896 -0.505538
+vn 0.916178 0.170848 -0.362532
+vn 0.916178 0.170848 -0.362532
+vn 0.840735 0.193896 -0.505538
+vn 0.582035 0.737917 -0.341633
+vn 0.562781 0.724437 -0.398081
+vn 0.562781 0.724437 -0.398081
+vn 0.582035 0.737917 -0.341633
+vn 0.124969 0.956720 -0.262811
+vn 0.135392 0.936931 -0.322227
+vn 0.135392 0.936931 -0.322227
+vn 0.124969 0.956720 -0.262811
+vn -0.282580 0.911355 -0.299300
+vn -0.270432 0.921096 -0.280086
+vn -0.282580 0.911355 -0.299300
+vn -0.262733 0.873879 -0.409033
+vn -0.469440 0.734859 -0.489498
+vn -0.518829 0.761397 -0.388704
+vn -0.518829 0.761397 -0.388704
+vn -0.469440 0.734859 -0.489498
+vn -0.692144 0.266708 -0.670674
+vn -0.747894 0.399637 -0.530043
+vn -0.747894 0.399637 -0.530043
+vn -0.692144 0.266708 -0.670674
+vn -0.570736 -0.331841 -0.751094
+vn -0.732271 -0.264371 -0.627604
+vn -0.732271 -0.264371 -0.627604
+vn -0.570736 -0.331841 -0.751094
+vn -0.368997 -0.607973 -0.703000
+vn -0.438562 -0.737287 -0.513878
+vn -0.438562 -0.737287 -0.513878
+vn -0.368997 -0.607973 -0.703000
+vn -0.183933 -0.930227 -0.317564
+vn -0.148376 -0.924110 -0.352144
+vn -0.148376 -0.924110 -0.352144
+vn -0.183933 -0.930227 -0.317564
+vn 0.189771 -0.979659 -0.065227
+vn 0.142905 -0.947039 -0.287569
+vn 0.142905 -0.947039 -0.287569
+vn 0.189771 -0.979659 -0.065227
+vn 0.465173 -0.762505 -0.449668
+vn 0.447579 -0.843455 -0.297082
+vn 0.447579 -0.843455 -0.297082
+vn 0.465173 -0.762505 -0.449668
+vn 0.753522 -0.353281 -0.554434
+vn 0.753100 -0.468254 -0.462145
+vn 0.753100 -0.468254 -0.462145
+vn 0.753522 -0.353281 -0.554434
+vn 0.896713 0.224754 -0.381302
+vn 0.840735 0.193896 -0.505538
+vn 0.840735 0.193896 -0.505538
+vn 0.896713 0.224754 -0.381302
+vn 0.658829 0.752107 -0.016710
+vn 0.582035 0.737917 -0.341633
+vn 0.582035 0.737917 -0.341633
+vn 0.658829 0.752107 -0.016710
+vn 0.079760 0.971974 -0.221145
+vn 0.124969 0.956720 -0.262811
+vn 0.124969 0.956720 -0.262811
+vn 0.079760 0.971974 -0.221145
+vn -0.262733 0.873879 -0.409033
+vn -0.282580 0.911355 -0.299300
+vn -0.183933 -0.930227 -0.317564
+vn -0.034647 -0.999264 0.016458
+vn 0.189771 -0.979659 -0.065227
+vn -0.262733 0.873879 -0.409033
+vn -0.182680 0.789102 -0.586469
+vn -0.385874 0.685415 -0.617501
+vn -0.469440 0.734859 -0.489498
+vn -0.469440 0.734859 -0.489498
+vn -0.385874 0.685415 -0.617501
+vn -0.565816 0.194223 -0.801330
+vn -0.692144 0.266708 -0.670674
+vn -0.692144 0.266708 -0.670674
+vn -0.565816 0.194223 -0.801330
+vn -0.474061 -0.377860 -0.795291
+vn -0.570736 -0.331841 -0.751094
+vn -0.570736 -0.331841 -0.751094
+vn -0.474061 -0.377860 -0.795291
+vn -0.355599 -0.590667 -0.724336
+vn -0.368997 -0.607973 -0.703000
+vn -0.368997 -0.607973 -0.703000
+vn -0.355599 -0.590667 -0.724336
+vn -0.266207 -0.697127 -0.665693
+vn -0.183933 -0.930227 -0.317564
+vn -0.183933 -0.930227 -0.317564
+vn -0.266207 -0.697127 -0.665693
+vn -0.097487 -0.829887 -0.549348
+vn -0.034647 -0.999264 0.016458
+vn -0.034647 -0.999264 0.016458
+vn -0.097487 -0.829887 -0.549348
+vn 0.223692 -0.877690 -0.423819
+vn 0.189771 -0.979659 -0.065227
+vn 0.189771 -0.979659 -0.065227
+vn 0.223692 -0.877690 -0.423819
+vn 0.502276 -0.674824 -0.540677
+vn 0.465173 -0.762505 -0.449668
+vn 0.465173 -0.762505 -0.449668
+vn 0.502276 -0.674824 -0.540677
+vn 0.733653 -0.255125 -0.629813
+vn 0.753522 -0.353281 -0.554434
+vn 0.753522 -0.353281 -0.554434
+vn 0.733653 -0.255125 -0.629813
+vn 0.844495 0.206437 -0.494177
+vn 0.896713 0.224754 -0.381302
+vn 0.896713 0.224754 -0.381302
+vn 0.844495 0.206437 -0.494177
+vn 0.670867 0.706019 -0.226881
+vn 0.658829 0.752107 -0.016710
+vn 0.658829 0.752107 -0.016710
+vn 0.670867 0.706019 -0.226881
+vn 0.140174 0.921579 -0.362000
+vn 0.079760 0.971974 -0.221145
+vn 0.079760 0.971974 -0.221145
+vn 0.140174 0.921579 -0.362000
+vn -0.182680 0.789102 -0.586469
+vn 0.079760 0.971974 -0.221145
+vn -0.182680 0.789102 -0.586469
+vn -0.262733 0.873879 -0.409033
+vn -0.182680 0.789102 -0.586469
+vn -0.169637 0.713594 -0.679711
+vn -0.322695 0.606992 -0.726243
+vn -0.385874 0.685415 -0.617501
+vn -0.385874 0.685415 -0.617501
+vn -0.322695 0.606992 -0.726243
+vn -0.471321 0.150507 -0.869025
+vn -0.565816 0.194223 -0.801330
+vn -0.565816 0.194223 -0.801330
+vn -0.471321 0.150507 -0.869025
+vn -0.480392 -0.394185 -0.783480
+vn -0.474061 -0.377860 -0.795291
+vn -0.474061 -0.377860 -0.795291
+vn -0.480392 -0.394185 -0.783480
+vn -0.402066 -0.663856 -0.630585
+vn -0.355599 -0.590667 -0.724336
+vn -0.355599 -0.590667 -0.724336
+vn -0.402066 -0.663856 -0.630585
+vn -0.283049 -0.757377 -0.588441
+vn -0.266207 -0.697127 -0.665693
+vn -0.266207 -0.697127 -0.665693
+vn -0.283049 -0.757377 -0.588441
+vn -0.138493 -0.749435 -0.647431
+vn -0.097487 -0.829887 -0.549348
+vn -0.097487 -0.829887 -0.549348
+vn -0.138493 -0.749435 -0.647431
+vn 0.134279 -0.713621 -0.687542
+vn 0.223692 -0.877690 -0.423819
+vn 0.223692 -0.877690 -0.423819
+vn 0.134279 -0.713621 -0.687542
+vn 0.450552 -0.590406 -0.669644
+vn 0.502276 -0.674824 -0.540677
+vn 0.502276 -0.674824 -0.540677
+vn 0.450552 -0.590406 -0.669644
+vn 0.689114 -0.175476 -0.703086
+vn 0.733653 -0.255125 -0.629813
+vn 0.733653 -0.255125 -0.629813
+vn 0.689114 -0.175476 -0.703086
+vn 0.656810 0.208507 -0.724655
+vn 0.844495 0.206437 -0.494177
+vn 0.844495 0.206437 -0.494177
+vn 0.656810 0.208507 -0.724655
+vn 0.451690 0.493203 -0.743456
+vn 0.670867 0.706019 -0.226881
+vn 0.670867 0.706019 -0.226881
+vn 0.451690 0.493203 -0.743456
+vn 0.085311 0.736455 -0.671086
+vn 0.140174 0.921579 -0.362000
+vn 0.140174 0.921579 -0.362000
+vn 0.085311 0.736455 -0.671086
+vn -0.169637 0.713594 -0.679711
+vn -0.182680 0.789102 -0.586469
+vn -0.169637 0.713594 -0.679711
+vn -0.167396 0.681765 -0.712162
+vn -0.306176 0.510388 -0.803592
+vn -0.322695 0.606992 -0.726243
+vn -0.322695 0.606992 -0.726243
+vn -0.306176 0.510388 -0.803592
+vn -0.421575 0.092973 -0.902015
+vn -0.471321 0.150507 -0.869025
+vn -0.471321 0.150507 -0.869025
+vn -0.421575 0.092973 -0.902015
+vn -0.467731 -0.339197 -0.816194
+vn -0.480392 -0.394185 -0.783480
+vn -0.480392 -0.394185 -0.783480
+vn -0.467731 -0.339197 -0.816194
+vn -0.375984 -0.612998 -0.694888
+vn -0.402066 -0.663856 -0.630585
+vn -0.402066 -0.663856 -0.630585
+vn -0.375984 -0.612998 -0.694888
+vn -0.192662 -0.711889 -0.675348
+vn -0.283049 -0.757377 -0.588441
+vn -0.283049 -0.757377 -0.588441
+vn -0.192662 -0.711889 -0.675348
+vn -0.138493 -0.749435 -0.647431
+vn -0.138493 -0.749435 -0.647431
+vn -0.192662 -0.711889 -0.675348
+vn 0.054787 -0.654867 -0.753756
+vn 0.134279 -0.713621 -0.687542
+vn 0.134279 -0.713621 -0.687542
+vn 0.054787 -0.654867 -0.753756
+vn 0.357679 -0.605383 -0.711039
+vn 0.450552 -0.590406 -0.669644
+vn 0.450552 -0.590406 -0.669644
+vn 0.357679 -0.605383 -0.711039
+vn 0.693304 -0.146815 -0.705532
+vn 0.689114 -0.175476 -0.703086
+vn 0.689114 -0.175476 -0.703086
+vn 0.693304 -0.146815 -0.705532
+vn 0.723808 0.298369 -0.622156
+vn 0.656810 0.208507 -0.724655
+vn 0.656810 0.208507 -0.724655
+vn 0.723808 0.298369 -0.622156
+vn 0.377931 0.489968 -0.785557
+vn 0.451690 0.493203 -0.743456
+vn 0.451690 0.493203 -0.743456
+vn 0.377931 0.489968 -0.785557
+vn 0.068198 0.645754 -0.760494
+vn 0.085311 0.736455 -0.671086
+vn 0.085311 0.736455 -0.671086
+vn 0.068198 0.645754 -0.760494
+vn -0.167396 0.681765 -0.712162
+vn -0.169637 0.713594 -0.679711
+vn -0.167396 0.681765 -0.712162
+vn -0.165330 0.654861 -0.737444
+vn -0.351386 0.491343 -0.796938
+vn -0.306176 0.510388 -0.803592
+vn -0.306176 0.510388 -0.803592
+vn -0.351386 0.491343 -0.796938
+vn -0.454394 0.102306 -0.884907
+vn -0.421575 0.092973 -0.902015
+vn -0.421575 0.092973 -0.902015
+vn -0.454394 0.102306 -0.884907
+vn -0.442345 -0.296219 -0.846514
+vn -0.467731 -0.339197 -0.816194
+vn -0.467731 -0.339197 -0.816194
+vn -0.442345 -0.296219 -0.846514
+vn -0.325783 -0.559583 -0.762058
+vn -0.375984 -0.612998 -0.694888
+vn -0.375984 -0.612998 -0.694888
+vn -0.325783 -0.559583 -0.762058
+vn -0.174921 -0.705926 -0.686347
+vn -0.192662 -0.711889 -0.675348
+vn -0.192662 -0.711889 -0.675348
+vn -0.174921 -0.705926 -0.686347
+vn 0.030725 -0.746706 -0.664444
+vn 0.054787 -0.654867 -0.753756
+vn 0.054787 -0.654867 -0.753756
+vn 0.030725 -0.746706 -0.664444
+vn 0.287435 -0.631043 -0.720532
+vn 0.357679 -0.605383 -0.711039
+vn 0.357679 -0.605383 -0.711039
+vn 0.287435 -0.631043 -0.720532
+vn 0.518721 -0.201062 -0.830965
+vn 0.693304 -0.146815 -0.705532
+vn 0.693304 -0.146815 -0.705532
+vn 0.518721 -0.201062 -0.830965
+vn 0.638529 0.115506 -0.760880
+vn 0.723808 0.298369 -0.622156
+vn 0.723808 0.298369 -0.622156
+vn 0.638529 0.115506 -0.760880
+vn 0.581393 0.291488 -0.759617
+vn 0.723808 0.298369 -0.622156
+vn 0.581393 0.291488 -0.759617
+vn 0.294380 0.505154 -0.811271
+vn 0.377931 0.489968 -0.785557
+vn 0.377931 0.489968 -0.785557
+vn 0.294380 0.505154 -0.811271
+vn 0.056026 0.593760 -0.802689
+vn 0.068198 0.645754 -0.760494
+vn 0.068198 0.645754 -0.760494
+vn 0.056026 0.593760 -0.802689
+vn -0.165330 0.654861 -0.737444
+vn -0.167396 0.681765 -0.712162
+vn -0.165330 0.654861 -0.737444
+vn -0.147238 0.547816 -0.823541
+vn -0.314353 0.396505 -0.862534
+vn -0.351386 0.491343 -0.796938
+vn -0.351386 0.491343 -0.796938
+vn -0.314353 0.396505 -0.862534
+vn -0.403319 0.108570 -0.908596
+vn -0.454394 0.102306 -0.884907
+vn -0.454394 0.102306 -0.884907
+vn -0.403319 0.108570 -0.908596
+vn -0.424418 -0.269184 -0.864528
+vn -0.442345 -0.296219 -0.846514
+vn -0.442345 -0.296219 -0.846514
+vn -0.424418 -0.269184 -0.864528
+vn -0.343176 -0.609565 -0.714605
+vn -0.325783 -0.559583 -0.762058
+vn -0.325783 -0.559583 -0.762058
+vn -0.343176 -0.609565 -0.714605
+vn -0.174551 -0.730926 -0.659757
+vn -0.174921 -0.705926 -0.686347
+vn -0.174921 -0.705926 -0.686347
+vn -0.174551 -0.730926 -0.659757
+vn 0.006623 -0.682395 -0.730953
+vn 0.030725 -0.746706 -0.664444
+vn 0.030725 -0.746706 -0.664444
+vn 0.006623 -0.682395 -0.730953
+vn 0.184528 -0.523818 -0.831604
+vn 0.287435 -0.631043 -0.720532
+vn 0.287435 -0.631043 -0.720532
+vn 0.184528 -0.523818 -0.831604
+vn 0.304626 -0.244732 -0.920494
+vn 0.518721 -0.201062 -0.830965
+vn 0.518721 -0.201062 -0.830965
+vn 0.304626 -0.244732 -0.920494
+vn 0.360313 -0.008623 -0.932792
+vn 0.638529 0.115506 -0.760880
+vn 0.638529 0.115506 -0.760880
+vn 0.360313 -0.008623 -0.932792
+vn 0.317767 0.222944 -0.921586
+vn 0.581393 0.291488 -0.759617
+vn 0.581393 0.291488 -0.759617
+vn 0.317767 0.222944 -0.921586
+vn 0.192905 0.446100 -0.873946
+vn 0.294380 0.505154 -0.811271
+vn 0.294380 0.505154 -0.811271
+vn 0.192905 0.446100 -0.873946
+vn 0.042505 0.546284 -0.836521
+vn 0.056026 0.593760 -0.802689
+vn 0.056026 0.593760 -0.802689
+vn 0.042505 0.546284 -0.836521
+vn -0.147238 0.547816 -0.823541
+vn -0.165330 0.654861 -0.737444
+vn -0.147238 0.547816 -0.823541
+vn -0.149840 0.490958 -0.858201
+vn -0.257358 0.297533 -0.919370
+vn -0.314353 0.396505 -0.862534
+vn -0.314353 0.396505 -0.862534
+vn -0.257358 0.297533 -0.919370
+vn -0.330214 0.099587 -0.938638
+vn -0.403319 0.108570 -0.908596
+vn -0.403319 0.108570 -0.908596
+vn -0.330214 0.099587 -0.938638
+vn -0.382920 -0.179207 -0.906232
+vn -0.424418 -0.269184 -0.864528
+vn -0.424418 -0.269184 -0.864528
+vn -0.382920 -0.179207 -0.906232
+vn -0.314313 -0.506127 -0.803146
+vn -0.343176 -0.609565 -0.714605
+vn -0.343176 -0.609565 -0.714605
+vn -0.314313 -0.506127 -0.803146
+vn -0.143654 -0.625740 -0.766689
+vn -0.174551 -0.730926 -0.659757
+vn -0.174551 -0.730926 -0.659757
+vn -0.143654 -0.625740 -0.766689
+vn -0.012057 -0.535388 -0.844520
+vn 0.006623 -0.682395 -0.730953
+vn 0.006623 -0.682395 -0.730953
+vn -0.012057 -0.535388 -0.844520
+vn 0.096725 -0.431595 -0.896867
+vn 0.184528 -0.523818 -0.831604
+vn 0.184528 -0.523818 -0.831604
+vn 0.096725 -0.431595 -0.896867
+vn 0.215183 -0.270667 -0.938316
+vn 0.304626 -0.244732 -0.920494
+vn 0.304626 -0.244732 -0.920494
+vn 0.215183 -0.270667 -0.938316
+vn 0.288848 -0.058847 -0.955565
+vn 0.360313 -0.008623 -0.932792
+vn 0.360313 -0.008623 -0.932792
+vn 0.288848 -0.058847 -0.955565
+vn 0.282000 0.203980 -0.937480
+vn 0.317767 0.222944 -0.921586
+vn 0.317767 0.222944 -0.921586
+vn 0.282000 0.203980 -0.937480
+vn 0.221508 0.478066 -0.849934
+vn 0.192905 0.446100 -0.873946
+vn 0.192905 0.446100 -0.873946
+vn 0.221508 0.478066 -0.849934
+vn 0.055818 0.592226 -0.803836
+vn 0.042505 0.546284 -0.836521
+vn 0.042505 0.546284 -0.836521
+vn 0.055818 0.592226 -0.803836
+vn -0.149840 0.490958 -0.858201
+vn -0.147238 0.547816 -0.823541
+vn -0.149840 0.490958 -0.858201
+vn -0.163702 0.433070 -0.886370
+vn -0.253477 0.285598 -0.924220
+vn -0.257358 0.297533 -0.919370
+vn -0.257358 0.297533 -0.919370
+vn -0.253477 0.285598 -0.924220
+vn -0.296461 0.114332 -0.948177
+vn -0.330214 0.099587 -0.938638
+vn -0.330214 0.099587 -0.938638
+vn -0.296461 0.114332 -0.948177
+vn -0.301371 -0.091069 -0.949148
+vn -0.382920 -0.179207 -0.906232
+vn -0.382920 -0.179207 -0.906232
+vn -0.301371 -0.091069 -0.949148
+vn -0.236556 -0.311152 -0.920449
+vn -0.314313 -0.506127 -0.803146
+vn -0.314313 -0.506127 -0.803146
+vn -0.236556 -0.311152 -0.920449
+vn -0.112929 -0.455361 -0.883116
+vn -0.143654 -0.625740 -0.766689
+vn -0.143654 -0.625740 -0.766689
+vn -0.112929 -0.455361 -0.883116
+vn -0.014658 -0.437878 -0.898915
+vn -0.012057 -0.535388 -0.844520
+vn -0.012057 -0.535388 -0.844520
+vn -0.014658 -0.437878 -0.898915
+vn 0.046904 -0.363167 -0.930543
+vn 0.096725 -0.431595 -0.896867
+vn 0.096725 -0.431595 -0.896867
+vn 0.046904 -0.363167 -0.930543
+vn 0.120231 -0.240312 -0.963221
+vn 0.215183 -0.270667 -0.938316
+vn 0.215183 -0.270667 -0.938316
+vn 0.120231 -0.240312 -0.963221
+vn 0.178683 -0.055186 -0.982358
+vn 0.288848 -0.058847 -0.955565
+vn 0.288848 -0.058847 -0.955565
+vn 0.178683 -0.055186 -0.982358
+vn 0.196791 0.144113 -0.969796
+vn 0.282000 0.203980 -0.937480
+vn 0.282000 0.203980 -0.937480
+vn 0.196791 0.144113 -0.969796
+vn 0.163229 0.353810 -0.920964
+vn 0.221508 0.478066 -0.849934
+vn 0.221508 0.478066 -0.849934
+vn 0.163229 0.353810 -0.920964
+vn 0.014658 0.488056 -0.872689
+vn 0.055818 0.592226 -0.803836
+vn 0.055818 0.592226 -0.803836
+vn 0.014658 0.488056 -0.872689
+vn -0.163702 0.433070 -0.886370
+vn -0.149840 0.490958 -0.858201
+vn -0.163702 0.433070 -0.886370
+vn -0.149491 0.304833 -0.940601
+vn -0.209223 0.221906 -0.952357
+vn -0.253477 0.285598 -0.924220
+vn -0.253477 0.285598 -0.924220
+vn -0.209223 0.221906 -0.952357
+vn -0.233778 0.094572 -0.967680
+vn -0.296461 0.114332 -0.948177
+vn -0.296461 0.114332 -0.948177
+vn -0.233778 0.094572 -0.967680
+vn -0.224586 -0.045694 -0.973382
+vn -0.301371 -0.091069 -0.949148
+vn -0.301371 -0.091069 -0.949148
+vn -0.224586 -0.045694 -0.973382
+vn -0.181107 -0.182442 -0.966393
+vn -0.236556 -0.311152 -0.920449
+vn -0.236556 -0.311152 -0.920449
+vn -0.181107 -0.182442 -0.966393
+vn -0.097438 -0.307264 -0.946623
+vn -0.112929 -0.455361 -0.883116
+vn -0.112929 -0.455361 -0.883116
+vn -0.097438 -0.307264 -0.946623
+vn -0.014980 -0.330841 -0.943568
+vn -0.014658 -0.437878 -0.898915
+vn -0.014658 -0.437878 -0.898915
+vn -0.014980 -0.330841 -0.943568
+vn 0.023141 -0.268489 -0.963005
+vn 0.046904 -0.363167 -0.930543
+vn 0.046904 -0.363167 -0.930543
+vn 0.023141 -0.268489 -0.963005
+vn 0.052860 -0.166427 -0.984636
+vn 0.120231 -0.240312 -0.963221
+vn 0.120231 -0.240312 -0.963221
+vn 0.052860 -0.166427 -0.984636
+vn 0.082076 -0.029355 -0.996194
+vn 0.178683 -0.055186 -0.982358
+vn 0.178683 -0.055186 -0.982358
+vn 0.082076 -0.029355 -0.996194
+vn 0.088078 0.090509 -0.991993
+vn 0.196791 0.144113 -0.969796
+vn 0.196791 0.144113 -0.969796
+vn 0.088078 0.090509 -0.991993
+vn 0.054988 0.197588 -0.978742
+vn 0.163229 0.353810 -0.920964
+vn 0.163229 0.353810 -0.920964
+vn 0.054988 0.197588 -0.978742
+vn -0.040803 0.297670 -0.953796
+vn 0.014658 0.488056 -0.872689
+vn 0.014658 0.488056 -0.872689
+vn -0.040803 0.297670 -0.953796
+vn -0.149491 0.304833 -0.940601
+vn -0.163702 0.433070 -0.886370
+vn -0.149491 0.304833 -0.940601
+vn -0.115546 0.153296 -0.981402
+vn -0.139220 0.116466 -0.983389
+vn -0.209223 0.221906 -0.952357
+vn -0.209223 0.221906 -0.952357
+vn -0.139220 0.116466 -0.983389
+vn -0.148997 0.056990 -0.987194
+vn -0.233778 0.094572 -0.967680
+vn -0.233778 0.094572 -0.967680
+vn -0.148997 0.056990 -0.987194
+vn -0.144492 -0.006623 -0.989484
+vn -0.224586 -0.045694 -0.973382
+vn -0.224586 -0.045694 -0.973382
+vn -0.144492 -0.006623 -0.989484
+vn -0.124934 -0.067568 -0.989862
+vn -0.181107 -0.182442 -0.966393
+vn -0.181107 -0.182442 -0.966393
+vn -0.124934 -0.067568 -0.989862
+vn -0.086505 -0.126678 -0.988165
+vn -0.097438 -0.307264 -0.946623
+vn -0.097438 -0.307264 -0.946623
+vn -0.086505 -0.126678 -0.988165
+vn -0.041805 -0.149526 -0.987874
+vn -0.014980 -0.330841 -0.943568
+vn -0.014980 -0.330841 -0.943568
+vn -0.041805 -0.149526 -0.987874
+vn -0.018028 -0.123000 -0.992243
+vn 0.023141 -0.268489 -0.963005
+vn 0.023141 -0.268489 -0.963005
+vn -0.018028 -0.123000 -0.992243
+vn -0.009836 -0.067008 -0.997704
+vn 0.052860 -0.166427 -0.984636
+vn 0.052860 -0.166427 -0.984636
+vn -0.009836 -0.067008 -0.997704
+vn -0.004757 -0.000710 -0.999988
+vn 0.082076 -0.029355 -0.996194
+vn 0.082076 -0.029355 -0.996194
+vn -0.004757 -0.000710 -0.999988
+vn -0.007589 0.056020 -0.998401
+vn 0.088078 0.090509 -0.991993
+vn 0.088078 0.090509 -0.991993
+vn -0.007589 0.056020 -0.998401
+vn -0.027915 0.103791 -0.994207
+vn 0.054988 0.197588 -0.978742
+vn 0.054988 0.197588 -0.978742
+vn -0.027915 0.103791 -0.994207
+vn -0.072218 0.145273 -0.986752
+vn -0.040803 0.297670 -0.953796
+vn -0.040803 0.297670 -0.953796
+vn -0.072218 0.145273 -0.986752
+vn -0.115546 0.153296 -0.981402
+vn -0.149491 0.304833 -0.940601
+vn -0.078039 0.020607 -0.996737
+vn -0.139220 0.116466 -0.983389
+vn -0.115546 0.153296 -0.981402
+vn -0.078039 0.020607 -0.996737
+vn -0.148997 0.056990 -0.987194
+vn -0.139220 0.116466 -0.983389
+vn -0.078039 0.020607 -0.996737
+vn -0.144492 -0.006623 -0.989484
+vn -0.148997 0.056990 -0.987194
+vn -0.078039 0.020607 -0.996737
+vn -0.124934 -0.067568 -0.989862
+vn -0.144492 -0.006623 -0.989484
+vn -0.078039 0.020607 -0.996737
+vn -0.086505 -0.126678 -0.988165
+vn -0.124934 -0.067568 -0.989862
+vn -0.078039 0.020607 -0.996737
+vn -0.041805 -0.149526 -0.987874
+vn -0.086505 -0.126678 -0.988165
+vn -0.078039 0.020607 -0.996737
+vn -0.018028 -0.123000 -0.992243
+vn -0.041805 -0.149526 -0.987874
+vn -0.078039 0.020607 -0.996737
+vn -0.009836 -0.067008 -0.997704
+vn -0.018028 -0.123000 -0.992243
+vn -0.078039 0.020607 -0.996737
+vn -0.004757 -0.000710 -0.999988
+vn -0.009836 -0.067008 -0.997704
+vn -0.078039 0.020607 -0.996737
+vn -0.007589 0.056020 -0.998401
+vn -0.004757 -0.000710 -0.999988
+vn -0.078039 0.020607 -0.996737
+vn -0.027915 0.103791 -0.994207
+vn -0.007589 0.056020 -0.998401
+vn -0.078039 0.020607 -0.996737
+vn -0.072218 0.145273 -0.986752
+vn -0.027915 0.103791 -0.994207
+vn -0.078039 0.020607 -0.996737
+vn -0.115546 0.153296 -0.981402
+vn -0.072218 0.145273 -0.986752
+f 6/2/1 1/1/2 2/3/3
+f 6/4/4 2/3/5 3/5/6
+f 6/6/7 3/5/8 4/7/9
+f 6/8/10 4/7/11 5/9/12
+f 6/12/13 7/11/14 8/13/15
+f 6/14/16 8/13/17 9/15/18
+f 6/16/19 9/15/20 10/17/21
+f 6/18/22 10/17/23 11/19/24
+f 6/20/25 11/19/26 1/21/27
+f 1/1/28 12/22/29 13/24/30 2/3/31
+f 2/3/32 13/24/33 14/25/34 3/5/35
+f 3/5/36 14/25/37 15/26/38 4/7/39
+f 4/7/40 15/26/41 16/27/42 5/9/43
+f 5/9/44 16/27/45 17/28/46 6/10/47
+f 6/10/48 17/28/49 18/29/50 7/11/51
+f 7/11/52 18/29/53 19/30/54 8/13/55
+f 8/13/56 19/30/57 20/31/58 9/15/59
+f 9/15/60 20/31/61 21/32/62 10/17/63
+f 10/17/64 21/32/65 22/33/66 11/19/67
+f 11/19/68 22/33/69 12/23/70 1/21/71
+f 12/22/72 23/34/73 24/35/74 13/24/75
+f 13/24/76 24/35/77 25/36/78 14/25/79
+f 14/25/80 25/36/81 26/37/82 15/26/83
+f 15/26/84 26/37/85 27/38/86 16/27/87
+f 16/27/88 27/38/89 28/39/90 17/28/91
+f 17/28/92 28/39/93 29/40/94 18/29/95
+f 18/29/96 29/40/97 30/41/98 19/30/99
+f 19/30/100 30/41/101 31/42/102 20/31/103
+f 20/31/104 31/42/105 32/43/106 21/32/107
+f 21/32/108 32/43/109 33/44/110 22/33/111
+f 22/33/112 33/44/113 23/45/114 12/23/115
+f 23/34/116 34/46/117 35/48/118 24/35/119
+f 24/35/120 35/48/121 36/49/122 25/36/123
+f 25/36/124 36/49/125 37/50/126 26/37/127
+f 26/37/128 37/50/129 38/51/130 27/38/131
+f 27/38/132 38/51/133 39/52/134 28/39/135
+f 28/39/136 39/52/137 40/53/138 29/40/139
+f 29/40/140 40/53/141 41/54/142 30/41/143
+f 30/41/144 41/54/145 42/55/146 31/42/147
+f 31/42/148 42/55/149 43/56/150 32/43/151
+f 32/43/152 43/56/153 44/57/154 33/44/155
+f 33/44/156 44/57/157 34/47/158 23/45/159
+f 34/46/160 45/58/161 46/59/162 35/48/163
+f 35/48/164 46/59/165 47/60/166 36/49/167
+f 36/49/168 47/60/169 48/61/170 37/50/171
+f 37/50/172 48/61/173 49/62/174 38/51/175
+f 38/51/176 49/62/177 50/63/178 39/52/179
+f 39/52/180 50/63/181 51/64/182 40/53/183
+f 40/53/184 51/64/185 52/65/186 41/54/187
+f 41/54/188 52/65/189 53/66/190 42/55/191
+f 42/55/192 53/66/193 54/67/194 43/56/195
+f 43/56/196 54/67/197 55/68/198 44/57/199
+f 44/57/200 55/68/201 45/69/202 34/47/203
+f 45/58/204 56/70/205 57/72/206 46/59/207
+f 46/59/208 57/72/209 58/73/210 47/60/211
+f 47/60/212 58/73/213 59/74/214 48/61/215
+f 48/61/216 59/74/217 60/75/218 49/62/219
+f 49/62/220 60/75/221 61/76/222 50/63/223
+f 50/63/224 61/76/225 62/77/226 51/64/227
+f 51/64/228 62/77/229 63/78/230 52/65/231
+f 52/65/232 63/78/233 64/79/234 53/66/235
+f 53/66/236 64/79/237 65/80/238 54/67/239
+f 54/67/240 65/80/241 66/81/242 55/68/243
+f 55/68/244 66/81/245 56/71/246 45/69/247
+f 56/70/248 67/82/249 68/84/250 57/72/251
+f 57/72/252 68/84/253 69/85/254 58/73/255
+f 58/73/256 69/85/257 70/86/258 59/74/259
+f 59/74/260 70/86/261 71/87/262 60/75/263
+f 60/75/264 71/87/265 72/88/266 61/76/267
+f 61/76/268 72/88/269 73/89/270 62/77/271
+f 62/77/272 73/89/273 74/90/274 63/78/275
+f 63/78/276 74/90/277 75/91/278 64/79/279
+f 64/79/280 75/91/281 76/92/282 65/80/283
+f 65/80/284 76/92/285 77/93/286 66/81/287
+f 66/81/288 77/93/289 67/83/290 56/71/291
+f 67/82/292 78/94/293 79/96/294 68/84/295
+f 68/84/296 79/96/297 80/97/298 69/85/299
+f 69/85/300 80/97/301 81/98/302 70/86/303
+f 70/86/304 81/98/305 82/99/306 71/87/307
+f 71/87/308 82/99/309 83/100/310 72/88/311
+f 72/88/312 83/100/313 84/101/314 73/89/315
+f 73/89/316 84/101/317 92/110/318 74/90/319
+f 74/90/320 92/110/321 93/111/322 75/91/323
+f 75/91/324 93/111/325 94/112/326 76/92/327
+f 76/92/328 94/112/329 95/113/330 77/93/331
+f 77/93/332 95/113/333 78/95/334 67/83/335
+f 78/94/336 85/102/337 86/104/338
+f 78/94/339 86/104/340 79/96/341
+f 79/96/342 86/104/343 87/105/344 80/97/345
+f 80/97/346 87/105/347 88/106/348 81/98/349
+f 81/98/350 88/106/351 89/107/352 82/99/353
+f 82/99/354 89/107/355 90/108/356 83/100/357
+f 83/100/358 90/108/359 91/109/360 84/101/361
+f 84/101/362 91/109/363 92/110/364
+f 95/113/365 85/103/366 78/95/367
+f 85/102/368 96/114/369 97/116/370 86/104/371
+f 86/104/372 97/116/373 98/117/374 87/105/375
+f 87/105/376 98/117/377 99/118/378 88/106/379
+f 88/106/380 99/118/381 100/119/382 89/107/383
+f 89/107/384 100/119/385 101/120/386 90/108/387
+f 90/108/388 101/120/389 102/121/390 91/109/391
+f 91/109/392 102/121/393 103/122/394 92/110/395
+f 92/110/396 103/122/397 104/123/398 93/111/399
+f 93/111/400 104/123/401 105/124/402 94/112/403
+f 94/112/404 105/124/405 106/125/406 95/113/407
+f 95/113/408 106/125/409 96/115/410 85/103/411
+f 96/114/412 107/126/413 108/128/414 97/116/415
+f 97/116/416 108/128/417 109/129/418 98/117/419
+f 98/117/420 109/129/421 110/130/422 99/118/423
+f 99/118/424 110/130/425 111/131/426 100/119/427
+f 100/119/428 111/131/429 112/132/430 101/120/431
+f 101/120/432 112/132/433 113/133/434 102/121/435
+f 102/121/436 113/133/437 114/134/438 103/122/439
+f 103/122/440 114/134/441 115/135/442 104/123/443
+f 104/123/444 115/135/445 116/136/446 105/124/447
+f 105/124/448 116/136/449 117/137/450 106/125/451
+f 106/125/452 117/137/453 107/127/454 96/115/455
+f 107/126/456 118/138/457 119/140/458 108/128/459
+f 108/128/460 119/140/461 120/141/462
+f 108/128/463 120/141/464 121/142/465 109/129/466
+f 109/129/467 121/142/468 122/143/469 110/130/470
+f 110/130/471 122/143/472 123/144/473 111/131/474
+f 111/131/475 123/144/476 124/145/477 112/132/478
+f 112/132/479 124/145/480 125/146/481 113/133/482
+f 113/133/483 125/146/484 126/147/485 114/134/486
+f 114/134/487 126/147/488 127/148/489 115/135/490
+f 115/135/491 127/148/492 128/149/493 116/136/494
+f 116/136/495 128/149/496 129/150/497 117/137/498
+f 117/137/499 129/150/500 118/139/501 107/127/502
+f 118/138/503 130/151/504 131/153/505 119/140/506
+f 119/140/507 131/153/508 132/154/509 120/141/510
+f 120/141/511 132/154/512 133/155/513 121/142/514
+f 121/142/515 133/155/516 134/156/517 122/143/518
+f 122/143/519 134/156/520 135/157/521 123/144/522
+f 123/144/523 135/157/524 136/158/525 124/145/526
+f 124/145/527 136/158/528 137/159/529 125/146/530
+f 125/146/531 137/159/532 138/160/533 126/147/534
+f 126/147/535 138/160/536 139/161/537 127/148/538
+f 127/148/539 139/161/540 140/162/541 128/149/542
+f 128/149/543 140/162/544 141/163/545 129/150/546
+f 129/150/547 141/163/548 130/152/549 118/139/550
+f 130/151/551 142/164/552 143/166/553 131/153/554
+f 131/153/555 143/166/556 144/167/557 132/154/558
+f 132/154/559 144/167/560 145/168/561 133/155/562
+f 133/155/563 145/168/564 146/169/565 134/156/566
+f 134/156/567 146/169/568 147/170/569 135/157/570
+f 135/157/571 147/170/572 148/171/573 136/158/574
+f 136/158/575 148/171/576 149/172/577 137/159/578
+f 137/159/579 149/172/580 150/173/581 138/160/582
+f 138/160/583 150/173/584 151/174/585 139/161/586
+f 139/161/587 151/174/588 152/175/589 140/162/590
+f 140/162/591 152/175/592 153/176/593 141/163/594
+f 141/163/595 153/176/596 142/165/597 130/152/598
+f 142/164/599 154/177/600 155/178/601 143/166/602
+f 143/166/603 155/178/604 156/179/605 144/167/606
+f 144/167/607 156/179/608 157/180/609 145/168/610
+f 145/168/611 157/180/612 158/181/613 146/169/614
+f 146/169/615 158/181/616 159/182/617 147/170/618
+f 147/170/619 159/182/620 160/183/621 148/171/622
+f 148/171/623 160/183/624 161/184/625 149/172/626
+f 149/172/627 161/184/628 162/185/629 150/173/630
+f 150/173/631 162/185/632 163/186/633 151/174/634
+f 151/174/635 163/186/636 164/187/637 152/175/638
+f 152/175/639 164/187/640 165/188/641 153/176/642
+f 153/176/643 165/188/644 154/189/645 142/165/646
+f 154/177/647 166/190/648 167/192/649 155/178/650
+f 155/178/651 167/192/652 168/193/653 156/179/654
+f 156/179/655 168/193/656 169/194/657 157/180/658
+f 157/180/659 169/194/660 170/195/661 158/181/662
+f 158/181/663 170/195/664 171/196/665 159/182/666
+f 159/182/667 171/196/668 172/197/669 160/183/670
+f 160/183/671 172/197/672 173/198/673 161/184/674
+f 161/184/675 173/198/676 174/199/677 162/185/678
+f 162/185/679 174/199/680 175/200/681 163/186/682
+f 163/186/683 175/200/684 176/201/685 164/187/686
+f 164/187/687 176/201/688 177/202/689 165/188/690
+f 165/188/691 177/202/692 166/191/693 154/189/694
+f 166/190/695 178/203/696 179/205/697 167/192/698
+f 167/192/699 179/205/700 180/206/701 168/193/702
+f 168/193/703 180/206/704 181/207/705 169/194/706
+f 169/194/707 181/207/708 182/208/709 170/195/710
+f 170/195/711 182/208/712 183/209/713 171/196/714
+f 171/196/715 183/209/716 185/211/717 172/197/718
+f 172/197/719 185/211/720 186/212/721 173/198/722
+f 173/198/723 186/212/724 187/213/725 174/199/726
+f 174/199/727 187/213/728 188/214/729 175/200/730
+f 175/200/731 188/214/732 189/215/733 176/201/734
+f 176/201/735 189/215/736 190/216/737 177/202/738
+f 177/202/739 190/216/740 178/204/741 166/191/742
+f 183/209/743 184/210/744 185/211/745
+f 178/203/746 203/217/747 191/218/748 179/205/749
+f 179/205/750 191/218/751 192/219/752 180/206/753
+f 180/206/754 192/219/755 193/220/756 181/207/757
+f 181/207/758 193/220/759 194/221/760 182/208/761
+f 182/208/762 194/221/763 195/222/764 183/209/765
+f 183/209/766 195/222/767 196/223/768 184/210/769
+f 184/210/770 196/223/771 197/224/772 185/211/773
+f 185/211/774 197/224/775 198/225/776 186/212/777
+f 186/212/778 198/225/779 199/226/780 187/213/781
+f 187/213/782 199/226/783 200/227/784 188/214/785
+f 188/214/786 200/227/787 201/228/788 189/215/789
+f 189/215/790 201/228/791 202/229/792 190/216/793
+f 190/216/794 202/229/795 203/230/796
+f 190/216/797 203/230/798 178/204/799
+f 203/217/800 216/231/801 204/232/802 191/218/803
+f 191/218/804 204/232/805 205/233/806 192/219/807
+f 192/219/808 205/233/809 206/234/810 193/220/811
+f 193/220/812 206/234/813 207/235/814 194/221/815
+f 194/221/816 207/235/817 208/236/818 195/222/819
+f 195/222/820 208/236/821 209/237/822 196/223/823
+f 196/223/824 209/237/825 210/238/826 197/224/827
+f 197/224/828 210/238/829 211/239/830 198/225/831
+f 198/225/832 211/239/833 212/240/834 199/226/835
+f 199/226/836 212/240/837 213/241/838 200/227/839
+f 200/227/840 213/241/841 214/242/842 201/228/843
+f 201/228/844 214/242/845 215/243/846 202/229/847
+f 202/229/848 215/243/849 216/244/850 203/230/851
+f 216/231/852 228/245/853 217/246/854 204/232/855
+f 204/232/856 217/246/857 218/247/858 205/233/859
+f 205/233/860 218/247/861 219/248/862 206/234/863
+f 206/234/864 219/248/865 220/249/866 207/235/867
+f 207/235/868 220/249/869 221/250/870 208/236/871
+f 208/236/872 221/250/873 209/237/874
+f 209/237/875 221/250/876 222/251/877 210/238/878
+f 210/238/879 222/251/880 223/252/881 211/239/882
+f 211/239/883 223/252/884 224/253/885 212/240/886
+f 212/240/887 224/253/888 225/254/889 213/241/890
+f 213/241/891 225/254/892 226/255/893 214/242/894
+f 214/242/895 226/255/896 227/256/897 215/243/898
+f 215/243/899 227/256/900 228/257/901 216/244/902
+f 228/245/903 241/258/904 229/259/905 217/246/906
+f 217/246/907 229/259/908 230/260/909 218/247/910
+f 218/247/911 230/260/912 231/261/913 219/248/914
+f 219/248/915 231/261/916 232/262/917 220/249/918
+f 220/249/919 232/262/920 233/263/921 221/250/922
+f 221/250/923 233/263/924 234/264/925 222/251/926
+f 222/251/927 234/264/928 235/265/929 223/252/930
+f 223/252/931 235/265/932 236/266/933 224/253/934
+f 224/253/935 236/266/936 237/267/937 225/254/938
+f 225/254/939 237/267/940 238/268/941
+f 225/254/942 238/268/943 239/269/944 226/255/945
+f 226/255/946 239/269/947 240/270/948 227/256/949
+f 227/256/950 240/270/951 241/271/952 228/257/953
+f 241/258/954 254/272/955 242/273/956 229/259/957
+f 229/259/958 242/273/959 243/274/960 230/260/961
+f 230/260/962 243/274/963 244/275/964 231/261/965
+f 231/261/966 244/275/967 245/276/968 232/262/969
+f 232/262/970 245/276/971 246/277/972 233/263/973
+f 233/263/974 246/277/975 247/278/976 234/264/977
+f 234/264/978 247/278/979 248/279/980 235/265/981
+f 235/265/982 248/279/983 249/280/984 236/266/985
+f 236/266/986 249/280/987 250/281/988 237/267/989
+f 237/267/990 250/281/991 251/282/992 238/268/993
+f 238/268/994 251/282/995 252/283/996 239/269/997
+f 239/269/998 252/283/999 253/284/1000 240/270/1001
+f 240/270/1002 253/284/1003 254/285/1004 241/271/1005
+f 254/272/1006 267/286/1007 255/287/1008 242/273/1009
+f 242/273/1010 255/287/1011 256/288/1012 243/274/1013
+f 243/274/1014 256/288/1015 257/289/1016 244/275/1017
+f 244/275/1018 257/289/1019 258/290/1020 245/276/1021
+f 245/276/1022 258/290/1023 259/291/1024 246/277/1025
+f 246/277/1026 259/291/1027 260/292/1028 247/278/1029
+f 247/278/1030 260/292/1031 261/293/1032 248/279/1033
+f 248/279/1034 261/293/1035 262/294/1036 249/280/1037
+f 249/280/1038 262/294/1039 263/295/1040 250/281/1041
+f 250/281/1042 263/295/1043 264/296/1044 251/282/1045
+f 251/282/1046 264/296/1047 265/297/1048 252/283/1049
+f 252/283/1050 265/297/1051 266/298/1052 253/284/1053
+f 253/284/1054 266/298/1055 267/299/1056 254/285/1057
+f 267/286/1058 280/300/1059 268/301/1060 255/287/1061
+f 255/287/1062 268/301/1063 269/302/1064 256/288/1065
+f 256/288/1066 269/302/1067 270/303/1068 257/289/1069
+f 257/289/1070 270/303/1071 271/304/1072 258/290/1073
+f 258/290/1074 271/304/1075 272/305/1076 259/291/1077
+f 259/291/1078 272/305/1079 273/306/1080 260/292/1081
+f 260/292/1082 273/306/1083 274/307/1084 261/293/1085
+f 261/293/1086 274/307/1087 275/308/1088 262/294/1089
+f 262/294/1090 275/308/1091 276/309/1092 263/295/1093
+f 263/295/1094 276/309/1095 277/310/1096 264/296/1097
+f 264/296/1098 277/310/1099 278/311/1100 265/297/1101
+f 265/297/1102 278/311/1103 279/312/1104 266/298/1105
+f 266/298/1106 279/312/1107 280/313/1108 267/299/1109
+f 280/300/1110 293/314/1111 281/315/1112 268/301/1113
+f 268/301/1114 281/315/1115 282/316/1116 269/302/1117
+f 269/302/1118 282/316/1119 283/317/1120 270/303/1121
+f 270/303/1122 283/317/1123 284/318/1124 271/304/1125
+f 271/304/1126 284/318/1127 285/319/1128 272/305/1129
+f 272/305/1130 285/319/1131 286/320/1132 273/306/1133
+f 273/306/1134 286/320/1135 287/321/1136 274/307/1137
+f 274/307/1138 287/321/1139 288/322/1140 275/308/1141
+f 275/308/1142 288/322/1143 289/323/1144 276/309/1145
+f 276/309/1146 289/323/1147 290/324/1148 277/310/1149
+f 277/310/1150 290/324/1151 291/325/1152 278/311/1153
+f 278/311/1154 291/325/1155 292/326/1156 279/312/1157
+f 279/312/1158 292/326/1159 293/327/1160 280/313/1161
+f 293/314/1162 306/328/1163 294/329/1164 281/315/1165
+f 281/315/1166 294/329/1167 295/330/1168 282/316/1169
+f 282/316/1170 295/330/1171 296/331/1172 283/317/1173
+f 283/317/1174 296/331/1175 297/332/1176 284/318/1177
+f 284/318/1178 297/332/1179 298/333/1180 285/319/1181
+f 285/319/1182 298/333/1183 299/334/1184 286/320/1185
+f 286/320/1186 299/334/1187 300/335/1188 287/321/1189
+f 287/321/1190 300/335/1191 301/336/1192 288/322/1193
+f 288/322/1194 301/336/1195 302/337/1196 289/323/1197
+f 289/323/1198 302/337/1199 303/338/1200 290/324/1201
+f 290/324/1202 303/338/1203 304/339/1204 291/325/1205
+f 291/325/1206 304/339/1207 305/340/1208 292/326/1209
+f 292/326/1210 305/340/1211 306/341/1212 293/327/1213
+f 307/342/1214 294/329/1215 306/328/1216
+f 307/343/1217 295/330/1218 294/329/1219
+f 307/344/1220 296/331/1221 295/330/1222
+f 307/345/1223 297/332/1224 296/331/1225
+f 307/346/1226 298/333/1227 297/332/1228
+f 307/347/1229 299/334/1230 298/333/1231
+f 307/348/1232 300/335/1233 299/334/1234
+f 307/349/1235 301/336/1236 300/335/1237
+f 307/350/1238 302/337/1239 301/336/1240
+f 307/351/1241 303/338/1242 302/337/1243
+f 307/352/1244 304/339/1245 303/338/1246
+f 307/353/1247 305/340/1248 304/339/1249
+f 307/354/1250 306/341/1251 305/340/1252
diff --git a/KaplaDemo/externalIP/resources/bullet.obj b/KaplaDemo/externalIP/resources/bullet.obj
new file mode 100644
index 00000000..199ffdbc
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/bullet.obj
@@ -0,0 +1,763 @@
+# Wavefront OBJ exported by MilkShape 3D
+
+v 0.126627 -0.015394 0.000504
+v 0.109628 -0.015394 0.063504
+v 0.063128 -0.015394 0.110004
+v 0.000127 -0.015394 0.127004
+v -0.062872 -0.015394 0.110004
+v -0.109373 -0.015394 0.063504
+v -0.126373 -0.015394 0.000504
+v -0.109373 -0.015394 -0.062496
+v -0.062872 -0.015394 -0.108996
+v 0.000127 -0.015394 -0.125996
+v 0.063128 -0.015394 -0.108996
+v 0.109628 -0.015394 -0.062496
+v 0.126627 0.004106 0.000504
+v 0.109628 0.004106 0.063504
+v 0.063128 0.004106 0.110004
+v 0.000127 0.004106 0.127004
+v -0.062872 0.004106 0.110004
+v -0.109373 0.004106 0.063504
+v -0.126373 0.004106 0.000504
+v -0.109373 0.004106 -0.062496
+v -0.062872 0.004106 -0.108996
+v 0.000127 0.004106 -0.125996
+v 0.063128 0.004106 -0.108996
+v 0.109628 0.004106 -0.062496
+v 0.131627 0.011606 0.000504
+v 0.114127 0.011606 0.066004
+v 0.065628 0.011606 0.114504
+v 0.000127 0.011606 0.132004
+v -0.065373 0.011606 0.114504
+v -0.113873 0.011606 0.066004
+v -0.131372 0.011606 0.000504
+v -0.113873 0.011606 -0.064996
+v -0.065373 0.011606 -0.113496
+v 0.000127 0.011606 -0.130996
+v 0.065628 0.011606 -0.113496
+v 0.114127 0.011606 -0.064996
+v 0.128128 0.172606 0.000504
+v 0.110627 0.172606 0.064504
+v 0.064127 0.172606 0.111004
+v 0.000127 0.172606 0.128504
+v -0.063873 0.172606 0.111004
+v -0.110372 0.172606 0.064504
+v -0.127872 0.172606 0.000504
+v -0.110372 0.172606 -0.063496
+v -0.063873 0.172606 -0.109996
+v 0.000127 0.172606 -0.127496
+v 0.064127 0.172606 -0.109996
+v 0.110627 0.172606 -0.063496
+v 0.116627 0.333606 0.000504
+v 0.101128 0.333606 0.058504
+v 0.058127 0.333606 0.101504
+v 0.000127 0.333606 0.117004
+v -0.057873 0.333606 0.101504
+v -0.100872 0.333606 0.058504
+v -0.116373 0.333606 0.000504
+v -0.100872 0.333606 -0.057496
+v -0.057873 0.333606 -0.100496
+v 0.000127 0.333606 -0.115996
+v 0.058127 0.333606 -0.100496
+v 0.101128 0.333606 -0.057496
+v 0.094127 0.494606 0.000504
+v 0.081628 0.494606 0.047504
+v 0.047128 0.494606 0.082004
+v 0.000127 0.494606 0.094504
+v -0.046872 0.494606 0.082004
+v -0.081373 0.494606 0.047504
+v -0.093873 0.494606 0.000504
+v -0.081373 0.494606 -0.046496
+v -0.046872 0.494606 -0.080996
+v 0.000127 0.494606 -0.093496
+v 0.047128 0.494606 -0.080996
+v 0.081628 0.494606 -0.046496
+v 0.067127 0.655606 0.000504
+v 0.058127 0.655606 0.034004
+v 0.033628 0.655606 0.058504
+v 0.000127 0.655606 0.067504
+v -0.033373 0.655606 0.058504
+v -0.057873 0.655606 0.034004
+v -0.066873 0.655606 0.000504
+v -0.057873 0.655606 -0.032996
+v -0.033373 0.655606 -0.057496
+v 0.000127 0.655606 -0.066496
+v 0.033628 0.655606 -0.057496
+v 0.058127 0.655606 -0.032996
+v 0.035627 0.816606 0.000504
+v 0.031127 0.816606 0.018504
+v 0.018127 0.816606 0.031504
+v 0.000127 0.816606 0.036004
+v -0.017873 0.816606 0.031504
+v -0.030873 0.816606 0.018504
+v -0.035373 0.816606 0.000504
+v -0.030873 0.816606 -0.017496
+v -0.017873 0.816606 -0.030496
+v 0.000127 0.816606 -0.034996
+v 0.018127 0.816606 -0.030496
+v 0.031127 0.816606 -0.017496
+v 0.026627 0.828606 0.000504
+v 0.023127 0.828606 0.013504
+v 0.013127 0.828606 0.023504
+v 0.000127 0.828606 0.027004
+v -0.012873 0.828606 0.023504
+v -0.022873 0.828606 0.013504
+v -0.026373 0.828606 0.000504
+v -0.022873 0.828606 -0.012496
+v -0.012873 0.828606 -0.022496
+v 0.000127 0.828606 -0.025996
+v 0.013127 0.828606 -0.022496
+v 0.023127 0.828606 -0.012496
+v 0.010627 0.836606 0.000504
+v 0.009127 0.836606 0.006004
+v 0.005627 0.836606 0.009504
+v 0.000127 0.836606 0.011004
+v -0.005373 0.836606 0.009504
+v -0.008872 0.836606 0.006004
+v -0.010372 0.836606 0.000504
+v -0.008872 0.836606 -0.004996
+v -0.005373 0.836606 -0.008496
+v 0.000127 0.836606 -0.009996
+v 0.005627 0.836606 -0.008496
+v 0.009127 0.836606 -0.004996
+v 0.000127 0.836606 0.000504
+v 0.000127 0.836606 0.006004
+v 0.000127 0.836606 -0.008496
+v 0.000127 0.836606 -0.004996
+v 0.000127 0.836606 0.009504
+v -0.065373 -0.022894 0.114504
+v 0.000127 -0.022894 0.132004
+v 0.065628 -0.022894 0.114504
+v 0.114127 -0.022894 0.066004
+v 0.131627 -0.022894 0.000504
+v 0.114127 -0.022894 -0.064996
+v 0.065628 -0.022894 -0.113496
+v 0.000127 -0.022894 -0.130996
+v -0.065373 -0.022894 -0.113496
+v -0.113873 -0.022894 -0.064996
+v -0.131372 -0.022894 0.000504
+v -0.113873 -0.022894 0.066004
+v -0.062872 -0.182894 0.110004
+v 0.000127 -0.182894 0.127004
+v 0.063128 -0.182894 0.110004
+v 0.109628 -0.182894 0.063504
+v 0.126627 -0.182894 0.000504
+v 0.109628 -0.182894 -0.062496
+v 0.063128 -0.182894 -0.108996
+v 0.000127 -0.182894 -0.125996
+v -0.062872 -0.182894 -0.108996
+v -0.109373 -0.182894 -0.062496
+v -0.126373 -0.182894 0.000504
+v -0.109373 -0.182894 0.063504
+v -0.059873 -0.277894 0.104504
+v 0.000127 -0.277894 0.120504
+v 0.060127 -0.277894 0.104504
+v 0.104127 -0.277894 0.060504
+v 0.120127 -0.277894 0.000504
+v 0.104127 -0.277894 -0.059496
+v 0.060127 -0.277894 -0.103496
+v 0.000127 -0.277894 -0.119496
+v -0.059873 -0.277894 -0.103496
+v -0.103873 -0.277894 -0.059496
+v -0.119872 -0.277894 0.000504
+v -0.103873 -0.277894 0.060504
+v -0.048372 -0.457894 0.084504
+v 0.000127 -0.457894 0.097504
+v 0.048627 -0.457894 0.084504
+v 0.084127 -0.457894 0.049004
+v 0.097127 -0.457894 0.000504
+v 0.084127 -0.457894 -0.047996
+v 0.048627 -0.457894 -0.083496
+v 0.000127 -0.457894 -0.096496
+v -0.048372 -0.457894 -0.083496
+v -0.083873 -0.457894 -0.047996
+v -0.096873 -0.457894 0.000504
+v -0.083873 -0.457894 0.049004
+v -0.041873 -0.470394 0.073004
+v 0.000127 -0.470394 0.084504
+v 0.042128 -0.470394 0.073004
+v 0.072627 -0.470394 0.042504
+v 0.084127 -0.470394 0.000504
+v 0.072627 -0.470394 -0.041496
+v 0.042128 -0.470394 -0.071996
+v 0.000127 -0.470394 -0.083496
+v -0.041873 -0.470394 -0.071996
+v -0.072373 -0.470394 -0.041496
+v -0.083873 -0.470394 0.000504
+v -0.072373 -0.470394 0.042504
+v 0.000127 -0.470394 0.000504
+v 0.000127 -0.470394 0.042504
+v 0.000127 -0.470394 0.073004
+v 0.000127 -0.470394 -0.071996
+v 0.000127 -0.470394 -0.041496
+# 190 vertices
+
+vt 0.000000 1.000000
+# 1 texture coordinates
+
+vn 0.830163 0.297447 -0.471545
+vn 0.823333 -0.295545 -0.484537
+vn 0.955802 -0.293896 -0.008215
+vn 0.955801 0.293900 0.008215
+vn 0.830164 -0.297444 0.471546
+vn 0.823332 0.295549 0.484536
+vn 0.484537 -0.295548 0.823332
+vn 0.471545 0.297448 0.830162
+vn -0.000000 -0.193594 0.981082
+vn -0.000000 0.390797 0.920477
+vn -0.484536 -0.295550 0.823331
+vn -0.471544 0.297451 0.830162
+vn -0.830162 -0.297448 0.471546
+vn -0.823331 0.295551 0.484537
+vn -0.955801 -0.293898 -0.008216
+vn -0.955800 0.293902 0.008216
+vn -0.823332 -0.295548 -0.484537
+vn -0.830161 0.297452 -0.471545
+vn -0.471545 -0.297448 -0.830163
+vn -0.484536 0.295553 -0.823330
+vn -0.000000 -0.390792 -0.920479
+vn -0.000000 0.193597 -0.981081
+vn 0.471546 -0.297445 -0.830163
+vn 0.484537 0.295552 -0.823331
+vn 0.833165 -0.286523 -0.473013
+vn 0.959065 -0.283061 0.008422
+vn 0.826404 -0.284623 0.485846
+vn 0.473013 -0.286524 0.833164
+vn -0.000000 -0.384176 0.923260
+vn -0.473012 -0.286527 0.833164
+vn -0.826403 -0.284626 0.485846
+vn -0.959065 -0.283062 0.008422
+vn -0.833164 -0.286527 -0.473012
+vn -0.485846 -0.284628 -0.826402
+vn -0.000000 -0.178360 -0.983965
+vn 0.485847 -0.284626 -0.826402
+vn 0.864239 0.046656 -0.500914
+vn 0.998915 0.046560 -0.000077
+vn 0.864350 0.046361 0.500750
+vn 0.500914 0.046656 0.864238
+vn -0.000000 0.039090 0.999236
+vn -0.500914 0.046656 0.864238
+vn -0.864350 0.046362 0.500749
+vn -0.998915 0.046561 -0.000076
+vn -0.864238 0.046657 -0.500914
+vn -0.500750 0.046362 -0.864350
+vn -0.000000 0.054029 -0.998539
+vn 0.500750 0.046362 -0.864350
+vn 0.861447 0.103957 -0.497093
+vn 0.994530 0.104438 -0.001459
+vn 0.861164 0.103933 0.497589
+vn 0.497093 0.103957 0.861447
+vn -0.000000 0.092886 0.995677
+vn -0.497094 0.103957 0.861447
+vn -0.861164 0.103933 0.497589
+vn -0.994530 0.104437 -0.001459
+vn -0.861447 0.103957 -0.497093
+vn -0.497589 0.103933 -0.861164
+vn -0.000000 0.115966 -0.993253
+vn 0.497589 0.103933 -0.861164
+vn 0.856156 0.151747 -0.493933
+vn 0.988391 0.151930 0.000038
+vn 0.856409 0.152001 0.493416
+vn 0.493933 0.151746 0.856156
+vn -0.000000 0.147267 0.989097
+vn -0.493933 0.151746 0.856156
+vn -0.856409 0.152000 0.493416
+vn -0.988391 0.151930 0.000039
+vn -0.856156 0.151746 -0.493934
+vn -0.493417 0.152000 -0.856409
+vn -0.000000 0.156590 -0.987664
+vn 0.493417 0.152000 -0.856409
+vn 0.853321 0.178267 -0.489964
+vn 0.983932 0.178524 -0.002637
+vn 0.852360 0.177811 0.491798
+vn 0.489966 0.178267 0.853320
+vn -0.000000 0.174531 0.984652
+vn -0.489965 0.178267 0.853320
+vn -0.852360 0.177811 0.491798
+vn -0.983932 0.178524 -0.002636
+vn -0.853320 0.178267 -0.489966
+vn -0.491800 0.177811 -0.852359
+vn 0.000000 0.182510 -0.983204
+vn 0.491799 0.177811 -0.852360
+vn 0.786929 0.414037 -0.457510
+vn 0.912605 0.408762 -0.008151
+vn 0.793599 0.418021 0.442108
+vn 0.457512 0.414038 0.786928
+vn 0.000001 0.335466 0.942052
+vn -0.457512 0.414038 0.786927
+vn -0.793599 0.418021 0.442108
+vn -0.912604 0.408763 -0.008150
+vn -0.786929 0.414037 -0.457512
+vn -0.442109 0.418022 -0.793598
+vn 0.000001 0.479299 -0.877652
+vn 0.442108 0.418022 -0.793599
+vn 0.538684 0.775595 -0.329047
+vn 0.637027 0.770739 -0.012563
+vn 0.558900 0.772092 0.302496
+vn 0.329046 0.775594 0.538686
+vn 0.000001 0.720369 0.693591
+vn -0.329047 0.775594 0.538685
+vn -0.558901 0.772092 0.302496
+vn -0.637026 0.770740 -0.012564
+vn -0.538684 0.775595 -0.329047
+vn -0.302497 0.772093 -0.558899
+vn 0.000001 0.816671 -0.577104
+vn 0.302495 0.772093 -0.558900
+vn 0.189358 0.972724 -0.133981
+vn 0.228679 0.973286 -0.020494
+vn 0.209130 0.972972 0.097928
+vn 0.160700 0.960516 0.227122
+vn 0.000001 0.952575 0.304303
+vn -0.160701 0.960516 0.227120
+vn -0.209130 0.972972 0.097927
+vn -0.228678 0.973286 -0.020494
+vn -0.189360 0.972724 -0.133980
+vn -0.097929 0.972972 -0.209130
+vn 0.000001 0.973449 -0.228902
+vn 0.097929 0.972972 -0.209130
+vn 0.000000 1.000000 0.000000
+vn -0.834538 0.282304 0.473129
+vn -0.486469 0.280396 0.827482
+vn -0.000000 0.172427 0.985022
+vn 0.486469 0.280394 0.827482
+vn 0.834539 0.282300 0.473129
+vn 0.960343 0.278712 -0.007840
+vn 0.827484 0.280391 -0.486469
+vn 0.473130 0.282301 -0.834538
+vn -0.000000 0.381406 -0.924408
+vn -0.473129 0.282304 -0.834538
+vn -0.827483 0.280394 -0.486469
+vn -0.960342 0.278713 -0.007840
+vn -0.864736 -0.049355 0.499795
+vn -0.499753 -0.048748 0.864795
+vn -0.000000 -0.055268 0.998472
+vn 0.499753 -0.048748 0.864795
+vn 0.864737 -0.049355 0.499795
+vn 0.998769 -0.049607 0.000148
+vn 0.864795 -0.048748 -0.499753
+vn 0.499795 -0.049355 -0.864736
+vn -0.000000 -0.043945 -0.999034
+vn -0.499795 -0.049355 -0.864737
+vn -0.864795 -0.048748 -0.499753
+vn -0.998769 -0.049608 0.000149
+vn -0.862059 -0.096388 0.497557
+vn -0.497350 -0.096915 0.862119
+vn 0.000000 -0.107417 0.994214
+vn 0.497350 -0.096915 0.862119
+vn 0.862059 -0.096389 0.497557
+vn 0.995258 -0.097267 0.000526
+vn 0.862119 -0.096915 -0.497351
+vn 0.497557 -0.096389 -0.862059
+vn 0.000000 -0.087104 -0.996199
+vn -0.497557 -0.096388 -0.862059
+vn -0.862120 -0.096916 -0.497350
+vn -0.995258 -0.097267 0.000526
+vn -0.764118 -0.454627 0.457644
+vn -0.433085 -0.455591 0.777736
+vn 0.000000 -0.555385 0.831594
+vn 0.433085 -0.455591 0.777736
+vn 0.764119 -0.454626 0.457643
+vn 0.891196 -0.453435 0.012870
+vn 0.777736 -0.455591 -0.433086
+vn 0.457643 -0.454625 -0.764120
+vn 0.000000 -0.344639 -0.938735
+vn -0.457643 -0.454625 -0.764120
+vn -0.777736 -0.455591 -0.433086
+vn -0.891196 -0.453437 0.012869
+vn -0.300920 -0.929676 0.212484
+vn -0.187024 -0.896646 0.401309
+vn 0.000000 -0.871161 0.490997
+vn 0.187024 -0.896646 0.401309
+vn 0.300920 -0.929676 0.212484
+vn 0.368540 -0.929036 0.032700
+vn 0.334928 -0.929226 -0.156087
+vn 0.212484 -0.929676 -0.300920
+vn 0.000000 -0.872898 -0.487902
+vn -0.212484 -0.929676 -0.300920
+vn -0.334927 -0.929226 -0.156088
+vn -0.368539 -0.929037 0.032700
+vn 0.000000 -1.000000 0.000000
+# 182 normals
+
+g default
+s 1
+f 12/1/1 24/1/2 13/1/3
+f 12/1/1 13/1/3 1/1/4
+f 1/1/4 13/1/3 14/1/5
+f 1/1/4 14/1/5 2/1/6
+f 2/1/6 14/1/5 15/1/7
+f 2/1/6 15/1/7 3/1/8
+f 3/1/8 15/1/7 16/1/9
+f 3/1/8 16/1/9 4/1/10
+f 16/1/9 17/1/11 5/1/12
+f 16/1/9 5/1/12 4/1/10
+f 17/1/11 18/1/13 6/1/14
+f 17/1/11 6/1/14 5/1/12
+f 18/1/13 19/1/15 7/1/16
+f 18/1/13 7/1/16 6/1/14
+f 19/1/15 20/1/17 8/1/18
+f 19/1/15 8/1/18 7/1/16
+f 20/1/17 21/1/19 9/1/20
+f 20/1/17 9/1/20 8/1/18
+f 21/1/19 22/1/21 10/1/22
+f 21/1/19 10/1/22 9/1/20
+f 10/1/22 22/1/21 23/1/23
+f 10/1/22 23/1/23 11/1/24
+f 11/1/24 23/1/23 24/1/2
+f 11/1/24 24/1/2 12/1/1
+f 24/1/2 36/1/25 25/1/26
+f 24/1/2 25/1/26 13/1/3
+f 13/1/3 25/1/26 26/1/27
+f 13/1/3 26/1/27 14/1/5
+f 14/1/5 26/1/27 27/1/28
+f 14/1/5 27/1/28 15/1/7
+f 15/1/7 27/1/28 28/1/29
+f 15/1/7 28/1/29 16/1/9
+f 28/1/29 29/1/30 17/1/11
+f 28/1/29 17/1/11 16/1/9
+f 29/1/30 30/1/31 18/1/13
+f 29/1/30 18/1/13 17/1/11
+f 30/1/31 31/1/32 19/1/15
+f 30/1/31 19/1/15 18/1/13
+f 31/1/32 32/1/33 20/1/17
+f 31/1/32 20/1/17 19/1/15
+f 32/1/33 33/1/34 21/1/19
+f 32/1/33 21/1/19 20/1/17
+f 33/1/34 34/1/35 22/1/21
+f 33/1/34 22/1/21 21/1/19
+f 22/1/21 34/1/35 35/1/36
+f 22/1/21 35/1/36 23/1/23
+f 23/1/23 35/1/36 36/1/25
+f 23/1/23 36/1/25 24/1/2
+f 36/1/25 48/1/37 37/1/38
+f 36/1/25 37/1/38 25/1/26
+f 25/1/26 37/1/38 38/1/39
+f 25/1/26 38/1/39 26/1/27
+f 26/1/27 38/1/39 39/1/40
+f 26/1/27 39/1/40 27/1/28
+f 27/1/28 39/1/40 40/1/41
+f 27/1/28 40/1/41 28/1/29
+f 40/1/41 41/1/42 29/1/30
+f 40/1/41 29/1/30 28/1/29
+f 41/1/42 42/1/43 30/1/31
+f 41/1/42 30/1/31 29/1/30
+f 42/1/43 43/1/44 31/1/32
+f 42/1/43 31/1/32 30/1/31
+f 43/1/44 44/1/45 32/1/33
+f 43/1/44 32/1/33 31/1/32
+f 44/1/45 45/1/46 33/1/34
+f 44/1/45 33/1/34 32/1/33
+f 45/1/46 46/1/47 34/1/35
+f 45/1/46 34/1/35 33/1/34
+f 34/1/35 46/1/47 47/1/48
+f 34/1/35 47/1/48 35/1/36
+f 35/1/36 47/1/48 48/1/37
+f 35/1/36 48/1/37 36/1/25
+f 48/1/37 60/1/49 49/1/50
+f 48/1/37 49/1/50 37/1/38
+f 37/1/38 49/1/50 50/1/51
+f 37/1/38 50/1/51 38/1/39
+f 38/1/39 50/1/51 51/1/52
+f 38/1/39 51/1/52 39/1/40
+f 39/1/40 51/1/52 52/1/53
+f 39/1/40 52/1/53 40/1/41
+f 52/1/53 53/1/54 41/1/42
+f 52/1/53 41/1/42 40/1/41
+f 53/1/54 54/1/55 42/1/43
+f 53/1/54 42/1/43 41/1/42
+f 54/1/55 55/1/56 43/1/44
+f 54/1/55 43/1/44 42/1/43
+f 55/1/56 56/1/57 44/1/45
+f 55/1/56 44/1/45 43/1/44
+f 56/1/57 57/1/58 45/1/46
+f 56/1/57 45/1/46 44/1/45
+f 57/1/58 58/1/59 46/1/47
+f 57/1/58 46/1/47 45/1/46
+f 46/1/47 58/1/59 59/1/60
+f 46/1/47 59/1/60 47/1/48
+f 47/1/48 59/1/60 60/1/49
+f 47/1/48 60/1/49 48/1/37
+f 60/1/49 72/1/61 61/1/62
+f 60/1/49 61/1/62 49/1/50
+f 49/1/50 61/1/62 62/1/63
+f 49/1/50 62/1/63 50/1/51
+f 50/1/51 62/1/63 63/1/64
+f 50/1/51 63/1/64 51/1/52
+f 51/1/52 63/1/64 64/1/65
+f 51/1/52 64/1/65 52/1/53
+f 64/1/65 65/1/66 53/1/54
+f 64/1/65 53/1/54 52/1/53
+f 65/1/66 66/1/67 54/1/55
+f 65/1/66 54/1/55 53/1/54
+f 66/1/67 67/1/68 55/1/56
+f 66/1/67 55/1/56 54/1/55
+f 67/1/68 68/1/69 56/1/57
+f 67/1/68 56/1/57 55/1/56
+f 68/1/69 69/1/70 57/1/58
+f 68/1/69 57/1/58 56/1/57
+f 69/1/70 70/1/71 58/1/59
+f 69/1/70 58/1/59 57/1/58
+f 58/1/59 70/1/71 71/1/72
+f 58/1/59 71/1/72 59/1/60
+f 59/1/60 71/1/72 72/1/61
+f 59/1/60 72/1/61 60/1/49
+f 72/1/61 84/1/73 73/1/74
+f 72/1/61 73/1/74 61/1/62
+f 61/1/62 73/1/74 74/1/75
+f 61/1/62 74/1/75 62/1/63
+f 62/1/63 74/1/75 75/1/76
+f 62/1/63 75/1/76 63/1/64
+f 63/1/64 75/1/76 76/1/77
+f 63/1/64 76/1/77 64/1/65
+f 76/1/77 77/1/78 65/1/66
+f 76/1/77 65/1/66 64/1/65
+f 77/1/78 78/1/79 66/1/67
+f 77/1/78 66/1/67 65/1/66
+f 78/1/79 79/1/80 67/1/68
+f 78/1/79 67/1/68 66/1/67
+f 79/1/80 80/1/81 68/1/69
+f 79/1/80 68/1/69 67/1/68
+f 80/1/81 81/1/82 69/1/70
+f 80/1/81 69/1/70 68/1/69
+f 81/1/82 82/1/83 70/1/71
+f 81/1/82 70/1/71 69/1/70
+f 70/1/71 82/1/83 83/1/84
+f 70/1/71 83/1/84 71/1/72
+f 71/1/72 83/1/84 84/1/73
+f 71/1/72 84/1/73 72/1/61
+f 84/1/73 96/1/85 85/1/86
+f 84/1/73 85/1/86 73/1/74
+f 73/1/74 85/1/86 86/1/87
+f 73/1/74 86/1/87 74/1/75
+f 74/1/75 86/1/87 87/1/88
+f 74/1/75 87/1/88 75/1/76
+f 75/1/76 87/1/88 88/1/89
+f 75/1/76 88/1/89 76/1/77
+f 88/1/89 89/1/90 77/1/78
+f 88/1/89 77/1/78 76/1/77
+f 89/1/90 90/1/91 78/1/79
+f 89/1/90 78/1/79 77/1/78
+f 90/1/91 91/1/92 79/1/80
+f 90/1/91 79/1/80 78/1/79
+f 91/1/92 92/1/93 80/1/81
+f 91/1/92 80/1/81 79/1/80
+f 92/1/93 93/1/94 81/1/82
+f 92/1/93 81/1/82 80/1/81
+f 93/1/94 94/1/95 82/1/83
+f 93/1/94 82/1/83 81/1/82
+f 82/1/83 94/1/95 95/1/96
+f 82/1/83 95/1/96 83/1/84
+f 83/1/84 95/1/96 96/1/85
+f 83/1/84 96/1/85 84/1/73
+f 96/1/85 108/1/97 97/1/98
+f 96/1/85 97/1/98 85/1/86
+f 85/1/86 97/1/98 98/1/99
+f 85/1/86 98/1/99 86/1/87
+f 86/1/87 98/1/99 99/1/100
+f 86/1/87 99/1/100 87/1/88
+f 87/1/88 99/1/100 100/1/101
+f 87/1/88 100/1/101 88/1/89
+f 100/1/101 101/1/102 89/1/90
+f 100/1/101 89/1/90 88/1/89
+f 101/1/102 102/1/103 90/1/91
+f 101/1/102 90/1/91 89/1/90
+f 102/1/103 103/1/104 91/1/92
+f 102/1/103 91/1/92 90/1/91
+f 103/1/104 104/1/105 92/1/93
+f 103/1/104 92/1/93 91/1/92
+f 104/1/105 105/1/106 93/1/94
+f 104/1/105 93/1/94 92/1/93
+f 105/1/106 106/1/107 94/1/95
+f 105/1/106 94/1/95 93/1/94
+f 94/1/95 106/1/107 107/1/108
+f 94/1/95 107/1/108 95/1/96
+f 95/1/96 107/1/108 108/1/97
+f 95/1/96 108/1/97 96/1/85
+f 108/1/97 120/1/109 109/1/110
+f 108/1/97 109/1/110 97/1/98
+f 97/1/98 109/1/110 110/1/111
+f 97/1/98 110/1/111 98/1/99
+f 98/1/99 110/1/111 111/1/112
+f 98/1/99 111/1/112 99/1/100
+f 99/1/100 111/1/112 112/1/113
+f 99/1/100 112/1/113 100/1/101
+f 112/1/113 113/1/114 101/1/102
+f 112/1/113 101/1/102 100/1/101
+f 113/1/114 114/1/115 102/1/103
+f 113/1/114 102/1/103 101/1/102
+f 114/1/115 115/1/116 103/1/104
+f 114/1/115 103/1/104 102/1/103
+f 115/1/116 116/1/117 104/1/105
+f 115/1/116 104/1/105 103/1/104
+f 116/1/117 117/1/118 105/1/106
+f 116/1/117 105/1/106 104/1/105
+f 117/1/118 118/1/119 106/1/107
+f 117/1/118 106/1/107 105/1/106
+f 106/1/107 118/1/119 119/1/120
+f 106/1/107 119/1/120 107/1/108
+f 107/1/108 119/1/120 120/1/109
+f 107/1/108 120/1/109 108/1/97
+f 124/1/121 123/1/121 117/1/118
+f 124/1/121 117/1/118 116/1/117
+f 121/1/121 124/1/121 116/1/117
+f 121/1/121 116/1/117 115/1/116
+f 122/1/121 121/1/121 115/1/116
+f 122/1/121 115/1/116 114/1/115
+f 125/1/121 122/1/121 114/1/115
+f 125/1/121 114/1/115 113/1/114
+f 119/1/120 123/1/121 124/1/121
+f 119/1/120 124/1/121 120/1/109
+f 120/1/109 124/1/121 121/1/121
+f 120/1/109 121/1/121 109/1/110
+f 109/1/110 121/1/121 122/1/121
+f 109/1/110 122/1/121 110/1/111
+f 110/1/111 122/1/121 125/1/121
+f 110/1/111 125/1/121 111/1/112
+f 123/1/121 119/1/120 118/1/119
+f 123/1/121 118/1/119 117/1/118
+f 112/1/113 111/1/112 125/1/121
+f 112/1/113 125/1/121 113/1/114
+f 5/1/12 6/1/14 137/1/122
+f 5/1/12 137/1/122 126/1/123
+f 4/1/10 5/1/12 126/1/123
+f 4/1/10 126/1/123 127/1/124
+f 128/1/125 3/1/8 4/1/10
+f 128/1/125 4/1/10 127/1/124
+f 129/1/126 2/1/6 3/1/8
+f 129/1/126 3/1/8 128/1/125
+f 130/1/127 1/1/4 2/1/6
+f 130/1/127 2/1/6 129/1/126
+f 131/1/128 12/1/1 1/1/4
+f 131/1/128 1/1/4 130/1/127
+f 132/1/129 11/1/24 12/1/1
+f 132/1/129 12/1/1 131/1/128
+f 133/1/130 10/1/22 11/1/24
+f 133/1/130 11/1/24 132/1/129
+f 9/1/20 10/1/22 133/1/130
+f 9/1/20 133/1/130 134/1/131
+f 8/1/18 9/1/20 134/1/131
+f 8/1/18 134/1/131 135/1/132
+f 7/1/16 8/1/18 135/1/132
+f 7/1/16 135/1/132 136/1/133
+f 6/1/14 7/1/16 136/1/133
+f 6/1/14 136/1/133 137/1/122
+f 126/1/123 137/1/122 149/1/134
+f 126/1/123 149/1/134 138/1/135
+f 127/1/124 126/1/123 138/1/135
+f 127/1/124 138/1/135 139/1/136
+f 140/1/137 128/1/125 127/1/124
+f 140/1/137 127/1/124 139/1/136
+f 141/1/138 129/1/126 128/1/125
+f 141/1/138 128/1/125 140/1/137
+f 142/1/139 130/1/127 129/1/126
+f 142/1/139 129/1/126 141/1/138
+f 143/1/140 131/1/128 130/1/127
+f 143/1/140 130/1/127 142/1/139
+f 144/1/141 132/1/129 131/1/128
+f 144/1/141 131/1/128 143/1/140
+f 145/1/142 133/1/130 132/1/129
+f 145/1/142 132/1/129 144/1/141
+f 134/1/131 133/1/130 145/1/142
+f 134/1/131 145/1/142 146/1/143
+f 135/1/132 134/1/131 146/1/143
+f 135/1/132 146/1/143 147/1/144
+f 136/1/133 135/1/132 147/1/144
+f 136/1/133 147/1/144 148/1/145
+f 137/1/122 136/1/133 148/1/145
+f 137/1/122 148/1/145 149/1/134
+f 138/1/135 149/1/134 161/1/146
+f 138/1/135 161/1/146 150/1/147
+f 139/1/136 138/1/135 150/1/147
+f 139/1/136 150/1/147 151/1/148
+f 152/1/149 140/1/137 139/1/136
+f 152/1/149 139/1/136 151/1/148
+f 153/1/150 141/1/138 140/1/137
+f 153/1/150 140/1/137 152/1/149
+f 154/1/151 142/1/139 141/1/138
+f 154/1/151 141/1/138 153/1/150
+f 155/1/152 143/1/140 142/1/139
+f 155/1/152 142/1/139 154/1/151
+f 156/1/153 144/1/141 143/1/140
+f 156/1/153 143/1/140 155/1/152
+f 157/1/154 145/1/142 144/1/141
+f 157/1/154 144/1/141 156/1/153
+f 146/1/143 145/1/142 157/1/154
+f 146/1/143 157/1/154 158/1/155
+f 147/1/144 146/1/143 158/1/155
+f 147/1/144 158/1/155 159/1/156
+f 148/1/145 147/1/144 159/1/156
+f 148/1/145 159/1/156 160/1/157
+f 149/1/134 148/1/145 160/1/157
+f 149/1/134 160/1/157 161/1/146
+f 150/1/147 161/1/146 173/1/158
+f 150/1/147 173/1/158 162/1/159
+f 151/1/148 150/1/147 162/1/159
+f 151/1/148 162/1/159 163/1/160
+f 164/1/161 152/1/149 151/1/148
+f 164/1/161 151/1/148 163/1/160
+f 165/1/162 153/1/150 152/1/149
+f 165/1/162 152/1/149 164/1/161
+f 166/1/163 154/1/151 153/1/150
+f 166/1/163 153/1/150 165/1/162
+f 167/1/164 155/1/152 154/1/151
+f 167/1/164 154/1/151 166/1/163
+f 168/1/165 156/1/153 155/1/152
+f 168/1/165 155/1/152 167/1/164
+f 169/1/166 157/1/154 156/1/153
+f 169/1/166 156/1/153 168/1/165
+f 158/1/155 157/1/154 169/1/166
+f 158/1/155 169/1/166 170/1/167
+f 159/1/156 158/1/155 170/1/167
+f 159/1/156 170/1/167 171/1/168
+f 160/1/157 159/1/156 171/1/168
+f 160/1/157 171/1/168 172/1/169
+f 161/1/146 160/1/157 172/1/169
+f 161/1/146 172/1/169 173/1/158
+f 162/1/159 173/1/158 185/1/170
+f 162/1/159 185/1/170 174/1/171
+f 163/1/160 162/1/159 174/1/171
+f 163/1/160 174/1/171 175/1/172
+f 176/1/173 164/1/161 163/1/160
+f 176/1/173 163/1/160 175/1/172
+f 177/1/174 165/1/162 164/1/161
+f 177/1/174 164/1/161 176/1/173
+f 178/1/175 166/1/163 165/1/162
+f 178/1/175 165/1/162 177/1/174
+f 179/1/176 167/1/164 166/1/163
+f 179/1/176 166/1/163 178/1/175
+f 180/1/177 168/1/165 167/1/164
+f 180/1/177 167/1/164 179/1/176
+f 181/1/178 169/1/166 168/1/165
+f 181/1/178 168/1/165 180/1/177
+f 170/1/167 169/1/166 181/1/178
+f 170/1/167 181/1/178 182/1/179
+f 171/1/168 170/1/167 182/1/179
+f 171/1/168 182/1/179 183/1/180
+f 172/1/169 171/1/168 183/1/180
+f 172/1/169 183/1/180 184/1/181
+f 173/1/158 172/1/169 184/1/181
+f 173/1/158 184/1/181 185/1/170
+f 182/1/179 189/1/182 190/1/182
+f 182/1/179 190/1/182 183/1/180
+f 183/1/180 190/1/182 186/1/182
+f 183/1/180 186/1/182 184/1/181
+f 184/1/181 186/1/182 187/1/182
+f 184/1/181 187/1/182 185/1/170
+f 185/1/170 187/1/182 188/1/182
+f 185/1/170 188/1/182 174/1/171
+f 190/1/182 189/1/182 180/1/177
+f 190/1/182 180/1/177 179/1/176
+f 186/1/182 190/1/182 179/1/176
+f 186/1/182 179/1/176 178/1/175
+f 187/1/182 186/1/182 178/1/175
+f 187/1/182 178/1/175 177/1/174
+f 188/1/182 187/1/182 177/1/174
+f 188/1/182 177/1/174 176/1/173
+f 189/1/182 182/1/179 181/1/178
+f 189/1/182 181/1/178 180/1/177
+f 174/1/171 188/1/182 176/1/173
+f 174/1/171 176/1/173 175/1/172
+# 376 triangles in group
+
+# 376 triangles total
+
diff --git a/KaplaDemo/externalIP/resources/car02_diffuse.bmp b/KaplaDemo/externalIP/resources/car02_diffuse.bmp
new file mode 100644
index 00000000..b67bc7d7
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/car02_diffuse.bmp
Binary files differ
diff --git a/KaplaDemo/externalIP/resources/car2.raw b/KaplaDemo/externalIP/resources/car2.raw
new file mode 100644
index 00000000..225d2e2d
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/car2.raw
Binary files differ
diff --git a/KaplaDemo/externalIP/resources/car_window_diffuse.bmp b/KaplaDemo/externalIP/resources/car_window_diffuse.bmp
new file mode 100644
index 00000000..ffa1aa0d
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/car_window_diffuse.bmp
Binary files differ
diff --git a/KaplaDemo/externalIP/resources/checker_tex0.jpg b/KaplaDemo/externalIP/resources/checker_tex0.jpg
new file mode 100644
index 00000000..83e1a632
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/checker_tex0.jpg
Binary files differ
diff --git a/KaplaDemo/externalIP/resources/checker_tex1.jpg b/KaplaDemo/externalIP/resources/checker_tex1.jpg
new file mode 100644
index 00000000..e024abfb
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/checker_tex1.jpg
Binary files differ
diff --git a/KaplaDemo/externalIP/resources/checker_tex2.jpg b/KaplaDemo/externalIP/resources/checker_tex2.jpg
new file mode 100644
index 00000000..21e891b8
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/checker_tex2.jpg
Binary files differ
diff --git a/KaplaDemo/externalIP/resources/checker_tex3.jpg b/KaplaDemo/externalIP/resources/checker_tex3.jpg
new file mode 100644
index 00000000..7e61a1a8
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/checker_tex3.jpg
Binary files differ
diff --git a/KaplaDemo/externalIP/resources/checker_tex4.jpg b/KaplaDemo/externalIP/resources/checker_tex4.jpg
new file mode 100644
index 00000000..dd5560a9
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/checker_tex4.jpg
Binary files differ
diff --git a/KaplaDemo/externalIP/resources/crosshair.bmp b/KaplaDemo/externalIP/resources/crosshair.bmp
new file mode 100644
index 00000000..a89f6372
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/crosshair.bmp
Binary files differ
diff --git a/KaplaDemo/externalIP/resources/fxaa.fs b/KaplaDemo/externalIP/resources/fxaa.fs
new file mode 100644
index 00000000..39550067
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/fxaa.fs
@@ -0,0 +1,1416 @@
+#define FXAA_PC 1
+#define FXAA_GLSL_130 1
+#define FXAA_LINEAR 0
+
+//#define FXAA_QUALITY__EDGE_THRESHOLD (1.0/8.0)
+//#define FXAA_QUALITY__EDGE_THRESHOLD_MIN (1.0/16.0)
+//#define FXAA_QUALITY__SUBPIX_CAP (3.0/4.0)
+//#define FXAA_QUALITY__SUBPIX_TRIM (1.0/2.0)
+
+#define FXAA_QUALITY__EDGE_THRESHOLD (1.0/8.0)
+#define FXAA_QUALITY__EDGE_THRESHOLD_MIN (1.0/16.0)
+#define FXAA_QUALITY__SUBPIX_CAP (7.0/8.0)
+#define FXAA_QUALITY__SUBPIX_TRIM (1.0/2.0)
+
+/*============================================================================
+
+
+ NVIDIA FXAA III.8 by TIMOTHY LOTTES
+
+
+------------------------------------------------------------------------------
+COPYRIGHT (C) 2010, 2011 NVIDIA CORPORATION. ALL RIGHTS RESERVED.
+------------------------------------------------------------------------------
+TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
+*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA
+OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR
+CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR
+LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION,
+OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE
+THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+
+------------------------------------------------------------------------------
+ INTEGRATION CHECKLIST
+------------------------------------------------------------------------------
+(1.)
+In the shader source,
+setup defines for the desired configuration.
+Example,
+
+ #define FXAA_PC 1
+ #define FXAA_HLSL_3 1
+ #define FXAA_LINEAR 1
+
+(2.)
+Then include this file,
+
+ #include "Fxaa3.h"
+
+(3.)
+Then call the FXAA pixel shader from within your desired shader,
+
+ return FxaaPixelShader(pos, posPos, tex, rcpFrame, rcpFrameOpt);
+
+(4.)
+Insure pass prior to FXAA outputs RGBL.
+See next section.
+
+(5.)
+Setup engine to provide "rcpFrame" and "rcpFrameOpt" constants.
+Not using constants will result in a performance loss.
+
+ // {x_} = 1.0/screenWidthInPixels
+ // {_y} = 1.0/screenHeightInPixels
+ float2 rcpFrame
+
+ // This must be from a constant/uniform.
+ // {x___} = 2.0/screenWidthInPixels
+ // {_y__} = 2.0/screenHeightInPixels
+ // {__z_} = 0.5/screenWidthInPixels
+ // {___w} = 0.5/screenHeightInPixels
+ float4 rcpFrameOpt
+
+(6.)
+Have FXAA vertex shader run as a full screen triangle,
+and output "pos" and "posPos" such that inputs in the pixel shader provide,
+
+ // {xy} = center of pixel
+ float2 pos,
+
+ // {xy__} = upper left of pixel
+ // {__zw} = lower right of pixel
+ float4 posPos,
+
+(7.)
+Insure the texture sampler used by FXAA is set to bilinear filtering.
+
+
+------------------------------------------------------------------------------
+ INTEGRATION - RGBL AND COLORSPACE
+------------------------------------------------------------------------------
+FXAA3 requires RGBL as input.
+
+RGB should be LDR (low dynamic range).
+Specifically do FXAA after tonemapping.
+
+RGB data as returned by a texture fetch can be linear or non-linear.
+Note an "sRGB format" texture counts as linear,
+because the result of a texture fetch is linear data.
+Regular "RGBA8" textures in the sRGB colorspace are non-linear.
+If a texture fetch results linear data the following is required,
+
+ #define FXAA_LINEAR 1
+
+Otherwise,
+
+ #define FXAA_LINEAR 0
+
+Luma must be stored in the alpha channel prior to running FXAA.
+This luma value must be gamma 2.0 encoded if using FXAA_LINEAR 1.
+If using FXAA_LINEAR 0, luma should match the perceptual space used for RGB.
+
+Example pass before FXAA where output is gamma 2.0 encoded,
+
+ color.rgb = ToneMap(color.rgb); // linear color output
+ color.rgb = sqrt(color.rgb); // gamma 2.0 color output
+ return color;
+
+To use FXAA,
+
+ color.rgb = ToneMap(color.rgb); // linear color output
+ color.rgb = sqrt(color.rgb); // gamma 2.0 color output
+ color.a = dot(color.rgb, float3(0.299, 0.587, 0.114)); // compute luma
+ return color;
+
+Another example where output is linear encoded,
+say for instance writing to an sRGB formated render target,
+where the render target does the conversion back to sRGB after blending,
+
+ color.rgb = ToneMap(color.rgb); // linear color output
+ return color;
+
+To use FXAA,
+
+ color.rgb = ToneMap(color.rgb); // linear color output
+ color.a = sqrt(dot(color.rgb, float3(0.299, 0.587, 0.114))); // compute luma
+ return color;
+
+Getting luma correct is required for the algorithm to work correctly.
+
+
+------------------------------------------------------------------------------
+ COMPLEX INTEGRATION
+------------------------------------------------------------------------------
+Q. What if the engine is blending into RGB before wanting to run FXAA?
+
+A. In the last opaque pass prior to FXAA,
+ have the pass write out luma into alpha.
+ Then blend into RGB only.
+ FXAA should be able to run ok
+ assuming the blending pass did not any add aliasing.
+ This should be the common case for particles and common blending passes.
+
+============================================================================*/
+
+/*============================================================================
+
+ INTEGRATION KNOBS
+
+============================================================================*/
+//
+// FXAA_PS3 and FXAA_360 choose the console algorithm (FXAA3 CONSOLE).
+//
+// 1 = Use API.
+// 0 = Don't use API.
+//
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_PS3
+ #define FXAA_PS3 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_360
+ #define FXAA_360 0
+#endif
+/*==========================================================================*/
+#ifndef FXAA_PC
+ //
+ // FXAA Quality
+ // The high quality PC algorithm.
+ //
+ #define FXAA_PC 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_PC_CONSOLE
+ //
+ // The console algorithm for PC is included
+ // for developers targeting really low spec machines.
+ //
+ #define FXAA_PC_CONSOLE 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_GLSL_120
+ #define FXAA_GLSL_120 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_GLSL_130
+ #define FXAA_GLSL_130 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_HLSL_3
+ #define FXAA_HLSL_3 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_HLSL_4
+ #define FXAA_HLSL_4 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_HLSL_5
+ #define FXAA_HLSL_5 0
+#endif
+/*==========================================================================*/
+#ifndef FXAA_EARLY_EXIT
+ //
+ // Controls algorithm's early exit path.
+ // On PS3 turning this on adds 2 cycles to the shader.
+ // On 360 turning this off adds 10ths of a millisecond to the shader.
+ // Turning this off on console will result in a more blurry image.
+ // So this defaults to on.
+ //
+ // 1 = On.
+ // 0 = Off.
+ //
+ #define FXAA_EARLY_EXIT 1
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_DISCARD
+ //
+ // Only valid for PC OpenGL currently.
+ //
+ // 1 = Use discard on pixels which don't need AA.
+ // For APIs which enable concurrent TEX+ROP from same surface.
+ // 0 = Return unchanged color on pixels which don't need AA.
+ //
+ #define FXAA_DISCARD 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_LINEAR
+ //
+ // 0 = Work in non-linear color space.
+ // Use this for standard 32-bit RGBA formats.
+ //
+ // 1 = Work in RGB=linear, A=non-linear luma.
+ // Use this for sRGB and FP16 formats.
+ // Works with either FXAA_ALGORITHM = 1 or 0.
+ //
+ #define FXAA_LINEAR 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_FAST_PIXEL_OFFSET
+ //
+ // Used for GLSL 120 only.
+ //
+ // 1 = GL API supports fast pixel offsets
+ // 0 = do not use fast pixel offsets
+ //
+ #ifdef GL_EXT_gpu_shader4
+ #define FXAA_FAST_PIXEL_OFFSET 1
+ #endif
+ #ifdef GL_NV_gpu_shader5
+ #define FXAA_FAST_PIXEL_OFFSET 1
+ #endif
+ #ifdef GL_ARB_gpu_shader5
+ #define FXAA_FAST_PIXEL_OFFSET 1
+ #endif
+ #ifndef FXAA_FAST_PIXEL_OFFSET
+ #define FXAA_FAST_PIXEL_OFFSET 0
+ #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_GATHER4_ALPHA
+ //
+ // 1 = API supports gather4 on alpha channel.
+ // 0 = API does not support gather4 on alpha channel.
+ //
+ #if (FXAA_HLSL_5 == 1)
+ #define FXAA_GATHER4_ALPHA 1
+ #endif
+ #ifdef GL_ARB_gpu_shader5
+ #define FXAA_GATHER4_ALPHA 1
+ #endif
+ #ifdef GL_NV_gpu_shader5
+ #define FXAA_GATHER4_ALPHA 1
+ #endif
+ #ifndef FXAA_GATHER4_ALPHA
+ #define FXAA_GATHER4_ALPHA 0
+ #endif
+#endif
+
+/*============================================================================
+ FXAA CONSOLE - TUNING KNOBS
+============================================================================*/
+#ifndef FXAA_CONSOLE__EDGE_SHARPNESS
+ //
+ // Consoles the sharpness of edges.
+ //
+ // Due to the PS3 being ALU bound,
+ // there are only two safe values here: 4 and 8.
+ // These options use the shaders ability to a free *|/ by 4|8.
+ //
+ // 8.0 is sharper
+ // 4.0 is softer
+ //
+ #if 1
+ #define FXAA_CONSOLE__EDGE_SHARPNESS 8.0
+ #else
+ #define FXAA_CONSOLE__EDGE_SHARPNESS 4.0
+ #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_CONSOLE__EDGE_THRESHOLD
+ //
+ // The minimum amount of local contrast required to apply algorithm.
+ // The console setting has a different mapping than the quality setting.
+ //
+ // This only applies when FXAA_EARLY_EXIT is 1.
+ //
+ // Due to the PS3 being ALU bound,
+ // there are only two safe values here: 0.25 and 0.125.
+ // These options use the shaders ability to a free *|/ by 4|8.
+ //
+ // 0.125 leaves less aliasing, but is softer
+ // 0.25 leaves more aliasing, and is sharper
+ //
+ #if 1
+ #define FXAA_CONSOLE__EDGE_THRESHOLD 0.125
+ #else
+ #define FXAA_CONSOLE__EDGE_THRESHOLD 0.25
+ #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_CONSOLE__EDGE_THRESHOLD_MIN
+ //
+ // Trims the algorithm from processing darks.
+ // The console setting has a different mapping than the quality setting.
+ //
+ // This only applies when FXAA_EARLY_EXIT is 1.
+ //
+ // This does not apply to PS3.
+ // PS3 was simplified to avoid more shader instructions.
+ //
+ #define FXAA_CONSOLE__EDGE_THRESHOLD_MIN 0.05
+#endif
+
+/*============================================================================
+ FXAA QUALITY - TUNING KNOBS
+============================================================================*/
+#ifndef FXAA_QUALITY__EDGE_THRESHOLD
+ //
+ // The minimum amount of local contrast required to apply algorithm.
+ //
+ // 1/3 - too little
+ // 1/4 - low quality
+ // 1/6 - default
+ // 1/8 - high quality
+ // 1/16 - overkill
+ //
+ #define FXAA_QUALITY__EDGE_THRESHOLD (1.0/6.0)
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_QUALITY__EDGE_THRESHOLD_MIN
+ //
+ // Trims the algorithm from processing darks.
+ //
+ // 1/32 - visible limit
+ // 1/16 - high quality
+ // 1/12 - upper limit (default, the start of visible unfiltered edges)
+ //
+ #define FXAA_QUALITY__EDGE_THRESHOLD_MIN (1.0/12.0)
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_QUALITY__SUBPIX_CAP
+ //
+ // Insures fine detail is not completely removed.
+ // This partly overrides FXAA_SUBPIX_TRIM.
+ //
+ // 3/4 - default amount of filtering
+ // 7/8 - high amount of filtering
+ // 1 - no capping of filtering
+ //
+ #define FXAA_QUALITY__SUBPIX_CAP (3.0/4.0)
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_QUALITY__SUBPIX_TRIM
+ //
+ // Controls removal of sub-pixel aliasing,
+ //
+ // 1/2 - low removal (sharper but more sub-pixel aliasing)
+ // 1/3 - medium removal
+ // 1/4 - default removal
+ // 1/8 - high removal
+ // 0 - complete removal (softer but less sub-pixel aliasing)
+ //
+ #define FXAA_QUALITY__SUBPIX_TRIM (1.0/4.0)
+#endif
+
+
+/*============================================================================
+
+ API PORTING
+
+============================================================================*/
+#if FXAA_GLSL_120
+ // Requires,
+ // #version 120
+ // And at least,
+ // #extension GL_EXT_gpu_shader4 : enable
+ // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)
+ #define half float
+ #define half2 vec2
+ #define half3 vec3
+ #define half4 vec4
+ #define int2 ivec2
+ #define float2 vec2
+ #define float3 vec3
+ #define float4 vec4
+ #define FxaaInt2 ivec2
+ #define FxaaFloat2 vec2
+ #define FxaaFloat3 vec3
+ #define FxaaFloat4 vec4
+ #define FxaaDiscard discard
+ #define FxaaDot3(a, b) dot(a, b)
+ #define FxaaSat(x) clamp(x, 0.0, 1.0)
+ #define FxaaLerp(x,y,s) mix(x,y,s)
+ #define FxaaTex sampler2D
+ #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)
+ #if (FXAA_FAST_PIXEL_OFFSET == 1)
+ #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)
+ #else
+ #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)
+ #endif
+ #if (FXAA_GATHER4_ALPHA == 1)
+ // use #extension GL_ARB_gpu_shader5 : enable
+ #define FxaaTexAlpha4(t, p, r) textureGather(t, p, 3)
+ #define FxaaTexOffAlpha4(t, p, o, r) textureGatherOffset(t, p, o, 3)
+ #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#if FXAA_GLSL_130
+ // Requires "#version 130" or better
+ #define half float
+ #define half2 vec2
+ #define half3 vec3
+ #define half4 vec4
+ #define int2 ivec2
+ #define float2 vec2
+ #define float3 vec3
+ #define float4 vec4
+ #define FxaaInt2 ivec2
+ #define FxaaFloat2 vec2
+ #define FxaaFloat3 vec3
+ #define FxaaFloat4 vec4
+ #define FxaaDiscard discard
+ #define FxaaDot3(a, b) dot(a, b)
+ #define FxaaSat(x) clamp(x, 0.0, 1.0)
+ #define FxaaLerp(x,y,s) mix(x,y,s)
+ #define FxaaTex sampler2D
+ #define FxaaTexTop(t, p) textureLod(t, p, 0.0)
+ #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)
+ #if (FXAA_GATHER4_ALPHA == 1)
+ // use #extension GL_ARB_gpu_shader5 : enable
+ #define FxaaTexAlpha4(t, p, r) textureGather(t, p, 3)
+ #define FxaaTexOffAlpha4(t, p, o, r) textureGatherOffset(t, p, o, 3)
+ #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_HLSL_3 == 1) || (FXAA_360 == 1)
+ #define int2 float2
+ #define FxaaInt2 float2
+ #define FxaaFloat2 float2
+ #define FxaaFloat3 float3
+ #define FxaaFloat4 float4
+ #define FxaaDiscard clip(-1)
+ #define FxaaDot3(a, b) dot(a, b)
+ #define FxaaSat(x) saturate(x)
+ #define FxaaLerp(x,y,s) lerp(x,y,s)
+ #define FxaaTex sampler2D
+ #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))
+ #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))
+#endif
+/*--------------------------------------------------------------------------*/
+#if FXAA_HLSL_4
+ #define FxaaInt2 int2
+ #define FxaaFloat2 float2
+ #define FxaaFloat3 float3
+ #define FxaaFloat4 float4
+ #define FxaaDiscard clip(-1)
+ #define FxaaDot3(a, b) dot(a, b)
+ #define FxaaSat(x) saturate(x)
+ #define FxaaLerp(x,y,s) lerp(x,y,s)
+ struct FxaaTex { SamplerState smpl; Texture2D tex; };
+ #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)
+ #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)
+#endif
+/*--------------------------------------------------------------------------*/
+#if FXAA_HLSL_5
+ #define FxaaInt2 int2
+ #define FxaaFloat2 float2
+ #define FxaaFloat3 float3
+ #define FxaaFloat4 float4
+ #define FxaaDiscard clip(-1)
+ #define FxaaDot3(a, b) dot(a, b)
+ #define FxaaSat(x) saturate(x)
+ #define FxaaLerp(x,y,s) lerp(x,y,s)
+ struct FxaaTex { SamplerState smpl; Texture2D tex; };
+ #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)
+ #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)
+ #define FxaaTexAlpha4(t, p, r) t.tex.GatherAlpha(t.smpl, p)
+ #define FxaaTexOffAlpha4(t, p, o, r) t.tex.GatherAlpha(t.smpl, p, o)
+#endif
+
+
+
+/*============================================================================
+
+ FXAA3 CONSOLE - 360 PIXEL SHADER
+
+------------------------------------------------------------------------------
+Might be some optimizations left here,
+as of this latest change didn't have a PIX dump to verify if TEX bound.
+============================================================================*/
+#if (FXAA_360 == 1)
+/*--------------------------------------------------------------------------*/
+half4 FxaaPixelShader(
+ // {xy} = center of pixel
+ float2 pos,
+ // {xy__} = upper left of pixel
+ // {__zw} = lower right of pixel
+ float4 posPos,
+ // {rgb_} = color in linear or perceptual color space
+ // {___a} = alpha output is junk value
+ FxaaTex tex,
+ // This must be from a constant/uniform.
+ // {xy} = rcpFrame not used on PC version of FXAA Console
+ float2 rcpFrame,
+ // This must be from a constant/uniform.
+ // {x___} = 2.0/screenWidthInPixels
+ // {_y__} = 2.0/screenHeightInPixels
+ // {__z_} = 0.5/screenWidthInPixels
+ // {___w} = 0.5/screenHeightInPixels
+ float4 rcpFrameOpt
+) {
+/*--------------------------------------------------------------------------*/
+ half4 lumaNwNeSwSe;
+ lumaNwNeSwSe.x = FxaaTexTop(tex, posPos.xy).w;
+ lumaNwNeSwSe.y = FxaaTexTop(tex, posPos.zy).w;
+ lumaNwNeSwSe.z = FxaaTexTop(tex, posPos.xw).w;
+ lumaNwNeSwSe.w = FxaaTexTop(tex, posPos.zw).w;
+/*--------------------------------------------------------------------------*/
+ half4 rgbyM = FxaaTexTop(tex, pos.xy);
+/*--------------------------------------------------------------------------*/
+ lumaNwNeSwSe.y += 1.0/384.0;
+/*--------------------------------------------------------------------------*/
+ half2 lumaMinTemp = min(lumaNwNeSwSe.xy, lumaNwNeSwSe.zw);
+ half2 lumaMaxTemp = max(lumaNwNeSwSe.xy, lumaNwNeSwSe.zw);
+/*--------------------------------------------------------------------------*/
+ half lumaMin = min(lumaMinTemp.x, lumaMinTemp.y);
+ half lumaMax = max(lumaMaxTemp.x, lumaMaxTemp.y);
+/*--------------------------------------------------------------------------*/
+ half lumaMinM = min(lumaMin, rgbyM.w);
+ half lumaMaxM = max(lumaMax, rgbyM.w);
+ if((lumaMaxM - lumaMinM) < max(FXAA_CONSOLE__EDGE_THRESHOLD_MIN, lumaMax * FXAA_CONSOLE__EDGE_THRESHOLD))
+ #if (FXAA_DISCARD == 1)
+ FxaaDiscard;
+ #else
+ return rgbyM;
+ #endif
+/*--------------------------------------------------------------------------*/
+ half2 dir;
+ dir.x = dot(lumaNwNeSwSe, float4(-1.0, -1.0, 1.0, 1.0));
+ dir.y = dot(lumaNwNeSwSe, float4( 1.0, -1.0, 1.0,-1.0));
+/*--------------------------------------------------------------------------*/
+ half2 dir1;
+ dir1 = normalize(dir.xy);
+/*--------------------------------------------------------------------------*/
+ half dirAbsMinTimesC = min(abs(dir1.x), abs(dir1.y)) * FXAA_CONSOLE__EDGE_SHARPNESS;
+ half2 dir2;
+ dir2 = clamp(dir1.xy / dirAbsMinTimesC, -2.0, 2.0);
+/*--------------------------------------------------------------------------*/
+ half4 rgbyN1 = FxaaTexTop(tex, pos.xy - dir1 * rcpFrameOpt.zw);
+ half4 rgbyP1 = FxaaTexTop(tex, pos.xy + dir1 * rcpFrameOpt.zw);
+ half4 rgbyN2 = FxaaTexTop(tex, pos.xy - dir2 * rcpFrameOpt.xy);
+ half4 rgbyP2 = FxaaTexTop(tex, pos.xy + dir2 * rcpFrameOpt.xy);
+/*--------------------------------------------------------------------------*/
+ half4 rgbyA = rgbyN1 * 0.5 + rgbyP1 * 0.5;
+ half4 rgbyB = rgbyN2 * 0.25 + rgbyP2 * 0.25 + rgbyA * 0.5;
+/*--------------------------------------------------------------------------*/
+ bool twoTap = (rgbyB.w < lumaMin) || (rgbyB.w > lumaMax);
+ if(twoTap) rgbyB.xyz = rgbyA.xyz;
+ return rgbyB;
+}
+/*==========================================================================*/
+#endif
+
+
+
+/*============================================================================
+
+ FXAA3 CONSOLE - OPTIMIZED PS3 PIXEL SHADER (NO EARLY EXIT)
+
+==============================================================================
+The code below does not exactly match the assembly.
+I have a feeling that 12 cycles is possible, but was not able to get there.
+Might have to increase register count to get full performance.
+Note this shader does not use perspective interpolation.
+
+Use the following cgc options,
+
+ --fenable-bx2 --fastmath --fastprecision --nofloatbindings
+
+------------------------------------------------------------------------------
+ NVSHADERPERF OUTPUT
+------------------------------------------------------------------------------
+For reference and to aid in debug, output of NVShaderPerf should match this,
+
+Shader to schedule:
+ 0: texpkb h0.w(TRUE), v5.zyxx, #0
+ 2: addh h2.z(TRUE), h0.w, constant(0.001953, 0.000000, 0.000000, 0.000000).x
+ 4: texpkb h0.w(TRUE), v5.xwxx, #0
+ 6: addh h0.z(TRUE), -h2, h0.w
+ 7: texpkb h1.w(TRUE), v5, #0
+ 9: addh h0.x(TRUE), h0.z, -h1.w
+ 10: addh h3.w(TRUE), h0.z, h1
+ 11: texpkb h2.w(TRUE), v5.zwzz, #0
+ 13: addh h0.z(TRUE), h3.w, -h2.w
+ 14: addh h0.x(TRUE), h2.w, h0
+ 15: nrmh h1.xz(TRUE), h0_n
+ 16: minh_m8 h0.x(TRUE), |h1|, |h1.z|
+ 17: maxh h4.w(TRUE), h0, h1
+ 18: divx h2.xy(TRUE), h1_n.xzzw, h0_n
+ 19: movr r1.zw(TRUE), v4.xxxy
+ 20: madr r2.xz(TRUE), -h1, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zzww, r1.zzww
+ 22: minh h5.w(TRUE), h0, h1
+ 23: texpkb h0(TRUE), r2.xzxx, #0
+ 25: madr r0.zw(TRUE), h1.xzxz, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w), r1
+ 27: maxh h4.x(TRUE), h2.z, h2.w
+ 28: texpkb h1(TRUE), r0.zwzz, #0
+ 30: addh_d2 h1(TRUE), h0, h1
+ 31: madr r0.xy(TRUE), -h2, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz
+ 33: texpkb h0(TRUE), r0, #0
+ 35: minh h4.z(TRUE), h2, h2.w
+ 36: fenct TRUE
+ 37: madr r1.xy(TRUE), h2, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz
+ 39: texpkb h2(TRUE), r1, #0
+ 41: addh_d2 h0(TRUE), h0, h2
+ 42: maxh h2.w(TRUE), h4, h4.x
+ 43: minh h2.x(TRUE), h5.w, h4.z
+ 44: addh_d2 h0(TRUE), h0, h1
+ 45: slth h2.x(TRUE), h0.w, h2
+ 46: sgth h2.w(TRUE), h0, h2
+ 47: movh h0(TRUE), h0
+ 48: addx.c0 rc(TRUE), h2, h2.w
+ 49: movh h0(c0.NE.x), h1
+
+IPU0 ------ Simplified schedule: --------
+Pass | Unit | uOp | PC: Op
+-----+--------+------+-------------------------
+ 1 | SCT0/1 | mov | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0;
+ | TEX | txl | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0;
+ | SCB1 | add | 2: ADDh h2.z, h0.--w-, const.--x-;
+ | | |
+ 2 | SCT0/1 | mov | 4: TXLr h0.w, g[TEX1].xwxx, const.xxxx, TEX0;
+ | TEX | txl | 4: TXLr h0.w, g[TEX1].xwxx, const.xxxx, TEX0;
+ | SCB1 | add | 6: ADDh h0.z,-h2, h0.--w-;
+ | | |
+ 3 | SCT0/1 | mov | 7: TXLr h1.w, g[TEX1], const.xxxx, TEX0;
+ | TEX | txl | 7: TXLr h1.w, g[TEX1], const.xxxx, TEX0;
+ | SCB0 | add | 9: ADDh h0.x, h0.z---,-h1.w---;
+ | SCB1 | add | 10: ADDh h3.w, h0.---z, h1;
+ | | |
+ 4 | SCT0/1 | mov | 11: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0;
+ | TEX | txl | 11: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0;
+ | SCB0 | add | 14: ADDh h0.x, h2.w---, h0;
+ | SCB1 | add | 13: ADDh h0.z, h3.--w-,-h2.--w-;
+ | | |
+ 5 | SCT1 | mov | 15: NRMh h1.xz, h0;
+ | SRB | nrm | 15: NRMh h1.xz, h0;
+ | SCB0 | min | 16: MINh*8 h0.x, |h1|, |h1.z---|;
+ | SCB1 | max | 17: MAXh h4.w, h0, h1;
+ | | |
+ 6 | SCT0 | div | 18: DIVx h2.xy, h1.xz--, h0;
+ | SCT1 | mov | 19: MOVr r1.zw, g[TEX0].--xy;
+ | SCB0 | mad | 20: MADr r2.xz,-h1, const.z-w-, r1.z-w-;
+ | SCB1 | min | 22: MINh h5.w, h0, h1;
+ | | |
+ 7 | SCT0/1 | mov | 23: TXLr h0, r2.xzxx, const.xxxx, TEX0;
+ | TEX | txl | 23: TXLr h0, r2.xzxx, const.xxxx, TEX0;
+ | SCB0 | max | 27: MAXh h4.x, h2.z---, h2.w---;
+ | SCB1 | mad | 25: MADr r0.zw, h1.--xz, const, r1;
+ | | |
+ 8 | SCT0/1 | mov | 28: TXLr h1, r0.zwzz, const.xxxx, TEX0;
+ | TEX | txl | 28: TXLr h1, r0.zwzz, const.xxxx, TEX0;
+ | SCB0/1 | add | 30: ADDh/2 h1, h0, h1;
+ | | |
+ 9 | SCT0 | mad | 31: MADr r0.xy,-h2, const.xy--, r1.zw--;
+ | SCT1 | mov | 33: TXLr h0, r0, const.zzzz, TEX0;
+ | TEX | txl | 33: TXLr h0, r0, const.zzzz, TEX0;
+ | SCB1 | min | 35: MINh h4.z, h2, h2.--w-;
+ | | |
+ 10 | SCT0 | mad | 37: MADr r1.xy, h2, const.xy--, r1.zw--;
+ | SCT1 | mov | 39: TXLr h2, r1, const.zzzz, TEX0;
+ | TEX | txl | 39: TXLr h2, r1, const.zzzz, TEX0;
+ | SCB0/1 | add | 41: ADDh/2 h0, h0, h2;
+ | | |
+ 11 | SCT0 | min | 43: MINh h2.x, h5.w---, h4.z---;
+ | SCT1 | max | 42: MAXh h2.w, h4, h4.---x;
+ | SCB0/1 | add | 44: ADDh/2 h0, h0, h1;
+ | | |
+ 12 | SCT0 | set | 45: SLTh h2.x, h0.w---, h2;
+ | SCT1 | set | 46: SGTh h2.w, h0, h2;
+ | SCB0/1 | mul | 47: MOVh h0, h0;
+ | | |
+ 13 | SCT0 | mad | 48: ADDxc0_s rc, h2, h2.w---;
+ | SCB0/1 | mul | 49: MOVh h0(NE0.xxxx), h1;
+
+Pass SCT TEX SCB
+ 1: 0% 100% 25%
+ 2: 0% 100% 25%
+ 3: 0% 100% 50%
+ 4: 0% 100% 50%
+ 5: 0% 0% 50%
+ 6: 100% 0% 75%
+ 7: 0% 100% 75%
+ 8: 0% 100% 100%
+ 9: 0% 100% 25%
+ 10: 0% 100% 100%
+ 11: 50% 0% 100%
+ 12: 50% 0% 100%
+ 13: 25% 0% 100%
+
+MEAN: 17% 61% 67%
+
+Pass SCT0 SCT1 TEX SCB0 SCB1
+ 1: 0% 0% 100% 0% 100%
+ 2: 0% 0% 100% 0% 100%
+ 3: 0% 0% 100% 100% 100%
+ 4: 0% 0% 100% 100% 100%
+ 5: 0% 0% 0% 100% 100%
+ 6: 100% 100% 0% 100% 100%
+ 7: 0% 0% 100% 100% 100%
+ 8: 0% 0% 100% 100% 100%
+ 9: 0% 0% 100% 0% 100%
+ 10: 0% 0% 100% 100% 100%
+ 11: 100% 100% 0% 100% 100%
+ 12: 100% 100% 0% 100% 100%
+ 13: 100% 0% 0% 100% 100%
+
+MEAN: 30% 23% 61% 76% 100%
+Fragment Performance Setup: Driver RSX Compiler, GPU RSX, Flags 0x5
+Results 13 cycles, 3 r regs, 923,076,923 pixels/s
+============================================================================*/
+#if (FXAA_PS3 == 1) && (FXAA_EARLY_EXIT == 0)
+/*--------------------------------------------------------------------------*/
+#pragma disablepc all
+#pragma option O3
+#pragma option OutColorPrec=fp16
+#pragma texformat default RGBA8
+/*==========================================================================*/
+half4 FxaaPixelShader(
+ // {xy} = center of pixel
+ float2 pos,
+ // {xy__} = upper left of pixel
+ // {__zw} = lower right of pixel
+ float4 posPos,
+ // {rgb_} = color in linear or perceptual color space
+ // {___a} = luma in perceptual color space (not linear)
+ sampler2D tex,
+ // This must be from a constant/uniform.
+ // {xy} = rcpFrame not used on PS3
+ float2 rcpFrame,
+ // This must be from a constant/uniform.
+ // {x___} = 2.0/screenWidthInPixels
+ // {_y__} = 2.0/screenHeightInPixels
+ // {__z_} = 0.5/screenWidthInPixels
+ // {___w} = 0.5/screenHeightInPixels
+ float4 rcpFrameOpt
+) {
+/*--------------------------------------------------------------------------*/
+// (1)
+ half4 dir;
+ half4 lumaNe = h4tex2Dlod(tex, half4(posPos.zy, 0, 0));
+ lumaNe.w += half(1.0/512.0);
+ dir.x = -lumaNe.w;
+ dir.z = -lumaNe.w;
+/*--------------------------------------------------------------------------*/
+// (2)
+ half4 lumaSw = h4tex2Dlod(tex, half4(posPos.xw, 0, 0));
+ dir.x += lumaSw.w;
+ dir.z += lumaSw.w;
+/*--------------------------------------------------------------------------*/
+// (3)
+ half4 lumaNw = h4tex2Dlod(tex, half4(posPos.xy, 0, 0));
+ dir.x -= lumaNw.w;
+ dir.z += lumaNw.w;
+/*--------------------------------------------------------------------------*/
+// (4)
+ half4 lumaSe = h4tex2Dlod(tex, half4(posPos.zw, 0, 0));
+ dir.x += lumaSe.w;
+ dir.z -= lumaSe.w;
+/*--------------------------------------------------------------------------*/
+// (5)
+ half4 dir1_pos;
+ dir1_pos.xy = normalize(dir.xyz).xz;
+ half dirAbsMinTimesC = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__EDGE_SHARPNESS);
+/*--------------------------------------------------------------------------*/
+// (6)
+ half4 dir2_pos;
+ dir2_pos.xy = clamp(dir1_pos.xy / dirAbsMinTimesC, half(-2.0), half(2.0));
+ dir1_pos.zw = pos.xy;
+ dir2_pos.zw = pos.xy;
+ half4 temp1N;
+ temp1N.xy = dir1_pos.zw - dir1_pos.xy * rcpFrameOpt.zw;
+/*--------------------------------------------------------------------------*/
+// (7)
+ temp1N = h4tex2Dlod(tex, half4(temp1N.xy, 0.0, 0.0));
+ half4 rgby1;
+ rgby1.xy = dir1_pos.zw + dir1_pos.xy * rcpFrameOpt.zw;
+/*--------------------------------------------------------------------------*/
+// (8)
+ rgby1 = h4tex2Dlod(tex, half4(rgby1.xy, 0.0, 0.0));
+ rgby1 = (temp1N + rgby1) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (9)
+ half4 temp2N;
+ temp2N.xy = dir2_pos.zw - dir2_pos.xy * rcpFrameOpt.xy;
+ temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0));
+/*--------------------------------------------------------------------------*/
+// (10)
+ half4 rgby2;
+ rgby2.xy = dir2_pos.zw + dir2_pos.xy * rcpFrameOpt.xy;
+ rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0));
+ rgby2 = (temp2N + rgby2) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (11)
+ // compilier moves these scalar ops up to other cycles
+ half lumaMin = min(min(lumaNw.w, lumaSw.w), min(lumaNe.w, lumaSe.w));
+ half lumaMax = max(max(lumaNw.w, lumaSw.w), max(lumaNe.w, lumaSe.w));
+ rgby2 = (rgby2 + rgby1) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (12)
+ bool twoTapLt = rgby2.w < lumaMin;
+ bool twoTapGt = rgby2.w > lumaMax;
+/*--------------------------------------------------------------------------*/
+// (13)
+ if(twoTapLt || twoTapGt) rgby2 = rgby1;
+/*--------------------------------------------------------------------------*/
+ return rgby2; }
+/*==========================================================================*/
+#endif
+
+
+
+/*============================================================================
+
+ FXAA3 CONSOLE - OPTIMIZED PS3 PIXEL SHADER (WITH EARLY EXIT)
+
+==============================================================================
+The code mostly matches the assembly.
+I have a feeling that 14 cycles is possible, but was not able to get there.
+Might have to increase register count to get full performance.
+Note this shader does not use perspective interpolation.
+
+Use the following cgc options,
+
+ --fenable-bx2 --fastmath --fastprecision --nofloatbindings
+
+------------------------------------------------------------------------------
+ NVSHADERPERF OUTPUT
+------------------------------------------------------------------------------
+For reference and to aid in debug, output of NVShaderPerf should match this,
+
+Shader to schedule:
+ 0: texpkb h0.w(TRUE), v5.zyxx, #0
+ 2: addh h2.y(TRUE), h0.w, constant(0.001953, 0.000000, 0.000000, 0.000000).x
+ 4: texpkb h1.w(TRUE), v5.xwxx, #0
+ 6: addh h0.x(TRUE), h1.w, -h2.y
+ 7: texpkb h2.w(TRUE), v5.zwzz, #0
+ 9: minh h4.w(TRUE), h2.y, h2
+ 10: maxh h5.x(TRUE), h2.y, h2.w
+ 11: texpkb h0.w(TRUE), v5, #0
+ 13: addh h3.w(TRUE), -h0, h0.x
+ 14: addh h0.x(TRUE), h0.w, h0
+ 15: addh h0.z(TRUE), -h2.w, h0.x
+ 16: addh h0.x(TRUE), h2.w, h3.w
+ 17: minh h5.y(TRUE), h0.w, h1.w
+ 18: nrmh h2.xz(TRUE), h0_n
+ 19: minh_m8 h2.w(TRUE), |h2.x|, |h2.z|
+ 20: divx h4.xy(TRUE), h2_n.xzzw, h2_n.w
+ 21: movr r1.zw(TRUE), v4.xxxy
+ 22: maxh h2.w(TRUE), h0, h1
+ 23: fenct TRUE
+ 24: madr r0.xy(TRUE), -h2.xzzw, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zwzz, r1.zwzz
+ 26: texpkb h0(TRUE), r0, #0
+ 28: maxh h5.x(TRUE), h2.w, h5
+ 29: minh h5.w(TRUE), h5.y, h4
+ 30: madr r1.xy(TRUE), h2.xzzw, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zwzz, r1.zwzz
+ 32: texpkb h2(TRUE), r1, #0
+ 34: addh_d2 h2(TRUE), h0, h2
+ 35: texpkb h1(TRUE), v4, #0
+ 37: maxh h5.y(TRUE), h5.x, h1.w
+ 38: minh h4.w(TRUE), h1, h5
+ 39: madr r0.xy(TRUE), -h4, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz
+ 41: texpkb h0(TRUE), r0, #0
+ 43: addh_m8 h5.z(TRUE), h5.y, -h4.w
+ 44: madr r2.xy(TRUE), h4, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz
+ 46: texpkb h3(TRUE), r2, #0
+ 48: addh_d2 h0(TRUE), h0, h3
+ 49: addh_d2 h3(TRUE), h0, h2
+ 50: movh h0(TRUE), h3
+ 51: slth h3.x(TRUE), h3.w, h5.w
+ 52: sgth h3.w(TRUE), h3, h5.x
+ 53: addx.c0 rc(TRUE), h3.x, h3
+ 54: slth.c0 rc(TRUE), h5.z, h5
+ 55: movh h0(c0.NE.w), h2
+ 56: movh h0(c0.NE.x), h1
+
+IPU0 ------ Simplified schedule: --------
+Pass | Unit | uOp | PC: Op
+-----+--------+------+-------------------------
+ 1 | SCT0/1 | mov | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0;
+ | TEX | txl | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0;
+ | SCB0 | add | 2: ADDh h2.y, h0.-w--, const.-x--;
+ | | |
+ 2 | SCT0/1 | mov | 4: TXLr h1.w, g[TEX1].xwxx, const.xxxx, TEX0;
+ | TEX | txl | 4: TXLr h1.w, g[TEX1].xwxx, const.xxxx, TEX0;
+ | SCB0 | add | 6: ADDh h0.x, h1.w---,-h2.y---;
+ | | |
+ 3 | SCT0/1 | mov | 7: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0;
+ | TEX | txl | 7: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0;
+ | SCB0 | max | 10: MAXh h5.x, h2.y---, h2.w---;
+ | SCB1 | min | 9: MINh h4.w, h2.---y, h2;
+ | | |
+ 4 | SCT0/1 | mov | 11: TXLr h0.w, g[TEX1], const.xxxx, TEX0;
+ | TEX | txl | 11: TXLr h0.w, g[TEX1], const.xxxx, TEX0;
+ | SCB0 | add | 14: ADDh h0.x, h0.w---, h0;
+ | SCB1 | add | 13: ADDh h3.w,-h0, h0.---x;
+ | | |
+ 5 | SCT0 | mad | 16: ADDh h0.x, h2.w---, h3.w---;
+ | SCT1 | mad | 15: ADDh h0.z,-h2.--w-, h0.--x-;
+ | SCB0 | min | 17: MINh h5.y, h0.-w--, h1.-w--;
+ | | |
+ 6 | SCT1 | mov | 18: NRMh h2.xz, h0;
+ | SRB | nrm | 18: NRMh h2.xz, h0;
+ | SCB1 | min | 19: MINh*8 h2.w, |h2.---x|, |h2.---z|;
+ | | |
+ 7 | SCT0 | div | 20: DIVx h4.xy, h2.xz--, h2.ww--;
+ | SCT1 | mov | 21: MOVr r1.zw, g[TEX0].--xy;
+ | SCB1 | max | 22: MAXh h2.w, h0, h1;
+ | | |
+ 8 | SCT0 | mad | 24: MADr r0.xy,-h2.xz--, const.zw--, r1.zw--;
+ | SCT1 | mov | 26: TXLr h0, r0, const.xxxx, TEX0;
+ | TEX | txl | 26: TXLr h0, r0, const.xxxx, TEX0;
+ | SCB0 | max | 28: MAXh h5.x, h2.w---, h5;
+ | SCB1 | min | 29: MINh h5.w, h5.---y, h4;
+ | | |
+ 9 | SCT0 | mad | 30: MADr r1.xy, h2.xz--, const.zw--, r1.zw--;
+ | SCT1 | mov | 32: TXLr h2, r1, const.xxxx, TEX0;
+ | TEX | txl | 32: TXLr h2, r1, const.xxxx, TEX0;
+ | SCB0/1 | add | 34: ADDh/2 h2, h0, h2;
+ | | |
+ 10 | SCT0/1 | mov | 35: TXLr h1, g[TEX0], const.xxxx, TEX0;
+ | TEX | txl | 35: TXLr h1, g[TEX0], const.xxxx, TEX0;
+ | SCB0 | max | 37: MAXh h5.y, h5.-x--, h1.-w--;
+ | SCB1 | min | 38: MINh h4.w, h1, h5;
+ | | |
+ 11 | SCT0 | mad | 39: MADr r0.xy,-h4, const.xy--, r1.zw--;
+ | SCT1 | mov | 41: TXLr h0, r0, const.zzzz, TEX0;
+ | TEX | txl | 41: TXLr h0, r0, const.zzzz, TEX0;
+ | SCB0 | mad | 44: MADr r2.xy, h4, const.xy--, r1.zw--;
+ | SCB1 | add | 43: ADDh*8 h5.z, h5.--y-,-h4.--w-;
+ | | |
+ 12 | SCT0/1 | mov | 46: TXLr h3, r2, const.xxxx, TEX0;
+ | TEX | txl | 46: TXLr h3, r2, const.xxxx, TEX0;
+ | SCB0/1 | add | 48: ADDh/2 h0, h0, h3;
+ | | |
+ 13 | SCT0/1 | mad | 49: ADDh/2 h3, h0, h2;
+ | SCB0/1 | mul | 50: MOVh h0, h3;
+ | | |
+ 14 | SCT0 | set | 51: SLTh h3.x, h3.w---, h5.w---;
+ | SCT1 | set | 52: SGTh h3.w, h3, h5.---x;
+ | SCB0 | set | 54: SLThc0 rc, h5.z---, h5;
+ | SCB1 | add | 53: ADDxc0_s rc, h3.---x, h3;
+ | | |
+ 15 | SCT0/1 | mul | 55: MOVh h0(NE0.wwww), h2;
+ | SCB0/1 | mul | 56: MOVh h0(NE0.xxxx), h1;
+
+Pass SCT TEX SCB
+ 1: 0% 100% 25%
+ 2: 0% 100% 25%
+ 3: 0% 100% 50%
+ 4: 0% 100% 50%
+ 5: 50% 0% 25%
+ 6: 0% 0% 25%
+ 7: 100% 0% 25%
+ 8: 0% 100% 50%
+ 9: 0% 100% 100%
+ 10: 0% 100% 50%
+ 11: 0% 100% 75%
+ 12: 0% 100% 100%
+ 13: 100% 0% 100%
+ 14: 50% 0% 50%
+ 15: 100% 0% 100%
+
+MEAN: 26% 60% 56%
+
+Pass SCT0 SCT1 TEX SCB0 SCB1
+ 1: 0% 0% 100% 100% 0%
+ 2: 0% 0% 100% 100% 0%
+ 3: 0% 0% 100% 100% 100%
+ 4: 0% 0% 100% 100% 100%
+ 5: 100% 100% 0% 100% 0%
+ 6: 0% 0% 0% 0% 100%
+ 7: 100% 100% 0% 0% 100%
+ 8: 0% 0% 100% 100% 100%
+ 9: 0% 0% 100% 100% 100%
+ 10: 0% 0% 100% 100% 100%
+ 11: 0% 0% 100% 100% 100%
+ 12: 0% 0% 100% 100% 100%
+ 13: 100% 100% 0% 100% 100%
+ 14: 100% 100% 0% 100% 100%
+ 15: 100% 100% 0% 100% 100%
+
+MEAN: 33% 33% 60% 86% 80%
+Fragment Performance Setup: Driver RSX Compiler, GPU RSX, Flags 0x5
+Results 15 cycles, 3 r regs, 800,000,000 pixels/s
+============================================================================*/
+#if (FXAA_PS3 == 1) && (FXAA_EARLY_EXIT == 1)
+/*--------------------------------------------------------------------------*/
+#pragma disablepc all
+#pragma option O2
+#pragma option OutColorPrec=fp16
+#pragma texformat default RGBA8
+/*==========================================================================*/
+half4 FxaaPixelShader(
+ // {xy} = center of pixel
+ float2 pos,
+ // {xy__} = upper left of pixel
+ // {__zw} = lower right of pixel
+ float4 posPos,
+ // {rgb_} = color in linear or perceptual color space
+ // {___a} = luma in perceptual color space (not linear)
+ sampler2D tex,
+ // This must be from a constant/uniform.
+ // {xy} = rcpFrame not used on PS3
+ float2 rcpFrame,
+ // This must be from a constant/uniform.
+ // {x___} = 2.0/screenWidthInPixels
+ // {_y__} = 2.0/screenHeightInPixels
+ // {__z_} = 0.5/screenWidthInPixels
+ // {___w} = 0.5/screenHeightInPixels
+ float4 rcpFrameOpt
+) {
+/*--------------------------------------------------------------------------*/
+// (1)
+ half4 rgbyNe = h4tex2Dlod(tex, half4(posPos.zy, 0, 0));
+ half lumaNe = rgbyNe.w + half(1.0/512.0);
+/*--------------------------------------------------------------------------*/
+// (2)
+ half4 lumaSw = h4tex2Dlod(tex, half4(posPos.xw, 0, 0));
+ half lumaSwNegNe = lumaSw.w - lumaNe;
+/*--------------------------------------------------------------------------*/
+// (3)
+ half4 lumaNw = h4tex2Dlod(tex, half4(posPos.xy, 0, 0));
+ half lumaMaxNwSw = max(lumaNw.w, lumaSw.w);
+ half lumaMinNwSw = min(lumaNw.w, lumaSw.w);
+/*--------------------------------------------------------------------------*/
+// (4)
+ half4 lumaSe = h4tex2Dlod(tex, half4(posPos.zw, 0, 0));
+ half dirZ = lumaNw.w + lumaSwNegNe;
+ half dirX = -lumaNw.w + lumaSwNegNe;
+/*--------------------------------------------------------------------------*/
+// (5)
+ half3 dir;
+ dir.y = 0.0;
+ dir.x = lumaSe.w + dirX;
+ dir.z = -lumaSe.w + dirZ;
+ half lumaMinNeSe = min(lumaNe, lumaSe.w);
+/*--------------------------------------------------------------------------*/
+// (6)
+ half4 dir1_pos;
+ dir1_pos.xy = normalize(dir).xz;
+ half dirAbsMinTimes8 = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__EDGE_SHARPNESS);
+/*--------------------------------------------------------------------------*/
+// (7)
+ half4 dir2_pos;
+ dir2_pos.xy = clamp(dir1_pos.xy / dirAbsMinTimes8, half(-2.0), half(2.0));
+ dir1_pos.zw = pos.xy;
+ dir2_pos.zw = pos.xy;
+ half lumaMaxNeSe = max(lumaNe, lumaSe.w);
+/*--------------------------------------------------------------------------*/
+// (8)
+ half4 temp1N;
+ temp1N.xy = dir1_pos.zw - dir1_pos.xy * rcpFrameOpt.zw;
+ temp1N = h4tex2Dlod(tex, half4(temp1N.xy, 0.0, 0.0));
+ half lumaMax = max(lumaMaxNwSw, lumaMaxNeSe);
+ half lumaMin = min(lumaMinNwSw, lumaMinNeSe);
+/*--------------------------------------------------------------------------*/
+// (9)
+ half4 rgby1;
+ rgby1.xy = dir1_pos.zw + dir1_pos.xy * rcpFrameOpt.zw;
+ rgby1 = h4tex2Dlod(tex, half4(rgby1.xy, 0.0, 0.0));
+ rgby1 = (temp1N + rgby1) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (10)
+ half4 rgbyM = h4tex2Dlod(tex, half4(pos.xy, 0.0, 0.0));
+ half lumaMaxM = max(lumaMax, rgbyM.w);
+ half lumaMinM = min(lumaMin, rgbyM.w);
+/*--------------------------------------------------------------------------*/
+// (11)
+ half4 temp2N;
+ temp2N.xy = dir2_pos.zw - dir2_pos.xy * rcpFrameOpt.xy;
+ temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0));
+ half4 rgby2;
+ rgby2.xy = dir2_pos.zw + dir2_pos.xy * rcpFrameOpt.xy;
+ half lumaRangeM = (lumaMaxM - lumaMinM) / FXAA_CONSOLE__EDGE_THRESHOLD;
+/*--------------------------------------------------------------------------*/
+// (12)
+ rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0));
+ rgby2 = (temp2N + rgby2) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (13)
+ rgby2 = (rgby2 + rgby1) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (14)
+ bool twoTapLt = rgby2.w < lumaMin;
+ bool twoTapGt = rgby2.w > lumaMax;
+ bool earlyExit = lumaRangeM < lumaMax;
+ bool twoTap = twoTapLt || twoTapGt;
+/*--------------------------------------------------------------------------*/
+// (15)
+ if(twoTap) rgby2 = rgby1;
+ if(earlyExit) rgby2 = rgbyM;
+/*--------------------------------------------------------------------------*/
+ return rgby2; }
+/*==========================================================================*/
+#endif
+
+
+
+/*============================================================================
+
+ FXAA3 CONSOLE - PC PIXEL SHADER
+
+------------------------------------------------------------------------------
+Using a modified version of the PS3 version here to best target old hardware.
+============================================================================*/
+#if (FXAA_PC_CONSOLE == 1)
+/*--------------------------------------------------------------------------*/
+half4 FxaaPixelShader(
+ // {xy} = center of pixel
+ float2 pos,
+ // {xy__} = upper left of pixel
+ // {__zw} = lower right of pixel
+ float4 posPos,
+ // {rgb_} = color in linear or perceptual color space
+ // {___a} = alpha output is junk value
+ FxaaTex tex,
+ // This must be from a constant/uniform.
+ // {xy} = rcpFrame not used on PC version of FXAA Console
+ float2 rcpFrame,
+ // This must be from a constant/uniform.
+ // {x___} = 2.0/screenWidthInPixels
+ // {_y__} = 2.0/screenHeightInPixels
+ // {__z_} = 0.5/screenWidthInPixels
+ // {___w} = 0.5/screenHeightInPixels
+ float4 rcpFrameOpt
+) {
+/*--------------------------------------------------------------------------*/
+ half4 dir;
+ dir.y = 0.0;
+ half4 lumaNe = FxaaTexTop(tex, posPos.zy);
+ lumaNe.w += half(1.0/384.0);
+ dir.x = -lumaNe.w;
+ dir.z = -lumaNe.w;
+/*--------------------------------------------------------------------------*/
+ half4 lumaSw = FxaaTexTop(tex, posPos.xw);
+ dir.x += lumaSw.w;
+ dir.z += lumaSw.w;
+/*--------------------------------------------------------------------------*/
+ half4 lumaNw = FxaaTexTop(tex, posPos.xy);
+ dir.x -= lumaNw.w;
+ dir.z += lumaNw.w;
+/*--------------------------------------------------------------------------*/
+ half4 lumaSe = FxaaTexTop(tex, posPos.zw);
+ dir.x += lumaSe.w;
+ dir.z -= lumaSe.w;
+/*==========================================================================*/
+ #if (FXAA_EARLY_EXIT == 1)
+ half4 rgbyM = FxaaTexTop(tex, pos.xy);
+/*--------------------------------------------------------------------------*/
+ half lumaMin = min(min(lumaNw.w, lumaSw.w), min(lumaNe.w, lumaSe.w));
+ half lumaMax = max(max(lumaNw.w, lumaSw.w), max(lumaNe.w, lumaSe.w));
+/*--------------------------------------------------------------------------*/
+ half lumaMinM = min(lumaMin, rgbyM.w);
+ half lumaMaxM = max(lumaMax, rgbyM.w);
+/*--------------------------------------------------------------------------*/
+ if((lumaMaxM - lumaMinM) < max(FXAA_CONSOLE__EDGE_THRESHOLD_MIN, lumaMax * FXAA_CONSOLE__EDGE_THRESHOLD))
+ #if (FXAA_DISCARD == 1)
+ FxaaDiscard;
+ #else
+ return rgbyM;
+ #endif
+ #endif
+/*==========================================================================*/
+ half4 dir1_pos;
+ dir1_pos.xy = normalize(dir.xyz).xz;
+ half dirAbsMinTimesC = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__EDGE_SHARPNESS);
+/*--------------------------------------------------------------------------*/
+ half4 dir2_pos;
+ dir2_pos.xy = clamp(dir1_pos.xy / dirAbsMinTimesC, half(-2.0), half(2.0));
+ dir1_pos.zw = pos.xy;
+ dir2_pos.zw = pos.xy;
+ half4 temp1N;
+ temp1N.xy = dir1_pos.zw - dir1_pos.xy * rcpFrameOpt.zw;
+/*--------------------------------------------------------------------------*/
+ temp1N = FxaaTexTop(tex, temp1N.xy);
+ half4 rgby1;
+ rgby1.xy = dir1_pos.zw + dir1_pos.xy * rcpFrameOpt.zw;
+/*--------------------------------------------------------------------------*/
+ rgby1 = FxaaTexTop(tex, rgby1.xy);
+ rgby1 = (temp1N + rgby1) * 0.5;
+/*--------------------------------------------------------------------------*/
+ half4 temp2N;
+ temp2N.xy = dir2_pos.zw - dir2_pos.xy * rcpFrameOpt.xy;
+ temp2N = FxaaTexTop(tex, temp2N.xy);
+/*--------------------------------------------------------------------------*/
+ half4 rgby2;
+ rgby2.xy = dir2_pos.zw + dir2_pos.xy * rcpFrameOpt.xy;
+ rgby2 = FxaaTexTop(tex, rgby2.xy);
+ rgby2 = (temp2N + rgby2) * 0.5;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_EARLY_EXIT == 0)
+ half lumaMin = min(min(lumaNw.w, lumaSw.w), min(lumaNe.w, lumaSe.w));
+ half lumaMax = max(max(lumaNw.w, lumaSw.w), max(lumaNe.w, lumaSe.w));
+ #endif
+ rgby2 = (rgby2 + rgby1) * 0.5;
+/*--------------------------------------------------------------------------*/
+ bool twoTapLt = rgby2.w < lumaMin;
+ bool twoTapGt = rgby2.w > lumaMax;
+/*--------------------------------------------------------------------------*/
+ if(twoTapLt || twoTapGt) rgby2 = rgby1;
+/*--------------------------------------------------------------------------*/
+ return rgby2; }
+/*==========================================================================*/
+#endif
+
+
+
+/*============================================================================
+
+ FXAA3 QUALITY - PC
+
+============================================================================*/
+#if (FXAA_PC == 1)
+/*--------------------------------------------------------------------------*/
+float4 FxaaPixelShader(
+ // {xy} = center of pixel
+ float2 pos,
+ // {xyzw} = not used on FXAA3 Quality
+ float4 posPos,
+ // {rgb_} = color in linear or perceptual color space
+ // {___a} = luma in perceptual color space (not linear)
+ FxaaTex tex,
+ // This must be from a constant/uniform.
+ // {x_} = 1.0/screenWidthInPixels
+ // {_y} = 1.0/screenHeightInPixels
+ float2 rcpFrame,
+ // {xyzw} = not used on FXAA3 Quality
+ float4 rcpFrameOpt
+) {
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_GATHER4_ALPHA == 1)
+ float4 luma4A = FxaaTexOffAlpha4(tex, pos.xy, FxaaInt2(-1, -1), rcpFrame.xy);
+ #if (FXAA_DISCARD == 0)
+ float4 rgbyM = FxaaTexTop(tex, pos.xy);
+ #endif
+ float4 luma4B = FxaaTexAlpha4(tex, pos.xy, rcpFrame.xy);
+ float lumaNE = FxaaTexOff(tex, pos.xy, FxaaInt2(1, -1), rcpFrame.xy).w;
+ float lumaSW = FxaaTexOff(tex, pos.xy, FxaaInt2(-1, 1), rcpFrame.xy).w;
+ float lumaNW = luma4A.w;
+ float lumaN = luma4A.z;
+ float lumaW = luma4A.x;
+ float lumaM = luma4A.y;
+ float lumaE = luma4B.z;
+ float lumaS = luma4B.x;
+ float lumaSE = luma4B.y;
+ #else
+ float lumaN = FxaaTexOff(tex, pos.xy, FxaaInt2(0, -1), rcpFrame.xy).w;
+ float lumaW = FxaaTexOff(tex, pos.xy, FxaaInt2(-1, 0), rcpFrame.xy).w;
+ float4 rgbyM = FxaaTexTop(tex, pos.xy);
+ float lumaE = FxaaTexOff(tex, pos.xy, FxaaInt2( 1, 0), rcpFrame.xy).w;
+ float lumaS = FxaaTexOff(tex, pos.xy, FxaaInt2( 0, 1), rcpFrame.xy).w;
+ float lumaM = rgbyM.w;
+ #endif
+/*--------------------------------------------------------------------------*/
+ float rangeMin = min(lumaM, min(min(lumaN, lumaW), min(lumaS, lumaE)));
+ float rangeMax = max(lumaM, max(max(lumaN, lumaW), max(lumaS, lumaE)));
+ float range = rangeMax - rangeMin;
+/*--------------------------------------------------------------------------*/
+ if(range < max(FXAA_QUALITY__EDGE_THRESHOLD_MIN, rangeMax * FXAA_QUALITY__EDGE_THRESHOLD))
+ #if (FXAA_DISCARD == 1)
+ FxaaDiscard;
+ #else
+ return rgbyM;
+ #endif
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_GATHER4_ALPHA == 0)
+ float lumaNW = FxaaTexOff(tex, pos.xy, FxaaInt2(-1,-1), rcpFrame.xy).w;
+ float lumaNE = FxaaTexOff(tex, pos.xy, FxaaInt2( 1,-1), rcpFrame.xy).w;
+ float lumaSW = FxaaTexOff(tex, pos.xy, FxaaInt2(-1, 1), rcpFrame.xy).w;
+ float lumaSE = FxaaTexOff(tex, pos.xy, FxaaInt2( 1, 1), rcpFrame.xy).w;
+ #endif
+/*--------------------------------------------------------------------------*/
+ #define FXAA_QUALITY__SUBPIX_TRIM_SCALE (1.0/(1.0 - FXAA_QUALITY__SUBPIX_TRIM))
+/*--------------------------------------------------------------------------*/
+ float lumaL = (lumaN + lumaW + lumaE + lumaS) * 0.25;
+ float rangeL = abs(lumaL - lumaM);
+ float blendL = FxaaSat((rangeL / range) - FXAA_QUALITY__SUBPIX_TRIM) * FXAA_QUALITY__SUBPIX_TRIM_SCALE;
+ blendL = min(FXAA_QUALITY__SUBPIX_CAP, blendL);
+/*--------------------------------------------------------------------------*/
+ float edgeVert =
+ abs(lumaNW + (-2.0 * lumaN) + lumaNE) +
+ 2.0 * abs(lumaW + (-2.0 * lumaM) + lumaE ) +
+ abs(lumaSW + (-2.0 * lumaS) + lumaSE);
+ float edgeHorz =
+ abs(lumaNW + (-2.0 * lumaW) + lumaSW) +
+ 2.0 * abs(lumaN + (-2.0 * lumaM) + lumaS ) +
+ abs(lumaNE + (-2.0 * lumaE) + lumaSE);
+ bool horzSpan = edgeHorz >= edgeVert;
+/*--------------------------------------------------------------------------*/
+ float lengthSign = horzSpan ? -rcpFrame.y : -rcpFrame.x;
+ if(!horzSpan) lumaN = lumaW;
+ if(!horzSpan) lumaS = lumaE;
+ float gradientN = abs(lumaN - lumaM);
+ float gradientS = abs(lumaS - lumaM);
+ lumaN = (lumaN + lumaM) * 0.5;
+ lumaS = (lumaS + lumaM) * 0.5;
+/*--------------------------------------------------------------------------*/
+ bool pairN = gradientN >= gradientS;
+ if(!pairN) lumaN = lumaS;
+ if(!pairN) gradientN = gradientS;
+ if(!pairN) lengthSign *= -1.0;
+ float2 posN;
+ posN.x = pos.x + (horzSpan ? 0.0 : lengthSign * 0.5);
+ posN.y = pos.y + (horzSpan ? lengthSign * 0.5 : 0.0);
+/*--------------------------------------------------------------------------*/
+ #define FXAA_SEARCH_STEPS 6
+ #define FXAA_SEARCH_THRESHOLD (1.0/4.0)
+/*--------------------------------------------------------------------------*/
+ gradientN *= FXAA_SEARCH_THRESHOLD;
+/*--------------------------------------------------------------------------*/
+ float2 posP = posN;
+ float2 offNP = horzSpan ?
+ FxaaFloat2(rcpFrame.x, 0.0) :
+ FxaaFloat2(0.0f, rcpFrame.y);
+ float lumaEndN;
+ float lumaEndP;
+ bool doneN = false;
+ bool doneP = false;
+ posN += offNP * (-1.5);
+ posP += offNP * ( 1.5);
+ for(int i = 0; i < FXAA_SEARCH_STEPS; i++) {
+ lumaEndN = FxaaTexTop(tex, posN.xy).w;
+ lumaEndP = FxaaTexTop(tex, posP.xy).w;
+ bool doneN2 = abs(lumaEndN - lumaN) >= gradientN;
+ bool doneP2 = abs(lumaEndP - lumaN) >= gradientN;
+ if(doneN2 && !doneN) posN += offNP;
+ if(doneP2 && !doneP) posP -= offNP;
+ if(doneN2 && doneP2) break;
+ doneN = doneN2;
+ doneP = doneP2;
+ if(!doneN) posN -= offNP * 2.0;
+ if(!doneP) posP += offNP * 2.0; }
+/*--------------------------------------------------------------------------*/
+ float dstN = horzSpan ? pos.x - posN.x : pos.y - posN.y;
+ float dstP = horzSpan ? posP.x - pos.x : posP.y - pos.y;
+/*--------------------------------------------------------------------------*/
+ bool directionN = dstN < dstP;
+ lumaEndN = directionN ? lumaEndN : lumaEndP;
+/*--------------------------------------------------------------------------*/
+ if(((lumaM - lumaN) < 0.0) == ((lumaEndN - lumaN) < 0.0))
+ lengthSign = 0.0;
+/*--------------------------------------------------------------------------*/
+ float spanLength = (dstP + dstN);
+ dstN = directionN ? dstN : dstP;
+ float subPixelOffset = 0.5 + (dstN * (-1.0/spanLength));
+ subPixelOffset += blendL * (1.0/8.0);
+ subPixelOffset *= lengthSign;
+ float3 rgbF = FxaaTexTop(tex, FxaaFloat2(
+ pos.x + (horzSpan ? 0.0 : subPixelOffset),
+ pos.y + (horzSpan ? subPixelOffset : 0.0))).xyz;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_LINEAR == 1)
+ lumaL *= lumaL;
+ #endif
+ float lumaF = dot(rgbF, float3(0.299, 0.587, 0.114)) + (1.0/(65536.0*256.0));
+ float lumaB = FxaaLerp(lumaF, lumaL, blendL);
+ float scale = min(4.0, lumaB/lumaF);
+ rgbF *= scale;
+ return float4(rgbF, lumaM); }
+/*==========================================================================*/
+#endif
+
+
+uniform sampler2D imgWithLumaTex;
+uniform vec2 rcpFrame;
+void main (void)
+{
+ vec4 pospos = vec4(0,0,0,0);
+ vec4 rcpFrameOpt = vec4(0,0,0,0);
+
+ vec4 col = FxaaPixelShader(gl_TexCoord[0].xy, pospos, imgWithLumaTex, rcpFrame, rcpFrameOpt);
+ gl_FragColor = col;
+ } \ No newline at end of file
diff --git a/KaplaDemo/externalIP/resources/fxaa.vs b/KaplaDemo/externalIP/resources/fxaa.vs
new file mode 100644
index 00000000..7727c6f1
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/fxaa.vs
@@ -0,0 +1,6 @@
+
+void main(void)
+{
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_Position = gl_Vertex * 2.0f - 1.0f;
+}
diff --git a/KaplaDemo/externalIP/resources/shaders/bloomH_fs.cpp b/KaplaDemo/externalIP/resources/shaders/bloomH_fs.cpp
new file mode 100644
index 00000000..eb9db462
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/bloomH_fs.cpp
@@ -0,0 +1,24 @@
+ uniform sampler2D colorTex;
+ uniform float sx;
+
+ void main (void)
+ {
+ vec3 bloom = vec3(0.0, 0.0, 0.0);
+ const float hdrScale = 1.5;
+ const int kernelSize = 10;
+ const float invScale = 1.0 / (hdrScale * float(kernelSize));
+
+ for (int x = -kernelSize; x <= kernelSize; x++)
+ {
+ float s = gl_TexCoord[0].s + x * sx;
+ float t = gl_TexCoord[0].t;
+ vec3 color = texture2D(colorTex, vec2(s,t)).rgb;
+ float luminance = dot(color, vec3(0.2125, 0.7154, 0.0721));
+ if (luminance > 1.0)
+ {
+ bloom += color * ((kernelSize+1) - abs(float(x)));
+ }
+ }
+
+ gl_FragColor = vec4(bloom * invScale, 1.0);
+ } \ No newline at end of file
diff --git a/KaplaDemo/externalIP/resources/shaders/bloomV_fs.cpp b/KaplaDemo/externalIP/resources/shaders/bloomV_fs.cpp
new file mode 100644
index 00000000..05f858e3
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/bloomV_fs.cpp
@@ -0,0 +1,30 @@
+ uniform sampler2D colorTex;
+ uniform sampler2D blurTex;
+ uniform float sy;
+
+ void main (void)
+ {
+ const float hdrScale = 1.5;
+ const int kernelSize = 10;
+ const float invScale = 1.0 / (hdrScale * float(kernelSize) * 100.0);
+
+ vec3 colorP = texture2D(colorTex, gl_TexCoord[0]).rgb;
+ vec3 bloom = vec3(0.0, 0.0, 0.0);
+
+ for (int y = -kernelSize; y <= kernelSize; y++)
+ {
+ float s = gl_TexCoord[0].s;
+ float t = gl_TexCoord[0].t + y * sy;
+ vec3 color = texture2D(blurTex, vec2(s,t)).rgb;
+ float luminance = dot(color, vec3(0.2125, 0.7154, 0.0721));
+ if (luminance > 1.0)
+ {
+ bloom += color * ((kernelSize+1) - abs(float(y)));
+ }
+ }
+
+ vec3 hdrColor = invScale * bloom + colorP;
+
+ vec3 toneMappedColor = 2.0 * hdrColor / (hdrColor + vec3(1.0));
+ gl_FragColor = vec4(toneMappedColor, 1.0);
+ } \ No newline at end of file
diff --git a/KaplaDemo/externalIP/resources/shaders/combine_fs.cpp b/KaplaDemo/externalIP/resources/shaders/combine_fs.cpp
new file mode 100644
index 00000000..98160e6a
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/combine_fs.cpp
@@ -0,0 +1,529 @@
+uniform sampler3D ttt3D;
+
+ uniform float extraNoiseScale = 1.0f;
+ uniform float noiseScale = 0.03f;
+ float noise(float p) {
+ return texture3D(ttt3D, vec3(p*noiseScale*extraNoiseScale, 0.5, 0.5)).x;
+ }
+
+ float noise(float p, float q) {
+ return texture3D(ttt3D, vec3(p*noiseScale*extraNoiseScale, q*noiseScale*extraNoiseScale, 0.5)).x;
+ }
+
+ float snoise(float p) {
+ return noise(p)*2.0f - 1.0f;
+ }
+ float snoise(float p, float q) {
+ return noise(p, q)*2.0f - 1.0f;
+ }
+ float boxstep(float a, float b, float x) {
+ return (clamp(((x)-(a)) / ((b)-(a)), 0, 1));
+
+ }
+
+ uniform float Ka = 1;
+ uniform float Kd = 0.75;
+ uniform float Ks = 0.15;
+ uniform float roughness = 0.025;
+ uniform vec3 specularcolor = vec3(1, 1, 1);
+ uniform float ringscale = 0;
+ uniform float grainscale = 0;
+ uniform float txtscale = 1;
+ uniform float plankspertile = 4;
+ uniform vec3 lightwood = vec3(0.57, 0.292, 0.125);
+ uniform vec3 darkwood = vec3(0.275, 0.15, 0.06);
+ uniform vec3 groovecolor = vec3(.05, .04, .015);
+ //uniform float plankwidth = .05;
+ uniform float plankwidth = .2;
+ uniform float groovewidth = 0.001;
+ uniform float plankvary = 0.8;
+ uniform float grainy = 1;
+ uniform float wavy = 0.08;
+ uniform float MINFILTERWIDTH = 1.0e-7;
+
+ vec3 myTexture3D_0(vec3 p)
+ {
+ float r;
+ float r2;
+ float whichrow;
+ float whichplank;
+ float swidth;
+ float twidth;
+ float fwidth;
+ float ss;
+ float tt;
+ float w;
+ float h;
+ float fade;
+ float ttt;
+ vec3 Ct;
+ vec3 woodcolor;
+ float groovy;
+ float PGWIDTH;
+ float PGHEIGHT;
+ float GWF;
+ float GHF;
+ float tilewidth;
+ float whichtile;
+ float tmp;
+ float planklength;
+
+
+ PGWIDTH = plankwidth + groovewidth;
+ planklength = PGWIDTH * plankspertile - groovewidth;
+
+ PGHEIGHT = planklength + groovewidth;
+ GWF = groovewidth*0.5 / PGWIDTH;
+ GHF = groovewidth*0.5 / PGHEIGHT;
+
+ // Determine how wide in s-t space one pixel projects to
+ float s = p.x;
+ float t = p.y;
+ float du = 1.0;
+ float dv = 1.0;
+
+ swidth = (max(abs(dFdx(s)*du) + abs(dFdy(s)*dv), MINFILTERWIDTH) /
+ PGWIDTH) * txtscale;
+ twidth = (max(abs(dFdx(t)*du) + abs(dFdy(t)*dv), MINFILTERWIDTH) /
+ PGHEIGHT) * txtscale;
+ fwidth = max(swidth, twidth);
+
+ ss = (txtscale * s) / PGWIDTH;
+ whichrow = floor(ss);
+ tt = (txtscale * t) / PGHEIGHT;
+ whichplank = floor(tt);
+
+ if (mod(whichrow / plankspertile + whichplank, 2) >= 1) {
+ ss = txtscale * t / PGWIDTH;
+ whichrow = floor(ss);
+ tt = txtscale * s / PGHEIGHT;
+ whichplank = floor(tt);
+ tmp = swidth; swidth = twidth; twidth = tmp;
+ }
+ ss -= whichrow;
+ tt -= whichplank;
+ whichplank += 20 * (whichrow + 10);
+
+ if (swidth >= 1)
+ w = 1 - 2 * GWF;
+ else w = clamp(boxstep(GWF - swidth, GWF, ss), max(1 - GWF / swidth, 0), 1)
+ - clamp(boxstep(1 - GWF - swidth, 1 - GWF, ss), 0, 2 * GWF / swidth);
+ if (twidth >= 1)
+ h = 1 - 2 * GHF;
+ else h = clamp(boxstep(GHF - twidth, GHF, tt), max(1 - GHF / twidth, 0), 1)
+ - clamp(boxstep(1 - GHF - twidth, 1 - GHF, tt), 0, 2 * GHF / twidth);
+ // This would be the non-antialiased version:
+ //w = step (GWF,ss) - step(1-GWF,ss);
+ //h = step (GHF,tt) - step(1-GHF,tt);
+
+ groovy = w*h;
+
+
+
+ // Add the ring patterns
+ fade = smoothstep(1 / ringscale, 8 / ringscale, fwidth);
+ if (fade < 0.999) {
+
+ ttt = tt / 4 + whichplank / 28.38 + wavy * noise(8 * ss, tt / 4);
+ r = ringscale * noise(ss - whichplank, ttt);
+ r -= floor(r);
+ r = 0.3 + 0.7*smoothstep(0.2, 0.55, r)*(1 - smoothstep(0.75, 0.8, r));
+ r = (1 - fade)*r + 0.65*fade;
+
+ // Multiply the ring pattern by the fine grain
+
+ fade = smoothstep(2 / grainscale, 8 / grainscale, fwidth);
+ if (fade < 0.999) {
+ r2 = 1.3 - noise(ss*grainscale, (tt*grainscale / 4));
+ r2 = grainy * r2*r2 + (1 - grainy);
+ r *= (1 - fade)*r2 + (0.75*fade);
+
+ }
+ else r *= 0.75;
+
+ }
+ else r = 0.4875;
+
+
+ // Mix the light and dark wood according to the grain pattern
+ woodcolor = lerp(lightwood, darkwood, r);
+
+ // Add plank-to-plank variation in overall color
+ woodcolor *= (1 - plankvary / 2 + plankvary * noise(whichplank + 0.5));
+
+ Ct = lerp(groovecolor, woodcolor, groovy);
+ return Ct;
+
+ }
+
+ float noise3D_1(vec3 p)
+ {
+ return texture3D(ttt3D, p).x*2.0f - 1.0f;
+ }
+
+ float turbulence_1(vec3 p, int octaves, float lacunarity, float gain) {
+
+ float freq = 1.0f;
+ float amp = 0.8f;
+ float sum = 0.0f;
+
+ for (int i = 0; i<octaves; i++) {
+ sum += abs(noise3D_1(p*freq))*amp;
+ freq *= lacunarity;
+ amp *= gain;
+ }
+ return sum;
+ }
+
+ float spike_1(float c, float w, float x) {
+ return smoothstep(c - w, c, x) * smoothstep(c + w, c, x);
+ }
+
+ vec3 myTexture3D_1(vec3 p)
+ {
+
+
+ float noiseScale = 0.1f*extraNoiseScale;
+ float noise = turbulence_1(p*noiseScale, 3, 3.0f, 0.5f);
+ //noise = turbulence(p*noiseScale + vec3(noise, noise, noise*0.3)*0.01f, 8, 3.0f, 0.5f);
+
+ //noise = spike(0.35f, 0.05f, noise);
+ //noise = noise;
+
+ vec3 base = lerp(vec3(164, 148, 108)*1.63 / 255, vec3(178, 156, 126)*1.73 / 255, spike_1(0.5f, 0.3f, turbulence_1(p*noiseScale*0.7f + vec3(noise*0.5, noise, noise)*0.011f, 2, 2.0f, 0.5f)));
+ //vec3 b2 = lerp(base, vec3(0.0f, 0.0f, 0.0f), noise);
+ vec3 b2 = lerp(base, vec3(173, 160, 121)*1.73 / 255, noise);
+
+
+
+ return b2*0.75f;
+
+ }
+
+ vec3 myTexture3DCom(vec3 p, float mat) {
+ // Depend on material ID
+
+ if (mat < 0.5f) {
+ //return myTexture3D_0(p);
+ return vec3(173, 160, 151) *0.85/ 255;
+ //return lightwood*1.3;
+ }
+ else
+ if (mat < 1.5f) {
+ //return myTexture3D_1(p);
+ return vec3(173, 100, 21)*1.73 / 255;
+ } else {
+ return vec3(1.0f, 0.0f, 0.0f);
+
+ }
+
+ }
+// scene reflection
+uniform float reflectionCoeff = 0.0f;
+uniform float specularCoeff = 0.0f;
+
+uniform sampler2DRect reflectionTex;
+
+// Shadow map
+uniform float shadowAmbient = 0.0;
+uniform float hdrScale = 5.0;
+uniform sampler2D texture;
+uniform sampler2DArrayShadow stex;
+uniform sampler2DArrayShadow stex2;
+uniform sampler2DArrayShadow stex3;
+uniform samplerCube skyboxTex;
+uniform vec2 texSize; // x - size, y - 1/size
+uniform vec4 far_d;
+
+// Spot lights
+uniform vec3 spotLightDir;
+uniform vec3 spotLightPos;
+uniform float spotLightCosineDecayBegin;
+uniform float spotLightCosineDecayEnd;
+
+uniform vec3 spotLightDir2;
+uniform vec3 spotLightPos2;
+uniform float spotLightCosineDecayBegin2;
+uniform float spotLightCosineDecayEnd2;
+
+uniform vec3 spotLightDir3;
+uniform vec3 spotLightPos3;
+uniform float spotLightCosineDecayBegin3;
+uniform float spotLightCosineDecayEnd3;
+
+uniform vec3 parallelLightDir;
+uniform float shadowAdd;
+uniform int useTexture;
+uniform int numShadows;
+
+
+uniform float roughnessScale;
+uniform vec3 ambientColor;
+
+uniform sampler2DArray diffuseTexArray;
+uniform sampler2DArray bumpTexArray;
+uniform sampler2DArray specularTexArray;
+uniform sampler2DArray emissiveReflectSpecPowerTexArray;
+
+uniform vec2 shadowTaps[12];
+
+
+float shadowCoeff1(float bscale)
+{
+
+ int index = 3;
+
+ if(gl_FragCoord.z < far_d.x)
+ index = 0;
+ else if(gl_FragCoord.z < far_d.y)
+ index = 1;
+ else if(gl_FragCoord.z < far_d.z)
+ index = 2;
+
+ vec4 shadow_coord = gl_TextureMatrix[index]*vec4(gl_TexCoord[1].xyz, 1);
+
+ shadow_coord.w = shadow_coord.z + shadowAdd*bscale;
+ // tell glsl in which layer to do the look up
+ shadow_coord.z = float(index);
+
+
+ // Gaussian 3x3 filter
+// return shadow2DArray(stex, shadow_coord).x;
+ /*
+ const float X = 1.0f;
+ float ret = shadow2DArray(stex, shadow_coord).x * 0.25;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( -X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( -X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( -X, X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( 0, -X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( 0, X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( X, X)).x * 0.0625;
+ return ret;*/
+ const int numTaps = 6;
+ float radius = 0.0003f/pow(2,index);
+ float s = 0.0f;
+ for (int i = 0; i < numTaps; i++)
+ {
+ s += shadow2DArray(stex, shadow_coord + vec4(shadowTaps[i] * radius, 0.0f, 0.0f)).r;
+ }
+ s /= numTaps;
+ return s;
+}
+float shadowCoeff2()
+{
+ const int index = 1;
+
+ //int index = 3;
+ //if(gl_FragCoord.z < far_d.x)
+ // index = 0;
+ //else if(gl_FragCoord.z < far_d.y)
+ // index = 1;
+ //else if(gl_FragCoord.z < far_d.z)
+ // index = 2;
+
+ vec4 shadow_coord = gl_TextureMatrix[index]*vec4(gl_TexCoord[1].xyz, 1);
+
+ shadow_coord.w = shadow_coord.z + shadowAdd;
+ shadow_coord.z = float(0);
+ // return shadow2DArray(stex, shadow_coord).x;
+
+ const float X = 1.0f;
+ float ret = shadow2DArray(stex2, shadow_coord).x * 0.25;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( -X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( -X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( -X, X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( 0, -X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( 0, X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( X, X)).x * 0.0625;
+ return ret;
+}
+float shadowCoeff3()
+{
+ const int index = 2;
+
+ //int index = 3;
+ //if(gl_FragCoord.z < far_d.x)
+ // index = 0;
+ //else if(gl_FragCoord.z < far_d.y)
+ // index = 1;
+ //else if(gl_FragCoord.z < far_d.z)
+ // index = 2;
+
+ vec4 shadow_coord = gl_TextureMatrix[index]*vec4(gl_TexCoord[1].xyz, 1);
+
+ shadow_coord.w = shadow_coord.z + shadowAdd;
+ shadow_coord.z = float(0);
+
+ // return shadow2DArray(stex, shadow_coord).x;
+
+ const float X = 1.0f;
+ float ret = shadow2DArray(stex3, shadow_coord).x * 0.25;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( -X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( -X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( -X, X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( 0, -X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( 0, X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( X, X)).x * 0.0625;
+ return ret;
+}
+
+
+
+uniform float RollOff = 0.5f;
+uniform float fresnelBias = 0.0;
+uniform float fresnelScale = 1.0;
+uniform float fresnelPower = 3.0; // 5.0 is physically correct
+void main()
+{
+
+/*
+ int index = 3;
+
+ if(gl_FragCoord.z < far_d.x)
+ index = 0;
+ else if(gl_FragCoord.z < far_d.y)
+ index = 1;
+ else if(gl_FragCoord.z < far_d.z)
+ index = 2;
+ if (index == 3) gl_FragColor = vec4(1,0,0,1);
+ if (index == 2) gl_FragColor = vec4(0,1,0,1);
+ if (index == 1) gl_FragColor = vec4(0,0,1,1);
+ if (index == 0) gl_FragColor = vec4(1,1,0,1);
+ return;*/
+ /*
+ int index = 3;
+
+ if(gl_FragCoord.z < far_d.x)
+ index = 0;
+ else if(gl_FragCoord.z < far_d.y)
+ index = 1;
+ else if(gl_FragCoord.z < far_d.z)
+ index = 2;
+
+ vec4 shadow_coord = gl_TextureMatrix[index]*vec4(gl_TexCoord[1].xyz, 1);
+
+ shadow_coord.w = shadow_coord.z + shadowAdd;
+ // tell glsl in which layer to do the look up
+ shadow_coord.z = float(index)*0.33333333f;
+ gl_FragColor = vec4(shadow_coord.xyz,1.0f);
+ return;
+ */
+ //// TODO, expose this as user parameter
+ const float skyLightIntensity = 0.2;
+ const float rimLightIntensity = 0.3;
+
+ vec3 normal = normalize(gl_TexCoord[2].xyz);
+ vec3 t0 = gl_TexCoord[3].xyz;
+ vec3 t1 = gl_TexCoord[4].xyz;
+
+ vec3 diffuseMat;
+ vec3 specularMat;
+ vec3 bump;
+ vec3 emissiveReflectSpecPow;
+
+ // read in material color for diffuse, specular, bump, emmisive
+
+ // 3D texture
+ diffuseMat = myTexture3DCom(gl_TexCoord[0].xyz, gl_TexCoord[6].w);
+ //diffuseMat = myTexture3D(gl_TexCoord[0].xyz);//texture3D(ttt3D, gl_TexCoord[0].xyz);
+ //diffuseMat = texture3D(ttt3D, gl_TexCoord[0].xyz);
+
+ specularMat = vec3(1.0);
+ bump = texture2D(texture, gl_TexCoord[5].xy).xyz;
+ if (dot(bump,bump) < 0.01) bump = vec3(0.5,0.5,1);
+ emissiveReflectSpecPow = vec3(0.0,0.0,0.0);
+
+
+ // apply bump to the normal
+ bump = (bump - vec3(0.5,0.5,0.5)) * 2.0f;
+ bump.xy *= roughnessScale*0.1;
+
+ float sc = 1.0f;
+ normal = normalize(t0*bump.x + t1*bump.y + sc*normal * bump.z);
+
+ //gl_FragColor.xyz = normal*0.5 + vec3(0.5,0.5,0.5);
+ //gl_FragColor.w = 1;
+ //return;
+ vec3 eyeVec = normalize(gl_TexCoord[1].xyz);
+
+ // apply gamma correction for diffuse textures
+ //diffuseMat = pow(diffuseMat, 0.45);
+
+ float specularPower = emissiveReflectSpecPow.b*255.0f + 1.0f;
+
+ // TODO - fix this
+ specularPower = 10.0f;
+
+ float emissive = 0.0f;
+ float reflectivity = emissiveReflectSpecPow.b;
+ float fresnel = fresnelBias + fresnelScale*pow(1.0 - max(0.0, dot(normal, eyeVec)), fresnelPower);
+ float specular = 0.0f;
+
+ vec3 skyNormal = reflect(eyeVec, normal);
+ vec3 skyColor = skyLightIntensity * textureCube(skyboxTex, skyNormal).rgb;
+ vec3 ambientSkyColor = diffuseMat * skyColor;
+
+ vec3 diffuseColor = vec3(0.0, 0.0, 0.0);
+
+ if (numShadows >= 1) {
+
+ vec3 lightColor = hdrScale * vec3(1.0, 1.0, 1.0);
+ vec3 shadowColor = vec3(0.4, 0.4, 0.7); // colored shadow
+ //vec3 lvec = normalize(spotLightDir);
+ vec3 lvec = normalize(spotLightPos - gl_TexCoord[1].xyz);
+ float ldn = max(0.0f, dot(normal, lvec));
+ float cosine = dot(lvec, spotLightDir);
+ float intensity = smoothstep(spotLightCosineDecayBegin, spotLightCosineDecayEnd, cosine);
+
+ float bscale = 1;//1.0f-ldn;
+
+ float shadowC = shadowCoeff1(bscale);
+ //gl_FragColor = vec4(shadowC,shadowC,shadowC,1.0f);
+ //return;
+ vec3 irradiance = shadowC * ldn * lightColor;
+
+ // diffuse irradiance
+ diffuseColor += diffuseMat * irradiance*intensity;
+
+ // add colored shadow
+ diffuseColor += (1.0 - shadowC*ldn) * shadowAmbient * shadowColor * diffuseMat*intensity;
+
+ vec3 r = reflect(lvec, normal);
+ specular += pow(max(0.0, dot(r, eyeVec)), specularPower)*shadowC*intensity;
+ }
+
+ // add rim light
+ if (numShadows >= 2) {
+ vec3 lightColor = hdrScale * vec3(1.0, 1.0, 1.0);
+ vec3 lvec = normalize(spotLightDir2);
+ float ldn = max(0.0f, dot(normal, lvec));
+ vec3 irradiance = ldn * lightColor;
+
+ // diffuse irradiance
+ diffuseColor += diffuseMat * irradiance;
+ }
+
+ vec3 color = vec3(0.0, 0.0, 0.0);
+
+ color += diffuseColor;
+ color += ambientSkyColor;
+ color += specular*specularMat;
+ color += hdrScale * emissive * diffuseMat;
+
+ //vec3 reflectColor = diffuseMat * texture2DRect(reflectionTex, gl_FragCoord.xy).rgb;
+ //color = reflectionCoeff * reflectColor + (1.0f - reflectionCoeff) * color;
+ color = (fresnel * skyColor + (1.0 - fresnel) * color) * reflectivity + (1.0 - reflectivity) * color;
+
+ gl_FragColor.rgb = color;
+ gl_FragColor.w = gl_Color.w;
+
+ float fog = clamp(gl_Fog.scale*(gl_Fog.end+gl_TexCoord[1].z), 0.0, 1.0);
+ vec4 fogCol = gl_Fog.color;
+ gl_FragColor = mix(fogCol, gl_FragColor, fog);
+} \ No newline at end of file
diff --git a/KaplaDemo/externalIP/resources/shaders/combine_vs.cpp b/KaplaDemo/externalIP/resources/shaders/combine_vs.cpp
new file mode 100644
index 00000000..af9f33fe
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/combine_vs.cpp
@@ -0,0 +1,79 @@
+
+uniform float uvScale = 1.0f;
+uniform sampler2D transTex;
+uniform int transTexSize;
+uniform float iTransTexSize;
+uniform float bumpTextureUVScale;
+//attribute mat4 transformmatrix;
+void main()
+{
+
+ int ti = (int)(gl_MultiTexCoord0.w);
+ //int ti = tq;
+ int tpr = transTexSize / 4;
+ int row = ti / tpr;
+ int col = (ti - row*tpr)*4;
+
+ float fx = (col+0.5f)*iTransTexSize;
+ float fy = (row+0.5f)*iTransTexSize;
+
+
+ vec4 r0 = texture2D(transTex, vec2(fx,fy));
+ vec4 r1 = texture2D(transTex, vec2(fx+iTransTexSize,fy));
+ vec4 r2 = texture2D(transTex, vec2(fx+iTransTexSize*2.0f,fy));
+ vec4 r3 = texture2D(transTex, vec2(fx+iTransTexSize*3.0f,fy));
+// vec4 r3 = vec4(0,0,0,1);
+
+ vec3 offset = vec3(r0.w, r1.w, r2.w);
+ r0.w = 0.0f;
+ r1.w = 0.0f;
+ r2.w = 0.0f;
+
+ float material = r3.w;
+ r3.w = 1.0f;
+ mat4 transformmatrix = mat4(r0,r1,r2,r3);
+
+
+
+
+ mat4 mvp = gl_ModelViewMatrix * transformmatrix;
+ mat4 mvpt = gl_ModelViewMatrixInverseTranspose * transformmatrix;
+ vec4 t0 = vec4(gl_MultiTexCoord0.xyz, 0.0f);
+
+ vec4 t1 = vec4(cross(gl_Normal.xyz, t0.xyz), 0.0f);
+
+// mat4 mvp = gl_ModelViewMatrix;
+// mat4 mvpt = gl_ModelViewMatrixInverseTranspose;
+
+
+ vec4 eyeSpacePos = mvp * gl_Vertex;
+ //eyeSpacePos.y += gl_InstanceID * 0.2f;
+ //gl_TexCoord[0].xyz = gl_MultiTexCoord0.xyz*uvScale;
+ vec3 coord3d = gl_Vertex.xyz + offset;
+ gl_TexCoord[0].xyz = (coord3d)*uvScale;
+ gl_TexCoord[1] = eyeSpacePos;
+ gl_FrontColor = gl_Color;
+ gl_Position = gl_ProjectionMatrix*eyeSpacePos;
+ gl_TexCoord[2] = mvpt * vec4(gl_Normal.xyz,0.0);
+
+ gl_TexCoord[3] = mvpt * t0;
+ gl_TexCoord[4].xyz = mvpt * t1;
+
+ gl_TexCoord[5].xy = vec2(dot(coord3d, t0.xyz), dot(coord3d, t1.xyz))*bumpTextureUVScale*2;
+
+ gl_TexCoord[6].xyz = vec3(gl_MultiTexCoord1.xy, material);
+ gl_TexCoord[6].y = 1.0 - gl_TexCoord[6].y;
+
+ float MAX_3D_TEX = 8.0;
+ if (gl_TexCoord[6].x >= 5.0f) {
+ // 2D Tex
+ gl_TexCoord[6].x -= 5.0f;
+ gl_TexCoord[6].z = floor(gl_TexCoord[6].z / MAX_3D_TEX);
+ } else {
+ gl_TexCoord[6].z -= floor(gl_TexCoord[6].z / MAX_3D_TEX)*MAX_3D_TEX;
+ gl_TexCoord[6].z -= 100.0f;
+
+ }
+ gl_TexCoord[6].w = floor(fract(material / MAX_3D_TEX)*MAX_3D_TEX + 0.5f);
+ gl_ClipVertex = vec4(eyeSpacePos.xyz, 1.0f);
+} \ No newline at end of file
diff --git a/KaplaDemo/externalIP/resources/shaders/debris_fs.cpp b/KaplaDemo/externalIP/resources/shaders/debris_fs.cpp
new file mode 100644
index 00000000..6dd9406d
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/debris_fs.cpp
@@ -0,0 +1,309 @@
+ uniform sampler3D ttt3D;
+ uniform float extraNoiseScale = 1.0f;
+float noise3D(vec3 p)
+{
+ return texture3D(ttt3D, p).x*2.0f - 1.0f;
+}
+
+float turbulence(vec3 p, int octaves, float lacunarity, float gain) {
+
+ float freq = 1.0f;
+ float amp = 0.8f;
+ float sum = 0.0f;
+
+ for(int i=0; i<octaves; i++) {
+ sum += abs(noise3D(p*freq))*amp;
+ freq *= lacunarity;
+ amp *= gain;
+ }
+ return sum;
+}
+
+float spike(float c, float w, float x) {
+ return smoothstep(c-w, c, x) * smoothstep(c+w, c, x);
+}
+
+vec3 myTexture3D(vec3 p)
+{
+
+
+ float noiseScale = 0.1f*extraNoiseScale;
+ float noise = turbulence(p*noiseScale, 3, 3.0f, 0.5f);
+ //noise = turbulence(p*noiseScale + vec3(noise, noise, noise*0.3)*0.01f, 8, 3.0f, 0.5f);
+
+ //noise = spike(0.35f, 0.05f, noise);
+ //noise = noise;
+
+ vec3 base = lerp(vec3(164,148,108)*1.63/255, vec3(178,156,126)*1.73/255, spike(0.5f, 0.3f, turbulence(p*noiseScale*0.7f + vec3(noise*0.5, noise, noise)*0.011f, 2, 2.0f, 0.5f)));
+ //vec3 b2 = lerp(base, vec3(0.0f, 0.0f, 0.0f), noise);
+ vec3 b2 = lerp(base, vec3(173, 160, 121)*1.73/255, noise);
+
+
+
+ return b2;
+
+
+
+
+
+}
+
+// scene reflection
+uniform float reflectionCoeff = 0.0f;
+uniform float specularCoeff = 0.0f;
+
+uniform sampler2DRect reflectionTex;
+
+// Shadow map
+uniform float shadowAmbient = 0.0;
+uniform float hdrScale = 5.0;
+uniform sampler2D texture;
+uniform sampler2DArrayShadow stex;
+uniform sampler2DArrayShadow stex2;
+uniform sampler2DArrayShadow stex3;
+uniform samplerCube skyboxTex;
+uniform vec2 texSize; // x - size, y - 1/size
+uniform vec4 far_d;
+
+// Spot lights
+uniform vec3 spotLightDir;
+uniform vec3 spotLightPos;
+uniform float spotLightCosineDecayBegin;
+uniform float spotLightCosineDecayEnd;
+
+uniform vec3 spotLightDir2;
+uniform vec3 spotLightPos2;
+uniform float spotLightCosineDecayBegin2;
+uniform float spotLightCosineDecayEnd2;
+
+uniform vec3 spotLightDir3;
+uniform vec3 spotLightPos3;
+uniform float spotLightCosineDecayBegin3;
+uniform float spotLightCosineDecayEnd3;
+
+uniform vec3 parallelLightDir;
+uniform float shadowAdd;
+uniform int useTexture;
+uniform int numShadows;
+
+
+uniform float roughnessScale;
+uniform vec3 ambientColor;
+
+uniform sampler2DArray diffuseTexArray;
+uniform sampler2DArray bumpTexArray;
+uniform sampler2DArray specularTexArray;
+uniform sampler2DArray emissiveReflectSpecPowerTexArray;
+
+
+
+float shadowCoeff1()
+{
+ const int index = 0;
+
+ //int index = 3;
+ //
+ //if(gl_FragCoord.z < far_d.x)
+ // index = 0;
+ //else if(gl_FragCoord.z < far_d.y)
+ // index = 1;
+ //else if(gl_FragCoord.z < far_d.z)
+ // index = 2;
+
+ vec4 shadow_coord = gl_TextureMatrix[index]*vec4(gl_TexCoord[1].xyz, 1);
+
+ shadow_coord.w = shadow_coord.z + shadowAdd;
+ // tell glsl in which layer to do the look up
+ shadow_coord.z = float(index);
+
+
+ // Gaussian 3x3 filter
+ // return shadow2DArray(stex, shadow_coord).x;
+ const float X = 1.0f;
+ float ret = shadow2DArray(stex, shadow_coord).x * 0.25;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( -X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( -X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( -X, X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( 0, -X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( 0, X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( X, X)).x * 0.0625;
+ return ret;
+}
+float shadowCoeff2()
+{
+ const int index = 1;
+
+ //int index = 3;
+ //if(gl_FragCoord.z < far_d.x)
+ // index = 0;
+ //else if(gl_FragCoord.z < far_d.y)
+ // index = 1;
+ //else if(gl_FragCoord.z < far_d.z)
+ // index = 2;
+
+ vec4 shadow_coord = gl_TextureMatrix[index]*vec4(gl_TexCoord[1].xyz, 1);
+
+ shadow_coord.w = shadow_coord.z + shadowAdd;
+ shadow_coord.z = float(0);
+ // return shadow2DArray(stex, shadow_coord).x;
+
+ const float X = 1.0f;
+ float ret = shadow2DArray(stex2, shadow_coord).x * 0.25;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( -X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( -X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( -X, X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( 0, -X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( 0, X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( X, X)).x * 0.0625;
+ return ret;
+}
+float shadowCoeff3()
+{
+ const int index = 2;
+
+ //int index = 3;
+ //if(gl_FragCoord.z < far_d.x)
+ // index = 0;
+ //else if(gl_FragCoord.z < far_d.y)
+ // index = 1;
+ //else if(gl_FragCoord.z < far_d.z)
+ // index = 2;
+
+ vec4 shadow_coord = gl_TextureMatrix[index]*vec4(gl_TexCoord[1].xyz, 1);
+
+ shadow_coord.w = shadow_coord.z + shadowAdd;
+ shadow_coord.z = float(0);
+
+ // return shadow2DArray(stex, shadow_coord).x;
+
+ const float X = 1.0f;
+ float ret = shadow2DArray(stex3, shadow_coord).x * 0.25;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( -X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( -X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( -X, X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( 0, -X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( 0, X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( X, X)).x * 0.0625;
+ return ret;
+}
+
+
+
+uniform float RollOff = 0.5f;
+uniform float fresnelBias = 0.0;
+uniform float fresnelScale = 1.0;
+uniform float fresnelPower = 3.0; // 5.0 is physically correct
+void main()
+{
+ //// TODO, expose this as user parameter
+ const float skyLightIntensity = 0.2;
+ const float rimLightIntensity = 0.3;
+
+ vec3 normal = normalize(gl_TexCoord[2].xyz);
+ vec3 t0 = gl_TexCoord[3].xyz;
+ vec3 t1 = gl_TexCoord[4].xyz;
+
+ vec3 diffuseMat;
+ vec3 specularMat;
+ vec3 bump;
+ vec3 emissiveReflectSpecPow;
+
+ // read in material color for diffuse, specular, bump, emmisive
+ if (gl_TexCoord[6].z >= 0.0f) {
+ // 2D texture
+ diffuseMat = texture2DArray(diffuseTexArray, gl_TexCoord[6].xyz).rgb;
+ //specularMat = texture2DArray(specularTexArray, gl_TexCoord[6].xyz).rgb; // TODO Does not seem to work
+ specularMat = vec3(1.0f);
+ bump = texture2DArray(bumpTexArray, gl_TexCoord[6].xyz).xyz;
+ if (dot(bump,bump) < 0.01) bump = vec3(0.5,0.5,1);
+ emissiveReflectSpecPow = texture2DArray(emissiveReflectSpecPowerTexArray, gl_TexCoord[6].xyz).xyz;
+
+ } else {
+ // 3D texture
+ diffuseMat = myTexture3D(gl_TexCoord[0].xyz) * vec3(0.5,0.5,0.5);//texture3D(ttt3D, gl_TexCoord[0].xyz);
+ specularMat = vec3(1.0);
+ bump = texture2D(texture, gl_TexCoord[5].xy).xyz;
+ if (dot(bump,bump) < 0.01) bump = vec3(0.5,0.5,1);
+ emissiveReflectSpecPow = vec3(0.0,0.0,0.0);
+ }
+
+ // apply bump to the normal
+ bump = (bump - vec3(0.5,0.5,0.5)) * 2.0f;
+ bump.xy *= roughnessScale*2;
+ float sc = 1.0f;
+ normal = normalize(t0*bump.x + t1*bump.y + sc*normal * bump.z);
+
+ vec3 eyeVec = normalize(gl_TexCoord[1].xyz);
+
+ // apply gamma correction for diffuse textures
+ diffuseMat = pow(diffuseMat, 0.45);
+
+ float specularPower = emissiveReflectSpecPow.b*255.0f + 1.0f;
+
+ // TODO - fix this
+ specularPower = 10.0f;
+
+ float emissive = emissiveReflectSpecPow.r*10.0f;
+ float reflectivity = emissiveReflectSpecPow.b;
+ float fresnel = fresnelBias + fresnelScale*pow(1.0 - max(0.0, dot(normal, eyeVec)), fresnelPower);
+ float specular = 0.0f;
+
+ vec3 skyNormal = reflect(eyeVec, normal);
+ vec3 skyColor = skyLightIntensity * textureCube(skyboxTex, skyNormal).rgb;
+ vec3 ambientSkyColor = diffuseMat * skyColor;
+
+ vec3 diffuseColor = vec3(0.0, 0.0, 0.0);
+
+ if (numShadows >= 1) {
+ vec3 lightColor = hdrScale * vec3(1.0, 0.9, 0.9);
+ vec3 shadowColor = vec3(0.4, 0.4, 0.9); // colored shadow
+ vec3 lvec = normalize(spotLightDir);
+ float ldn = max(0.0f, dot(normal, lvec));
+ float shadowC = shadowCoeff1();
+ vec3 irradiance = shadowC * ldn * lightColor;
+
+ // diffuse irradiance
+ diffuseColor += diffuseMat * irradiance;
+
+ // add colored shadow
+ diffuseColor += (1.0 - shadowC) * shadowAmbient * shadowColor * diffuseMat;
+
+ vec3 r = reflect(lvec, normal);
+ specular += pow(max(0.0, dot(r,eyeVec)), specularPower)*shadowC;
+ }
+
+ // add rim light
+ if (numShadows >= 2) {
+ vec3 lightColor = rimLightIntensity * vec3(1.0, 0.9, 0.9);
+ vec3 lvec = normalize(spotLightDir2);
+ float ldn = max(0.0f, dot(normal, lvec));
+ vec3 irradiance = ldn * lightColor;
+
+ // diffuse irradiance
+ diffuseColor += diffuseMat * irradiance;
+ }
+
+ vec3 color = vec3(0.0, 0.0, 0.0);
+
+ color += diffuseColor;
+ color += ambientSkyColor;
+ color += specular*specularMat;
+ //color += hdrScale * emissive * diffuseMat;
+
+ //vec3 reflectColor = diffuseMat * texture2DRect(reflectionTex, gl_FragCoord.xy).rgb;
+ //color = reflectionCoeff * reflectColor + (1.0f - reflectionCoeff) * color;
+ //color = (fresnel * skyColor + (1.0 - fresnel) * color) * reflectivity + (1.0 - reflectivity) * color;
+
+ gl_FragColor.rgb = color;
+ gl_FragColor.w = gl_Color.w;
+
+ float fog = clamp(gl_Fog.scale*(gl_Fog.end+gl_TexCoord[1].z), 0.0, 1.0);
+ vec4 fogCol = gl_Fog.color;
+ gl_FragColor = mix(fogCol, gl_FragColor, fog);
+} \ No newline at end of file
diff --git a/KaplaDemo/externalIP/resources/shaders/debris_vs.cpp b/KaplaDemo/externalIP/resources/shaders/debris_vs.cpp
new file mode 100644
index 00000000..80040ea7
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/debris_vs.cpp
@@ -0,0 +1,44 @@
+uniform float uvScale = 1.0f;
+attribute mat4 transformmatrix;
+uniform float bumpTextureUVScale;
+
+void main()
+{
+ mat4 mvp = gl_ModelViewMatrix * transformmatrix;
+ mat4 mvpt = gl_ModelViewMatrixInverseTranspose * transformmatrix;
+ //mat4 mvp2 = gl_ModelViewMatrix * transformmatrix;
+ //mat4 mvp = gl_ModelViewMatrix;
+ //mat4 mvpt = gl_ModelViewMatrixInverseTranspose;
+
+ vec4 eyeSpacePos = mvp * gl_Vertex;
+
+ vec4 t0 = vec4(gl_MultiTexCoord0.xyz, 0.0f);
+ vec4 t1 = vec4(cross(gl_Normal.xyz, t0.xyz), 0.0f);
+
+
+ vec3 coord3d = gl_Vertex.xyz;
+ gl_TexCoord[0].xyz = (coord3d)*uvScale;
+ gl_TexCoord[1] = eyeSpacePos;
+ gl_FrontColor = gl_Color;
+ gl_Position = gl_ProjectionMatrix*eyeSpacePos;
+ gl_TexCoord[2] = mvpt * vec4(gl_Normal.xyz,0.0);
+
+ gl_TexCoord[3] = mvpt * t0;
+ gl_TexCoord[4] = mvpt * t1;
+
+ gl_TexCoord[5].xy = vec2(dot(coord3d, t0.xyz), dot(coord3d, t1.xyz))*bumpTextureUVScale*2;
+
+ gl_TexCoord[6].xyz = vec3(0,0,-100); // TODO: 2D UV are 0 and material id is -100 (first 3D texture)
+
+ /*
+ //vec4 eyeSpacePos2 = mvp2 * gl_Vertex;
+ gl_TexCoord[0] = gl_MultiTexCoord0*uvScale;
+ gl_TexCoord[1] = eyeSpacePos;
+ gl_FrontColor = gl_Color;
+ //gl_FrontColor.x += eyeSpacePos2.x;
+
+ gl_Position = gl_ProjectionMatrix*eyeSpacePos;
+ gl_TexCoord[2] = mvpt * vec4(gl_Normal.xyz,0.0);
+ gl_ClipVertex = vec4(eyeSpacePos.xyz, 1.0f);
+ */
+} \ No newline at end of file
diff --git a/KaplaDemo/externalIP/resources/shaders/default_fs.cpp b/KaplaDemo/externalIP/resources/shaders/default_fs.cpp
new file mode 100644
index 00000000..8dda1d21
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/default_fs.cpp
@@ -0,0 +1,308 @@
+
+// scene reflection
+uniform float reflectionCoeff = 0.0f;
+uniform float specularCoeff = 0.0f;
+
+uniform sampler2DRect reflectionTex;
+
+// Shadow map
+uniform float shadowAmbient = 0.0;
+uniform sampler2D texture;
+uniform sampler2DArrayShadow stex;
+uniform sampler2DArrayShadow stex2;
+uniform sampler2DArrayShadow stex3;
+uniform samplerCube skyboxTex;
+
+uniform float hdrScale = 5.0;
+
+uniform vec2 texSize; // x - size, y - 1/size
+uniform vec4 far_d;
+
+// Spot lights
+uniform vec3 spotLightDir;
+uniform vec3 spotLightPos;
+uniform float spotLightCosineDecayBegin;
+uniform float spotLightCosineDecayEnd;
+
+uniform vec3 spotLightDir2;
+uniform vec3 spotLightPos2;
+uniform float spotLightCosineDecayBegin2;
+uniform float spotLightCosineDecayEnd2;
+
+uniform vec3 spotLightDir3;
+uniform vec3 spotLightPos3;
+uniform float spotLightCosineDecayBegin3;
+uniform float spotLightCosineDecayEnd3;
+
+uniform vec3 parallelLightDir;
+uniform float shadowAdd;
+uniform int useTexture;
+uniform int numShadows;
+uniform vec3 ambientColor;
+uniform vec2 shadowTaps[12];
+float shadowCoeff1()
+{
+ //const int index = 0;
+
+ int index = 3;
+
+ if(gl_FragCoord.z < far_d.x)
+ index = 0;
+ else if(gl_FragCoord.z < far_d.y)
+ index = 1;
+ else if(gl_FragCoord.z < far_d.z)
+ index = 2;
+
+ vec4 shadow_coord = gl_TextureMatrix[index]*vec4(gl_TexCoord[1].xyz, 1);
+
+ shadow_coord.w = shadow_coord.z + shadowAdd;
+ // tell glsl in which layer to do the look up
+ shadow_coord.z = float(index);
+
+
+ // Gaussian 3x3 filter
+// return shadow2DArray(stex, shadow_coord).x;
+ /*
+ const float X = 1.0f;
+ float ret = shadow2DArray(stex, shadow_coord).x * 0.25;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( -X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( -X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( -X, X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( 0, -X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( 0, X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( X, X)).x * 0.0625;
+ return ret;*/
+ const int numTaps = 12;
+ float radius = 0.0003f / pow(2, index);
+ float s = 0.0f;
+ for (int i = 0; i < numTaps; i++)
+ {
+ s += shadow2DArray(stex, shadow_coord + vec4(shadowTaps[i] * radius, 0.0f, 0.0f)).r;
+ }
+ s /= numTaps;
+ return s;
+}
+float shadowCoeff2()
+{
+ const int index = 1;
+
+ //int index = 3;
+ //if(gl_FragCoord.z < far_d.x)
+ // index = 0;
+ //else if(gl_FragCoord.z < far_d.y)
+ // index = 1;
+ //else if(gl_FragCoord.z < far_d.z)
+ // index = 2;
+
+ vec4 shadow_coord = gl_TextureMatrix[index]*vec4(gl_TexCoord[1].xyz, 1);
+
+ shadow_coord.w = shadow_coord.z + shadowAdd;
+ shadow_coord.z = float(0);
+// return shadow2DArray(stex, shadow_coord).x;
+ /*
+ const float X = 1.0f;
+ float ret = shadow2DArray(stex2, shadow_coord).x * 0.25;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( -X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( -X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( -X, X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( 0, -X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( 0, X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( X, X)).x * 0.0625;
+ return ret;*/
+ const int numTaps = 12;
+ float radius = 1.0f;
+ float s = 0.0f;
+ for (int i = 0; i < numTaps; i++)
+ {
+ s += shadow2DArray(stex, shadow_coord + vec4(shadowTaps[i] * radius, 0.0f, 0.0f)).r;
+ }
+ s /= numTaps;
+ return s;
+}
+float shadowCoeff3()
+{
+ const int index = 2;
+
+ //int index = 3;
+ //if(gl_FragCoord.z < far_d.x)
+ // index = 0;
+ //else if(gl_FragCoord.z < far_d.y)
+ // index = 1;
+ //else if(gl_FragCoord.z < far_d.z)
+ // index = 2;
+
+ vec4 shadow_coord = gl_TextureMatrix[index]*vec4(gl_TexCoord[1].xyz, 1);
+
+ shadow_coord.w = shadow_coord.z + shadowAdd;
+ shadow_coord.z = float(0);
+
+// return shadow2DArray(stex, shadow_coord).x;
+ /*
+ const float X = 1.0f;
+ float ret = shadow2DArray(stex3, shadow_coord).x * 0.25;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( -X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( -X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( -X, X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( 0, -X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( 0, X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( X, X)).x * 0.0625;
+ return ret;*/
+ const int numTaps = 12;
+ float radius = 0.02f;
+ float s = 0.0f;
+ for (int i = 0; i < numTaps; i++)
+ {
+ s += shadow2DArray(stex, shadow_coord + vec4(shadowTaps[i] * radius, 0.0f, 0.0f)).r;
+ }
+ s /= numTaps;
+ return s;
+}
+
+float filterwidth(float2 v)
+{
+ float2 fw = max(abs(ddx(v)), abs(ddy(v)));
+ return max(fw.x, fw.y);
+}
+
+float2 bump(float2 x)
+{
+ return (floor((x) / 2) + 2.f * max(((x) / 2) - floor((x) / 2) - .5f, 0.f));
+}
+
+float checker(float2 uv)
+{
+ float width = filterwidth(uv);
+ float2 p0 = uv - 0.5 * width;
+ float2 p1 = uv + 0.5 * width;
+
+ float2 i = (bump(p1) - bump(p0)) / width;
+ return i.x * i.y + (1 - i.x) * (1 - i.y);
+}
+uniform float fresnelBias = 0.0;
+uniform float fresnelScale = 1.0;
+uniform float fresnelPower = 3.0; // 5.0 is physically correct
+
+uniform float RollOff = 0.5f;
+void main()
+{
+
+//// TODO, expose this as user parameter
+ const float skyLightIntensity = 0.2;
+ const float rimLightIntensity = 0.3;
+
+
+ vec3 diffuseMat;
+ vec3 specularMat;
+ vec3 emissiveReflectSpecPow;
+
+ specularMat = vec3(1.0);
+ emissiveReflectSpecPow = vec3(0.0,0.0,0.0);
+
+ vec3 normal = normalize(gl_TexCoord[2].xyz);
+ vec3 wnormal = normalize(gl_TexCoord[4].xyz);
+ // read in material color for diffuse, specular, bump, emmisive
+
+ // 3D texture
+ vec4 colorx;
+ if (useTexture > 0)
+ colorx = texture2D(texture, gl_TexCoord[0]);
+ else {
+ colorx = gl_Color;
+ colorx *= 1.0 - 0.25*checker(float2(gl_TexCoord[3].x, gl_TexCoord[3].z));
+ }
+ colorx = clamp(colorx,0,1);
+ diffuseMat = colorx.xyz*0.4;
+ //diffuseMat = myTexture3D(gl_TexCoord[0].xyz);//texture3D(ttt3D, gl_TexCoord[0].xyz);
+ //diffuseMat = texture3D(ttt3D, gl_TexCoord[0].xyz);
+
+ if (dot(normal, gl_TexCoord[1].xyz) > 0) {
+ normal.xyz *= -1;
+ }
+
+ //gl_FragColor.xyz = normal*0.5 + vec3(0.5,0.5,0.5);
+ //gl_FragColor.w = 1;
+ //return;
+ vec3 eyeVec = normalize(gl_TexCoord[1].xyz);
+
+ // apply gamma correction for diffuse textures
+ //diffuseMat = pow(diffuseMat, 0.45);
+
+ float specularPower = emissiveReflectSpecPow.b*255.0f + 1.0f;
+
+ // TODO - fix this
+ specularPower = 10.0f;
+
+ float emissive = 0.0f;
+ float reflectivity = emissiveReflectSpecPow.b;
+ float fresnel = fresnelBias + fresnelScale*pow(1.0 - max(0.0, dot(normal, eyeVec)), fresnelPower);
+ float specular = 0.0f;
+
+ vec3 skyNormal = reflect(eyeVec, normal);
+ vec3 skyColor = skyLightIntensity * textureCube(skyboxTex, skyNormal).rgb;
+ vec3 ambientSkyColor = diffuseMat * skyColor;
+
+ vec3 diffuseColor = vec3(0.0, 0.0, 0.0);
+
+ if (numShadows >= 1) {
+
+ vec3 lightColor = hdrScale * vec3(1.0, 1.0, 1.0);
+ vec3 shadowColor = vec3(0.4, 0.4, 0.7); // colored shadow
+ //vec3 lvec = normalize(spotLightDir);
+ vec3 lvec = normalize(spotLightPos - gl_TexCoord[1].xyz);
+ float cosine = dot(lvec, spotLightDir);
+ float intensity = smoothstep(spotLightCosineDecayBegin, spotLightCosineDecayEnd, cosine);
+
+ float ldn = max(0.0f, dot(normal, lvec));
+ float shadowC = shadowCoeff1();
+ //gl_FragColor = vec4(shadowC,shadowC,shadowC,1.0f);
+ //return;
+ vec3 irradiance = shadowC * ldn * lightColor;
+
+ // diffuse irradiance
+ diffuseColor += diffuseMat * irradiance*intensity;
+
+ // add colored shadow
+ diffuseColor += (1.0 - shadowC*ldn) * shadowAmbient * shadowColor * diffuseMat*intensity;
+
+ vec3 r = reflect(lvec, normal);
+ specular += pow(max(0.0, dot(r, eyeVec)), specularPower)*shadowC*intensity;
+ }
+
+ // add rim light
+ if (numShadows >= 2) {
+ vec3 lightColor = hdrScale * vec3(1.0, 1.0, 1.0);
+ vec3 lvec = normalize(spotLightDir2);
+ float ldn = max(0.0f, dot(normal, lvec));
+ vec3 irradiance = ldn * lightColor;
+
+ // diffuse irradiance
+ diffuseColor += diffuseMat * irradiance;
+ }
+
+ vec3 color = vec3(0.0, 0.0, 0.0);
+
+ color += diffuseColor;
+ color += ambientSkyColor;
+ color += specular*specularMat;
+ color += hdrScale * emissive * diffuseMat;
+
+ //vec3 reflectColor = diffuseMat * texture2DRect(reflectionTex, gl_FragCoord.xy).rgb;
+ //color = reflectionCoeff * reflectColor + (1.0f - reflectionCoeff) * color;
+ color = (fresnel * skyColor + (1.0 - fresnel) * color) * reflectivity + (1.0 - reflectivity) * color;
+
+ gl_FragColor.rgb = color;
+ gl_FragColor.w = gl_Color.w;
+
+ //float fog = clamp(gl_Fog.scale*(gl_Fog.end+gl_TexCoord[1].z), 0.0, 1.0);
+ //vec4 fogCol = gl_Fog.color;
+ float fog = clamp(gl_Fog.scale*(gl_Fog.end+gl_TexCoord[1].z), 0.0, 1.0);
+ vec4 fogCol = gl_Fog.color;
+ gl_FragColor = mix(fogCol, gl_FragColor, fog);
+
+} \ No newline at end of file
diff --git a/KaplaDemo/externalIP/resources/shaders/default_vs.cpp b/KaplaDemo/externalIP/resources/shaders/default_vs.cpp
new file mode 100644
index 00000000..cacedf1c
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/default_vs.cpp
@@ -0,0 +1,13 @@
+uniform float uvScale = 1.0f;
+void main()
+{
+ vec4 eyeSpacePos = gl_ModelViewMatrix * gl_Vertex;
+ gl_TexCoord[0] = gl_MultiTexCoord0*uvScale;
+ gl_TexCoord[1] = eyeSpacePos;
+ gl_FrontColor = gl_Color;
+ gl_Position = gl_ProjectionMatrix*eyeSpacePos;
+ gl_TexCoord[2] = gl_ModelViewMatrixInverseTranspose * vec4(gl_Normal.xyz,0.0);
+ gl_TexCoord[3].xyz = gl_Vertex.xyz;
+ gl_TexCoord[4].xyz = gl_Normal.xyz;
+ gl_ClipVertex = vec4(eyeSpacePos.xyz, 1.0f);
+} \ No newline at end of file
diff --git a/KaplaDemo/externalIP/resources/shaders/dof_fs.cpp b/KaplaDemo/externalIP/resources/shaders/dof_fs.cpp
new file mode 100644
index 00000000..98ca0566
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/dof_fs.cpp
@@ -0,0 +1,38 @@
+ uniform sampler2D colorTex;
+ uniform sampler2D depthTex;
+ uniform float sx;
+ uniform float sy;
+
+ void main (void)
+ {
+ const float depthEnd = 0.993;
+ const float depthSize = 0.015;
+
+ vec3 colorP = texture2D(colorTex, gl_TexCoord[0]).rgb;
+ float depth = texture2D(depthTex, gl_TexCoord[0].st).r;
+
+ if ((depth - depthEnd) < depthSize)
+ {
+ const int depthKernelSize = 5;
+ vec3 colorSum = vec3(0.0);
+ float cnt = 0.0;
+ for (int x = -depthKernelSize; x <= depthKernelSize; x++)
+ for (int y = -depthKernelSize; y <= depthKernelSize; y++)
+ {
+ float s = gl_TexCoord[0].s + x * sy;
+ float t = gl_TexCoord[0].t + y * sy;
+ float scalex = ((depthKernelSize+1) - abs(float(x))) / depthKernelSize;
+ float scaley = ((depthKernelSize+1) - abs(float(y))) / depthKernelSize;
+ float scale = scalex * scaley;
+ vec3 color = texture2D(colorTex, vec2(s,t)).rgb;
+ colorSum += scale * color;
+ cnt += scale;
+ }
+
+ colorSum /= cnt;
+ float depthScale = pow(max(0.0f,min(1.0, ( abs(depth-depthEnd)) / depthSize)),1.5);
+ colorP = depthScale * colorSum + (1.0 - depthScale) * colorP;
+ }
+
+ gl_FragColor = vec4(colorP, 1.0);
+ } \ No newline at end of file
diff --git a/KaplaDemo/externalIP/resources/shaders/dof_vs.cpp b/KaplaDemo/externalIP/resources/shaders/dof_vs.cpp
new file mode 100644
index 00000000..1f6a9ad7
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/dof_vs.cpp
@@ -0,0 +1,5 @@
+ void main(void)
+ {
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_Position = gl_Vertex * 2.0 - 1.0;
+ } \ No newline at end of file
diff --git a/KaplaDemo/externalIP/resources/shaders/dust_fs.cpp b/KaplaDemo/externalIP/resources/shaders/dust_fs.cpp
new file mode 100644
index 00000000..43e0ed63
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/dust_fs.cpp
@@ -0,0 +1,123 @@
+uniform sampler2DArrayShadow stex;
+uniform float shadowAmbient = 0.3;
+
+float shadowCoef()
+{
+ const int index = 0;
+ /*
+ int index = 3;
+
+ // find the appropriate depth map to look up in based on the depth of this fragment
+ if(gl_FragCoord.z < far_d.x)
+ index = 0;
+ else if(gl_FragCoord.z < far_d.y)
+ index = 1;
+ else if(gl_FragCoord.z < far_d.z)
+ index = 2;
+ */
+
+ // transform this fragment's position from view space to scaled light clip space
+ // such that the xy coordinates are in [0;1]
+ // note there is no need to divide by w for othogonal light sources
+ vec4 shadow_coord = gl_TextureMatrix[index]*vec4(gl_TexCoord[2].xyz, 1);
+
+ shadow_coord.w = shadow_coord.z;
+
+ // tell glsl in which layer to do the look up
+ shadow_coord.z = float(index);
+
+
+ // Gaussian 3x3 filter
+ return shadow2DArray(stex, shadow_coord).x;
+}
+uniform float ispotMaxDist;
+uniform vec3 spotOriginEye;
+uniform sampler2D spot_a0123;
+uniform sampler2D spot_b123;
+
+uniform sampler2D smokeTex;
+
+const float PI = 3.1415926535897932384626433832795;
+const vec3 _2pik = vec3(2.0) * vec3(PI,2.0*PI,3.0*PI);
+const vec3 factor_a = vec3(2.0*PI)*vec3(1.0,2.0,3.0);
+const vec3 factor_b = vec3(2.0*PI)*vec3(1.0,2.0,3.0);
+const vec3 value_1 = vec3(1.0);
+
+uniform mat4 eyeToSpotMatrix;
+void main()
+{
+ //gl_FragColor = gl_Color;
+ //return;
+/*
+ gl_FragColor = texture2D(smokeTex, gl_TexCoord[0].xy);
+ gl_FragColor.w = gl_FragColor.r;
+ gl_FragColor.xyz = vec3(1,1,1);
+ return;
+*/
+ // calculate eye-space normal from texture coordinates
+ vec3 N;
+ N.xy = gl_TexCoord[0].xy*vec2(2.0, -2.0) + vec2(-1.0, 1.0);
+ float mag = dot(N.xy, N.xy);
+ if (mag > 1.0) discard; // kill pixels outside circle
+
+ float falloff = pow(1.0-mag,1.0);//exp(-mag);
+ //falloff = 1.0f;
+ float shadowC = shadowCoef();
+
+ vec3 shadowColor = vec3(0.4, 0.4, 0.9)*0.8;
+
+ // Also FOM
+
+// vec4 projectionCoordinate = eyeToSpotMatrix*vec4(gl_TexCoord[2].xyz, 1.0f);
+ vec4 projectionCoordinate = eyeToSpotMatrix*vec4(gl_TexCoord[2].xyz, 1.0f);
+ //gl_FragColor.xyz = gl_TexCoord[3].xyz*0.25f;
+ //gl_FragColor.xyz = projectionCoordinate.xyz / projectionCoordinate.w;
+ //gl_FragColor.w = 1.0f;
+
+ //read Fourier series coefficients for color extinction on RGB
+ vec4 sR_a0123 = texture2DProj(spot_a0123,projectionCoordinate);
+ vec3 sR_b123 = texture2DProj(spot_b123,projectionCoordinate).rgb;
+
+ //gl_FragColor.xyz = sR_a0123.xyz;
+ //gl_FragColor.w = 1.0f;
+ //return;
+ //compute absolute and normalized distance (in spot depth range)
+ float distance2spotCenter = length(spotOriginEye-gl_TexCoord[2].xyz);//distance from spot origin to surfel in world space
+ float d = distance2spotCenter*ispotMaxDist;
+
+
+ //compute some value to recover the extinction coefficient using the Fourier series
+ vec3 sin_a123 = sin(factor_a*vec3(d));
+ vec3 cos_b123 = value_1-cos(factor_b*vec3(d));
+
+ //compute the extinction coefficients using Fourier
+ float att = (sR_a0123.r*d/2.0) + dot(sin_a123*(sR_a0123.gba/_2pik) ,value_1) + dot(cos_b123*(sR_b123.rgb/_2pik) ,value_1);
+
+ att = max(0.0f, att);
+ att = min(1.0f, att);
+ shadowC *= (1.0f-att);
+ float inS = shadowC;
+ shadowC = (shadowAmbient + (1.0f -shadowAmbient)*shadowC);
+ //....
+ if (gl_TexCoord[0].z > 1) shadowC = 1;
+ vec4 texColor = texture2D(smokeTex, gl_TexCoord[0].xy*0.25+gl_TexCoord[1].xy);
+
+ gl_FragColor.xyz = (texColor.x)*gl_Color.xyz*(shadowColor + (vec3(1.0f,1,1) -shadowColor)*shadowC);//*falloff;
+ gl_FragColor.w = gl_Color.w*texColor.r;
+
+
+ //float fog = clamp(gl_Fog.scale*(gl_Fog.end+gl_TexCoord[2].z), 0.0, 1.0);
+ //float fog = exp(-gl_Fog.density*(gl_TexCoord[0].z*gl_TexCoord[0].z));
+ //gl_FragColor = mix(gl_Fog.color, gl_FragColor, fog);
+
+ gl_FragColor.xyz *= 1.6f;
+ gl_FragColor.w *= max(min(falloff,1.0f),0.0f) * max(min(gl_TexCoord[0].w,1.0f),0.0f);
+ //gl_FragColor.w = 1;
+ //gl_FragColor.xyz = vec3(shadowC, shadowC, shadowC);
+// gl_FragColor.w = 0.2f;
+ //gl_FragColor.w = falloff * gl_TexCoord[0].w;
+ //gl_FragColor.xyz = sR_a0123.xyz;
+ gl_FragColor.xyz *= ((gl_TexCoord[0].z)+inS*0.3)*0.7;
+ //gl_FragDepth = gl_FragCoord.z - (1-mag)*0.00002;
+
+}
diff --git a/KaplaDemo/externalIP/resources/shaders/dust_gs.cpp b/KaplaDemo/externalIP/resources/shaders/dust_gs.cpp
new file mode 100644
index 00000000..672a66e5
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/dust_gs.cpp
@@ -0,0 +1,116 @@
+//#version 120\n
+//#extension GL_EXT_geometry_shader4 : enable\n
+uniform float pointRadius; // point size in world space
+uniform float densityThreshold = 50.0;
+uniform float idensityThreshold = 1.0 / 30.0;
+uniform float pointShrink = 0.25;
+uniform sampler2D meteorTex;
+void main()
+{
+ gl_FrontColor = gl_FrontColorIn[0];
+ float density = gl_TexCoordIn[0][1].x;
+ float life = gl_TexCoordIn[0][1].y;
+
+
+ gl_TexCoord[1].xy = 0.25f*vec2(gl_PrimitiveIDIn / 4, gl_PrimitiveIDIn % 4);
+ // scale down point size based on density
+ float factor = 1.0f;//density * idensityThreshold;
+ //smoothstep(0.0f, densityThreshold, density);
+ //density * idensityThreshold;
+ //clamp(density / 50.0f, 0, 1);
+ float pointSize = pointRadius*factor;//*(pointShrink + smoothstep(0.0, densityThreshold, density)*(1.0-pointShrink));
+
+ pointSize *= gl_TexCoordIn[0][3].x;
+ float tmp = gl_TexCoordIn[0][3].y;
+
+ float bb = 1.0f;
+ if (tmp > 0.5f) {
+ //gl_FrontColor = vec4(3*life,0,0,1);
+ // TODO: Meteor trail color here...
+ //vec2 fetchPos = vec2( min(max((3-lifeTime)/3,0),1), 0);
+ float val = 1-min(max((life-0.3)/0.2,0.01),0.99);
+ vec2 fetchPos = vec2(val, 0);
+ gl_FrontColor = texture2D(meteorTex, fetchPos);
+ if (gl_FrontColor.r > 0.5) bb += (gl_FrontColor.r-0.5)*(gl_FrontColor.r-0.5)*10;
+
+ }
+// float pointSize = pointRadius;
+
+ // eye space
+ vec3 pos = gl_PositionIn[0].xyz;
+ vec3 pos2 = gl_TexCoordIn[0][0].xyz;
+ vec3 motion = pos - pos2;
+ vec3 dir = normalize(motion);
+ float len = length(motion);
+
+ vec3 x = dir * pointSize;
+ vec3 view = normalize(-pos);
+ vec3 y = normalize(cross(dir, view)) * pointSize;
+ float facing = dot(view, dir);
+
+ // check for very small motion to avoid jitter
+ float threshold = 0.01;
+// if (len < threshold) {
+ if ((len < threshold) || (facing > 0.95) || (facing < -0.95)) {
+ pos2 = pos;
+ x = vec3(pointSize, 0.0, 0.0);
+ y = vec3(0.0, -pointSize, 0.0);
+ }
+
+ float angle = density;
+ float cv = cos(angle);
+ float sv = sin(angle);
+
+ vec3 xt = cv*x + sv*y;
+ vec3 yt = -sv*x + cv*y;
+ x = xt;
+ y = yt;
+
+ {
+
+ gl_TexCoord[0] = vec4(0, 0, bb, life);
+ gl_TexCoord[2] = vec4(pos + x + y, 1);
+ gl_Position = gl_ProjectionMatrix * gl_TexCoord[2];
+ gl_TexCoord[3] = gl_TexCoordIn[0][2];
+ EmitVertex();
+
+ gl_TexCoord[0] = vec4(0, 1, bb, life);
+ gl_TexCoord[2] = vec4(pos + x - y, 1);
+ gl_Position = gl_ProjectionMatrix * gl_TexCoord[2];
+
+ EmitVertex();
+
+ gl_TexCoord[0] = vec4(1, 0, bb, life);
+ gl_TexCoord[2] = vec4(pos2 - x + y, 1);
+ gl_Position = gl_ProjectionMatrix * gl_TexCoord[2];
+
+ EmitVertex();
+
+ gl_TexCoord[0] = vec4(1, 1, bb, life);
+ gl_TexCoord[2] = vec4(pos2 - x - y, 1);
+ gl_Position = gl_ProjectionMatrix * gl_TexCoord[2];
+
+ EmitVertex();
+/*
+ gl_TexCoord[0] = vec4(0, 0, 0, life);
+ gl_TexCoord[2] = vec4(pos + x + y, 1);
+ gl_Position = gl_ProjectionMatrix * gl_TexCoord[2];
+ EmitVertex();
+
+ gl_TexCoord[0] = vec4(0, 1, 0, life);
+ gl_TexCoord[2] = vec4(pos + x - y, 1);
+ gl_Position = gl_ProjectionMatrix * gl_TexCoord[2];
+ EmitVertex();
+
+ gl_TexCoord[0] = vec4(1, 0, 0, life);
+ gl_TexCoord[2] = vec4(pos2 - x + y, 1);
+ gl_Position = gl_ProjectionMatrix * gl_TexCoord[2];
+ EmitVertex();
+
+ gl_TexCoord[0] = vec4(1, 1, 0, life);
+ gl_TexCoord[2] = vec4(pos2 - x - y, 1);
+ gl_Position = gl_ProjectionMatrix * gl_TexCoord[2];
+ EmitVertex();
+ */
+ }
+}
diff --git a/KaplaDemo/externalIP/resources/shaders/dust_vs.cpp b/KaplaDemo/externalIP/resources/shaders/dust_vs.cpp
new file mode 100644
index 00000000..784782bf
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/dust_vs.cpp
@@ -0,0 +1,19 @@
+uniform float timestep = 0.02;
+uniform vec3 eyeVel;
+uniform float iStartFade = 1.0;
+void main()
+{
+ vec3 pos = gl_Vertex.xyz;
+ vec3 vel = gl_MultiTexCoord2.xyz;
+ //vel = vec3(10.0f,0.0f,0.0f);
+ vec3 pos2 = (pos - (vel+eyeVel)*timestep); // previous position
+
+ gl_Position = gl_ModelViewMatrix * vec4(pos, 1.0); // eye space
+ gl_TexCoord[0] = gl_ModelViewMatrix * vec4(pos2, 1.0);
+ gl_TexCoord[1].x = gl_MultiTexCoord1.x;
+ gl_TexCoord[1].y = max(0.0f, min(gl_MultiTexCoord3.x*iStartFade, 1.0f));
+ gl_TexCoord[2].xyz = pos;
+ gl_TexCoord[3] = gl_MultiTexCoord4;
+
+ gl_FrontColor = gl_Color;
+}
diff --git a/KaplaDemo/externalIP/resources/shaders/filterh_fs.cpp b/KaplaDemo/externalIP/resources/shaders/filterh_fs.cpp
new file mode 100644
index 00000000..0bff104c
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/filterh_fs.cpp
@@ -0,0 +1,15 @@
+ uniform sampler2D ssaoTex;
+ uniform float sx;
+
+ void main (void)
+ {
+ float SSAO = 0.0;
+
+ for(int x = -4; x <= 4; x++)
+ {
+ SSAO += texture2D(ssaoTex,vec2(x * sx + gl_TexCoord[0].s,gl_TexCoord[0].t)).r * (5.0 - abs(float(x)));
+ }
+
+ gl_FragColor = vec4(vec3(SSAO / 25.0),1.0);
+ gl_FragColor.w = gl_FragColor.x;
+ } \ No newline at end of file
diff --git a/KaplaDemo/externalIP/resources/shaders/filterv_fs.cpp b/KaplaDemo/externalIP/resources/shaders/filterv_fs.cpp
new file mode 100644
index 00000000..a062ac5a
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/filterv_fs.cpp
@@ -0,0 +1,17 @@
+ uniform sampler2D ssaoTex;
+ uniform float sy;
+
+ void main (void)
+ {
+
+ float SSAO = 0.0;
+
+ for(int y = -4; y <= 4; y++)
+ {
+ SSAO += texture2D(ssaoTex,vec2(gl_TexCoord[0].s,y * sy + gl_TexCoord[0].t)).r * (5.0 - abs(float(y)));
+ }
+
+ gl_FragColor = vec4(vec3(pow(SSAO / 25.0,1.5)),1.0);
+ gl_FragColor.w = gl_FragColor.x;
+ //gl_FragColor = vec4(1,1,1,1);
+ } \ No newline at end of file
diff --git a/KaplaDemo/externalIP/resources/shaders/filterv_vs.cpp b/KaplaDemo/externalIP/resources/shaders/filterv_vs.cpp
new file mode 100644
index 00000000..1f6a9ad7
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/filterv_vs.cpp
@@ -0,0 +1,5 @@
+ void main(void)
+ {
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_Position = gl_Vertex * 2.0 - 1.0;
+ } \ No newline at end of file
diff --git a/KaplaDemo/externalIP/resources/shaders/passthrough_vs.cpp b/KaplaDemo/externalIP/resources/shaders/passthrough_vs.cpp
new file mode 100644
index 00000000..a4227f3b
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/passthrough_vs.cpp
@@ -0,0 +1,7 @@
+void main()
+{
+ gl_Position = gl_Vertex;
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[1] = gl_Vertex;
+ gl_FrontColor = gl_Color;
+} \ No newline at end of file
diff --git a/KaplaDemo/externalIP/resources/shaders/scene_fs.cpp b/KaplaDemo/externalIP/resources/shaders/scene_fs.cpp
new file mode 100644
index 00000000..d239da41
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/scene_fs.cpp
@@ -0,0 +1,313 @@
+ uniform sampler3D ttt3D;
+ uniform float extraNoiseScale = 1.0f;
+float noise3D(vec3 p)
+{
+ return texture3D(ttt3D, p).x*2.0f - 1.0f;
+}
+
+float turbulence(vec3 p, int octaves, float lacunarity, float gain) {
+
+ float freq = 1.0f;
+ float amp = 0.8f;
+ float sum = 0.0f;
+
+ for(int i=0; i<octaves; i++) {
+ sum += abs(noise3D(p*freq))*amp;
+ freq *= lacunarity;
+ amp *= gain;
+ }
+ return sum;
+}
+
+float spike(float c, float w, float x) {
+ return smoothstep(c-w, c, x) * smoothstep(c+w, c, x);
+}
+
+vec3 myTexture3D(vec3 p)
+{
+
+
+ float noiseScale = 0.1f*extraNoiseScale;
+ float noise = turbulence(p*noiseScale, 3, 3.0f, 0.5f);
+ //noise = turbulence(p*noiseScale + vec3(noise, noise, noise*0.3)*0.01f, 8, 3.0f, 0.5f);
+
+ //noise = spike(0.35f, 0.05f, noise);
+ //noise = noise;
+
+ vec3 base = lerp(vec3(164,148,108)*1.63/255, vec3(178,156,126)*1.73/255, spike(0.5f, 0.3f, turbulence(p*noiseScale*0.7f + vec3(noise*0.5, noise, noise)*0.011f, 2, 2.0f, 0.5f)));
+ //vec3 b2 = lerp(base, vec3(0.0f, 0.0f, 0.0f), noise);
+ vec3 b2 = lerp(base, vec3(173, 160, 121)*1.73/255, noise);
+
+
+
+ return b2;
+
+
+
+
+
+}
+
+// scene reflection
+uniform float reflectionCoeff = 0.0f;
+uniform float specularCoeff = 0.0f;
+
+uniform sampler2DRect reflectionTex;
+
+// Shadow map
+uniform float shadowAmbient = 0.0;
+uniform float hdrScale = 5.0;
+uniform sampler2D texture;
+uniform sampler2DArrayShadow stex;
+uniform sampler2DArrayShadow stex2;
+uniform sampler2DArrayShadow stex3;
+uniform samplerCube skyboxTex;
+uniform vec2 texSize; // x - size, y - 1/size
+uniform vec4 far_d;
+
+// Spot lights
+uniform vec3 spotLightDir;
+uniform vec3 spotLightPos;
+uniform float spotLightCosineDecayBegin;
+uniform float spotLightCosineDecayEnd;
+
+uniform vec3 spotLightDir2;
+uniform vec3 spotLightPos2;
+uniform float spotLightCosineDecayBegin2;
+uniform float spotLightCosineDecayEnd2;
+
+uniform vec3 spotLightDir3;
+uniform vec3 spotLightPos3;
+uniform float spotLightCosineDecayBegin3;
+uniform float spotLightCosineDecayEnd3;
+
+uniform vec3 parallelLightDir;
+uniform float shadowAdd;
+uniform int useTexture;
+uniform int numShadows;
+
+
+uniform float roughnessScale;
+uniform vec3 ambientColor;
+
+uniform sampler2DArray diffuseTexArray;
+uniform sampler2DArray bumpTexArray;
+uniform sampler2DArray specularTexArray;
+uniform sampler2DArray emissiveReflectSpecPowerTexArray;
+
+
+
+float shadowCoeff1()
+{
+ const int index = 0;
+
+ //int index = 3;
+ //
+ //if(gl_FragCoord.z < far_d.x)
+ // index = 0;
+ //else if(gl_FragCoord.z < far_d.y)
+ // index = 1;
+ //else if(gl_FragCoord.z < far_d.z)
+ // index = 2;
+
+ vec4 shadow_coord = gl_TextureMatrix[index]*vec4(gl_TexCoord[1].xyz, 1);
+
+ shadow_coord.w = shadow_coord.z + shadowAdd;
+ // tell glsl in which layer to do the look up
+ shadow_coord.z = float(index);
+
+
+ // Gaussian 3x3 filter
+ // return shadow2DArray(stex, shadow_coord).x;
+ const float X = 1.0f;
+ float ret = shadow2DArray(stex, shadow_coord).x * 0.25;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( -X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( -X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( -X, X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( 0, -X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( 0, X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex, shadow_coord, ivec2( X, X)).x * 0.0625;
+ return ret;
+}
+float shadowCoeff2()
+{
+ const int index = 1;
+
+ //int index = 3;
+ //if(gl_FragCoord.z < far_d.x)
+ // index = 0;
+ //else if(gl_FragCoord.z < far_d.y)
+ // index = 1;
+ //else if(gl_FragCoord.z < far_d.z)
+ // index = 2;
+
+ vec4 shadow_coord = gl_TextureMatrix[index]*vec4(gl_TexCoord[1].xyz, 1);
+
+ shadow_coord.w = shadow_coord.z + shadowAdd;
+ shadow_coord.z = float(0);
+ // return shadow2DArray(stex, shadow_coord).x;
+
+ const float X = 1.0f;
+ float ret = shadow2DArray(stex2, shadow_coord).x * 0.25;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( -X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( -X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( -X, X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( 0, -X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( 0, X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex2, shadow_coord, ivec2( X, X)).x * 0.0625;
+ return ret;
+}
+float shadowCoeff3()
+{
+ const int index = 2;
+
+ //int index = 3;
+ //if(gl_FragCoord.z < far_d.x)
+ // index = 0;
+ //else if(gl_FragCoord.z < far_d.y)
+ // index = 1;
+ //else if(gl_FragCoord.z < far_d.z)
+ // index = 2;
+
+ vec4 shadow_coord = gl_TextureMatrix[index]*vec4(gl_TexCoord[1].xyz, 1);
+
+ shadow_coord.w = shadow_coord.z + shadowAdd;
+ shadow_coord.z = float(0);
+
+ // return shadow2DArray(stex, shadow_coord).x;
+
+ const float X = 1.0f;
+ float ret = shadow2DArray(stex3, shadow_coord).x * 0.25;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( -X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( -X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( -X, X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( 0, -X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( 0, X)).x * 0.125;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( X, -X)).x * 0.0625;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( X, 0)).x * 0.125;
+ ret += shadow2DArrayOffset(stex3, shadow_coord, ivec2( X, X)).x * 0.0625;
+ return ret;
+}
+
+
+
+uniform float RollOff = 0.5f;
+uniform float fresnelBias = 0.0;
+uniform float fresnelScale = 1.0;
+uniform float fresnelPower = 3.0; // 5.0 is physically correct
+void main()
+{
+ //// TODO, expose this as user parameter
+ const float skyLightIntensity = 0.2;
+ const float rimLightIntensity = 0.3;
+
+ vec3 normal = normalize(gl_TexCoord[2].xyz);
+ vec3 t0 = gl_TexCoord[3].xyz;
+ vec3 t1 = gl_TexCoord[4].xyz;
+
+ vec3 diffuseMat;
+ vec3 specularMat;
+ vec3 bump;
+ vec3 emissiveReflectSpecPow;
+
+ // read in material color for diffuse, specular, bump, emmisive
+ if (gl_TexCoord[6].z >= 0.0f) {
+ // 2D texture
+ diffuseMat = texture2DArray(diffuseTexArray, gl_TexCoord[6].xyz).rgb;
+ //specularMat = texture2DArray(specularTexArray, gl_TexCoord[6].xyz).rgb; // TODO Does not seem to work
+ specularMat = vec3(1.0f);
+ bump = texture2DArray(bumpTexArray, gl_TexCoord[6].xyz).xyz;
+ if (dot(bump,bump) < 0.01) bump = vec3(0.5,0.5,1);
+ emissiveReflectSpecPow = texture2DArray(emissiveReflectSpecPowerTexArray, gl_TexCoord[6].xyz).xyz;
+
+ } else {
+ // 3D texture
+ diffuseMat = myTexture3D(gl_TexCoord[0].xyz) * vec3(0.5,0.5,0.5);//texture3D(ttt3D, gl_TexCoord[0].xyz);
+ specularMat = vec3(1.0);
+ bump = texture2D(texture, gl_TexCoord[5].xy).xyz;
+ if (dot(bump,bump) < 0.01) bump = vec3(0.5,0.5,1);
+ emissiveReflectSpecPow = vec3(0.0,0.0,0.0);
+ }
+
+ // apply bump to the normal
+ bump = (bump - vec3(0.5,0.5,0.5)) * 2.0f;
+ bump.xy *= roughnessScale*2;
+
+ float sc = 1.0f;
+ normal = normalize(t0*bump.x + t1*bump.y + sc*normal * bump.z);
+
+ //gl_FragColor.xyz = normal*0.5 + vec3(0.5,0.5,0.5);
+ //gl_FragColor.w = 1;
+ //return;
+ vec3 eyeVec = normalize(gl_TexCoord[1].xyz);
+
+ // apply gamma correction for diffuse textures
+ diffuseMat = pow(diffuseMat, 0.45);
+
+ float specularPower = emissiveReflectSpecPow.b*255.0f + 1.0f;
+
+ // TODO - fix this
+ specularPower = 10.0f;
+
+ float emissive = emissiveReflectSpecPow.r*10.0f;
+ float reflectivity = emissiveReflectSpecPow.b;
+ float fresnel = fresnelBias + fresnelScale*pow(1.0 - max(0.0, dot(normal, eyeVec)), fresnelPower);
+ float specular = 0.0f;
+
+ vec3 skyNormal = reflect(eyeVec, normal);
+ vec3 skyColor = skyLightIntensity * textureCube(skyboxTex, skyNormal).rgb;
+ vec3 ambientSkyColor = diffuseMat * skyColor;
+
+ vec3 diffuseColor = vec3(0.0, 0.0, 0.0);
+
+ if (numShadows >= 1) {
+ vec3 lightColor = hdrScale * vec3(1.0, 0.9, 0.9);
+ vec3 shadowColor = vec3(0.4, 0.4, 0.9); // colored shadow
+ vec3 lvec = normalize(spotLightDir);
+ float ldn = max(0.0f, dot(normal, lvec));
+ float shadowC = shadowCoeff1();
+ vec3 irradiance = shadowC * ldn * lightColor;
+
+ // diffuse irradiance
+ diffuseColor += diffuseMat * irradiance;
+
+ // add colored shadow
+ diffuseColor += (1.0 - shadowC) * shadowAmbient * shadowColor * diffuseMat;
+
+ vec3 r = reflect(lvec, normal);
+ specular += pow(max(0.0, dot(r,eyeVec)), specularPower)*shadowC;
+ }
+
+ // add rim light
+ if (numShadows >= 2) {
+ vec3 lightColor = rimLightIntensity * vec3(1.0, 0.9, 0.9);
+ vec3 lvec = normalize(spotLightDir2);
+ float ldn = max(0.0f, dot(normal, lvec));
+ vec3 irradiance = ldn * lightColor;
+
+ // diffuse irradiance
+ diffuseColor += diffuseMat * irradiance;
+ }
+
+ vec3 color = vec3(0.0, 0.0, 0.0);
+
+ color += diffuseColor;
+ color += ambientSkyColor;
+ color += specular*specularMat;
+ color += hdrScale * emissive * diffuseMat;
+
+ //vec3 reflectColor = diffuseMat * texture2DRect(reflectionTex, gl_FragCoord.xy).rgb;
+ //color = reflectionCoeff * reflectColor + (1.0f - reflectionCoeff) * color;
+ color = (fresnel * skyColor + (1.0 - fresnel) * color) * reflectivity + (1.0 - reflectivity) * color;
+
+ gl_FragColor.rgb = color;
+ gl_FragColor.w = gl_Color.w;
+
+ float fog = clamp(gl_Fog.scale*(gl_Fog.end+gl_TexCoord[1].z), 0.0, 1.0);
+ vec4 fogCol = gl_Fog.color;
+ gl_FragColor = mix(fogCol, gl_FragColor, fog);
+} \ No newline at end of file
diff --git a/KaplaDemo/externalIP/resources/shaders/scene_vs.cpp b/KaplaDemo/externalIP/resources/shaders/scene_vs.cpp
new file mode 100644
index 00000000..f7ed3f27
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/scene_vs.cpp
@@ -0,0 +1,79 @@
+
+uniform float uvScale = 1.0f;
+uniform sampler2D transTex;
+uniform int transTexSize;
+uniform float iTransTexSize;
+uniform float bumpTextureUVScale;
+//attribute mat4 transformmatrix;
+void main()
+{
+
+ int ti = (int)(gl_MultiTexCoord0.w);
+ //int ti = tq;
+ int tpr = transTexSize / 4;
+ int row = ti / tpr;
+ int col = (ti - row*tpr)*4;
+
+ float fx = (col+0.5f)*iTransTexSize;
+ float fy = (row+0.5f)*iTransTexSize;
+
+
+ vec4 r0 = texture2D(transTex, vec2(fx,fy));
+ vec4 r1 = texture2D(transTex, vec2(fx+iTransTexSize,fy));
+ vec4 r2 = texture2D(transTex, vec2(fx+iTransTexSize*2.0f,fy));
+ vec4 r3 = texture2D(transTex, vec2(fx+iTransTexSize*3.0f,fy));
+// vec4 r3 = vec4(0,0,0,1);
+
+ vec3 offset = vec3(r0.w, r1.w, r2.w);
+ r0.w = 0.0f;
+ r1.w = 0.0f;
+ r2.w = 0.0f;
+
+ float material = r3.w;
+ r3.w = 1.0f;
+ mat4 transformmatrix = mat4(r0,r1,r2,r3);
+
+
+
+
+ mat4 mvp = gl_ModelViewMatrix * transformmatrix;
+ mat4 mvpt = gl_ModelViewMatrixInverseTranspose * transformmatrix;
+ vec4 t0 = vec4(gl_MultiTexCoord0.xyz, 0.0f);
+
+ vec4 t1 = vec4(cross(gl_Normal.xyz, t0.xyz), 0.0f);
+
+// mat4 mvp = gl_ModelViewMatrix;
+// mat4 mvpt = gl_ModelViewMatrixInverseTranspose;
+
+
+ vec4 eyeSpacePos = mvp * gl_Vertex;
+ //eyeSpacePos.y += gl_InstanceID * 0.2f;
+ //gl_TexCoord[0].xyz = gl_MultiTexCoord0.xyz*uvScale;
+ vec3 coord3d = gl_Vertex.xyz + offset;
+ gl_TexCoord[0].xyz = (coord3d)*uvScale;
+ gl_TexCoord[1] = eyeSpacePos;
+ gl_FrontColor = gl_Color;
+ gl_Position = gl_ProjectionMatrix*eyeSpacePos;
+ gl_TexCoord[2] = mvpt * vec4(gl_Normal.xyz,0.0);
+
+ gl_TexCoord[3] = mvpt * t0;
+ gl_TexCoord[4].xyz = mvpt * t1;
+
+ gl_TexCoord[5].xy = vec2(dot(coord3d, t0.xyz), dot(coord3d, t1.xyz))*bumpTextureUVScale*2;
+
+ gl_TexCoord[6].xyz = vec3(gl_MultiTexCoord1.xy, material);
+ gl_TexCoord[6].y = 1.0 - gl_TexCoord[6].y;
+
+ float MAX_3D_TEX = 8.0;
+ if (gl_TexCoord[6].x >= 5.0f) {
+ // 2D Tex
+ gl_TexCoord[6].x -= 5.0f;
+ gl_TexCoord[6].z = floor(gl_TexCoord[6].z / MAX_3D_TEX);
+ } else {
+ gl_TexCoord[6].z -= floor(gl_TexCoord[6].z / MAX_3D_TEX)*MAX_3D_TEX;
+ gl_TexCoord[6].z -= 100.0f;
+
+ }
+
+ gl_ClipVertex = vec4(eyeSpacePos.xyz, 1.0f);
+}
diff --git a/KaplaDemo/externalIP/resources/shaders/shadowdebug_fs.cpp b/KaplaDemo/externalIP/resources/shaders/shadowdebug_fs.cpp
new file mode 100644
index 00000000..1d9bc723
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/shaders/shadowdebug_fs.cpp
@@ -0,0 +1,8 @@
+uniform sampler2DArrayShadow tex;
+uniform float slice;
+void main()
+{
+float v = shadow2DArray(tex, vec4(gl_TexCoord[0].xy,slice,10.001f));
+ gl_FragColor = vec4(v,v,v,1);
+ //gl_FragColor = vec4(1,0,0,1);
+} \ No newline at end of file
diff --git a/KaplaDemo/externalIP/resources/ssao.fs b/KaplaDemo/externalIP/resources/ssao.fs
new file mode 100644
index 00000000..52d04f7d
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/ssao.fs
@@ -0,0 +1,45 @@
+#define SAMPLEDIV 4
+#define NUMSAMPLES SAMPLEDIV*SAMPLEDIV
+#define iNUMSAMPLES 1.0f / (SAMPLEDIV * SAMPLEDIV)
+#define BIAS 1.0f
+
+uniform vec3 samples[NUMSAMPLES];
+uniform sampler2D depthTex;
+uniform sampler2D normalTex;
+uniform sampler2D unitVecTex;
+uniform mat4x4 biasProjMat;
+uniform mat4x4 biasProjMatInv;
+
+void main (void)
+{
+ float ssao = 0.0;
+ float depth = texture2D(depthTex, gl_TexCoord[0].st).r;
+ if(depth < 1.0)
+ {
+ vec3 dir = normalize(texture2D(unitVecTex, gl_TexCoord[1].st).rgb * 2.0f - 1.0f);
+ vec3 n = normalize(texture2D(normalTex, gl_TexCoord[0].st).rgb * 2.0f - 1.0f);
+ vec4 myPosEye = biasProjMatInv * vec4(gl_TexCoord[0].st, depth, 1.0f);
+ myPosEye.xyz /= myPosEye.w;
+ vec3 t0 = normalize(dir - n * dot(dir, n));
+ vec3 t1 = cross(n, t0);
+ mat3x3 rmat = mat3x3(t0, t1, n);
+ for(int i = 0; i < NUMSAMPLES; i++)
+ {
+ vec3 samplePosEye = rmat * samples[i] + myPosEye.xyz;
+ vec4 samplePosScreen = biasProjMat * vec4(samplePosEye, 1.0f);
+ samplePosScreen.xyz /= samplePosScreen.w;
+ float sampleDepth = texture2D(depthTex, samplePosScreen.st).r;
+ if(sampleDepth < samplePosScreen.z)
+ {
+ vec4 surfacePosWorld = biasProjMatInv * vec4(samplePosScreen.st, sampleDepth, 1.0f);
+ surfacePosWorld.xyz /= surfacePosWorld.w;
+ vec3 p2p = surfacePosWorld.xyz - myPosEye.xyz;
+ ssao += 1.0f / (BIAS+dot(p2p, p2p));
+ }
+ }
+ ssao = 1.0f - ssao * iNUMSAMPLES;
+ } else {
+ ssao = 1.0f;
+ }
+ gl_FragColor = vec4(ssao,ssao,ssao,1.0f);
+}
diff --git a/KaplaDemo/externalIP/resources/ssao.vs b/KaplaDemo/externalIP/resources/ssao.vs
new file mode 100644
index 00000000..38935790
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/ssao.vs
@@ -0,0 +1,7 @@
+uniform vec2 scaleXY;
+void main(void)
+{
+ gl_TexCoord[0] = gl_Vertex;
+ gl_TexCoord[1] = vec4(gl_Vertex.xy * scaleXY, gl_Vertex.zw);
+ gl_Position = gl_Vertex * 2.0f - 1.0f;
+}
diff --git a/KaplaDemo/externalIP/resources/stoneBump.bmp b/KaplaDemo/externalIP/resources/stoneBump.bmp
new file mode 100644
index 00000000..62ab864d
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/stoneBump.bmp
Binary files differ
diff --git a/KaplaDemo/externalIP/resources/stoneBump.jpg b/KaplaDemo/externalIP/resources/stoneBump.jpg
new file mode 100644
index 00000000..542550c2
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/stoneBump.jpg
Binary files differ
diff --git a/KaplaDemo/externalIP/resources/terrain_ll2.bmp b/KaplaDemo/externalIP/resources/terrain_ll2.bmp
new file mode 100644
index 00000000..058a0242
--- /dev/null
+++ b/KaplaDemo/externalIP/resources/terrain_ll2.bmp
Binary files differ