diff options
author | Robin Cornelius | 2010-10-10 22:10:33 +0100 |
---|---|---|
committer | Robin Cornelius | 2010-10-10 22:10:33 +0100 |
commit | b3b30285126289f54b57bd42569bb0721e40e088 (patch) | |
tree | f4aaccb98d1a835c4ea376ec2803fc410a704052 /linden/indra/newview/app_settings | |
parent | Merge branch 'mccabe-plugins' into plugins_merge (diff) | |
download | meta-impy-b3b30285126289f54b57bd42569bb0721e40e088.zip meta-impy-b3b30285126289f54b57bd42569bb0721e40e088.tar.gz meta-impy-b3b30285126289f54b57bd42569bb0721e40e088.tar.bz2 meta-impy-b3b30285126289f54b57bd42569bb0721e40e088.tar.xz |
Revert "port of LL renderpipeline/Kirstens S19 pipeline for bridging to Viewer 2 texture system"
This reverts commit 087e15e89930d51c3964329befb273ae3b2d330d.
Conflicts:
linden/indra/newview/llsurface.cpp
linden/indra/newview/llviewerwindow.cpp
linden/indra/newview/llvoavatar.cpp
linden/indra/newview/pipeline.cpp
linden/indra/newview/pipeline.h
Diffstat (limited to 'linden/indra/newview/app_settings')
80 files changed, 130 insertions, 4822 deletions
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index d306f0d..57ed4c0 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml | |||
@@ -5122,21 +5122,6 @@ | |||
5122 | <key>Value</key> | 5122 | <key>Value</key> |
5123 | <integer>1</integer> | 5123 | <integer>1</integer> |
5124 | </map> | 5124 | </map> |
5125 | |||
5126 | <!--KL port --> | ||
5127 | <key>EnableTextureAtlas</key> | ||
5128 | <map> | ||
5129 | <key>Comment</key> | ||
5130 | <string>Whether to use texture atlas or not</string> | ||
5131 | <key>Persist</key> | ||
5132 | <integer>1</integer> | ||
5133 | <key>Type</key> | ||
5134 | <string>Boolean</string> | ||
5135 | <key>Value</key> | ||
5136 | <integer>0</integer> | ||
5137 | </map> | ||
5138 | <!--/KL port --> | ||
5139 | |||
5140 | <key>EnableVoiceChat</key> | 5125 | <key>EnableVoiceChat</key> |
5141 | <map> | 5126 | <map> |
5142 | <key>Comment</key> | 5127 | <key>Comment</key> |
@@ -8968,74 +8953,11 @@ | |||
8968 | <string>Vector3</string> | 8953 | <string>Vector3</string> |
8969 | <key>Value</key> | 8954 | <key>Value</key> |
8970 | <array> | 8955 | <array> |
8971 | <real>1.0</real> | ||
8972 | <real>12.0</real> | ||
8973 | <real>32.0</real> | ||
8974 | </array> | ||
8975 | </map> | ||
8976 | <key>RenderShadowSplitExponent</key> | ||
8977 | <map> | ||
8978 | <key>Comment</key> | ||
8979 | <string>Near clip plane split distances for shadow map frusta (x=perspective, y=ortho, z=transition rate).</string> | ||
8980 | <key>Persist</key> | ||
8981 | <integer>1</integer> | ||
8982 | <key>Type</key> | ||
8983 | <string>Vector3</string> | ||
8984 | <key>Value</key> | ||
8985 | <array> | ||
8986 | <real>3.0</real> | ||
8987 | <real>3.0</real> | ||
8988 | <real>2.0</real> | ||
8989 | </array> | ||
8990 | </map> | ||
8991 | <key>RenderShadowOrthoClipPlanes</key> | ||
8992 | <map> | ||
8993 | <key>Comment</key> | ||
8994 | <string>Near clip plane split distances for orthographic shadow map frusta.</string> | ||
8995 | <key>Persist</key> | ||
8996 | <integer>1</integer> | ||
8997 | <key>Type</key> | ||
8998 | <string>Vector3</string> | ||
8999 | <key>Value</key> | ||
9000 | <array> | ||
9001 | <real>4.0</real> | 8956 | <real>4.0</real> |
9002 | <real>8.0</real> | 8957 | <real>8.0</real> |
9003 | <real>24.0</real> | 8958 | <real>24.0</real> |
9004 | </array> | 8959 | </array> |
9005 | </map> | 8960 | </map> |
9006 | <key>RenderShadowProjOffset</key> | ||
9007 | <map> | ||
9008 | <key>Comment</key> | ||
9009 | <string>Amount to scale distance to virtual origin of shadow perspective projection.</string> | ||
9010 | <key>Persist</key> | ||
9011 | <integer>1</integer> | ||
9012 | <key>Type</key> | ||
9013 | <string>F32</string> | ||
9014 | <key>Value</key> | ||
9015 | <real>2.0</real> | ||
9016 | </map> | ||
9017 | <key>RenderShadowSlopeThreshold</key> | ||
9018 | <map> | ||
9019 | <key>Comment</key> | ||
9020 | <string>Cutoff slope value for points to affect perspective shadow generation</string> | ||
9021 | <key>Persist</key> | ||
9022 | <integer>1</integer> | ||
9023 | <key>Type</key> | ||
9024 | <string>F32</string> | ||
9025 | <key>Value</key> | ||
9026 | <real>0.0</real> | ||
9027 | </map> | ||
9028 | <key>RenderShadowProjExponent</key> | ||
9029 | <map> | ||
9030 | <key>Comment</key> | ||
9031 | <string>Exponent applied to transition between ortho and perspective shadow projections based on viewing angle and light vector.</string> | ||
9032 | <key>Persist</key> | ||
9033 | <integer>1</integer> | ||
9034 | <key>Type</key> | ||
9035 | <string>F32</string> | ||
9036 | <key>Value</key> | ||
9037 | <real>0.5</real> | ||
9038 | </map> | ||
9039 | <key>RenderSSAOScale</key> | 8961 | <key>RenderSSAOScale</key> |
9040 | <map> | 8962 | <map> |
9041 | <key>Comment</key> | 8963 | <key>Comment</key> |
@@ -9195,184 +9117,6 @@ | |||
9195 | <key>Value</key> | 9117 | <key>Value</key> |
9196 | <integer>0</integer> | 9118 | <integer>0</integer> |
9197 | </map> | 9119 | </map> |
9198 | |||
9199 | <key>RenderGILightRadius</key> | ||
9200 | <map> | ||
9201 | <key>Comment</key> | ||
9202 | <string>Distance of ambiant bounce lighting from sun.</string> | ||
9203 | <key>Persist</key> | ||
9204 | <integer>1</integer> | ||
9205 | <key>Type</key> | ||
9206 | <string>F32</string> | ||
9207 | <key>Value</key> | ||
9208 | <real>8</real> | ||
9209 | </map> | ||
9210 | |||
9211 | <key>RenderGISamples</key> | ||
9212 | <map> | ||
9213 | <key>Comment</key> | ||
9214 | <string>Number of samples to take for GI.</string> | ||
9215 | <key>Persist</key> | ||
9216 | <integer>1</integer> | ||
9217 | <key>Type</key> | ||
9218 | <string>U32</string> | ||
9219 | <key>Value</key> | ||
9220 | <real>64</real> | ||
9221 | </map> | ||
9222 | |||
9223 | <key>RenderGIRange</key> | ||
9224 | <map> | ||
9225 | <key>Comment</key> | ||
9226 | <string>Distance to cut off GI effect.</string> | ||
9227 | <key>Persist</key> | ||
9228 | <integer>1</integer> | ||
9229 | <key>Type</key> | ||
9230 | <string>F32</string> | ||
9231 | <key>Value</key> | ||
9232 | <real>128</real> | ||
9233 | </map> | ||
9234 | |||
9235 | |||
9236 | <key>RenderGIDirectionWeight</key> | ||
9237 | <map> | ||
9238 | <key>Comment</key> | ||
9239 | <string>Weight of reflected light vector in GI angular attenuation.</string> | ||
9240 | <key>Persist</key> | ||
9241 | <integer>1</integer> | ||
9242 | <key>Type</key> | ||
9243 | <string>F32</string> | ||
9244 | <key>Value</key> | ||
9245 | <real>0.5</real> | ||
9246 | </map> | ||
9247 | |||
9248 | <key>RenderGILightOffset</key> | ||
9249 | <map> | ||
9250 | <key>Comment</key> | ||
9251 | <string>Amount to offset light from point of impact in gi map (scaled by light radius).</string> | ||
9252 | <key>Persist</key> | ||
9253 | <integer>1</integer> | ||
9254 | <key>Type</key> | ||
9255 | <string>F32</string> | ||
9256 | <key>Value</key> | ||
9257 | <real>0.0</real> | ||
9258 | </map> | ||
9259 | |||
9260 | <key>RenderGIColorCurve</key> | ||
9261 | <map> | ||
9262 | <key>Comment</key> | ||
9263 | <string>Global illumination color correction curve parameters.</string> | ||
9264 | <key>Persist</key> | ||
9265 | <integer>1</integer> | ||
9266 | <key>Type</key> | ||
9267 | <string>Vector3</string> | ||
9268 | <key>Value</key> | ||
9269 | <array> | ||
9270 | <real>0.0</real> | ||
9271 | <real>0.2</real> | ||
9272 | <real>0.02</real> | ||
9273 | </array> | ||
9274 | </map> | ||
9275 | |||
9276 | <key>RenderLuminanceColorCurve</key> | ||
9277 | <map> | ||
9278 | <key>Comment</key> | ||
9279 | <string>Luminance color correction curve parameters.</string> | ||
9280 | <key>Persist</key> | ||
9281 | <integer>1</integer> | ||
9282 | <key>Type</key> | ||
9283 | <string>Vector3</string> | ||
9284 | <key>Value</key> | ||
9285 | <array> | ||
9286 | <real>0.30</real> | ||
9287 | <real>0.0</real> | ||
9288 | <real>0.04</real> | ||
9289 | </array> | ||
9290 | </map> | ||
9291 | |||
9292 | <key>RenderGILuminanceColorCurve</key> | ||
9293 | <map> | ||
9294 | <key>Comment</key> | ||
9295 | <string>Luminance color correction curve parameters.</string> | ||
9296 | <key>Persist</key> | ||
9297 | <integer>1</integer> | ||
9298 | <key>Type</key> | ||
9299 | <string>Vector3</string> | ||
9300 | <key>Value</key> | ||
9301 | <array> | ||
9302 | <real>0.4</real> | ||
9303 | <real>0.0</real> | ||
9304 | <real>0.05</real> | ||
9305 | </array> | ||
9306 | </map> | ||
9307 | |||
9308 | <key>RenderSunLuminanceColorCurve</key> | ||
9309 | <map> | ||
9310 | <key>Comment</key> | ||
9311 | <string>Luminance color correction curve parameters.</string> | ||
9312 | <key>Persist</key> | ||
9313 | <integer>1</integer> | ||
9314 | <key>Type</key> | ||
9315 | <string>Vector3</string> | ||
9316 | <key>Value</key> | ||
9317 | <array> | ||
9318 | <real>0.6</real> | ||
9319 | <real>0.0</real> | ||
9320 | <real>-0.3</real> | ||
9321 | </array> | ||
9322 | </map> | ||
9323 | |||
9324 | <key>RenderLuminanceDetail</key> | ||
9325 | <map> | ||
9326 | <key>Comment</key> | ||
9327 | <string>Mipmap level to use for luminance</string> | ||
9328 | <key>Persist</key> | ||
9329 | <integer>1</integer> | ||
9330 | <key>Type</key> | ||
9331 | <string>F32</string> | ||
9332 | <key>Value</key> | ||
9333 | <real>8.0</real> | ||
9334 | </map> | ||
9335 | |||
9336 | <key>RenderLuminanceFade</key> | ||
9337 | <map> | ||
9338 | <key>Comment</key> | ||
9339 | <string>Scaler for speed of luminance adjustment</string> | ||
9340 | <key>Persist</key> | ||
9341 | <integer>1</integer> | ||
9342 | <key>Type</key> | ||
9343 | <string>F32</string> | ||
9344 | <key>Value</key> | ||
9345 | <real>0.05</real> | ||
9346 | </map> | ||
9347 | |||
9348 | <key>RenderGISpecularCurve</key> | ||
9349 | <map> | ||
9350 | <key>Comment</key> | ||
9351 | <string>Global illumination specular color correction curve parameters.</string> | ||
9352 | <key>Persist</key> | ||
9353 | <integer>1</integer> | ||
9354 | <key>Type</key> | ||
9355 | <string>Vector3</string> | ||
9356 | <key>Value</key> | ||
9357 | <array> | ||
9358 | <real>0.1</real> | ||
9359 | <real>0.0</real> | ||
9360 | <real>0.9</real> | ||
9361 | </array> | ||
9362 | </map> | ||
9363 | |||
9364 | <key>RenderGIIntensity</key> | ||
9365 | <map> | ||
9366 | <key>Comment</key> | ||
9367 | <string>Distance of ambiant bounce lighting from sun.</string> | ||
9368 | <key>Persist</key> | ||
9369 | <integer>1</integer> | ||
9370 | <key>Type</key> | ||
9371 | <string>F32</string> | ||
9372 | <key>Value</key> | ||
9373 | <real>0.2f</real> | ||
9374 | </map> | ||
9375 | |||
9376 | <key>RenderDeferredAlphaSoften</key> | 9120 | <key>RenderDeferredAlphaSoften</key> |
9377 | <map> | 9121 | <map> |
9378 | <key>Comment</key> | 9122 | <key>Comment</key> |
@@ -9395,178 +9139,6 @@ | |||
9395 | <key>Value</key> | 9139 | <key>Value</key> |
9396 | <real>4</real> | 9140 | <real>4</real> |
9397 | </map> | 9141 | </map> |
9398 | <key>RenderDeferredSpotShadowBias</key> | ||
9399 | <map> | ||
9400 | <key>Comment</key> | ||
9401 | <string>Bias value for spot shadows (prevent shadow acne).</string> | ||
9402 | <key>Persist</key> | ||
9403 | <integer>1</integer> | ||
9404 | <key>Type</key> | ||
9405 | <string>F32</string> | ||
9406 | <key>Value</key> | ||
9407 | <real>-64.0</real> | ||
9408 | </map> | ||
9409 | <key>RenderDeferredSpotShadowOffset</key> | ||
9410 | <map> | ||
9411 | <key>Comment</key> | ||
9412 | <string>Offset value for spot shadows (prevent shadow acne).</string> | ||
9413 | <key>Persist</key> | ||
9414 | <integer>1</integer> | ||
9415 | <key>Type</key> | ||
9416 | <string>F32</string> | ||
9417 | <key>Value</key> | ||
9418 | <real>0.8</real> | ||
9419 | </map> | ||
9420 | |||
9421 | <key>RenderShadowBias</key> | ||
9422 | <map> | ||
9423 | <key>Comment</key> | ||
9424 | <string>Bias value for shadows (prevent shadow acne).</string> | ||
9425 | <key>Persist</key> | ||
9426 | <integer>1</integer> | ||
9427 | <key>Type</key> | ||
9428 | <string>F32</string> | ||
9429 | <key>Value</key> | ||
9430 | <real>0.001</real> | ||
9431 | </map> | ||
9432 | <key>RenderShadowOffset</key> | ||
9433 | <map> | ||
9434 | <key>Comment</key> | ||
9435 | <string>Offset value for shadows (prevent shadow acne).</string> | ||
9436 | <key>Persist</key> | ||
9437 | <integer>1</integer> | ||
9438 | <key>Type</key> | ||
9439 | <string>F32</string> | ||
9440 | <key>Value</key> | ||
9441 | <real>0.6</real> | ||
9442 | </map> | ||
9443 | |||
9444 | <key>RenderShadowResolutionScale</key> | ||
9445 | <map> | ||
9446 | <key>Comment</key> | ||
9447 | <string>Scale of shadow map resolution vs. screen resolution</string> | ||
9448 | <key>Persist</key> | ||
9449 | <integer>1</integer> | ||
9450 | <key>Type</key> | ||
9451 | <string>F32</string> | ||
9452 | <key>Value</key> | ||
9453 | <real>1.0</real> | ||
9454 | </map> | ||
9455 | |||
9456 | |||
9457 | |||
9458 | <key>RenderDeferredTreeShadowBias</key> | ||
9459 | <map> | ||
9460 | <key>Comment</key> | ||
9461 | <string>Bias value for tree shadows (prevent shadow acne).</string> | ||
9462 | <key>Persist</key> | ||
9463 | <integer>1</integer> | ||
9464 | <key>Type</key> | ||
9465 | <string>F32</string> | ||
9466 | <key>Value</key> | ||
9467 | <real>1.0</real> | ||
9468 | </map> | ||
9469 | <key>RenderDeferredTreeShadowOffset</key> | ||
9470 | <map> | ||
9471 | <key>Comment</key> | ||
9472 | <string>Offset value for tree shadows (prevent shadow acne).</string> | ||
9473 | <key>Persist</key> | ||
9474 | <integer>1</integer> | ||
9475 | <key>Type</key> | ||
9476 | <string>F32</string> | ||
9477 | <key>Value</key> | ||
9478 | <real>1.0</real> | ||
9479 | </map> | ||
9480 | |||
9481 | <key>RenderHighlightFadeTime</key> | ||
9482 | <map> | ||
9483 | <key>Comment</key> | ||
9484 | <string>Transition time for mouseover highlights.</string> | ||
9485 | <key>Persist</key> | ||
9486 | <integer>1</integer> | ||
9487 | <key>Type</key> | ||
9488 | <string>F32</string> | ||
9489 | <key>Value</key> | ||
9490 | <real>0.2</real> | ||
9491 | </map> | ||
9492 | |||
9493 | <key>RenderHighlightBrightness</key> | ||
9494 | <map> | ||
9495 | <key>Comment</key> | ||
9496 | <string>Brightness of mouseover highlights.</string> | ||
9497 | <key>Persist</key> | ||
9498 | <integer>1</integer> | ||
9499 | <key>Type</key> | ||
9500 | <string>F32</string> | ||
9501 | <key>Value</key> | ||
9502 | <real>4.0</real> | ||
9503 | </map> | ||
9504 | |||
9505 | <key>RenderHighlightThickness</key> | ||
9506 | <map> | ||
9507 | <key>Comment</key> | ||
9508 | <string>Thickness of mouseover highlights.</string> | ||
9509 | <key>Persist</key> | ||
9510 | <integer>1</integer> | ||
9511 | <key>Type</key> | ||
9512 | <string>F32</string> | ||
9513 | <key>Value</key> | ||
9514 | <real>0.6</real> | ||
9515 | </map> | ||
9516 | |||
9517 | <key>RenderHighlightColor</key> | ||
9518 | <map> | ||
9519 | <key>Comment</key> | ||
9520 | <string>Brightness of mouseover highlights.</string> | ||
9521 | <key>Persist</key> | ||
9522 | <integer>1</integer> | ||
9523 | <key>Type</key> | ||
9524 | <string>Color4</string> | ||
9525 | <key>Value</key> | ||
9526 | <array> | ||
9527 | <real>0.4</real> | ||
9528 | <real>0.98</real> | ||
9529 | <real>0.93</real> | ||
9530 | <real>1.0</real> | ||
9531 | </array> | ||
9532 | </map> | ||
9533 | |||
9534 | <key>RenderSpecularResX</key> | ||
9535 | <map> | ||
9536 | <key>Comment</key> | ||
9537 | <string>Spec map resolution.</string> | ||
9538 | <key>Persist</key> | ||
9539 | <integer>1</integer> | ||
9540 | <key>Type</key> | ||
9541 | <string>U32</string> | ||
9542 | <key>Value</key> | ||
9543 | <real>128</real> | ||
9544 | </map> | ||
9545 | |||
9546 | <key>RenderSpecularResY</key> | ||
9547 | <map> | ||
9548 | <key>Comment</key> | ||
9549 | <string>Spec map resolution.</string> | ||
9550 | <key>Persist</key> | ||
9551 | <integer>1</integer> | ||
9552 | <key>Type</key> | ||
9553 | <string>U32</string> | ||
9554 | <key>Value</key> | ||
9555 | <real>128</real> | ||
9556 | </map> | ||
9557 | |||
9558 | <key>RenderSpecularExponent</key> | ||
9559 | <map> | ||
9560 | <key>Comment</key> | ||
9561 | <string>Specular exponent for generating spec map</string> | ||
9562 | <key>Persist</key> | ||
9563 | <integer>1</integer> | ||
9564 | <key>Type</key> | ||
9565 | <string>F32</string> | ||
9566 | <key>Value</key> | ||
9567 | <real>1</real> | ||
9568 | </map> | ||
9569 | |||
9570 | <key>RenderDeferred</key> | 9142 | <key>RenderDeferred</key> |
9571 | <map> | 9143 | <map> |
9572 | <key>Comment</key> | 9144 | <key>Comment</key> |
@@ -9578,31 +9150,6 @@ | |||
9578 | <key>Value</key> | 9150 | <key>Value</key> |
9579 | <integer>0</integer> | 9151 | <integer>0</integer> |
9580 | </map> | 9152 | </map> |
9581 | |||
9582 | <key>RenderDeferredShadow</key> | ||
9583 | <map> | ||
9584 | <key>Comment</key> | ||
9585 | <string>Enable shadows in deferred renderer.</string> | ||
9586 | <key>Persist</key> | ||
9587 | <integer>1</integer> | ||
9588 | <key>Type</key> | ||
9589 | <string>Boolean</string> | ||
9590 | <key>Value</key> | ||
9591 | <integer>1</integer> | ||
9592 | </map> | ||
9593 | |||
9594 | <key>RenderDeferredGI</key> | ||
9595 | <map> | ||
9596 | <key>Comment</key> | ||
9597 | <string>Enable GI in deferred renderer.</string> | ||
9598 | <key>Persist</key> | ||
9599 | <integer>1</integer> | ||
9600 | <key>Type</key> | ||
9601 | <string>Boolean</string> | ||
9602 | <key>Value</key> | ||
9603 | <integer>0</integer> | ||
9604 | </map> | ||
9605 | |||
9606 | <key>RenderDeferredSunShadow</key> | 9153 | <key>RenderDeferredSunShadow</key> |
9607 | <map> | 9154 | <map> |
9608 | <key>Comment</key> | 9155 | <key>Comment</key> |
@@ -9614,67 +9161,6 @@ | |||
9614 | <key>Value</key> | 9161 | <key>Value</key> |
9615 | <integer>1</integer> | 9162 | <integer>1</integer> |
9616 | </map> | 9163 | </map> |
9617 | |||
9618 | <key>RenderDeferredSun</key> | ||
9619 | <map> | ||
9620 | <key>Comment</key> | ||
9621 | <string>Execute sunlight shader in deferred renderer.</string> | ||
9622 | <key>Persist</key> | ||
9623 | <integer>1</integer> | ||
9624 | <key>Type</key> | ||
9625 | <string>Boolean</string> | ||
9626 | <key>Value</key> | ||
9627 | <integer>1</integer> | ||
9628 | </map> | ||
9629 | |||
9630 | <key>RenderDeferredAtmospheric</key> | ||
9631 | <map> | ||
9632 | <key>Comment</key> | ||
9633 | <string>Execute atmospheric shader in deferred renderer.</string> | ||
9634 | <key>Persist</key> | ||
9635 | <integer>1</integer> | ||
9636 | <key>Type</key> | ||
9637 | <string>Boolean</string> | ||
9638 | <key>Value</key> | ||
9639 | <integer>1</integer> | ||
9640 | </map> | ||
9641 | |||
9642 | <key>RenderDeferredBlurLight</key> | ||
9643 | <map> | ||
9644 | <key>Comment</key> | ||
9645 | <string>Execute shadow softening shader in deferred renderer.</string> | ||
9646 | <key>Persist</key> | ||
9647 | <integer>1</integer> | ||
9648 | <key>Type</key> | ||
9649 | <string>Boolean</string> | ||
9650 | <key>Value</key> | ||
9651 | <integer>1</integer> | ||
9652 | </map> | ||
9653 | |||
9654 | <key>RenderDeferredLocalLights</key> | ||
9655 | <map> | ||
9656 | <key>Comment</key> | ||
9657 | <string>Execute local lighting shader in deferred renderer.</string> | ||
9658 | <key>Persist</key> | ||
9659 | <integer>1</integer> | ||
9660 | <key>Type</key> | ||
9661 | <string>Boolean</string> | ||
9662 | <key>Value</key> | ||
9663 | <integer>1</integer> | ||
9664 | </map> | ||
9665 | |||
9666 | <key>RenderDeferredFullscreenLights</key> | ||
9667 | <map> | ||
9668 | <key>Comment</key> | ||
9669 | <string>Execute local lighting shader in deferred renderer.</string> | ||
9670 | <key>Persist</key> | ||
9671 | <integer>1</integer> | ||
9672 | <key>Type</key> | ||
9673 | <string>Boolean</string> | ||
9674 | <key>Value</key> | ||
9675 | <integer>1</integer> | ||
9676 | </map> | ||
9677 | |||
9678 | <key>RenderDeferredSunWash</key> | 9164 | <key>RenderDeferredSunWash</key> |
9679 | <map> | 9165 | <map> |
9680 | <key>Comment</key> | 9166 | <key>Comment</key> |
@@ -9697,45 +9183,6 @@ | |||
9697 | <key>Value</key> | 9183 | <key>Value</key> |
9698 | <real>-0.0001</real> | 9184 | <real>-0.0001</real> |
9699 | </map> | 9185 | </map> |
9700 | <key>RenderShadowErrorCutoff</key> | ||
9701 | <map> | ||
9702 | <key>Comment</key> | ||
9703 | <string>Cutoff error value to use ortho instead of perspective projection.</string> | ||
9704 | <key>Persist</key> | ||
9705 | <integer>1</integer> | ||
9706 | <key>Type</key> | ||
9707 | <string>F32</string> | ||
9708 | <key>Value</key> | ||
9709 | <real>5.0</real> | ||
9710 | </map> | ||
9711 | <key>RenderShadowFOVCutoff</key> | ||
9712 | <map> | ||
9713 | <key>Comment</key> | ||
9714 | <string>Cutoff FOV to use ortho instead of perspective projection.</string> | ||
9715 | <key>Persist</key> | ||
9716 | <integer>1</integer> | ||
9717 | <key>Type</key> | ||
9718 | <string>F32</string> | ||
9719 | <key>Value</key> | ||
9720 | <real>1.1</real> | ||
9721 | </map> | ||
9722 | |||
9723 | <key>RenderShadowGaussian</key> | ||
9724 | <map> | ||
9725 | <key>Comment</key> | ||
9726 | <string>Gaussian coefficients for the two shadow/SSAO blurring passes (z component unused).</string> | ||
9727 | <key>Persist</key> | ||
9728 | <integer>1</integer> | ||
9729 | <key>Type</key> | ||
9730 | <string>Vector3</string> | ||
9731 | <key>Value</key> | ||
9732 | <array> | ||
9733 | <real>3.0</real> | ||
9734 | <real>2.0</real> | ||
9735 | <real>0.0</real> | ||
9736 | </array> | ||
9737 | </map> | ||
9738 | |||
9739 | <key>RenderShadowBlurSize</key> | 9186 | <key>RenderShadowBlurSize</key> |
9740 | <map> | 9187 | <map> |
9741 | <key>Comment</key> | 9188 | <key>Comment</key> |
@@ -9745,7 +9192,7 @@ | |||
9745 | <key>Type</key> | 9192 | <key>Type</key> |
9746 | <string>F32</string> | 9193 | <string>F32</string> |
9747 | <key>Value</key> | 9194 | <key>Value</key> |
9748 | <real>0.8</real> | 9195 | <real>0.7</real> |
9749 | </map> | 9196 | </map> |
9750 | <key>RenderShadowBlurSamples</key> | 9197 | <key>RenderShadowBlurSamples</key> |
9751 | <map> | 9198 | <map> |
@@ -9756,94 +9203,8 @@ | |||
9756 | <key>Type</key> | 9203 | <key>Type</key> |
9757 | <string>U32</string> | 9204 | <string>U32</string> |
9758 | <key>Value</key> | 9205 | <key>Value</key> |
9759 | <real>4</real> | 9206 | <real>5</real> |
9760 | </map> | ||
9761 | <key>RenderShadowBlurDistFactor</key> | ||
9762 | <map> | ||
9763 | <key>Comment</key> | ||
9764 | <string>Distance scaler for shadow blur.</string> | ||
9765 | <key>Persist</key> | ||
9766 | <integer>1</integer> | ||
9767 | <key>Type</key> | ||
9768 | <string>F32</string> | ||
9769 | <key>Value</key> | ||
9770 | <real>0.1</real> | ||
9771 | </map> | ||
9772 | |||
9773 | <key>RenderGIBlurColorCurve</key> | ||
9774 | <map> | ||
9775 | <key>Comment</key> | ||
9776 | <string>Color curve for GI softening kernel</string> | ||
9777 | <key>Persist</key> | ||
9778 | <integer>1</integer> | ||
9779 | <key>Type</key> | ||
9780 | <string>Vector3</string> | ||
9781 | <key>Value</key> | ||
9782 | <array> | ||
9783 | <real>1.0</real> | ||
9784 | <real>0.6</real> | ||
9785 | <real>0.1</real> | ||
9786 | </array> | ||
9787 | </map> | ||
9788 | |||
9789 | <key>RenderGIGaussian</key> | ||
9790 | <map> | ||
9791 | <key>Comment</key> | ||
9792 | <string>Gaussian coefficient for the two GI blurring passes.</string> | ||
9793 | <key>Persist</key> | ||
9794 | <integer>1</integer> | ||
9795 | <key>Type</key> | ||
9796 | <string>F32</string> | ||
9797 | <key>Value</key> | ||
9798 | <real>64</real> | ||
9799 | </map> | ||
9800 | |||
9801 | <key>RenderGIBlurPasses</key> | ||
9802 | <map> | ||
9803 | <key>Comment</key> | ||
9804 | <string>Scale of GI softening kernel.</string> | ||
9805 | <key>Persist</key> | ||
9806 | <integer>1</integer> | ||
9807 | <key>Type</key> | ||
9808 | <string>U32</string> | ||
9809 | <key>Value</key> | ||
9810 | <real>2</real> | ||
9811 | </map> | ||
9812 | |||
9813 | <key>RenderGIBlurSize</key> | ||
9814 | <map> | ||
9815 | <key>Comment</key> | ||
9816 | <string>Scale of GI softening kernel.</string> | ||
9817 | <key>Persist</key> | ||
9818 | <integer>1</integer> | ||
9819 | <key>Type</key> | ||
9820 | <string>F32</string> | ||
9821 | <key>Value</key> | ||
9822 | <real>3.0</real> | ||
9823 | </map> | ||
9824 | <key>RenderGIBlurSamples</key> | ||
9825 | <map> | ||
9826 | <key>Comment</key> | ||
9827 | <string>Number of samples to take for each pass of GI blur (value range 1-16). Actual number of samples is value * 2 - 1.</string> | ||
9828 | <key>Persist</key> | ||
9829 | <integer>1</integer> | ||
9830 | <key>Type</key> | ||
9831 | <string>U32</string> | ||
9832 | <key>Value</key> | ||
9833 | <real>6</real> | ||
9834 | </map> | 9207 | </map> |
9835 | <key>RenderGIBlurDistFactor</key> | ||
9836 | <map> | ||
9837 | <key>Comment</key> | ||
9838 | <string>Distance scaler for GI blur.</string> | ||
9839 | <key>Persist</key> | ||
9840 | <integer>1</integer> | ||
9841 | <key>Type</key> | ||
9842 | <string>F32</string> | ||
9843 | <key>Value</key> | ||
9844 | <real>0.0</real> | ||
9845 | </map> | ||
9846 | |||
9847 | <key>RenderDynamicLOD</key> | 9208 | <key>RenderDynamicLOD</key> |
9848 | <map> | 9209 | <map> |
9849 | <key>Comment</key> | 9210 | <key>Comment</key> |
@@ -10094,17 +9455,6 @@ | |||
10094 | <key>Value</key> | 9455 | <key>Value</key> |
10095 | <integer>0</integer> | 9456 | <integer>0</integer> |
10096 | </map> | 9457 | </map> |
10097 | <key>RenderHighlightSelections</key> | ||
10098 | <map> | ||
10099 | <key>Comment</key> | ||
10100 | <string>Show selection outlines on objects</string> | ||
10101 | <key>Persist</key> | ||
10102 | <integer>1</integer> | ||
10103 | <key>Type</key> | ||
10104 | <string>Boolean</string> | ||
10105 | <key>Value</key> | ||
10106 | <integer>1</integer> | ||
10107 | </map> | ||
10108 | <key>RenderHiddenSelections</key> | 9458 | <key>RenderHiddenSelections</key> |
10109 | <map> | 9459 | <map> |
10110 | <key>Comment</key> | 9460 | <key>Comment</key> |
@@ -10413,17 +9763,6 @@ | |||
10413 | <key>Value</key> | 9763 | <key>Value</key> |
10414 | <integer>0</integer> | 9764 | <integer>0</integer> |
10415 | </map> | 9765 | </map> |
10416 | <key>RenderUIBuffer</key> | ||
10417 | <map> | ||
10418 | <key>Comment</key> | ||
10419 | <string>Cache ui render in a screen aligned buffer.</string> | ||
10420 | <key>Persist</key> | ||
10421 | <integer>1</integer> | ||
10422 | <key>Type</key> | ||
10423 | <string>Boolean</string> | ||
10424 | <key>Value</key> | ||
10425 | <integer>0</integer> | ||
10426 | </map> | ||
10427 | <key>RenderUnloadedAvatar</key> | 9766 | <key>RenderUnloadedAvatar</key> |
10428 | <map> | 9767 | <map> |
10429 | <key>Comment</key> | 9768 | <key>Comment</key> |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index f90d91f..a91e9fa 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl | |||
@@ -13,9 +13,9 @@ uniform sampler2DShadow shadowMap1; | |||
13 | uniform sampler2DShadow shadowMap2; | 13 | uniform sampler2DShadow shadowMap2; |
14 | uniform sampler2DShadow shadowMap3; | 14 | uniform sampler2DShadow shadowMap3; |
15 | uniform sampler2D noiseMap; | 15 | uniform sampler2D noiseMap; |
16 | uniform sampler2DRect depthMap; | 16 | uniform sampler2DRect positionMap; |
17 | 17 | ||
18 | uniform mat4 shadow_matrix[6]; | 18 | uniform mat4 shadow_matrix[4]; |
19 | uniform vec4 shadow_clip; | 19 | uniform vec4 shadow_clip; |
20 | uniform vec2 screen_res; | 20 | uniform vec2 screen_res; |
21 | 21 | ||
@@ -26,31 +26,15 @@ varying vec3 vary_ambient; | |||
26 | varying vec3 vary_directional; | 26 | varying vec3 vary_directional; |
27 | varying vec3 vary_fragcoord; | 27 | varying vec3 vary_fragcoord; |
28 | varying vec3 vary_position; | 28 | varying vec3 vary_position; |
29 | varying vec3 vary_light; | ||
30 | 29 | ||
31 | uniform float alpha_soften; | 30 | uniform float alpha_soften; |
32 | 31 | ||
33 | uniform mat4 inv_proj; | ||
34 | |||
35 | vec4 getPosition(vec2 pos_screen) | ||
36 | { | ||
37 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
38 | vec2 sc = pos_screen.xy*2.0; | ||
39 | sc /= screen_res; | ||
40 | sc -= vec2(1.0,1.0); | ||
41 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
42 | vec4 pos = inv_proj * ndc; | ||
43 | pos /= pos.w; | ||
44 | pos.w = 1.0; | ||
45 | return pos; | ||
46 | } | ||
47 | |||
48 | void main() | 32 | void main() |
49 | { | 33 | { |
50 | vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; | 34 | vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; |
51 | frag *= screen_res; | 35 | frag *= screen_res; |
52 | 36 | ||
53 | vec3 samp_pos = getPosition(frag).xyz; | 37 | vec3 samp_pos = texture2DRect(positionMap, frag).xyz; |
54 | 38 | ||
55 | float shadow = 1.0; | 39 | float shadow = 1.0; |
56 | vec4 pos = vec4(vary_position, 1.0); | 40 | vec4 pos = vec4(vary_position, 1.0); |
@@ -98,7 +82,7 @@ void main() | |||
98 | 82 | ||
99 | //gl_FragColor = gl_Color; | 83 | //gl_FragColor = gl_Color; |
100 | gl_FragColor = color; | 84 | gl_FragColor = color; |
101 | //gl_FragColor = vec4(1,0,1,1)*shadow; | 85 | //gl_FragColor = vec4(1,0,1,1); |
102 | 86 | ||
103 | } | 87 | } |
104 | 88 | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index 48baf77..b496bd6 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl | |||
@@ -20,11 +20,8 @@ varying vec3 vary_ambient; | |||
20 | varying vec3 vary_directional; | 20 | varying vec3 vary_directional; |
21 | varying vec3 vary_fragcoord; | 21 | varying vec3 vary_fragcoord; |
22 | varying vec3 vary_position; | 22 | varying vec3 vary_position; |
23 | varying vec3 vary_light; | ||
24 | 23 | ||
25 | uniform float near_clip; | 24 | uniform float near_clip; |
26 | uniform float shadow_offset; | ||
27 | uniform float shadow_bias; | ||
28 | 25 | ||
29 | void main() | 26 | void main() |
30 | { | 27 | { |
@@ -35,9 +32,8 @@ void main() | |||
35 | 32 | ||
36 | vec4 pos = (gl_ModelViewMatrix * gl_Vertex); | 33 | vec4 pos = (gl_ModelViewMatrix * gl_Vertex); |
37 | vec3 norm = normalize(gl_NormalMatrix * gl_Normal); | 34 | vec3 norm = normalize(gl_NormalMatrix * gl_Normal); |
38 | // KL this works around ATI not compiling the shader but maintains shadow offset and bias vec3 not vec4 | 35 | vary_position = pos.xyz; |
39 | vary_position = pos.xyz + norm.xyz * (-pos.z/64.0*shadow_offset+shadow_bias); | 36 | |
40 | |||
41 | calcAtmospherics(pos.xyz); | 37 | calcAtmospherics(pos.xyz); |
42 | 38 | ||
43 | //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); | 39 | //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); |
@@ -58,8 +54,6 @@ void main() | |||
58 | col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz); | 54 | col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz); |
59 | col.rgb = scaleDownLight(col.rgb); | 55 | col.rgb = scaleDownLight(col.rgb); |
60 | 56 | ||
61 | vary_light = gl_LightSource[0].position.xyz; | ||
62 | |||
63 | vary_ambient = col.rgb*gl_Color.rgb; | 57 | vary_ambient = col.rgb*gl_Color.rgb; |
64 | vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); | 58 | vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); |
65 | 59 | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaF.glsl index ff64a6b..6c94f5c 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaF.glsl | |||
@@ -12,7 +12,7 @@ uniform sampler2DShadow shadowMap2; | |||
12 | uniform sampler2DShadow shadowMap3; | 12 | uniform sampler2DShadow shadowMap3; |
13 | uniform sampler2D noiseMap; | 13 | uniform sampler2D noiseMap; |
14 | 14 | ||
15 | uniform mat4 shadow_matrix[6]; | 15 | uniform mat4 shadow_matrix[4]; |
16 | uniform vec4 shadow_clip; | 16 | uniform vec4 shadow_clip; |
17 | 17 | ||
18 | vec3 atmosLighting(vec3 light); | 18 | vec3 atmosLighting(vec3 light); |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl index 4b9cca2..58aa5a9 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl | |||
@@ -8,18 +8,13 @@ | |||
8 | uniform sampler2D diffuseMap; | 8 | uniform sampler2D diffuseMap; |
9 | 9 | ||
10 | varying vec3 vary_normal; | 10 | varying vec3 vary_normal; |
11 | varying vec4 vary_position; | ||
11 | 12 | ||
12 | void main() | 13 | void main() |
13 | { | 14 | { |
14 | vec4 diff = gl_Color*texture2D(diffuseMap, gl_TexCoord[0].xy); | 15 | gl_FragData[0] = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy); |
15 | // Viewer 2.0 uses 0.2 but for KL's viewer if i want a complete avatar need this to be 0.0 for now. | ||
16 | if (diff.a < 0.0) | ||
17 | { | ||
18 | discard; | ||
19 | } | ||
20 | |||
21 | gl_FragData[0] = vec4(diff.rgb, 1.0); | ||
22 | gl_FragData[1] = vec4(0,0,0,0); | 16 | gl_FragData[1] = vec4(0,0,0,0); |
23 | gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0); | 17 | gl_FragData[2] = vec4(normalize(vary_normal), 0.0); |
18 | gl_FragData[3] = vary_position; | ||
24 | } | 19 | } |
25 | 20 | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl index 00083eb..27c09db 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl | |||
@@ -10,7 +10,6 @@ uniform sampler2D diffuseMap; | |||
10 | 10 | ||
11 | void main() | 11 | void main() |
12 | { | 12 | { |
13 | gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy).a); | 13 | gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy)); |
14 | //gl_FragColor = vec4(1,1,1,1); | ||
15 | } | 14 | } |
16 | 15 | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl index 8c8489d..14da6b1 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl | |||
@@ -28,7 +28,8 @@ void main() | |||
28 | norm = normalize(norm); | 28 | norm = normalize(norm); |
29 | 29 | ||
30 | pos = gl_ProjectionMatrix * pos; | 30 | pos = gl_ProjectionMatrix * pos; |
31 | pos.z = max(pos.z, -pos.w+0.01); | 31 | //smash geometry against near clip plane |
32 | pos.z = max(pos.z, -1.0); | ||
32 | gl_Position = pos; | 33 | gl_Position = pos; |
33 | 34 | ||
34 | gl_FrontColor = gl_Color; | 35 | gl_FrontColor = gl_Color; |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl index 471a1f0..12a7ff7 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl | |||
@@ -10,6 +10,7 @@ mat4 getSkinnedTransform(); | |||
10 | attribute vec4 weight; | 10 | attribute vec4 weight; |
11 | 11 | ||
12 | varying vec3 vary_normal; | 12 | varying vec3 vary_normal; |
13 | varying vec4 vary_position; | ||
13 | 14 | ||
14 | void main() | 15 | void main() |
15 | { | 16 | { |
@@ -29,6 +30,7 @@ void main() | |||
29 | norm.z = dot(trans[2].xyz, gl_Normal); | 30 | norm.z = dot(trans[2].xyz, gl_Normal); |
30 | norm = normalize(norm); | 31 | norm = normalize(norm); |
31 | 32 | ||
33 | vary_position = pos; | ||
32 | vary_normal = norm; | 34 | vary_normal = norm; |
33 | 35 | ||
34 | gl_Position = gl_ProjectionMatrix * pos; | 36 | gl_Position = gl_ProjectionMatrix * pos; |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index 1713fe9..3c6700a 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl | |||
@@ -7,11 +7,10 @@ | |||
7 | 7 | ||
8 | #extension GL_ARB_texture_rectangle : enable | 8 | #extension GL_ARB_texture_rectangle : enable |
9 | 9 | ||
10 | uniform sampler2DRect depthMap; | 10 | uniform sampler2DRect positionMap; |
11 | uniform sampler2DRect normalMap; | 11 | uniform sampler2DRect normalMap; |
12 | uniform sampler2DRect lightMap; | 12 | uniform sampler2DRect lightMap; |
13 | 13 | ||
14 | uniform float dist_factor; | ||
15 | uniform float blur_size; | 14 | uniform float blur_size; |
16 | uniform vec2 delta; | 15 | uniform vec2 delta; |
17 | uniform vec3 kern[32]; | 16 | uniform vec3 kern[32]; |
@@ -20,52 +19,30 @@ uniform float kern_scale; | |||
20 | 19 | ||
21 | varying vec2 vary_fragcoord; | 20 | varying vec2 vary_fragcoord; |
22 | 21 | ||
23 | uniform mat4 inv_proj; | ||
24 | uniform vec2 screen_res; | ||
25 | |||
26 | vec4 getPosition(vec2 pos_screen) | ||
27 | { | ||
28 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
29 | vec2 sc = pos_screen.xy*2.0; | ||
30 | sc /= screen_res; | ||
31 | sc -= vec2(1.0,1.0); | ||
32 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
33 | vec4 pos = inv_proj * ndc; | ||
34 | pos /= pos.w; | ||
35 | pos.w = 1.0; | ||
36 | return pos; | ||
37 | } | ||
38 | |||
39 | void main() | 22 | void main() |
40 | { | 23 | { |
41 | vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz*2.0-1.0; | 24 | vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz; |
42 | vec3 pos = getPosition(vary_fragcoord.xy).xyz; | 25 | vec3 pos = texture2DRect(positionMap, vary_fragcoord.xy).xyz; |
43 | vec4 ccol = texture2DRect(lightMap, vary_fragcoord.xy).rgba; | 26 | vec2 ccol = texture2DRect(lightMap, vary_fragcoord.xy).rg; |
44 | 27 | ||
45 | vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); | 28 | vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); |
46 | 29 | ||
47 | dlt /= max(-pos.z*dist_factor, 1.0); | ||
48 | |||
49 | vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free' | 30 | vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free' |
50 | vec4 col = defined_weight.xyxx * ccol; | 31 | vec2 col = defined_weight * ccol; |
51 | 32 | ||
52 | for (int i = 1; i < kern_length; i++) | 33 | for (int i = 1; i < kern_length; i++) |
53 | { | 34 | { |
54 | vec2 tc = vary_fragcoord.xy + kern[i].z*dlt; | 35 | vec2 tc = vary_fragcoord.xy + kern[i].z*dlt; |
55 | vec3 samppos = getPosition(tc).xyz; | 36 | vec3 samppos = texture2DRect(positionMap, tc).xyz; |
56 | float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane | 37 | float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane |
57 | if (d*d <= 0.003) | 38 | if (d*d <= 0.003) |
58 | { | 39 | { |
59 | col += texture2DRect(lightMap, tc)*kern[i].xyxx; | 40 | col += texture2DRect(lightMap, tc).rg*kern[i].xy; |
60 | defined_weight += kern[i].xy; | 41 | defined_weight += kern[i].xy; |
61 | } | 42 | } |
62 | } | 43 | } |
63 | 44 | ||
45 | col /= defined_weight; | ||
64 | 46 | ||
65 | 47 | gl_FragColor = vec4(col.r, col.g, 0.0, 1.0); | |
66 | col /= defined_weight.xyxx; | ||
67 | |||
68 | gl_FragColor = col; | ||
69 | |||
70 | //gl_FragColor = ccol; | ||
71 | } | 48 | } |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl index 1c29dae..a8712bc 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl | |||
@@ -11,6 +11,7 @@ uniform sampler2D bumpMap; | |||
11 | varying vec3 vary_mat0; | 11 | varying vec3 vary_mat0; |
12 | varying vec3 vary_mat1; | 12 | varying vec3 vary_mat1; |
13 | varying vec3 vary_mat2; | 13 | varying vec3 vary_mat2; |
14 | varying vec4 vary_position; | ||
14 | 15 | ||
15 | void main() | 16 | void main() |
16 | { | 17 | { |
@@ -21,7 +22,8 @@ void main() | |||
21 | dot(norm,vary_mat1), | 22 | dot(norm,vary_mat1), |
22 | dot(norm,vary_mat2)); | 23 | dot(norm,vary_mat2)); |
23 | 24 | ||
24 | gl_FragData[0] = vec4(gl_Color.rgb*col, 0.0); | 25 | gl_FragData[0].rgb = gl_Color.rgb*col; |
25 | gl_FragData[1] = vec4(col*gl_Color.a, gl_Color.a); | 26 | gl_FragData[1] = vec4(col*(gl_Color.a*1.5), gl_Color.a); |
26 | gl_FragData[2] = vec4(normalize(tnorm)*0.5+0.5, 0.0); | 27 | gl_FragData[2] = vec4(normalize(tnorm), 0.0); |
28 | gl_FragData[3] = vary_position; | ||
27 | } | 29 | } |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl index 9589912..ba18092 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl | |||
@@ -8,6 +8,7 @@ | |||
8 | varying vec3 vary_mat0; | 8 | varying vec3 vary_mat0; |
9 | varying vec3 vary_mat1; | 9 | varying vec3 vary_mat1; |
10 | varying vec3 vary_mat2; | 10 | varying vec3 vary_mat2; |
11 | varying vec4 vary_position; | ||
11 | 12 | ||
12 | void main() | 13 | void main() |
13 | { | 14 | { |
@@ -15,6 +16,8 @@ void main() | |||
15 | gl_Position = ftransform(); | 16 | gl_Position = ftransform(); |
16 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; | 17 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; |
17 | 18 | ||
19 | vary_position = gl_ModelViewMatrix * gl_Vertex; | ||
20 | |||
18 | vec3 n = normalize(gl_NormalMatrix * gl_Normal); | 21 | vec3 n = normalize(gl_NormalMatrix * gl_Normal); |
19 | vec3 b = normalize(gl_NormalMatrix * gl_MultiTexCoord2.xyz); | 22 | vec3 b = normalize(gl_NormalMatrix * gl_MultiTexCoord2.xyz); |
20 | vec3 t = cross(b, n); | 23 | vec3 t = cross(b, n); |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl index 919dd5d..f2ba2df 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl | |||
@@ -8,11 +8,13 @@ | |||
8 | uniform sampler2D diffuseMap; | 8 | uniform sampler2D diffuseMap; |
9 | 9 | ||
10 | varying vec3 vary_normal; | 10 | varying vec3 vary_normal; |
11 | varying vec4 vary_position; | ||
11 | 12 | ||
12 | void main() | 13 | void main() |
13 | { | 14 | { |
14 | vec3 col = texture2D(diffuseMap, gl_TexCoord[0].xy).rgb; | 15 | vec3 col = texture2D(diffuseMap, gl_TexCoord[0].xy).rgb; |
15 | gl_FragData[0] = vec4(gl_Color.rgb*col, 1.0); // KL viewer 2.0 has 0.0 but this is not working right yet besides i like to see my eyes :) | 16 | gl_FragData[0] = vec4(gl_Color.rgb*col, 1.0); |
16 | gl_FragData[1] = vec4(col*(gl_Color.a*1.5), gl_Color.a); | 17 | gl_FragData[1] = vec4(col*(gl_Color.a*1.5), gl_Color.a); |
17 | gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0); | 18 | gl_FragData[2] = vec4(normalize(vary_normal), 0.0); |
19 | gl_FragData[3] = vary_position; | ||
18 | } | 20 | } |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl index 44468cd..3413a7f 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl | |||
@@ -6,13 +6,16 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | varying vec3 vary_normal; | 8 | varying vec3 vary_normal; |
9 | varying vec4 vary_position; | ||
9 | 10 | ||
10 | void main() | 11 | void main() |
11 | { | 12 | { |
12 | //transform vertex | 13 | //transform vertex |
13 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; | 14 | gl_Position = ftransform(); |
14 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; | 15 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; |
15 | 16 | ||
17 | vary_position = gl_ModelViewMatrix * gl_Vertex; | ||
18 | |||
16 | vary_normal = normalize(gl_NormalMatrix * gl_Normal); | 19 | vary_normal = normalize(gl_NormalMatrix * gl_Normal); |
17 | 20 | ||
18 | gl_FrontColor = gl_Color; | 21 | gl_FrontColor = gl_Color; |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index e518bdd..2a811c5 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl | |||
@@ -8,9 +8,14 @@ | |||
8 | #extension GL_ARB_texture_rectangle : enable | 8 | #extension GL_ARB_texture_rectangle : enable |
9 | 9 | ||
10 | uniform sampler2D diffuseMap; | 10 | uniform sampler2D diffuseMap; |
11 | uniform sampler2DRect depthMap; | 11 | uniform sampler2DShadow shadowMap0; |
12 | uniform sampler2DShadow shadowMap1; | ||
13 | uniform sampler2DShadow shadowMap2; | ||
14 | uniform sampler2DShadow shadowMap3; | ||
12 | uniform sampler2D noiseMap; | 15 | uniform sampler2D noiseMap; |
16 | uniform sampler2DRect positionMap; | ||
13 | 17 | ||
18 | uniform mat4 shadow_matrix[4]; | ||
14 | uniform vec4 shadow_clip; | 19 | uniform vec4 shadow_clip; |
15 | uniform vec2 screen_res; | 20 | uniform vec2 screen_res; |
16 | 21 | ||
@@ -25,27 +30,12 @@ varying vec3 vary_fragcoord; | |||
25 | 30 | ||
26 | uniform float alpha_soften; | 31 | uniform float alpha_soften; |
27 | 32 | ||
28 | uniform mat4 inv_proj; | ||
29 | |||
30 | vec4 getPosition(vec2 pos_screen) | ||
31 | { | ||
32 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
33 | vec2 sc = pos_screen.xy*2.0; | ||
34 | sc /= screen_res; | ||
35 | sc -= vec2(1.0,1.0); | ||
36 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
37 | vec4 pos = inv_proj * ndc; | ||
38 | pos /= pos.w; | ||
39 | pos.w = 1.0; | ||
40 | return pos; | ||
41 | } | ||
42 | |||
43 | void main() | 33 | void main() |
44 | { | 34 | { |
45 | vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; | 35 | vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; |
46 | frag *= screen_res; | 36 | frag *= screen_res; |
47 | 37 | ||
48 | vec3 samp_pos = getPosition(frag).xyz; | 38 | vec3 samp_pos = texture2DRect(positionMap, frag).xyz; |
49 | 39 | ||
50 | float shadow = 1.0; | 40 | float shadow = 1.0; |
51 | vec4 pos = vary_position; | 41 | vec4 pos = vary_position; |
@@ -56,10 +46,10 @@ void main() | |||
56 | 46 | ||
57 | color.rgb = fullbrightScaleSoftClip(color.rgb); | 47 | color.rgb = fullbrightScaleSoftClip(color.rgb); |
58 | 48 | ||
59 | if (samp_pos.z != 0.0 && color.a < 1.0) | 49 | if (samp_pos.z != 0.0) |
60 | { | 50 | { |
61 | float dist_factor = alpha_soften; | 51 | float dist_factor = alpha_soften; |
62 | float a = color.a; | 52 | float a = gl_Color.a; |
63 | a *= a; | 53 | a *= a; |
64 | dist_factor *= 1.0/(1.0-a); | 54 | dist_factor *= 1.0/(1.0-a); |
65 | color.a *= min((pos.z-samp_pos.z)*dist_factor, 1.0); | 55 | color.a *= min((pos.z-samp_pos.z)*dist_factor, 1.0); |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl index aff5117..6381a1c 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl | |||
@@ -12,12 +12,12 @@ vec3 atmosAffectDirectionalLight(float lightIntensity); | |||
12 | vec3 scaleDownLight(vec3 light); | 12 | vec3 scaleDownLight(vec3 light); |
13 | vec3 scaleUpLight(vec3 light); | 13 | vec3 scaleUpLight(vec3 light); |
14 | 14 | ||
15 | varying vec4 vary_position; | ||
15 | varying vec3 vary_ambient; | 16 | varying vec3 vary_ambient; |
16 | varying vec3 vary_directional; | 17 | varying vec3 vary_directional; |
17 | varying vec3 vary_normal; | 18 | varying vec3 vary_normal; |
18 | varying vec3 vary_fragcoord; | 19 | varying vec3 vary_fragcoord; |
19 | uniform float near_clip; | 20 | uniform float near_clip; |
20 | varying vec4 vary_position; | ||
21 | 21 | ||
22 | void main() | 22 | void main() |
23 | { | 23 | { |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/giF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/giF.glsl deleted file mode 100644 index b351eec..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/giF.glsl +++ /dev/null | |||
@@ -1,165 +0,0 @@ | |||
1 | /** | ||
2 | * @file giF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #extension GL_ARB_texture_rectangle : enable | ||
9 | |||
10 | uniform sampler2DRect depthMap; | ||
11 | uniform sampler2DRect normalMap; | ||
12 | uniform sampler2D noiseMap; | ||
13 | |||
14 | uniform sampler2D diffuseGIMap; | ||
15 | uniform sampler2D normalGIMap; | ||
16 | uniform sampler2D depthGIMap; | ||
17 | |||
18 | uniform sampler2D lightFunc; | ||
19 | |||
20 | // Inputs | ||
21 | varying vec2 vary_fragcoord; | ||
22 | |||
23 | uniform vec2 screen_res; | ||
24 | |||
25 | uniform mat4 inv_proj; | ||
26 | uniform mat4 gi_mat; //gPipeline.mGIMatrix - eye space to sun space | ||
27 | uniform mat4 gi_mat_proj; //gPipeline.mGIMatrixProj - eye space to projected sun space | ||
28 | uniform mat4 gi_norm_mat; //gPipeline.mGINormalMatrix - eye space normal to sun space normal matrix | ||
29 | uniform mat4 gi_inv_proj; //gPipeline.mGIInvProj - projected sun space to sun space | ||
30 | uniform float gi_radius; | ||
31 | uniform float gi_intensity; | ||
32 | uniform int gi_samples; | ||
33 | uniform vec2 gi_kern[25]; | ||
34 | uniform vec2 gi_scale; | ||
35 | uniform vec3 gi_quad; | ||
36 | uniform vec3 gi_spec; | ||
37 | uniform float gi_direction_weight; | ||
38 | uniform float gi_light_offset; | ||
39 | |||
40 | vec4 getPosition(vec2 pos_screen) | ||
41 | { | ||
42 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
43 | vec2 sc = pos_screen.xy*2.0; | ||
44 | sc /= screen_res; | ||
45 | sc -= vec2(1.0,1.0); | ||
46 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
47 | vec4 pos = inv_proj * ndc; | ||
48 | pos /= pos.w; | ||
49 | pos.w = 1.0; | ||
50 | return pos; | ||
51 | } | ||
52 | |||
53 | vec4 getGIPosition(vec2 gi_tc) | ||
54 | { | ||
55 | float depth = texture2D(depthGIMap, gi_tc).a; | ||
56 | vec2 sc = gi_tc*2.0; | ||
57 | sc -= vec2(1.0, 1.0); | ||
58 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
59 | vec4 pos = gi_inv_proj*ndc; | ||
60 | pos.xyz /= pos.w; | ||
61 | pos.w = 1.0; | ||
62 | return pos; | ||
63 | } | ||
64 | |||
65 | vec3 giAmbient(vec3 pos, vec3 norm) | ||
66 | { | ||
67 | vec4 gi_c = gi_mat_proj * vec4(pos, 1.0); | ||
68 | gi_c.xyz /= gi_c.w; | ||
69 | |||
70 | vec4 gi_pos = gi_mat*vec4(pos,1.0); | ||
71 | vec3 gi_norm = (gi_norm_mat*vec4(norm,1.0)).xyz; | ||
72 | gi_norm = normalize(gi_norm); | ||
73 | |||
74 | vec2 tcx = gi_norm.xy; | ||
75 | vec2 tcy = gi_norm.yx; | ||
76 | |||
77 | vec4 eye_pos = gi_mat*vec4(0,0,0,1.0); | ||
78 | |||
79 | vec3 eye_dir = normalize(gi_pos.xyz-eye_pos.xyz/eye_pos.w); | ||
80 | |||
81 | //vec3 eye_dir = vec3(0,0,-1); | ||
82 | //eye_dir = (gi_norm_mat*vec4(eye_dir, 1.0)).xyz; | ||
83 | //eye_dir = normalize(eye_dir); | ||
84 | |||
85 | //float round_x = gi_scale.x; | ||
86 | //float round_y = gi_scale.y; | ||
87 | |||
88 | vec3 debug = texture2D(normalGIMap, gi_c.xy).rgb*0.5+0.5; | ||
89 | debug.xz = vec2(0.0,0.0); | ||
90 | //debug = fract(debug); | ||
91 | |||
92 | float round_x = 1.0/64.0; | ||
93 | float round_y = 1.0/64.0; | ||
94 | |||
95 | //gi_c.x = floor(gi_c.x/round_x+0.5)*round_x; | ||
96 | //gi_c.y = floor(gi_c.y/round_y+0.5)*round_y; | ||
97 | |||
98 | float fda = 0.0; | ||
99 | vec3 fdiff = vec3(0,0,0); | ||
100 | |||
101 | vec3 rcol = vec3(0,0,0); | ||
102 | |||
103 | float fsa = 0.0; | ||
104 | |||
105 | for (int i = -1; i < 2; i+=2 ) | ||
106 | { | ||
107 | for (int j = -1; j < 2; j+=2) | ||
108 | { | ||
109 | vec2 tc = vec2(i, j)*0.75; | ||
110 | vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0+tc*0.5).xyz; | ||
111 | //tc += gi_norm.xy*nz.z; | ||
112 | tc += nz.xy*2.0; | ||
113 | tc /= gi_samples; | ||
114 | tc += gi_c.xy; | ||
115 | |||
116 | vec3 lnorm = -normalize(texture2D(normalGIMap, tc.xy).xyz*2.0-1.0); | ||
117 | vec3 lpos = getGIPosition(tc.xy).xyz; | ||
118 | |||
119 | vec3 at = lpos-gi_pos.xyz; | ||
120 | float dist = dot(at,at); | ||
121 | float da = clamp(1.0/(gi_spec.x*dist), 0.0, 1.0); | ||
122 | |||
123 | if (da > 0.0) | ||
124 | { | ||
125 | //add angular attenuation | ||
126 | vec3 ldir = at; | ||
127 | float ang_atten = clamp(dot(ldir, gi_norm), 0.0, 1.0); | ||
128 | |||
129 | float ld = -dot(ldir, lnorm); | ||
130 | |||
131 | if (ang_atten > 0.0 && ld < 0.0) | ||
132 | { | ||
133 | vec3 diff = texture2D(diffuseGIMap, tc.xy).xyz; | ||
134 | da = da*ang_atten; | ||
135 | fda += da; | ||
136 | fdiff += diff*da; | ||
137 | } | ||
138 | } | ||
139 | } | ||
140 | } | ||
141 | |||
142 | fdiff /= max(gi_spec.y*fda, gi_quad.z); | ||
143 | fdiff = clamp(fdiff, vec3(0), vec3(1)); | ||
144 | |||
145 | vec3 ret = fda*fdiff; | ||
146 | //ret = ret*ret*gi_quad.x+ret*gi_quad.y+gi_quad.z; | ||
147 | |||
148 | //fda *= nz.z; | ||
149 | |||
150 | //rcol.rgb *= gi_intensity; | ||
151 | //return rcol.rgb+vary_AmblitColor.rgb*0.25; | ||
152 | //return vec4(debug, 0.0); | ||
153 | //return vec4(fda*fdiff, 0.0); | ||
154 | return clamp(ret,vec3(0.0), vec3(1.0)); | ||
155 | //return debug.xyz; | ||
156 | } | ||
157 | |||
158 | void main() | ||
159 | { | ||
160 | vec2 pos_screen = vary_fragcoord.xy; | ||
161 | vec4 pos = getPosition(pos_screen); | ||
162 | vec3 norm = texture2DRect(normalMap, pos_screen).xyz*2.0-1.0; | ||
163 | |||
164 | gl_FragData[0].xyz = giAmbient(pos, norm); | ||
165 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/giV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/giV.glsl deleted file mode 100644 index 71dcea9..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/giV.glsl +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /** | ||
2 | * @file giV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | |||
10 | uniform vec2 screen_res; | ||
11 | |||
12 | void main() | ||
13 | { | ||
14 | //transform vertex | ||
15 | gl_Position = ftransform(); | ||
16 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
17 | vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; | ||
18 | vec4 tex = gl_MultiTexCoord0; | ||
19 | tex.w = 1.0; | ||
20 | |||
21 | gl_FrontColor = gl_Color; | ||
22 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl deleted file mode 100644 index e8b53b0..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /** | ||
2 | * @file luminanceF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect diffuseMap; | ||
9 | |||
10 | varying vec2 vary_fragcoord; | ||
11 | |||
12 | void main() | ||
13 | { | ||
14 | gl_FragColor = texture2DRect(diffuseMap, vary_fragcoord.xy); | ||
15 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl deleted file mode 100644 index db8775f..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | /** | ||
2 | * @file giV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | |||
10 | uniform vec2 screen_res; | ||
11 | |||
12 | void main() | ||
13 | { | ||
14 | //transform vertex | ||
15 | gl_Position = ftransform(); | ||
16 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
17 | vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; | ||
18 | |||
19 | gl_FrontColor = gl_Color; | ||
20 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index ce0494c..3689d12 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl | |||
@@ -7,15 +7,13 @@ | |||
7 | 7 | ||
8 | #extension GL_ARB_texture_rectangle : enable | 8 | #extension GL_ARB_texture_rectangle : enable |
9 | 9 | ||
10 | uniform sampler2DRect depthMap; | ||
11 | uniform sampler2DRect diffuseRect; | 10 | uniform sampler2DRect diffuseRect; |
12 | uniform sampler2DRect specularRect; | 11 | uniform sampler2DRect specularRect; |
12 | uniform sampler2DRect positionMap; | ||
13 | uniform sampler2DRect normalMap; | 13 | uniform sampler2DRect normalMap; |
14 | uniform samplerCube environmentMap; | 14 | uniform samplerCube environmentMap; |
15 | uniform sampler2DRect lightMap; | 15 | uniform sampler2DRect lightMap; |
16 | uniform sampler2D noiseMap; | 16 | uniform sampler2D noiseMap; |
17 | uniform sampler2D lightFunc; | ||
18 | |||
19 | 17 | ||
20 | uniform vec3 env_mat[3]; | 18 | uniform vec3 env_mat[3]; |
21 | uniform float sun_wash; | 19 | uniform float sun_wash; |
@@ -25,48 +23,24 @@ uniform int light_count; | |||
25 | uniform vec4 light[16]; | 23 | uniform vec4 light[16]; |
26 | uniform vec4 light_col[16]; | 24 | uniform vec4 light_col[16]; |
27 | 25 | ||
28 | varying vec4 vary_fragcoord; | 26 | varying vec3 vary_fragcoord; |
29 | uniform vec2 screen_res; | 27 | uniform vec2 screen_res; |
30 | 28 | ||
31 | uniform float far_z; | ||
32 | |||
33 | uniform mat4 inv_proj; | ||
34 | |||
35 | vec4 getPosition(vec2 pos_screen) | ||
36 | { | ||
37 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
38 | vec2 sc = pos_screen.xy*2.0; | ||
39 | sc /= screen_res; | ||
40 | sc -= vec2(1.0,1.0); | ||
41 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
42 | vec4 pos = inv_proj * ndc; | ||
43 | pos /= pos.w; | ||
44 | pos.w = 1.0; | ||
45 | return pos; | ||
46 | } | ||
47 | |||
48 | void main() | 29 | void main() |
49 | { | 30 | { |
50 | vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res; | 31 | vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res; |
51 | vec3 pos = getPosition(frag.xy).xyz; | 32 | vec3 pos = texture2DRect(positionMap, frag.xy).xyz; |
52 | if (pos.z < far_z) | 33 | vec3 norm = normalize(texture2DRect(normalMap, frag.xy).xyz); |
53 | { | ||
54 | discard; | ||
55 | } | ||
56 | |||
57 | vec3 norm = normalize(texture2DRect(normalMap, frag.xy).xyz*2.0-1.0); | ||
58 | vec4 spec = texture2DRect(specularRect, frag.xy); | 34 | vec4 spec = texture2DRect(specularRect, frag.xy); |
59 | vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb; | 35 | vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb; |
60 | float noise = texture2D(noiseMap, frag.xy/128.0).b; | 36 | float noise = texture2D(noiseMap, frag.xy/128.0).b; |
61 | vec3 out_col = vec3(0,0,0); | 37 | vec3 out_col = vec3(0,0,0); |
62 | vec3 npos = normalize(-pos); | ||
63 | 38 | ||
64 | for (int i = 0; i < light_count; ++i) | 39 | for (int i = 0; i < light_count; ++i) |
65 | { | 40 | { |
66 | vec3 lv = light[i].xyz-pos; | 41 | vec3 lv = light[i].xyz-pos; |
67 | float dist2 = dot(lv,lv); | 42 | float dist2 = dot(lv,lv); |
68 | dist2 /= light[i].w; | 43 | if (dist2 > light[i].w) |
69 | if (dist2 > 1.0) | ||
70 | { | 44 | { |
71 | continue; | 45 | continue; |
72 | } | 46 | } |
@@ -81,41 +55,29 @@ void main() | |||
81 | da = dot(norm, lv); | 55 | da = dot(norm, lv); |
82 | 56 | ||
83 | float fa = light_col[i].a+1.0; | 57 | float fa = light_col[i].a+1.0; |
84 | float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); | 58 | float dist_atten = clamp(1.0-(dist2-light[i].w*(1.0-fa))/(light[i].w*fa), 0.0, 1.0); |
85 | dist_atten *= noise; | 59 | dist_atten *= noise; |
86 | 60 | ||
87 | float lit = da * dist_atten; | 61 | float lit = da * dist_atten; |
88 | 62 | ||
89 | vec3 col = light_col[i].rgb*lit*diff; | 63 | vec3 col = light_col[i].rgb*lit*diff; |
90 | //vec3 col = vec3(dist2, light_col[i].a, lit); | ||
91 | 64 | ||
92 | if (spec.a > 0.0) | 65 | if (spec.a > 0.0) |
93 | { | 66 | { |
94 | //vec3 ref = dot(pos+lv, norm); | 67 | vec3 ref = reflect(normalize(pos), norm); |
95 | 68 | float sa = dot(ref,lv); | |
96 | float sa = dot(normalize(lv+npos),norm); | 69 | sa = max(sa, 0.0); |
97 | 70 | sa = pow(sa, 128.0 * spec.a*spec.a/dist_atten)*min(dist_atten*4.0, 1.0); | |
98 | if (sa > 0) | 71 | sa *= noise; |
99 | { | 72 | col += da*sa*light_col[i].rgb*spec.rgb; |
100 | sa = texture2D(lightFunc,vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); | ||
101 | sa *= noise; | ||
102 | col += da*sa*light_col[i].rgb*spec.rgb; | ||
103 | } | ||
104 | } | 73 | } |
105 | 74 | ||
106 | out_col += col; | 75 | out_col += col; |
107 | } | 76 | } |
108 | 77 | ||
109 | if (dot(out_col, out_col) <= 0.0) | ||
110 | { | ||
111 | discard; | ||
112 | } | ||
113 | |||
114 | //attenuate point light contribution by SSAO component | 78 | //attenuate point light contribution by SSAO component |
115 | out_col *= texture2DRect(lightMap, frag.xy).g; | 79 | out_col *= texture2DRect(lightMap, frag.xy).g; |
116 | 80 | ||
117 | gl_FragColor.rgb = out_col; | 81 | gl_FragColor.rgb = out_col; |
118 | gl_FragColor.a = 0.0; | 82 | gl_FragColor.a = 0.0; |
119 | |||
120 | //gl_FragColor = vec4(0.1, 0.025, 0.025/4.0, 0.0); | ||
121 | } | 83 | } |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl deleted file mode 100644 index 021e8a2..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ /dev/null | |||
@@ -1,184 +0,0 @@ | |||
1 | /** | ||
2 | * @file multiSpotLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #version 120 | ||
9 | |||
10 | #extension GL_ARB_texture_rectangle : enable | ||
11 | |||
12 | uniform sampler2DRect diffuseRect; | ||
13 | uniform sampler2DRect specularRect; | ||
14 | uniform sampler2DRect depthMap; | ||
15 | uniform sampler2DRect normalMap; | ||
16 | uniform samplerCube environmentMap; | ||
17 | uniform sampler2DRect lightMap; | ||
18 | uniform sampler2D noiseMap; | ||
19 | uniform sampler2D lightFunc; | ||
20 | uniform sampler2D projectionMap; | ||
21 | |||
22 | uniform mat4 proj_mat; //screen space to light space | ||
23 | uniform float proj_near; //near clip for projection | ||
24 | uniform vec3 proj_p; //plane projection is emitting from (in screen space) | ||
25 | uniform vec3 proj_n; | ||
26 | uniform float proj_focus; //distance from plane to begin blurring | ||
27 | uniform float proj_lod; //(number of mips in proj map) | ||
28 | uniform float proj_range; //range between near clip and far clip plane of projection | ||
29 | uniform float proj_ambient_lod; | ||
30 | uniform float proj_ambiance; | ||
31 | uniform float near_clip; | ||
32 | uniform float far_clip; | ||
33 | |||
34 | uniform vec3 proj_origin; //origin of projection to be used for angular attenuation | ||
35 | uniform float sun_wash; | ||
36 | uniform int proj_shadow_idx; | ||
37 | uniform float shadow_fade; | ||
38 | |||
39 | varying vec4 vary_light; | ||
40 | |||
41 | varying vec4 vary_fragcoord; | ||
42 | uniform vec2 screen_res; | ||
43 | |||
44 | uniform mat4 inv_proj; | ||
45 | |||
46 | vec4 getPosition(vec2 pos_screen) | ||
47 | { | ||
48 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
49 | vec2 sc = pos_screen.xy*2.0; | ||
50 | sc /= screen_res; | ||
51 | sc -= vec2(1.0,1.0); | ||
52 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
53 | vec4 pos = inv_proj * ndc; | ||
54 | pos /= pos.w; | ||
55 | pos.w = 1.0; | ||
56 | return pos; | ||
57 | } | ||
58 | |||
59 | void main() | ||
60 | { | ||
61 | vec4 frag = vary_fragcoord; | ||
62 | frag.xyz /= frag.w; | ||
63 | frag.xyz = frag.xyz*0.5+0.5; | ||
64 | frag.xy *= screen_res; | ||
65 | |||
66 | vec3 pos = getPosition(frag.xy).xyz; | ||
67 | vec3 lv = vary_light.xyz-pos.xyz; | ||
68 | float dist2 = dot(lv,lv); | ||
69 | dist2 /= vary_light.w; | ||
70 | if (dist2 > 1.0) | ||
71 | { | ||
72 | discard; | ||
73 | } | ||
74 | |||
75 | float shadow = 1.0; | ||
76 | |||
77 | if (proj_shadow_idx >= 0) | ||
78 | { | ||
79 | vec4 shd = texture2DRect(lightMap, frag.xy); | ||
80 | float sh[2]; | ||
81 | sh[0] = shd.b; | ||
82 | sh[1] = shd.a; | ||
83 | shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0); | ||
84 | } | ||
85 | |||
86 | vec3 norm = texture2DRect(normalMap, frag.xy).xyz*2.0-1.0; | ||
87 | |||
88 | norm = normalize(norm); | ||
89 | float l_dist = -dot(lv, proj_n); | ||
90 | |||
91 | vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); | ||
92 | if (proj_tc.z < 0.0) | ||
93 | { | ||
94 | discard; | ||
95 | } | ||
96 | |||
97 | proj_tc.xyz /= proj_tc.w; | ||
98 | |||
99 | float fa = gl_Color.a+1.0; | ||
100 | float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); | ||
101 | |||
102 | lv = proj_origin-pos.xyz; | ||
103 | lv = normalize(lv); | ||
104 | float da = dot(norm, lv); | ||
105 | |||
106 | vec3 col = vec3(0,0,0); | ||
107 | |||
108 | vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; | ||
109 | |||
110 | float noise = texture2D(noiseMap, frag.xy/128.0).b; | ||
111 | if (proj_tc.z > 0.0 && | ||
112 | proj_tc.x < 1.0 && | ||
113 | proj_tc.y < 1.0 && | ||
114 | proj_tc.x > 0.0 && | ||
115 | proj_tc.y > 0.0) | ||
116 | { | ||
117 | float lit = 0.0; | ||
118 | float amb_da = proj_ambiance; | ||
119 | |||
120 | if (da > 0.0) | ||
121 | { | ||
122 | float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); | ||
123 | float lod = diff * proj_lod; | ||
124 | |||
125 | vec4 plcol = texture2DLod(projectionMap, proj_tc.xy, lod); | ||
126 | |||
127 | vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; | ||
128 | |||
129 | lit = da * dist_atten * noise; | ||
130 | |||
131 | col = lcol*lit*diff_tex*shadow; | ||
132 | amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance; | ||
133 | } | ||
134 | |||
135 | //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); | ||
136 | vec4 amb_plcol = texture2DLod(projectionMap, proj_tc.xy, proj_ambient_lod); | ||
137 | |||
138 | amb_da += (da*da*0.5+0.5)*proj_ambiance; | ||
139 | |||
140 | amb_da *= dist_atten * noise; | ||
141 | |||
142 | amb_da = min(amb_da, 1.0-lit); | ||
143 | |||
144 | col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; | ||
145 | } | ||
146 | |||
147 | |||
148 | vec4 spec = texture2DRect(specularRect, frag.xy); | ||
149 | if (spec.a > 0.0) | ||
150 | { | ||
151 | vec3 ref = reflect(normalize(pos), norm); | ||
152 | |||
153 | //project from point pos in direction ref to plane proj_p, proj_n | ||
154 | vec3 pdelta = proj_p-pos; | ||
155 | float ds = dot(ref, proj_n); | ||
156 | |||
157 | if (ds < 0.0) | ||
158 | { | ||
159 | vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; | ||
160 | |||
161 | vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); | ||
162 | |||
163 | if (stc.z > 0.0) | ||
164 | { | ||
165 | stc.xy /= stc.w; | ||
166 | |||
167 | if (stc.x < 1.0 && | ||
168 | stc.y < 1.0 && | ||
169 | stc.x > 0.0 && | ||
170 | stc.y > 0.0) | ||
171 | { | ||
172 | vec4 scol = texture2DLod(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); | ||
173 | col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow; | ||
174 | } | ||
175 | } | ||
176 | } | ||
177 | } | ||
178 | |||
179 | //attenuate point light contribution by SSAO component | ||
180 | col *= texture2DRect(lightMap, frag.xy).g; | ||
181 | |||
182 | gl_FragColor.rgb = col; | ||
183 | gl_FragColor.a = 0.0; | ||
184 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index d8ccfd4..52bad1f 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl | |||
@@ -9,54 +9,33 @@ | |||
9 | 9 | ||
10 | uniform sampler2DRect diffuseRect; | 10 | uniform sampler2DRect diffuseRect; |
11 | uniform sampler2DRect specularRect; | 11 | uniform sampler2DRect specularRect; |
12 | uniform sampler2DRect positionMap; | ||
12 | uniform sampler2DRect normalMap; | 13 | uniform sampler2DRect normalMap; |
13 | uniform samplerCube environmentMap; | 14 | uniform samplerCube environmentMap; |
14 | uniform sampler2DRect lightMap; | 15 | uniform sampler2DRect lightMap; |
15 | uniform sampler2D noiseMap; | 16 | uniform sampler2D noiseMap; |
16 | uniform sampler2D lightFunc; | ||
17 | uniform sampler2DRect depthMap; | ||
18 | 17 | ||
19 | uniform vec3 env_mat[3]; | 18 | uniform vec3 env_mat[3]; |
20 | uniform float sun_wash; | 19 | uniform float sun_wash; |
21 | 20 | ||
22 | varying vec4 vary_light; | 21 | varying vec4 vary_light; |
23 | 22 | ||
24 | varying vec4 vary_fragcoord; | 23 | varying vec3 vary_fragcoord; |
25 | uniform vec2 screen_res; | 24 | uniform vec2 screen_res; |
26 | 25 | ||
27 | uniform mat4 inv_proj; | ||
28 | uniform vec4 viewport; | ||
29 | |||
30 | vec4 getPosition(vec2 pos_screen) | ||
31 | { | ||
32 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
33 | vec2 sc = (pos_screen.xy-viewport.xy)*2.0; | ||
34 | sc /= viewport.zw; | ||
35 | sc -= vec2(1.0,1.0); | ||
36 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
37 | vec4 pos = inv_proj * ndc; | ||
38 | pos /= pos.w; | ||
39 | pos.w = 1.0; | ||
40 | return pos; | ||
41 | } | ||
42 | |||
43 | void main() | 26 | void main() |
44 | { | 27 | { |
45 | vec4 frag = vary_fragcoord; | 28 | vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; |
46 | frag.xyz /= frag.w; | 29 | frag *= screen_res; |
47 | frag.xyz = frag.xyz*0.5+0.5; | 30 | vec3 pos = texture2DRect(positionMap, frag).xyz; |
48 | frag.xy *= screen_res; | ||
49 | |||
50 | vec3 pos = getPosition(frag.xy).xyz; | ||
51 | vec3 lv = vary_light.xyz-pos; | 31 | vec3 lv = vary_light.xyz-pos; |
52 | float dist2 = dot(lv,lv); | 32 | float dist2 = dot(lv,lv); |
53 | dist2 /= vary_light.w; | 33 | if (dist2 > vary_light.w) |
54 | if (dist2 > 1.0) | ||
55 | { | 34 | { |
56 | discard; | 35 | discard; |
57 | } | 36 | } |
58 | 37 | ||
59 | vec3 norm = texture2DRect(normalMap, frag.xy).xyz*2.0-1.0; | 38 | vec3 norm = texture2DRect(normalMap, frag).xyz; |
60 | float da = dot(norm, lv); | 39 | float da = dot(norm, lv); |
61 | if (da < 0.0) | 40 | if (da < 0.0) |
62 | { | 41 | { |
@@ -67,30 +46,24 @@ void main() | |||
67 | lv = normalize(lv); | 46 | lv = normalize(lv); |
68 | da = dot(norm, lv); | 47 | da = dot(norm, lv); |
69 | 48 | ||
70 | float noise = texture2D(noiseMap, frag.xy/128.0).b; | 49 | float noise = texture2D(noiseMap, frag/128.0).b; |
71 | 50 | ||
72 | vec3 col = texture2DRect(diffuseRect, frag.xy).rgb; | 51 | vec3 col = texture2DRect(diffuseRect, frag).rgb; |
73 | float fa = gl_Color.a+1.0; | 52 | float fa = gl_Color.a+1.0; |
74 | float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); | 53 | float dist_atten = clamp(1.0-(dist2-vary_light.w*(1.0-fa))/(vary_light.w*fa), 0.0, 1.0); |
75 | float lit = da * dist_atten * noise; | 54 | float lit = da * dist_atten * noise; |
76 | 55 | ||
77 | col = gl_Color.rgb*lit*col; | 56 | col = gl_Color.rgb*lit*col; |
78 | 57 | ||
79 | vec4 spec = texture2DRect(specularRect, frag.xy); | 58 | vec4 spec = texture2DRect(specularRect, frag); |
80 | if (spec.a > 0.0) | 59 | if (spec.a > 0.0) |
81 | { | 60 | { |
82 | float sa = dot(normalize(lv-normalize(pos)),norm); | 61 | vec3 ref = reflect(normalize(pos), norm); |
83 | if (sa > 0.0) | 62 | float sa = dot(ref,lv); |
84 | { | 63 | sa = max(sa, 0.0); |
85 | sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); | 64 | sa = pow(sa, 128.0 * spec.a*spec.a/dist_atten)*min(dist_atten*4.0, 1.0); |
86 | sa *= noise; | 65 | sa *= noise; |
87 | col += da*sa*gl_Color.rgb*spec.rgb; | 66 | col += da*sa*gl_Color.rgb*spec.rgb; |
88 | } | ||
89 | } | ||
90 | |||
91 | if (dot(col, col) <= 0.0) | ||
92 | { | ||
93 | discard; | ||
94 | } | 67 | } |
95 | 68 | ||
96 | //attenuate point light contribution by SSAO component | 69 | //attenuate point light contribution by SSAO component |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl index e815ca2..a4edb88 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl | |||
@@ -6,7 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | varying vec4 vary_light; | 8 | varying vec4 vary_light; |
9 | varying vec4 vary_fragcoord; | 9 | varying vec3 vary_fragcoord; |
10 | 10 | ||
11 | uniform vec2 screen_res; | 11 | uniform vec2 screen_res; |
12 | uniform float near_clip; | 12 | uniform float near_clip; |
@@ -14,10 +14,10 @@ uniform float near_clip; | |||
14 | void main() | 14 | void main() |
15 | { | 15 | { |
16 | //transform vertex | 16 | //transform vertex |
17 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; | 17 | gl_Position = ftransform(); |
18 | 18 | ||
19 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | 19 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; |
20 | vary_fragcoord = pos; | 20 | vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); |
21 | 21 | ||
22 | vec4 tex = gl_MultiTexCoord0; | 22 | vec4 tex = gl_MultiTexCoord0; |
23 | tex.w = 1.0; | 23 | tex.w = 1.0; |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl deleted file mode 100644 index 71de036..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | /** | ||
2 | * @file postDeferredF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #extension GL_ARB_texture_rectangle : enable | ||
9 | |||
10 | uniform sampler2DRect diffuseRect; | ||
11 | uniform sampler2DRect localLightMap; | ||
12 | uniform sampler2DRect sunLightMap; | ||
13 | uniform sampler2DRect giLightMap; | ||
14 | uniform sampler2D luminanceMap; | ||
15 | uniform sampler2DRect lightMap; | ||
16 | |||
17 | uniform vec3 lum_quad; | ||
18 | uniform float lum_lod; | ||
19 | uniform vec4 ambient; | ||
20 | |||
21 | uniform vec3 gi_quad; | ||
22 | |||
23 | uniform vec2 screen_res; | ||
24 | varying vec2 vary_fragcoord; | ||
25 | |||
26 | void main() | ||
27 | { | ||
28 | vec2 tc = vary_fragcoord.xy; | ||
29 | vec3 lum = texture2DLod(luminanceMap, tc/screen_res, lum_lod).rgb; | ||
30 | float luminance = lum.r; | ||
31 | luminance = luminance*lum_quad.y+lum_quad.z; | ||
32 | |||
33 | vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); | ||
34 | |||
35 | float ambocc = texture2DRect(lightMap, vary_fragcoord.xy).g; | ||
36 | |||
37 | vec3 gi_col = texture2DRect(giLightMap, vary_fragcoord.xy).rgb; | ||
38 | gi_col = gi_col*gi_col*gi_quad.x + gi_col*gi_quad.y+gi_quad.z*ambocc*ambient.rgb; | ||
39 | gi_col *= diff; | ||
40 | |||
41 | vec4 sun_col = texture2DRect(sunLightMap, vary_fragcoord.xy); | ||
42 | |||
43 | vec3 local_col = texture2DRect(localLightMap, vary_fragcoord.xy).rgb; | ||
44 | |||
45 | |||
46 | sun_col *= 1.0/min(luminance, 1.0); | ||
47 | gi_col *= 1.0/luminance; | ||
48 | |||
49 | vec3 col = sun_col.rgb+gi_col+local_col; | ||
50 | |||
51 | gl_FragColor.rgb = col.rgb; | ||
52 | col.rgb = max(col.rgb-vec3(1.0,1.0,1.0), vec3(0.0, 0.0, 0.0)); | ||
53 | |||
54 | gl_FragColor.a = 0.0; // max(dot(col.rgb,col.rgb)*lum_quad.x, sun_col.a); | ||
55 | |||
56 | //gl_FragColor.rgb = vec3(lum_lod); | ||
57 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl deleted file mode 100644 index 9819232..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /** | ||
2 | * @file postDeferredV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | uniform vec2 screen_res; | ||
10 | |||
11 | void main() | ||
12 | { | ||
13 | //transform vertex | ||
14 | gl_Position = ftransform(); | ||
15 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
16 | vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; | ||
17 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl deleted file mode 100644 index 3556c7b..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl +++ /dev/null | |||
@@ -1,107 +0,0 @@ | |||
1 | /** | ||
2 | * @file postgiF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2D diffuseGIMap; | ||
9 | uniform sampler2D normalGIMap; | ||
10 | uniform sampler2D depthGIMap; | ||
11 | uniform sampler2D diffuseMap; | ||
12 | |||
13 | uniform sampler2D lastDiffuseGIMap; | ||
14 | uniform sampler2D lastNormalGIMap; | ||
15 | uniform sampler2D lastMinpGIMap; | ||
16 | uniform sampler2D lastMaxpGIMap; | ||
17 | |||
18 | uniform float gi_blend; | ||
19 | |||
20 | uniform mat4 gi_mat; //gPipeline.mGIMatrix - eye space to sun space | ||
21 | uniform mat4 gi_mat_proj; //gPipeline.mGIMatrixProj - eye space to projected sun space | ||
22 | uniform mat4 gi_norm_mat; //gPipeline.mGINormalMatrix - eye space normal to sun space normal matrix | ||
23 | uniform mat4 gi_inv_proj; //gPipeline.mGIInvProj - projected sun space to sun space | ||
24 | uniform float gi_radius; | ||
25 | uniform float gi_intensity; | ||
26 | uniform vec2 gi_kern[16]; | ||
27 | uniform vec2 gi_scale; | ||
28 | |||
29 | |||
30 | vec4 getGIPosition(vec2 gi_tc) | ||
31 | { | ||
32 | float depth = texture2D(depthGIMap, gi_tc).a; | ||
33 | vec2 sc = gi_tc*2.0; | ||
34 | sc -= vec2(1.0, 1.0); | ||
35 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
36 | vec4 pos = gi_inv_proj*ndc; | ||
37 | pos.xyz /= pos.w; | ||
38 | pos.w = 1.0; | ||
39 | return pos; | ||
40 | } | ||
41 | |||
42 | |||
43 | void main() | ||
44 | { | ||
45 | vec2 c_tc = gl_TexCoord[0].xy; | ||
46 | |||
47 | vec3 diff = vec3(0,0,0); | ||
48 | vec3 minp = vec3(1024,1024,1024); | ||
49 | vec3 maxp = vec3(-1024,-1024,-1024); | ||
50 | vec3 norm = vec3(0,0,0); | ||
51 | |||
52 | float dweight = 0.0; | ||
53 | |||
54 | vec3 cnorm = normalize(texture2D(normalGIMap, c_tc).rgb*2.0-1.0); | ||
55 | |||
56 | vec3 cpos = vec3(0,0,0); | ||
57 | float tweight = 0.0; | ||
58 | |||
59 | for (int i = 0; i < 8; ++i) | ||
60 | { | ||
61 | for (int j = 0; j < 8; ++j) | ||
62 | { | ||
63 | vec2 tc = vec2(i-4+0.5, j-4+0.5); | ||
64 | float weight = 1.0-length(tc)/6.0; | ||
65 | tc *= 1.0/(256.0); | ||
66 | tc += c_tc; | ||
67 | |||
68 | vec3 n = texture2D(normalGIMap, tc).rgb*2.0-1.0; | ||
69 | tweight += weight; | ||
70 | |||
71 | diff += weight*texture2D(diffuseGIMap, tc).rgb; | ||
72 | |||
73 | norm += n*weight; | ||
74 | |||
75 | dweight += dot(n, cnorm); | ||
76 | |||
77 | vec3 pos = getGIPosition(tc).xyz; | ||
78 | cpos += pos*weight; | ||
79 | |||
80 | minp = min(pos, minp); | ||
81 | maxp = max(pos, maxp); | ||
82 | } | ||
83 | } | ||
84 | |||
85 | dweight = abs(1.0-dweight/64.0); | ||
86 | float mind = min(sqrt(dweight+0.5), 1.0); | ||
87 | |||
88 | dweight *= dweight; | ||
89 | |||
90 | cpos /= tweight; | ||
91 | |||
92 | diff = clamp(diff/tweight, vec3(1.0/2.2), vec3(1,1,1)); | ||
93 | norm = normalize(norm); | ||
94 | maxp = cpos; | ||
95 | minp = vec3(dweight, mind, cpos.z-minp.z); | ||
96 | |||
97 | //float blend = 1.0; | ||
98 | //diff = mix(texture2D(lastDiffuseGIMap, c_tc).rgb, diff, blend); | ||
99 | //norm = mix(texture2D(lastNormalGIMap, c_tc).rgb, norm, blend); | ||
100 | //maxp = mix(texture2D(lastMaxpGIMap, c_tc).rgb, maxp, blend); | ||
101 | //minp = mix(texture2D(lastMinpGIMap, c_tc).rgb, minp, blend); | ||
102 | |||
103 | gl_FragData[0].rgb = diff; | ||
104 | gl_FragData[2].xyz = normalize(norm); | ||
105 | gl_FragData[1].xyz = maxp; | ||
106 | gl_FragData[3].xyz = minp; | ||
107 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl deleted file mode 100644 index 5a8eb65..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | /** | ||
2 | * @file postgiV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec3 vary_normal; | ||
9 | |||
10 | void main() | ||
11 | { | ||
12 | //transform vertex | ||
13 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
14 | gl_Position = pos; | ||
15 | gl_TexCoord[0].xy = pos.xy*0.5+0.5; | ||
16 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl index b0b31fd..b3758c3 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl | |||
@@ -7,11 +7,8 @@ | |||
7 | 7 | ||
8 | uniform sampler2D diffuseMap; | 8 | uniform sampler2D diffuseMap; |
9 | 9 | ||
10 | varying vec4 post_pos; | ||
11 | 10 | ||
12 | void main() | 11 | void main() |
13 | { | 12 | { |
14 | gl_FragColor = vec4(1,1,1,texture2D(diffuseMap, gl_TexCoord[0].xy).a * gl_Color.a); | 13 | gl_FragColor = vec4(1,1,1,texture2D(diffuseMap, gl_TexCoord[0].xy).a * gl_Color.a); |
15 | |||
16 | gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0); | ||
17 | } | 14 | } |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl index 7214d24..aae1bee 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl | |||
@@ -5,17 +5,13 @@ | |||
5 | * $License$ | 5 | * $License$ |
6 | */ | 6 | */ |
7 | 7 | ||
8 | varying vec4 post_pos; | ||
9 | |||
10 | void main() | 8 | void main() |
11 | { | 9 | { |
12 | //transform vertex | 10 | //transform vertex |
13 | vec4 pos = gl_ModelViewProjectionMatrix*gl_Vertex; | 11 | vec4 pos = gl_ModelViewProjectionMatrix*gl_Vertex; |
14 | 12 | //smash geometry against the near clip plane (great for ortho projections) | |
15 | post_pos = pos; | 13 | pos.z = max(pos.z, -1.0); |
16 | 14 | gl_Position = pos; | |
17 | gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); | ||
18 | |||
19 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; | 15 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; |
20 | gl_FrontColor = gl_Color; | 16 | gl_FrontColor = gl_Color; |
21 | } | 17 | } |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 64e263a..d5671a6 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl | |||
@@ -272,4 +272,8 @@ void main() | |||
272 | 272 | ||
273 | gl_FragColor.rgb = col; | 273 | gl_FragColor.rgb = col; |
274 | gl_FragColor.a = 0.0; | 274 | gl_FragColor.a = 0.0; |
275 | //gl_FragColor.rg = scol_ambocc.rg; | ||
276 | //gl_FragColor.rgb = norm.rgb*0.5+0.5; | ||
277 | //gl_FragColor.rgb = vec3(ambocc); | ||
278 | //gl_FragColor.rgb = vec3(scol); | ||
275 | } | 279 | } |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl deleted file mode 100644 index d653408..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ /dev/null | |||
@@ -1,199 +0,0 @@ | |||
1 | /** | ||
2 | * @file spotLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #version 120 | ||
9 | |||
10 | #extension GL_ARB_texture_rectangle : enable | ||
11 | |||
12 | uniform sampler2DRect diffuseRect; | ||
13 | uniform sampler2DRect specularRect; | ||
14 | uniform sampler2DRect depthMap; | ||
15 | uniform sampler2DRect normalMap; | ||
16 | uniform samplerCube environmentMap; | ||
17 | uniform sampler2DRect lightMap; | ||
18 | uniform sampler2D noiseMap; | ||
19 | uniform sampler2D lightFunc; | ||
20 | uniform sampler2D projectionMap; | ||
21 | |||
22 | uniform mat4 proj_mat; //screen space to light space | ||
23 | uniform float proj_near; //near clip for projection | ||
24 | uniform vec3 proj_p; //plane projection is emitting from (in screen space) | ||
25 | uniform vec3 proj_n; | ||
26 | uniform float proj_focus; //distance from plane to begin blurring | ||
27 | uniform float proj_lod; //(number of mips in proj map) | ||
28 | uniform float proj_range; //range between near clip and far clip plane of projection | ||
29 | uniform float proj_ambiance; | ||
30 | uniform float near_clip; | ||
31 | uniform float far_clip; | ||
32 | |||
33 | uniform vec3 proj_origin; //origin of projection to be used for angular attenuation | ||
34 | uniform float sun_wash; | ||
35 | uniform int proj_shadow_idx; | ||
36 | uniform float shadow_fade; | ||
37 | |||
38 | varying vec4 vary_light; | ||
39 | |||
40 | varying vec4 vary_fragcoord; | ||
41 | uniform vec2 screen_res; | ||
42 | |||
43 | uniform mat4 inv_proj; | ||
44 | |||
45 | vec4 getPosition(vec2 pos_screen) | ||
46 | { | ||
47 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
48 | vec2 sc = pos_screen.xy*2.0; | ||
49 | sc /= screen_res; | ||
50 | sc -= vec2(1.0,1.0); | ||
51 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
52 | vec4 pos = inv_proj * ndc; | ||
53 | pos /= pos.w; | ||
54 | pos.w = 1.0; | ||
55 | return pos; | ||
56 | } | ||
57 | |||
58 | void main() | ||
59 | { | ||
60 | vec4 frag = vary_fragcoord; | ||
61 | frag.xyz /= frag.w; | ||
62 | frag.xyz = frag.xyz*0.5+0.5; | ||
63 | frag.xy *= screen_res; | ||
64 | |||
65 | float shadow = 1.0; | ||
66 | |||
67 | if (proj_shadow_idx >= 0) | ||
68 | { | ||
69 | vec4 shd = texture2DRect(lightMap, frag.xy); | ||
70 | float sh[2]; | ||
71 | sh[0] = shd.b; | ||
72 | sh[1] = shd.a; | ||
73 | shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0); | ||
74 | } | ||
75 | |||
76 | vec3 pos = getPosition(frag.xy).xyz; | ||
77 | vec3 lv = vary_light.xyz-pos.xyz; | ||
78 | float dist2 = dot(lv,lv); | ||
79 | dist2 /= vary_light.w; | ||
80 | if (dist2 > 1.0) | ||
81 | { | ||
82 | discard; | ||
83 | } | ||
84 | |||
85 | vec3 norm = texture2DRect(normalMap, frag.xy).xyz*2.0-1.0; | ||
86 | |||
87 | norm = normalize(norm); | ||
88 | float l_dist = -dot(lv, proj_n); | ||
89 | |||
90 | vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); | ||
91 | if (proj_tc.z < 0.0) | ||
92 | { | ||
93 | discard; | ||
94 | } | ||
95 | |||
96 | proj_tc.xyz /= proj_tc.w; | ||
97 | |||
98 | float fa = gl_Color.a+1.0; | ||
99 | float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); | ||
100 | |||
101 | lv = proj_origin-pos.xyz; | ||
102 | lv = normalize(lv); | ||
103 | float da = dot(norm, lv); | ||
104 | |||
105 | vec3 col = vec3(0,0,0); | ||
106 | |||
107 | vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; | ||
108 | |||
109 | float noise = texture2D(noiseMap, frag.xy/128.0).b; | ||
110 | if (proj_tc.z > 0.0 && | ||
111 | proj_tc.x < 1.0 && | ||
112 | proj_tc.y < 1.0 && | ||
113 | proj_tc.x > 0.0 && | ||
114 | proj_tc.y > 0.0) | ||
115 | { | ||
116 | float lit = 0.0; | ||
117 | if (da > 0.0) | ||
118 | { | ||
119 | float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); | ||
120 | float lod = diff * proj_lod; | ||
121 | |||
122 | vec4 plcol = texture2DLod(projectionMap, proj_tc.xy, lod); | ||
123 | |||
124 | vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; | ||
125 | |||
126 | lit = da * dist_atten * noise; | ||
127 | |||
128 | col = lcol*lit*diff_tex*shadow; | ||
129 | } | ||
130 | |||
131 | float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); | ||
132 | float lod = diff * proj_lod; | ||
133 | vec4 amb_plcol = texture2DLod(projectionMap, proj_tc.xy, lod); | ||
134 | //float amb_da = mix(proj_ambiance, proj_ambiance*max(-da, 0.0), max(da, 0.0)); | ||
135 | float amb_da = proj_ambiance; | ||
136 | if (da > 0.0) | ||
137 | { | ||
138 | amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance; | ||
139 | } | ||
140 | |||
141 | amb_da += (da*da*0.5+0.5)*proj_ambiance; | ||
142 | |||
143 | amb_da *= dist_atten * noise; | ||
144 | |||
145 | amb_da = min(amb_da, 1.0-lit); | ||
146 | |||
147 | col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; | ||
148 | } | ||
149 | |||
150 | |||
151 | vec4 spec = texture2DRect(specularRect, frag.xy); | ||
152 | if (spec.a > 0.0) | ||
153 | { | ||
154 | vec3 ref = reflect(normalize(pos), norm); | ||
155 | |||
156 | //project from point pos in direction ref to plane proj_p, proj_n | ||
157 | vec3 pdelta = proj_p-pos; | ||
158 | float ds = dot(ref, proj_n); | ||
159 | |||
160 | if (ds < 0.0) | ||
161 | { | ||
162 | vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; | ||
163 | |||
164 | vec3 stc = (proj_mat * vec4(pfinal.xyz, 1.0)).xyz; | ||
165 | |||
166 | if (stc.z > 0.0) | ||
167 | { | ||
168 | stc.xy /= stc.z+proj_near; | ||
169 | |||
170 | if (stc.x < 1.0 && | ||
171 | stc.y < 1.0 && | ||
172 | stc.x > 0.0 && | ||
173 | stc.y > 0.0) | ||
174 | { | ||
175 | vec4 scol = texture2DLod(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); | ||
176 | col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow; | ||
177 | } | ||
178 | } | ||
179 | } | ||
180 | } | ||
181 | |||
182 | /*if (spec.a > 0.0) | ||
183 | { | ||
184 | //vec3 ref = reflect(normalize(pos), norm); | ||
185 | float sa = dot(normalize(lv-normalize(pos)),norm);; | ||
186 | //sa = max(sa, 0.0); | ||
187 | //sa = pow(sa, 128.0 * spec.a*spec.a/dist_atten)*min(dist_atten*4.0, 1.0); | ||
188 | sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); | ||
189 | sa *= noise; | ||
190 | col += da*sa*lcol*spec.rgb; | ||
191 | }*/ | ||
192 | |||
193 | //attenuate point light contribution by SSAO component | ||
194 | col *= texture2DRect(lightMap, frag.xy).g; | ||
195 | |||
196 | |||
197 | gl_FragColor.rgb = col; | ||
198 | gl_FragColor.a = 0.0; | ||
199 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl index 22bdd2c..d43fe6c 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl | |||
@@ -7,21 +7,17 @@ | |||
7 | 7 | ||
8 | #extension GL_ARB_texture_rectangle : enable | 8 | #extension GL_ARB_texture_rectangle : enable |
9 | 9 | ||
10 | uniform sampler2DRect depthMap; | 10 | uniform sampler2DRect positionMap; |
11 | uniform sampler2DRect normalMap; | 11 | uniform sampler2DRect normalMap; |
12 | uniform sampler2DRectShadow shadowMap0; | 12 | uniform sampler2DRect depthMap; |
13 | uniform sampler2DRectShadow shadowMap1; | 13 | uniform sampler2DShadow shadowMap0; |
14 | uniform sampler2DRectShadow shadowMap2; | 14 | uniform sampler2DShadow shadowMap1; |
15 | uniform sampler2DRectShadow shadowMap3; | 15 | uniform sampler2DShadow shadowMap2; |
16 | uniform sampler2DRectShadow shadowMap4; | 16 | uniform sampler2DShadow shadowMap3; |
17 | uniform sampler2DRectShadow shadowMap5; | ||
18 | uniform sampler2D noiseMap; | 17 | uniform sampler2D noiseMap; |
19 | 18 | ||
20 | uniform sampler2D lightFunc; | ||
21 | |||
22 | |||
23 | // Inputs | 19 | // Inputs |
24 | uniform mat4 shadow_matrix[6]; | 20 | uniform mat4 shadow_matrix[4]; |
25 | uniform vec4 shadow_clip; | 21 | uniform vec4 shadow_clip; |
26 | uniform float ssao_radius; | 22 | uniform float ssao_radius; |
27 | uniform float ssao_max_radius; | 23 | uniform float ssao_max_radius; |
@@ -31,25 +27,6 @@ uniform float ssao_factor_inv; | |||
31 | varying vec2 vary_fragcoord; | 27 | varying vec2 vary_fragcoord; |
32 | varying vec4 vary_light; | 28 | varying vec4 vary_light; |
33 | 29 | ||
34 | uniform mat4 inv_proj; | ||
35 | uniform vec2 screen_res; | ||
36 | |||
37 | uniform float shadow_bias; | ||
38 | uniform float shadow_offset; | ||
39 | |||
40 | vec4 getPosition(vec2 pos_screen) | ||
41 | { | ||
42 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
43 | vec2 sc = pos_screen.xy*2.0; | ||
44 | sc /= screen_res; | ||
45 | sc -= vec2(1.0,1.0); | ||
46 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
47 | vec4 pos = inv_proj * ndc; | ||
48 | pos /= pos.w; | ||
49 | pos.w = 1.0; | ||
50 | return pos; | ||
51 | } | ||
52 | |||
53 | //calculate decreases in ambient lighting when crowded out (SSAO) | 30 | //calculate decreases in ambient lighting when crowded out (SSAO) |
54 | float calcAmbientOcclusion(vec4 pos, vec3 norm) | 31 | float calcAmbientOcclusion(vec4 pos, vec3 norm) |
55 | { | 32 | { |
@@ -77,7 +54,7 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm) | |||
77 | for (int i = 0; i < 8; i++) | 54 | for (int i = 0; i < 8; i++) |
78 | { | 55 | { |
79 | vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect); | 56 | vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect); |
80 | vec3 samppos_world = getPosition(samppos_screen).xyz; | 57 | vec3 samppos_world = texture2DRect(positionMap, samppos_screen).xyz; |
81 | 58 | ||
82 | vec3 diff = pos_world - samppos_world; | 59 | vec3 diff = pos_world - samppos_world; |
83 | float dist2 = dot(diff, diff); | 60 | float dist2 = dot(diff, diff); |
@@ -97,18 +74,14 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm) | |||
97 | 74 | ||
98 | angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); | 75 | angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); |
99 | 76 | ||
100 | return (1.0 - (float(points != 0) * angle_hidden)); | 77 | return 1.0 - (float(points != 0) * angle_hidden); |
101 | } | 78 | } |
102 | 79 | ||
103 | void main() | 80 | void main() |
104 | { | 81 | { |
105 | vec2 pos_screen = vary_fragcoord.xy; | 82 | vec2 pos_screen = vary_fragcoord.xy; |
106 | 83 | vec4 pos = vec4(texture2DRect(positionMap, pos_screen).xyz, 1.0); | |
107 | //try doing an unproject here | 84 | vec3 norm = texture2DRect(normalMap, pos_screen).xyz; |
108 | |||
109 | vec4 pos = getPosition(pos_screen); | ||
110 | |||
111 | vec3 norm = texture2DRect(normalMap, pos_screen).xyz*2.0-1.0; | ||
112 | 85 | ||
113 | /*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL | 86 | /*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL |
114 | { | 87 | { |
@@ -117,45 +90,35 @@ void main() | |||
117 | }*/ | 90 | }*/ |
118 | 91 | ||
119 | float shadow = 1.0; | 92 | float shadow = 1.0; |
120 | float dp_directional_light = max(0.0, dot(norm, vary_light.xyz)); | 93 | float dp_directional_light = max(0.0, dot(norm, vary_light.xyz)); |
121 | 94 | ||
122 | vec4 spos = vec4(pos.xyz + norm.xyz * (-pos.z/64.0*shadow_offset+shadow_bias), 1.0); | ||
123 | |||
124 | //vec3 debug = vec3(0,0,0); | ||
125 | |||
126 | if (dp_directional_light == 0.0) | 95 | if (dp_directional_light == 0.0) |
127 | { | 96 | { |
128 | // if we know this point is facing away from the sun then we know it's in shadow without having to do a squirrelly shadow-map lookup | 97 | // if we know this point is facing away from the sun then we know it's in shadow without having to do a squirrelly shadow-map lookup |
129 | shadow = 0.0; | 98 | shadow = 0.0; |
130 | } | 99 | } |
131 | else if (spos.z > -shadow_clip.w) | 100 | else if (pos.z > -shadow_clip.w) |
132 | { | 101 | { |
133 | vec4 lpos; | 102 | if (pos.z < -shadow_clip.z) |
134 | |||
135 | if (spos.z < -shadow_clip.z) | ||
136 | { | 103 | { |
137 | lpos = shadow_matrix[3]*spos; | 104 | vec4 lpos = shadow_matrix[3]*pos; |
138 | lpos.xy *= screen_res; | 105 | shadow = shadow2DProj(shadowMap3, lpos).x; |
139 | shadow = shadow2DRectProj(shadowMap3, lpos).x; | ||
140 | shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0); | 106 | shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0); |
141 | } | 107 | } |
142 | else if (spos.z < -shadow_clip.y) | 108 | else if (pos.z < -shadow_clip.y) |
143 | { | 109 | { |
144 | lpos = shadow_matrix[2]*spos; | 110 | vec4 lpos = shadow_matrix[2]*pos; |
145 | lpos.xy *= screen_res; | 111 | shadow = shadow2DProj(shadowMap2, lpos).x; |
146 | shadow = shadow2DRectProj(shadowMap2, lpos).x; | ||
147 | } | 112 | } |
148 | else if (spos.z < -shadow_clip.x) | 113 | else if (pos.z < -shadow_clip.x) |
149 | { | 114 | { |
150 | lpos = shadow_matrix[1]*spos; | 115 | vec4 lpos = shadow_matrix[1]*pos; |
151 | lpos.xy *= screen_res; | 116 | shadow = shadow2DProj(shadowMap1, lpos).x; |
152 | shadow = shadow2DRectProj(shadowMap1, lpos).x; | ||
153 | } | 117 | } |
154 | else | 118 | else |
155 | { | 119 | { |
156 | lpos = shadow_matrix[0]*spos; | 120 | vec4 lpos = shadow_matrix[0]*pos; |
157 | lpos.xy *= screen_res; | 121 | shadow = shadow2DProj(shadowMap0, lpos).x; |
158 | shadow = shadow2DRectProj(shadowMap0, lpos).x; | ||
159 | } | 122 | } |
160 | 123 | ||
161 | // take the most-shadowed value out of these two: | 124 | // take the most-shadowed value out of these two: |
@@ -163,17 +126,6 @@ void main() | |||
163 | // * an unblurred dot product between the sun and this norm | 126 | // * an unblurred dot product between the sun and this norm |
164 | // the goal is to err on the side of most-shadow to fill-in shadow holes and reduce artifacting | 127 | // the goal is to err on the side of most-shadow to fill-in shadow holes and reduce artifacting |
165 | shadow = min(shadow, dp_directional_light); | 128 | shadow = min(shadow, dp_directional_light); |
166 | |||
167 | /*debug.r = lpos.y / (lpos.w*screen_res.y); | ||
168 | |||
169 | lpos.xy /= lpos.w*32.0; | ||
170 | if (fract(lpos.x) < 0.1 || fract(lpos.y) < 0.1) | ||
171 | { | ||
172 | debug.gb = vec2(0.5, 0.5); | ||
173 | } | ||
174 | |||
175 | debug += (1.0-shadow)*0.5;*/ | ||
176 | |||
177 | } | 129 | } |
178 | else | 130 | else |
179 | { | 131 | { |
@@ -183,18 +135,5 @@ void main() | |||
183 | 135 | ||
184 | gl_FragColor[0] = shadow; | 136 | gl_FragColor[0] = shadow; |
185 | gl_FragColor[1] = calcAmbientOcclusion(pos, norm); | 137 | gl_FragColor[1] = calcAmbientOcclusion(pos, norm); |
186 | 138 | //gl_FragColor[2] is unused as of August 2008, may be used for debugging | |
187 | //spotlight shadow 1 | ||
188 | vec4 lpos = shadow_matrix[4]*spos; | ||
189 | lpos.xy *= screen_res; | ||
190 | gl_FragColor[2] = shadow2DRectProj(shadowMap4, lpos).x; | ||
191 | |||
192 | //spotlight shadow 2 | ||
193 | lpos = shadow_matrix[5]*spos; | ||
194 | lpos.xy *= screen_res; | ||
195 | gl_FragColor[3] = shadow2DRectProj(shadowMap5, lpos).x; | ||
196 | |||
197 | //gl_FragColor.rgb = pos.xyz; | ||
198 | //gl_FragColor.b = shadow; | ||
199 | //gl_FragColor.rgb = debug; | ||
200 | } | 139 | } |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl index 308b9b1..211b2e0 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl | |||
@@ -12,6 +12,7 @@ uniform sampler2D detail_3; | |||
12 | uniform sampler2D alpha_ramp; | 12 | uniform sampler2D alpha_ramp; |
13 | 13 | ||
14 | varying vec3 vary_normal; | 14 | varying vec3 vary_normal; |
15 | varying vec4 vary_position; | ||
15 | 16 | ||
16 | void main() | 17 | void main() |
17 | { | 18 | { |
@@ -27,8 +28,9 @@ void main() | |||
27 | float alphaFinal = texture2D(alpha_ramp, gl_TexCoord[1].zw).a; | 28 | float alphaFinal = texture2D(alpha_ramp, gl_TexCoord[1].zw).a; |
28 | vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal ); | 29 | vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal ); |
29 | 30 | ||
30 | gl_FragData[0] = vec4(outColor.rgb, 0.0); // Kl 0.0 looks fine atm however check grass above waterline when GI enabled in future releases! | 31 | gl_FragData[0] = vec4(outColor.rgb, 1.0); |
31 | gl_FragData[1] = vec4(outColor.rgb*0.2, 0.2); | 32 | gl_FragData[1] = vec4(outColor.rgb*0.2, 0.2); |
32 | gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0); | 33 | gl_FragData[2] = vec4(normalize(vary_normal), 0.0); |
34 | gl_FragData[3] = vary_position; | ||
33 | } | 35 | } |
34 | 36 | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl index 3038b14..e9d6dca 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl | |||
@@ -6,6 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | varying vec3 vary_normal; | 8 | varying vec3 vary_normal; |
9 | varying vec4 vary_position; | ||
9 | 10 | ||
10 | vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1) | 11 | vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1) |
11 | { | 12 | { |
@@ -26,6 +27,7 @@ void main() | |||
26 | //transform vertex | 27 | //transform vertex |
27 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; | 28 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; |
28 | 29 | ||
30 | vary_position = gl_ModelViewMatrix * gl_Vertex; | ||
29 | vary_normal = normalize(gl_NormalMatrix * gl_Normal); | 31 | vary_normal = normalize(gl_NormalMatrix * gl_Normal); |
30 | 32 | ||
31 | // Transform and pass tex coords | 33 | // Transform and pass tex coords |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl index 49c65f1..bc2c981 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl | |||
@@ -8,11 +8,13 @@ | |||
8 | uniform sampler2D diffuseMap; | 8 | uniform sampler2D diffuseMap; |
9 | 9 | ||
10 | varying vec3 vary_normal; | 10 | varying vec3 vary_normal; |
11 | varying vec4 vary_position; | ||
11 | 12 | ||
12 | void main() | 13 | void main() |
13 | { | 14 | { |
14 | vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy); | 15 | vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy); |
15 | gl_FragData[0] = gl_Color*col; | 16 | gl_FragData[0] = gl_Color*col; |
16 | gl_FragData[1] = vec4(0,0,0,0); | 17 | gl_FragData[1] = vec4(0,0,0,0); |
17 | gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0); | 18 | gl_FragData[2] = vec4(normalize(vary_normal), 0.0); |
19 | gl_FragData[3] = vary_position; | ||
18 | } | 20 | } |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl index 6b9dc2d..9131d7c 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl | |||
@@ -6,6 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | varying vec3 vary_normal; | 8 | varying vec3 vary_normal; |
9 | varying vec4 vary_position; | ||
9 | 10 | ||
10 | void main() | 11 | void main() |
11 | { | 12 | { |
@@ -13,6 +14,8 @@ void main() | |||
13 | gl_Position = ftransform(); | 14 | gl_Position = ftransform(); |
14 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; | 15 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; |
15 | 16 | ||
17 | vary_position = gl_ModelViewMatrix * gl_Vertex; | ||
18 | |||
16 | vary_normal = normalize(gl_NormalMatrix * gl_Normal); | 19 | vary_normal = normalize(gl_NormalMatrix * gl_Normal); |
17 | 20 | ||
18 | gl_FrontColor = gl_Color; | 21 | gl_FrontColor = gl_Color; |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl index 6eea656..0a1f019 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl | |||
@@ -17,7 +17,7 @@ uniform sampler2DShadow shadowMap2; | |||
17 | uniform sampler2DShadow shadowMap3; | 17 | uniform sampler2DShadow shadowMap3; |
18 | uniform sampler2D noiseMap; | 18 | uniform sampler2D noiseMap; |
19 | 19 | ||
20 | uniform mat4 shadow_matrix[6]; | 20 | uniform mat4 shadow_matrix[4]; |
21 | uniform vec4 shadow_clip; | 21 | uniform vec4 shadow_clip; |
22 | 22 | ||
23 | uniform float sunAngle; | 23 | uniform float sunAngle; |
diff --git a/linden/indra/newview/app_settings/shaders/class1/effects/colorFilterF.glsl b/linden/indra/newview/app_settings/shaders/class1/effects/colorFilterF.glsl deleted file mode 100644 index 623ef7a..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/effects/colorFilterF.glsl +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /** | ||
2 | * @file colorFilterF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | uniform float brightness; | ||
10 | uniform float contrast; | ||
11 | uniform vec3 contrastBase; | ||
12 | uniform float saturation; | ||
13 | uniform vec3 lumWeights; | ||
14 | |||
15 | const float gamma = 2.0; | ||
16 | |||
17 | void main(void) | ||
18 | { | ||
19 | vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st)); | ||
20 | |||
21 | /// Modulate brightness | ||
22 | color *= brightness; | ||
23 | |||
24 | /// Modulate contrast | ||
25 | color = mix(contrastBase, color, contrast); | ||
26 | |||
27 | /// Modulate saturation | ||
28 | color = mix(vec3(dot(color, lumWeights)), color, saturation); | ||
29 | |||
30 | gl_FragColor = vec4(color, 1.0); | ||
31 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/effects/drawQuadV.glsl b/linden/indra/newview/app_settings/shaders/class1/effects/drawQuadV.glsl deleted file mode 100644 index 29c2a09..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/effects/drawQuadV.glsl +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /** | ||
2 | * @file drawQuadV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | void main(void) | ||
9 | { | ||
10 | //transform vertex | ||
11 | gl_Position = ftransform(); | ||
12 | gl_TexCoord[0] = gl_MultiTexCoord0; | ||
13 | gl_TexCoord[1] = gl_MultiTexCoord1; | ||
14 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/effects/nightVisionF.glsl b/linden/indra/newview/app_settings/shaders/class1/effects/nightVisionF.glsl deleted file mode 100644 index 271d5cf..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/effects/nightVisionF.glsl +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /** | ||
2 | * @file nightVisionF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | uniform sampler2D NoiseTexture; | ||
10 | uniform float brightMult; | ||
11 | uniform float noiseStrength; | ||
12 | |||
13 | float luminance(vec3 color) | ||
14 | { | ||
15 | /// CALCULATING LUMINANCE (Using NTSC lum weights) | ||
16 | /// http://en.wikipedia.org/wiki/Luma_%28video%29 | ||
17 | return dot(color, vec3(0.299, 0.587, 0.114)); | ||
18 | } | ||
19 | |||
20 | void main(void) | ||
21 | { | ||
22 | /// Get scene color | ||
23 | vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st)); | ||
24 | |||
25 | /// Extract luminance and scale up by night vision brightness | ||
26 | float lum = luminance(color) * brightMult; | ||
27 | |||
28 | /// Convert into night vision color space | ||
29 | /// Newer NVG colors (crisper and more saturated) | ||
30 | vec3 outColor = (lum * vec3(0.91, 1.21, 0.9)) + vec3(-0.07, 0.1, -0.12); | ||
31 | |||
32 | /// Add noise | ||
33 | float noiseValue = texture2D(NoiseTexture, gl_TexCoord[1].st).r; | ||
34 | noiseValue = (noiseValue - 0.5) * noiseStrength; | ||
35 | |||
36 | /// Older NVG colors (more muted) | ||
37 | // vec3 outColor = (lum * vec3(0.82, 0.75, 0.83)) + vec3(0.05, 0.32, -0.11); | ||
38 | |||
39 | outColor += noiseValue; | ||
40 | |||
41 | gl_FragColor = vec4(outColor, 1.0); | ||
42 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl deleted file mode 100644 index 0055a73..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
1 | /** | ||
2 | * @file alphaF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #extension GL_ARB_texture_rectangle : enable | ||
9 | |||
10 | uniform sampler2D diffuseMap; | ||
11 | uniform sampler2DRectShadow shadowMap0; | ||
12 | uniform sampler2DRectShadow shadowMap1; | ||
13 | uniform sampler2DRectShadow shadowMap2; | ||
14 | uniform sampler2DRectShadow shadowMap3; | ||
15 | uniform sampler2D noiseMap; | ||
16 | uniform sampler2DRect depthMap; | ||
17 | |||
18 | uniform mat4 shadow_matrix[6]; | ||
19 | uniform vec4 shadow_clip; | ||
20 | uniform vec2 screen_res; | ||
21 | |||
22 | vec3 atmosLighting(vec3 light); | ||
23 | vec3 scaleSoftClip(vec3 light); | ||
24 | |||
25 | varying vec3 vary_ambient; | ||
26 | varying vec3 vary_directional; | ||
27 | varying vec3 vary_fragcoord; | ||
28 | varying vec3 vary_position; | ||
29 | varying vec3 vary_light; | ||
30 | |||
31 | uniform float alpha_soften; | ||
32 | |||
33 | uniform mat4 inv_proj; | ||
34 | |||
35 | vec4 getPosition(vec2 pos_screen) | ||
36 | { | ||
37 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
38 | vec2 sc = pos_screen.xy*2.0; | ||
39 | sc /= screen_res; | ||
40 | sc -= vec2(1.0,1.0); | ||
41 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
42 | vec4 pos = inv_proj * ndc; | ||
43 | pos /= pos.w; | ||
44 | pos.w = 1.0; | ||
45 | return pos; | ||
46 | } | ||
47 | |||
48 | void main() | ||
49 | { | ||
50 | vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; | ||
51 | frag *= screen_res; | ||
52 | |||
53 | vec3 samp_pos = getPosition(frag).xyz; | ||
54 | |||
55 | float shadow = 1.0; | ||
56 | vec4 pos = vec4(vary_position, 1.0); | ||
57 | |||
58 | vec4 spos = pos; | ||
59 | |||
60 | if (spos.z > -shadow_clip.w) | ||
61 | { | ||
62 | vec4 lpos; | ||
63 | |||
64 | if (spos.z < -shadow_clip.z) | ||
65 | { | ||
66 | lpos = shadow_matrix[3]*spos; | ||
67 | lpos.xy *= screen_res; | ||
68 | shadow = shadow2DRectProj(shadowMap3, lpos).x; | ||
69 | shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0); | ||
70 | } | ||
71 | else if (spos.z < -shadow_clip.y) | ||
72 | { | ||
73 | lpos = shadow_matrix[2]*spos; | ||
74 | lpos.xy *= screen_res; | ||
75 | shadow = shadow2DRectProj(shadowMap2, lpos).x; | ||
76 | } | ||
77 | else if (spos.z < -shadow_clip.x) | ||
78 | { | ||
79 | lpos = shadow_matrix[1]*spos; | ||
80 | lpos.xy *= screen_res; | ||
81 | shadow = shadow2DRectProj(shadowMap1, lpos).x; | ||
82 | } | ||
83 | else | ||
84 | { | ||
85 | lpos = shadow_matrix[0]*spos; | ||
86 | lpos.xy *= screen_res; | ||
87 | shadow = shadow2DRectProj(shadowMap0, lpos).x; | ||
88 | } | ||
89 | } | ||
90 | |||
91 | vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, gl_Color.a); | ||
92 | vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * col; | ||
93 | |||
94 | color.rgb = atmosLighting(color.rgb); | ||
95 | |||
96 | color.rgb = scaleSoftClip(color.rgb); | ||
97 | |||
98 | if (samp_pos.z != 0.0) | ||
99 | { | ||
100 | float dist_factor = alpha_soften; | ||
101 | float a = gl_Color.a; | ||
102 | a *= a; | ||
103 | dist_factor *= 1.0/(1.0-a); | ||
104 | color.a *= min((pos.z-samp_pos.z)*dist_factor, 1.0); | ||
105 | } | ||
106 | |||
107 | //gl_FragColor = gl_Color; | ||
108 | gl_FragColor = color; | ||
109 | //gl_FragColor = vec4(1,0,1,1)*shadow; | ||
110 | |||
111 | } | ||
112 | |||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl deleted file mode 100644 index ab60b65..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl +++ /dev/null | |||
@@ -1,75 +0,0 @@ | |||
1 | /** | ||
2 | * @file alphaV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); | ||
9 | void calcAtmospherics(vec3 inPositionEye); | ||
10 | |||
11 | float calcDirectionalLight(vec3 n, vec3 l); | ||
12 | float calcPointLight(vec3 v, vec3 n, vec4 lp, float la); | ||
13 | |||
14 | vec3 atmosAmbient(vec3 light); | ||
15 | vec3 atmosAffectDirectionalLight(float lightIntensity); | ||
16 | vec3 scaleDownLight(vec3 light); | ||
17 | vec3 scaleUpLight(vec3 light); | ||
18 | |||
19 | varying vec3 vary_ambient; | ||
20 | varying vec3 vary_directional; | ||
21 | varying vec3 vary_fragcoord; | ||
22 | varying vec3 vary_position; | ||
23 | varying vec3 vary_light; | ||
24 | |||
25 | uniform float near_clip; | ||
26 | uniform float shadow_offset; | ||
27 | uniform float shadow_bias; | ||
28 | |||
29 | void main() | ||
30 | { | ||
31 | //transform vertex | ||
32 | gl_Position = ftransform(); | ||
33 | |||
34 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; | ||
35 | |||
36 | vec4 pos = (gl_ModelViewMatrix * gl_Vertex); | ||
37 | vec3 norm = normalize(gl_NormalMatrix * gl_Normal); | ||
38 | |||
39 | vary_position = vec4(pos.xyz + norm.xyz * (-pos.z/64.0*shadow_offset+shadow_bias), 1.0); | ||
40 | |||
41 | calcAtmospherics(pos.xyz); | ||
42 | |||
43 | //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); | ||
44 | vec4 col; | ||
45 | col.a = gl_Color.a; | ||
46 | |||
47 | // Add windlight lights | ||
48 | col.rgb = atmosAmbient(vec3(0.)); | ||
49 | col.rgb = scaleUpLight(col.rgb); | ||
50 | |||
51 | // Collect normal lights (need to be divided by two, as we later multiply by 2) | ||
52 | col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].linearAttenuation); | ||
53 | col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].linearAttenuation); | ||
54 | col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].linearAttenuation); | ||
55 | col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].linearAttenuation); | ||
56 | col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].linearAttenuation); | ||
57 | col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].linearAttenuation); | ||
58 | col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz); | ||
59 | col.rgb = scaleDownLight(col.rgb); | ||
60 | |||
61 | vary_light = gl_LightSource[0].position.xyz; | ||
62 | |||
63 | vary_ambient = col.rgb*gl_Color.rgb; | ||
64 | vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); | ||
65 | |||
66 | col.rgb = min(col.rgb*gl_Color.rgb, 1.0); | ||
67 | |||
68 | gl_FrontColor = col; | ||
69 | |||
70 | gl_FogFragCoord = pos.z; | ||
71 | |||
72 | pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
73 | vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); | ||
74 | |||
75 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaF.glsl deleted file mode 100644 index fe83c3c..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaF.glsl +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | /** | ||
2 | * @file avatarAlphaF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2D diffuseMap; | ||
9 | uniform sampler2DRectShadow shadowMap0; | ||
10 | uniform sampler2DRectShadow shadowMap1; | ||
11 | uniform sampler2DRectShadow shadowMap2; | ||
12 | uniform sampler2DRectShadow shadowMap3; | ||
13 | uniform sampler2D noiseMap; | ||
14 | |||
15 | uniform mat4 shadow_matrix[6]; | ||
16 | uniform vec4 shadow_clip; | ||
17 | uniform vec2 screen_res; | ||
18 | |||
19 | vec3 atmosLighting(vec3 light); | ||
20 | vec3 scaleSoftClip(vec3 light); | ||
21 | |||
22 | varying vec3 vary_ambient; | ||
23 | varying vec3 vary_directional; | ||
24 | varying vec4 vary_position; | ||
25 | varying vec3 vary_normal; | ||
26 | |||
27 | void main() | ||
28 | { | ||
29 | float shadow = 1.0; | ||
30 | vec4 pos = vary_position; | ||
31 | vec3 norm = normalize(vary_normal); | ||
32 | |||
33 | vec3 nz = texture2D(noiseMap, gl_FragCoord.xy/128.0).xyz; | ||
34 | |||
35 | vec4 spos = pos; | ||
36 | |||
37 | if (spos.z > -shadow_clip.w) | ||
38 | { | ||
39 | vec4 lpos; | ||
40 | |||
41 | if (spos.z < -shadow_clip.z) | ||
42 | { | ||
43 | lpos = shadow_matrix[3]*spos; | ||
44 | lpos.xy *= screen_res; | ||
45 | shadow = shadow2DRectProj(shadowMap3, lpos).x; | ||
46 | shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0); | ||
47 | } | ||
48 | else if (spos.z < -shadow_clip.y) | ||
49 | { | ||
50 | lpos = shadow_matrix[2]*spos; | ||
51 | lpos.xy *= screen_res; | ||
52 | shadow = shadow2DRectProj(shadowMap2, lpos).x; | ||
53 | } | ||
54 | else if (spos.z < -shadow_clip.x) | ||
55 | { | ||
56 | lpos = shadow_matrix[1]*spos; | ||
57 | lpos.xy *= screen_res; | ||
58 | shadow = shadow2DRectProj(shadowMap1, lpos).x; | ||
59 | } | ||
60 | else | ||
61 | { | ||
62 | lpos = shadow_matrix[0]*spos; | ||
63 | lpos.xy *= screen_res; | ||
64 | shadow = shadow2DRectProj(shadowMap0, lpos).x; | ||
65 | } | ||
66 | } | ||
67 | |||
68 | |||
69 | vec4 col = vec4(vary_ambient + vary_directional*shadow, gl_Color.a); | ||
70 | vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * col; | ||
71 | |||
72 | color.rgb = atmosLighting(color.rgb); | ||
73 | |||
74 | color.rgb = scaleSoftClip(color.rgb); | ||
75 | |||
76 | gl_FragColor = color; | ||
77 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl deleted file mode 100644 index c1988d3..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | /** | ||
2 | * @file avatarAlphaV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); | ||
9 | mat4 getSkinnedTransform(); | ||
10 | void calcAtmospherics(vec3 inPositionEye); | ||
11 | |||
12 | float calcDirectionalLight(vec3 n, vec3 l); | ||
13 | float calcPointLight(vec3 v, vec3 n, vec4 lp, float la); | ||
14 | |||
15 | vec3 atmosAmbient(vec3 light); | ||
16 | vec3 atmosAffectDirectionalLight(float lightIntensity); | ||
17 | vec3 scaleDownLight(vec3 light); | ||
18 | vec3 scaleUpLight(vec3 light); | ||
19 | |||
20 | varying vec4 vary_position; | ||
21 | varying vec3 vary_ambient; | ||
22 | varying vec3 vary_directional; | ||
23 | varying vec3 vary_normal; | ||
24 | |||
25 | void main() | ||
26 | { | ||
27 | gl_TexCoord[0] = gl_MultiTexCoord0; | ||
28 | |||
29 | vec4 pos; | ||
30 | vec3 norm; | ||
31 | |||
32 | mat4 trans = getSkinnedTransform(); | ||
33 | pos.x = dot(trans[0], gl_Vertex); | ||
34 | pos.y = dot(trans[1], gl_Vertex); | ||
35 | pos.z = dot(trans[2], gl_Vertex); | ||
36 | pos.w = 1.0; | ||
37 | |||
38 | norm.x = dot(trans[0].xyz, gl_Normal); | ||
39 | norm.y = dot(trans[1].xyz, gl_Normal); | ||
40 | norm.z = dot(trans[2].xyz, gl_Normal); | ||
41 | norm = normalize(norm); | ||
42 | |||
43 | gl_Position = gl_ProjectionMatrix * pos; | ||
44 | vary_position = pos; | ||
45 | vary_normal = norm; | ||
46 | |||
47 | calcAtmospherics(pos.xyz); | ||
48 | |||
49 | //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); | ||
50 | vec4 col; | ||
51 | col.a = gl_Color.a; | ||
52 | |||
53 | // Add windlight lights | ||
54 | col.rgb = atmosAmbient(vec3(0.)); | ||
55 | col.rgb = scaleUpLight(col.rgb); | ||
56 | |||
57 | // Collect normal lights (need to be divided by two, as we later multiply by 2) | ||
58 | col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].linearAttenuation); | ||
59 | col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].linearAttenuation); | ||
60 | col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].linearAttenuation); | ||
61 | col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].linearAttenuation); | ||
62 | col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].linearAttenuation); | ||
63 | col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].linearAttenuation); | ||
64 | col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz); | ||
65 | col.rgb = scaleDownLight(col.rgb); | ||
66 | |||
67 | vary_ambient = col.rgb*gl_Color.rgb; | ||
68 | vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); | ||
69 | |||
70 | col.rgb = min(col.rgb*gl_Color.rgb, 1.0); | ||
71 | |||
72 | gl_FrontColor = col; | ||
73 | |||
74 | gl_FogFragCoord = pos.z; | ||
75 | |||
76 | } | ||
77 | |||
78 | |||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl deleted file mode 100644 index 1713fe9..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | /** | ||
2 | * @file blurLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #extension GL_ARB_texture_rectangle : enable | ||
9 | |||
10 | uniform sampler2DRect depthMap; | ||
11 | uniform sampler2DRect normalMap; | ||
12 | uniform sampler2DRect lightMap; | ||
13 | |||
14 | uniform float dist_factor; | ||
15 | uniform float blur_size; | ||
16 | uniform vec2 delta; | ||
17 | uniform vec3 kern[32]; | ||
18 | uniform int kern_length; | ||
19 | uniform float kern_scale; | ||
20 | |||
21 | varying vec2 vary_fragcoord; | ||
22 | |||
23 | uniform mat4 inv_proj; | ||
24 | uniform vec2 screen_res; | ||
25 | |||
26 | vec4 getPosition(vec2 pos_screen) | ||
27 | { | ||
28 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
29 | vec2 sc = pos_screen.xy*2.0; | ||
30 | sc /= screen_res; | ||
31 | sc -= vec2(1.0,1.0); | ||
32 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
33 | vec4 pos = inv_proj * ndc; | ||
34 | pos /= pos.w; | ||
35 | pos.w = 1.0; | ||
36 | return pos; | ||
37 | } | ||
38 | |||
39 | void main() | ||
40 | { | ||
41 | vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz*2.0-1.0; | ||
42 | vec3 pos = getPosition(vary_fragcoord.xy).xyz; | ||
43 | vec4 ccol = texture2DRect(lightMap, vary_fragcoord.xy).rgba; | ||
44 | |||
45 | vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); | ||
46 | |||
47 | dlt /= max(-pos.z*dist_factor, 1.0); | ||
48 | |||
49 | vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free' | ||
50 | vec4 col = defined_weight.xyxx * ccol; | ||
51 | |||
52 | for (int i = 1; i < kern_length; i++) | ||
53 | { | ||
54 | vec2 tc = vary_fragcoord.xy + kern[i].z*dlt; | ||
55 | vec3 samppos = getPosition(tc).xyz; | ||
56 | float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane | ||
57 | if (d*d <= 0.003) | ||
58 | { | ||
59 | col += texture2DRect(lightMap, tc)*kern[i].xyxx; | ||
60 | defined_weight += kern[i].xy; | ||
61 | } | ||
62 | } | ||
63 | |||
64 | |||
65 | |||
66 | col /= defined_weight.xyxx; | ||
67 | |||
68 | gl_FragColor = col; | ||
69 | |||
70 | //gl_FragColor = ccol; | ||
71 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/blurLightV.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/blurLightV.glsl deleted file mode 100644 index b7f07e5..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/blurLightV.glsl +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /** | ||
2 | * @file blurLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | uniform vec2 screen_res; | ||
10 | |||
11 | void main() | ||
12 | { | ||
13 | //transform vertex | ||
14 | gl_Position = ftransform(); | ||
15 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
16 | vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; | ||
17 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl deleted file mode 100644 index 6519594..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ /dev/null | |||
@@ -1,188 +0,0 @@ | |||
1 | /** | ||
2 | * @file multiSpotLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #version 120 | ||
9 | |||
10 | #extension GL_ARB_texture_rectangle : enable | ||
11 | |||
12 | uniform sampler2DRect diffuseRect; | ||
13 | uniform sampler2DRect specularRect; | ||
14 | uniform sampler2DRect depthMap; | ||
15 | uniform sampler2DRect normalMap; | ||
16 | uniform samplerCube environmentMap; | ||
17 | uniform sampler2DRect lightMap; | ||
18 | uniform sampler2D noiseMap; | ||
19 | uniform sampler2D lightFunc; | ||
20 | uniform sampler2D projectionMap; | ||
21 | |||
22 | uniform mat4 proj_mat; //screen space to light space | ||
23 | uniform float proj_near; //near clip for projection | ||
24 | uniform vec3 proj_p; //plane projection is emitting from (in screen space) | ||
25 | uniform vec3 proj_n; | ||
26 | uniform float proj_focus; //distance from plane to begin blurring | ||
27 | uniform float proj_lod; //(number of mips in proj map) | ||
28 | uniform float proj_range; //range between near clip and far clip plane of projection | ||
29 | uniform float proj_ambient_lod; | ||
30 | uniform float proj_ambiance; | ||
31 | uniform float near_clip; | ||
32 | uniform float far_clip; | ||
33 | |||
34 | uniform vec3 proj_origin; //origin of projection to be used for angular attenuation | ||
35 | uniform float sun_wash; | ||
36 | uniform int proj_shadow_idx; | ||
37 | uniform float shadow_fade; | ||
38 | |||
39 | varying vec4 vary_light; | ||
40 | |||
41 | varying vec4 vary_fragcoord; | ||
42 | uniform vec2 screen_res; | ||
43 | |||
44 | uniform mat4 inv_proj; | ||
45 | |||
46 | vec4 getPosition(vec2 pos_screen) | ||
47 | { | ||
48 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
49 | vec2 sc = pos_screen.xy*2.0; | ||
50 | sc /= screen_res; | ||
51 | sc -= vec2(1.0,1.0); | ||
52 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
53 | vec4 pos = inv_proj * ndc; | ||
54 | pos /= pos.w; | ||
55 | pos.w = 1.0; | ||
56 | return pos; | ||
57 | } | ||
58 | |||
59 | void main() | ||
60 | { | ||
61 | vec4 frag = vary_fragcoord; | ||
62 | frag.xyz /= frag.w; | ||
63 | frag.xyz = frag.xyz*0.5+0.5; | ||
64 | frag.xy *= screen_res; | ||
65 | |||
66 | vec3 pos = getPosition(frag.xy).xyz; | ||
67 | vec3 lv = vary_light.xyz-pos.xyz; | ||
68 | float dist2 = dot(lv,lv); | ||
69 | dist2 /= vary_light.w; | ||
70 | if (dist2 > 1.0) | ||
71 | { | ||
72 | discard; | ||
73 | } | ||
74 | |||
75 | float shadow = 1.0; | ||
76 | |||
77 | if (proj_shadow_idx >= 0) | ||
78 | { | ||
79 | vec4 shd = texture2DRect(lightMap, frag.xy); | ||
80 | float sh[2]; | ||
81 | sh[0] = shd.b; | ||
82 | sh[1] = shd.a; | ||
83 | shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0); | ||
84 | } | ||
85 | |||
86 | vec3 norm = texture2DRect(normalMap, frag.xy).xyz*2.0-1.0; | ||
87 | |||
88 | norm = normalize(norm); | ||
89 | float l_dist = -dot(lv, proj_n); | ||
90 | |||
91 | vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); | ||
92 | if (proj_tc.z < 0.0) | ||
93 | { | ||
94 | discard; | ||
95 | } | ||
96 | |||
97 | proj_tc.xyz /= proj_tc.w; | ||
98 | |||
99 | float fa = gl_Color.a+1.0; | ||
100 | float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); | ||
101 | if (dist_atten <= 0.0) | ||
102 | { | ||
103 | discard; | ||
104 | } | ||
105 | |||
106 | lv = proj_origin-pos.xyz; | ||
107 | lv = normalize(lv); | ||
108 | float da = dot(norm, lv); | ||
109 | |||
110 | vec3 col = vec3(0,0,0); | ||
111 | |||
112 | vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; | ||
113 | |||
114 | float noise = texture2D(noiseMap, frag.xy/128.0).b; | ||
115 | if (proj_tc.z > 0.0 && | ||
116 | proj_tc.x < 1.0 && | ||
117 | proj_tc.y < 1.0 && | ||
118 | proj_tc.x > 0.0 && | ||
119 | proj_tc.y > 0.0) | ||
120 | { | ||
121 | float lit = 0.0; | ||
122 | float amb_da = proj_ambiance; | ||
123 | |||
124 | if (da > 0.0) | ||
125 | { | ||
126 | float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); | ||
127 | float lod = diff * proj_lod; | ||
128 | |||
129 | vec4 plcol = texture2DLod(projectionMap, proj_tc.xy, lod); | ||
130 | |||
131 | vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; | ||
132 | |||
133 | lit = da * dist_atten * noise; | ||
134 | |||
135 | col = lcol*lit*diff_tex*shadow; | ||
136 | amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance; | ||
137 | } | ||
138 | |||
139 | //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); | ||
140 | vec4 amb_plcol = texture2DLod(projectionMap, proj_tc.xy, proj_ambient_lod); | ||
141 | |||
142 | amb_da += (da*da*0.5+0.5)*proj_ambiance; | ||
143 | |||
144 | amb_da *= dist_atten * noise; | ||
145 | |||
146 | amb_da = min(amb_da, 1.0-lit); | ||
147 | |||
148 | col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; | ||
149 | } | ||
150 | |||
151 | |||
152 | vec4 spec = texture2DRect(specularRect, frag.xy); | ||
153 | if (spec.a > 0.0) | ||
154 | { | ||
155 | vec3 ref = reflect(normalize(pos), norm); | ||
156 | |||
157 | //project from point pos in direction ref to plane proj_p, proj_n | ||
158 | vec3 pdelta = proj_p-pos; | ||
159 | float ds = dot(ref, proj_n); | ||
160 | |||
161 | if (ds < 0.0) | ||
162 | { | ||
163 | vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; | ||
164 | |||
165 | vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); | ||
166 | |||
167 | if (stc.z > 0.0) | ||
168 | { | ||
169 | stc.xy /= stc.w; | ||
170 | |||
171 | if (stc.x < 1.0 && | ||
172 | stc.y < 1.0 && | ||
173 | stc.x > 0.0 && | ||
174 | stc.y > 0.0) | ||
175 | { | ||
176 | vec4 scol = texture2DLod(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); | ||
177 | col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow; | ||
178 | } | ||
179 | } | ||
180 | } | ||
181 | } | ||
182 | |||
183 | //attenuate point light contribution by SSAO component | ||
184 | col *= texture2DRect(lightMap, frag.xy).g; | ||
185 | |||
186 | gl_FragColor.rgb = col; | ||
187 | gl_FragColor.a = 0.0; | ||
188 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/postDeferredF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/postDeferredF.glsl deleted file mode 100644 index ee0e9d6..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/postDeferredF.glsl +++ /dev/null | |||
@@ -1,59 +0,0 @@ | |||
1 | /** | ||
2 | * @file postDeferredF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect diffuseRect; | ||
9 | uniform sampler2DRect localLightMap; | ||
10 | uniform sampler2DRect sunLightMap; | ||
11 | uniform sampler2DRect giLightMap; | ||
12 | uniform sampler2D luminanceMap; | ||
13 | uniform sampler2DRect lightMap; | ||
14 | |||
15 | uniform vec3 gi_lum_quad; | ||
16 | uniform vec3 sun_lum_quad; | ||
17 | uniform vec3 lum_quad; | ||
18 | uniform float lum_lod; | ||
19 | uniform vec4 ambient; | ||
20 | |||
21 | uniform vec3 gi_quad; | ||
22 | |||
23 | uniform vec2 screen_res; | ||
24 | varying vec2 vary_fragcoord; | ||
25 | |||
26 | void main() | ||
27 | { | ||
28 | vec2 tc = vary_fragcoord.xy; | ||
29 | vec3 lcol = texture2DLod(luminanceMap, tc/screen_res, lum_lod).rgb; | ||
30 | |||
31 | float lum = sqrt(lcol.r)*lum_quad.x+lcol.r*lcol.r*lum_quad.y+lcol.r*lum_quad.z; | ||
32 | |||
33 | vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); | ||
34 | |||
35 | float ambocc = texture2DRect(lightMap, vary_fragcoord.xy).g; | ||
36 | |||
37 | vec3 gi_col = texture2DRect(giLightMap, vary_fragcoord.xy).rgb; | ||
38 | gi_col = gi_col*gi_col*gi_quad.x + gi_col*gi_quad.y+gi_quad.z*ambocc*ambient.rgb; | ||
39 | gi_col *= diff; | ||
40 | |||
41 | vec4 sun_col = texture2DRect(sunLightMap, vary_fragcoord.xy); | ||
42 | |||
43 | vec3 local_col = texture2DRect(localLightMap, vary_fragcoord.xy).rgb; | ||
44 | |||
45 | |||
46 | float sun_lum = 1.0-lum; | ||
47 | sun_lum = sun_lum*sun_lum*sun_lum_quad.x + sun_lum*sun_lum_quad.y+sun_lum_quad.z; | ||
48 | |||
49 | float gi_lum = lum; | ||
50 | gi_lum = gi_lum*gi_lum*gi_lum_quad.x+gi_lum*gi_lum_quad.y+gi_lum_quad.z; | ||
51 | gi_col *= 1.0/gi_lum; | ||
52 | |||
53 | vec3 col = sun_col.rgb*(1.0+max(sun_lum,0.0))+gi_col+local_col; | ||
54 | |||
55 | gl_FragColor.rgb = col.rgb; | ||
56 | gl_FragColor.a = max(sun_lum*min(sun_col.r+sun_col.g+sun_col.b, 1.0), sun_col.a); | ||
57 | |||
58 | //gl_FragColor.rgb = texture2DRect(giLightMap, vary_fragcoord.xy).rgb; | ||
59 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/postDeferredV.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/postDeferredV.glsl deleted file mode 100644 index 9819232..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/postDeferredV.glsl +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /** | ||
2 | * @file postDeferredV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | uniform vec2 screen_res; | ||
10 | |||
11 | void main() | ||
12 | { | ||
13 | //transform vertex | ||
14 | gl_Position = ftransform(); | ||
15 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
16 | vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; | ||
17 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl deleted file mode 100644 index 52b79e3..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ /dev/null | |||
@@ -1,294 +0,0 @@ | |||
1 | /** | ||
2 | * @file softenLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #extension GL_ARB_texture_rectangle : enable | ||
9 | |||
10 | uniform sampler2DRect diffuseRect; | ||
11 | uniform sampler2DRect specularRect; | ||
12 | uniform sampler2DRect normalMap; | ||
13 | uniform sampler2DRect lightMap; | ||
14 | uniform sampler2D noiseMap; | ||
15 | uniform samplerCube environmentMap; | ||
16 | uniform sampler2D lightFunc; | ||
17 | uniform vec3 gi_quad; | ||
18 | |||
19 | uniform float blur_size; | ||
20 | uniform float blur_fidelity; | ||
21 | |||
22 | // Inputs | ||
23 | uniform vec4 morphFactor; | ||
24 | uniform vec3 camPosLocal; | ||
25 | //uniform vec4 camPosWorld; | ||
26 | uniform vec4 gamma; | ||
27 | uniform vec4 lightnorm; | ||
28 | uniform vec4 sunlight_color; | ||
29 | uniform vec4 ambient; | ||
30 | uniform vec4 blue_horizon; | ||
31 | uniform vec4 blue_density; | ||
32 | uniform vec4 haze_horizon; | ||
33 | uniform vec4 haze_density; | ||
34 | uniform vec4 cloud_shadow; | ||
35 | uniform vec4 density_multiplier; | ||
36 | uniform vec4 distance_multiplier; | ||
37 | uniform vec4 max_y; | ||
38 | uniform vec4 glow; | ||
39 | uniform float scene_light_strength; | ||
40 | uniform vec3 env_mat[3]; | ||
41 | uniform vec4 shadow_clip; | ||
42 | uniform mat3 ssao_effect_mat; | ||
43 | |||
44 | uniform sampler2DRect depthMap; | ||
45 | uniform mat4 inv_proj; | ||
46 | uniform vec2 screen_res; | ||
47 | |||
48 | varying vec4 vary_light; | ||
49 | varying vec2 vary_fragcoord; | ||
50 | |||
51 | vec3 vary_PositionEye; | ||
52 | |||
53 | vec3 vary_SunlitColor; | ||
54 | vec3 vary_AmblitColor; | ||
55 | vec3 vary_AdditiveColor; | ||
56 | vec3 vary_AtmosAttenuation; | ||
57 | |||
58 | vec4 getPosition(vec2 pos_screen) | ||
59 | { //get position in screen space (world units) given window coordinate and depth map | ||
60 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
61 | vec2 sc = pos_screen.xy*2.0; | ||
62 | sc /= screen_res; | ||
63 | sc -= vec2(1.0,1.0); | ||
64 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
65 | vec4 pos = inv_proj * ndc; | ||
66 | pos /= pos.w; | ||
67 | pos.w = 1.0; | ||
68 | return pos; | ||
69 | } | ||
70 | |||
71 | vec3 getPositionEye() | ||
72 | { | ||
73 | return vary_PositionEye; | ||
74 | } | ||
75 | vec3 getSunlitColor() | ||
76 | { | ||
77 | return vary_SunlitColor; | ||
78 | } | ||
79 | vec3 getAmblitColor() | ||
80 | { | ||
81 | return vary_AmblitColor; | ||
82 | } | ||
83 | vec3 getAdditiveColor() | ||
84 | { | ||
85 | return vary_AdditiveColor; | ||
86 | } | ||
87 | vec3 getAtmosAttenuation() | ||
88 | { | ||
89 | return vary_AtmosAttenuation; | ||
90 | } | ||
91 | |||
92 | |||
93 | void setPositionEye(vec3 v) | ||
94 | { | ||
95 | vary_PositionEye = v; | ||
96 | } | ||
97 | |||
98 | void setSunlitColor(vec3 v) | ||
99 | { | ||
100 | vary_SunlitColor = v; | ||
101 | } | ||
102 | |||
103 | void setAmblitColor(vec3 v) | ||
104 | { | ||
105 | vary_AmblitColor = v; | ||
106 | } | ||
107 | |||
108 | void setAdditiveColor(vec3 v) | ||
109 | { | ||
110 | vary_AdditiveColor = v; | ||
111 | } | ||
112 | |||
113 | void setAtmosAttenuation(vec3 v) | ||
114 | { | ||
115 | vary_AtmosAttenuation = v; | ||
116 | } | ||
117 | |||
118 | void calcAtmospherics(vec3 inPositionEye, float ambFactor) { | ||
119 | |||
120 | vec3 P = inPositionEye; | ||
121 | setPositionEye(P); | ||
122 | |||
123 | //(TERRAIN) limit altitude | ||
124 | if (P.y > max_y.x) P *= (max_y.x / P.y); | ||
125 | if (P.y < -max_y.x) P *= (-max_y.x / P.y); | ||
126 | |||
127 | vec3 tmpLightnorm = lightnorm.xyz; | ||
128 | |||
129 | vec3 Pn = normalize(P); | ||
130 | float Plen = length(P); | ||
131 | |||
132 | vec4 temp1 = vec4(0); | ||
133 | vec3 temp2 = vec3(0); | ||
134 | vec4 blue_weight; | ||
135 | vec4 haze_weight; | ||
136 | vec4 sunlight = sunlight_color; | ||
137 | vec4 light_atten; | ||
138 | |||
139 | //sunlight attenuation effect (hue and brightness) due to atmosphere | ||
140 | //this is used later for sunlight modulation at various altitudes | ||
141 | light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x); | ||
142 | //I had thought blue_density and haze_density should have equal weighting, | ||
143 | //but attenuation due to haze_density tends to seem too strong | ||
144 | |||
145 | temp1 = blue_density + vec4(haze_density.r); | ||
146 | blue_weight = blue_density / temp1; | ||
147 | haze_weight = vec4(haze_density.r) / temp1; | ||
148 | |||
149 | //(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain) | ||
150 | temp2.y = max(0.0, tmpLightnorm.y); | ||
151 | temp2.y = 1. / temp2.y; | ||
152 | sunlight *= exp( - light_atten * temp2.y); | ||
153 | |||
154 | // main atmospheric scattering line integral | ||
155 | temp2.z = Plen * density_multiplier.x; | ||
156 | |||
157 | // Transparency (-> temp1) | ||
158 | // ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati | ||
159 | // compiler gets confused. | ||
160 | temp1 = exp(-temp1 * temp2.z * distance_multiplier.x); | ||
161 | |||
162 | //final atmosphere attenuation factor | ||
163 | setAtmosAttenuation(temp1.rgb); | ||
164 | |||
165 | //compute haze glow | ||
166 | //(can use temp2.x as temp because we haven't used it yet) | ||
167 | temp2.x = dot(Pn, tmpLightnorm.xyz); | ||
168 | temp2.x = 1. - temp2.x; | ||
169 | //temp2.x is 0 at the sun and increases away from sun | ||
170 | temp2.x = max(temp2.x, .03); //was glow.y | ||
171 | //set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) | ||
172 | temp2.x *= glow.x; | ||
173 | //higher glow.x gives dimmer glow (because next step is 1 / "angle") | ||
174 | temp2.x = pow(temp2.x, glow.z); | ||
175 | //glow.z should be negative, so we're doing a sort of (1 / "angle") function | ||
176 | |||
177 | //add "minimum anti-solar illumination" | ||
178 | temp2.x += .25; | ||
179 | |||
180 | //increase ambient when there are more clouds | ||
181 | vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5; | ||
182 | |||
183 | /* decrease value and saturation (that in HSV, not HSL) for occluded areas | ||
184 | * // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html | ||
185 | * // The following line of code performs the equivalent of: | ||
186 | * float ambAlpha = tmpAmbient.a; | ||
187 | * float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis | ||
188 | * vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue); | ||
189 | * tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha); | ||
190 | */ | ||
191 | tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a); | ||
192 | |||
193 | //haze color | ||
194 | setAdditiveColor( | ||
195 | vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient) | ||
196 | + (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x | ||
197 | + tmpAmbient))); | ||
198 | |||
199 | //brightness of surface both sunlight and ambient | ||
200 | setSunlitColor(vec3(sunlight * .5)); | ||
201 | setAmblitColor(vec3(tmpAmbient * .25)); | ||
202 | setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1)); | ||
203 | } | ||
204 | |||
205 | vec3 atmosLighting(vec3 light) | ||
206 | { | ||
207 | light *= getAtmosAttenuation().r; | ||
208 | light += getAdditiveColor(); | ||
209 | return (2.0 * light); | ||
210 | } | ||
211 | |||
212 | vec3 atmosTransport(vec3 light) { | ||
213 | light *= getAtmosAttenuation().r; | ||
214 | light += getAdditiveColor() * 2.0; | ||
215 | return light; | ||
216 | } | ||
217 | vec3 atmosGetDiffuseSunlightColor() | ||
218 | { | ||
219 | return getSunlitColor(); | ||
220 | } | ||
221 | |||
222 | vec3 scaleDownLight(vec3 light) | ||
223 | { | ||
224 | return (light / scene_light_strength ); | ||
225 | } | ||
226 | |||
227 | vec3 scaleUpLight(vec3 light) | ||
228 | { | ||
229 | return (light * scene_light_strength); | ||
230 | } | ||
231 | |||
232 | vec3 atmosAmbient(vec3 light) | ||
233 | { | ||
234 | return getAmblitColor() + light / 2.0; | ||
235 | } | ||
236 | |||
237 | vec3 atmosAffectDirectionalLight(float lightIntensity) | ||
238 | { | ||
239 | return getSunlitColor() * lightIntensity; | ||
240 | } | ||
241 | |||
242 | vec3 scaleSoftClip(vec3 light) | ||
243 | { | ||
244 | //soft clip effect: | ||
245 | light = 1. - clamp(light, vec3(0.), vec3(1.)); | ||
246 | light = 1. - pow(light, gamma.xxx); | ||
247 | |||
248 | return light; | ||
249 | } | ||
250 | |||
251 | void main() | ||
252 | { | ||
253 | vec2 tc = vary_fragcoord.xy; | ||
254 | vec3 pos = getPosition(tc).xyz; | ||
255 | vec3 norm = texture2DRect(normalMap, tc).xyz*2.0-1.0; | ||
256 | vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz; | ||
257 | |||
258 | float da = max(dot(norm.xyz, vary_light.xyz), 0.0); | ||
259 | |||
260 | vec4 diffuse = texture2DRect(diffuseRect, tc); | ||
261 | vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); | ||
262 | |||
263 | vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg; | ||
264 | float scol = max(scol_ambocc.r, diffuse.a); | ||
265 | float ambocc = scol_ambocc.g; | ||
266 | |||
267 | calcAtmospherics(pos.xyz, ambocc); | ||
268 | |||
269 | vec3 col = atmosAmbient(vec3(0)); | ||
270 | col += atmosAffectDirectionalLight(max(min(da, scol), diffuse.a)); | ||
271 | |||
272 | col *= diffuse.rgb; | ||
273 | |||
274 | if (spec.a > 0.0) | ||
275 | { | ||
276 | vec3 ref = normalize(reflect(pos.xyz, norm.xyz)); | ||
277 | float sa = dot(ref, vary_light.xyz); | ||
278 | col.rgb += vary_SunlitColor*scol*spec.rgb*texture2D(lightFunc, vec2(sa, spec.a)).a; | ||
279 | } | ||
280 | |||
281 | col = atmosLighting(col); | ||
282 | col = scaleSoftClip(col); | ||
283 | |||
284 | gl_FragColor.rgb = col; | ||
285 | |||
286 | //gl_FragColor.rgb = gi_col.rgb; | ||
287 | gl_FragColor.a = 0.0; | ||
288 | |||
289 | //gl_FragColor.rg = scol_ambocc.rg; | ||
290 | //gl_FragColor.rgb = texture2DRect(lightMap, vary_fragcoord.xy).rgb; | ||
291 | //gl_FragColor.rgb = norm.rgb*0.5+0.5; | ||
292 | //gl_FragColor.rgb = vec3(ambocc); | ||
293 | //gl_FragColor.rgb = vec3(scol); | ||
294 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl deleted file mode 100644 index ad8af47..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /** | ||
2 | * @file softenLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform vec2 screen_res; | ||
9 | |||
10 | varying vec4 vary_light; | ||
11 | varying vec2 vary_fragcoord; | ||
12 | void main() | ||
13 | { | ||
14 | //transform vertex | ||
15 | gl_Position = ftransform(); | ||
16 | |||
17 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
18 | vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; | ||
19 | |||
20 | vec4 tex = gl_MultiTexCoord0; | ||
21 | tex.w = 1.0; | ||
22 | |||
23 | vary_light = gl_MultiTexCoord0; | ||
24 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl deleted file mode 100644 index d653408..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ /dev/null | |||
@@ -1,199 +0,0 @@ | |||
1 | /** | ||
2 | * @file spotLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #version 120 | ||
9 | |||
10 | #extension GL_ARB_texture_rectangle : enable | ||
11 | |||
12 | uniform sampler2DRect diffuseRect; | ||
13 | uniform sampler2DRect specularRect; | ||
14 | uniform sampler2DRect depthMap; | ||
15 | uniform sampler2DRect normalMap; | ||
16 | uniform samplerCube environmentMap; | ||
17 | uniform sampler2DRect lightMap; | ||
18 | uniform sampler2D noiseMap; | ||
19 | uniform sampler2D lightFunc; | ||
20 | uniform sampler2D projectionMap; | ||
21 | |||
22 | uniform mat4 proj_mat; //screen space to light space | ||
23 | uniform float proj_near; //near clip for projection | ||
24 | uniform vec3 proj_p; //plane projection is emitting from (in screen space) | ||
25 | uniform vec3 proj_n; | ||
26 | uniform float proj_focus; //distance from plane to begin blurring | ||
27 | uniform float proj_lod; //(number of mips in proj map) | ||
28 | uniform float proj_range; //range between near clip and far clip plane of projection | ||
29 | uniform float proj_ambiance; | ||
30 | uniform float near_clip; | ||
31 | uniform float far_clip; | ||
32 | |||
33 | uniform vec3 proj_origin; //origin of projection to be used for angular attenuation | ||
34 | uniform float sun_wash; | ||
35 | uniform int proj_shadow_idx; | ||
36 | uniform float shadow_fade; | ||
37 | |||
38 | varying vec4 vary_light; | ||
39 | |||
40 | varying vec4 vary_fragcoord; | ||
41 | uniform vec2 screen_res; | ||
42 | |||
43 | uniform mat4 inv_proj; | ||
44 | |||
45 | vec4 getPosition(vec2 pos_screen) | ||
46 | { | ||
47 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
48 | vec2 sc = pos_screen.xy*2.0; | ||
49 | sc /= screen_res; | ||
50 | sc -= vec2(1.0,1.0); | ||
51 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
52 | vec4 pos = inv_proj * ndc; | ||
53 | pos /= pos.w; | ||
54 | pos.w = 1.0; | ||
55 | return pos; | ||
56 | } | ||
57 | |||
58 | void main() | ||
59 | { | ||
60 | vec4 frag = vary_fragcoord; | ||
61 | frag.xyz /= frag.w; | ||
62 | frag.xyz = frag.xyz*0.5+0.5; | ||
63 | frag.xy *= screen_res; | ||
64 | |||
65 | float shadow = 1.0; | ||
66 | |||
67 | if (proj_shadow_idx >= 0) | ||
68 | { | ||
69 | vec4 shd = texture2DRect(lightMap, frag.xy); | ||
70 | float sh[2]; | ||
71 | sh[0] = shd.b; | ||
72 | sh[1] = shd.a; | ||
73 | shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0); | ||
74 | } | ||
75 | |||
76 | vec3 pos = getPosition(frag.xy).xyz; | ||
77 | vec3 lv = vary_light.xyz-pos.xyz; | ||
78 | float dist2 = dot(lv,lv); | ||
79 | dist2 /= vary_light.w; | ||
80 | if (dist2 > 1.0) | ||
81 | { | ||
82 | discard; | ||
83 | } | ||
84 | |||
85 | vec3 norm = texture2DRect(normalMap, frag.xy).xyz*2.0-1.0; | ||
86 | |||
87 | norm = normalize(norm); | ||
88 | float l_dist = -dot(lv, proj_n); | ||
89 | |||
90 | vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); | ||
91 | if (proj_tc.z < 0.0) | ||
92 | { | ||
93 | discard; | ||
94 | } | ||
95 | |||
96 | proj_tc.xyz /= proj_tc.w; | ||
97 | |||
98 | float fa = gl_Color.a+1.0; | ||
99 | float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); | ||
100 | |||
101 | lv = proj_origin-pos.xyz; | ||
102 | lv = normalize(lv); | ||
103 | float da = dot(norm, lv); | ||
104 | |||
105 | vec3 col = vec3(0,0,0); | ||
106 | |||
107 | vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; | ||
108 | |||
109 | float noise = texture2D(noiseMap, frag.xy/128.0).b; | ||
110 | if (proj_tc.z > 0.0 && | ||
111 | proj_tc.x < 1.0 && | ||
112 | proj_tc.y < 1.0 && | ||
113 | proj_tc.x > 0.0 && | ||
114 | proj_tc.y > 0.0) | ||
115 | { | ||
116 | float lit = 0.0; | ||
117 | if (da > 0.0) | ||
118 | { | ||
119 | float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); | ||
120 | float lod = diff * proj_lod; | ||
121 | |||
122 | vec4 plcol = texture2DLod(projectionMap, proj_tc.xy, lod); | ||
123 | |||
124 | vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; | ||
125 | |||
126 | lit = da * dist_atten * noise; | ||
127 | |||
128 | col = lcol*lit*diff_tex*shadow; | ||
129 | } | ||
130 | |||
131 | float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); | ||
132 | float lod = diff * proj_lod; | ||
133 | vec4 amb_plcol = texture2DLod(projectionMap, proj_tc.xy, lod); | ||
134 | //float amb_da = mix(proj_ambiance, proj_ambiance*max(-da, 0.0), max(da, 0.0)); | ||
135 | float amb_da = proj_ambiance; | ||
136 | if (da > 0.0) | ||
137 | { | ||
138 | amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance; | ||
139 | } | ||
140 | |||
141 | amb_da += (da*da*0.5+0.5)*proj_ambiance; | ||
142 | |||
143 | amb_da *= dist_atten * noise; | ||
144 | |||
145 | amb_da = min(amb_da, 1.0-lit); | ||
146 | |||
147 | col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; | ||
148 | } | ||
149 | |||
150 | |||
151 | vec4 spec = texture2DRect(specularRect, frag.xy); | ||
152 | if (spec.a > 0.0) | ||
153 | { | ||
154 | vec3 ref = reflect(normalize(pos), norm); | ||
155 | |||
156 | //project from point pos in direction ref to plane proj_p, proj_n | ||
157 | vec3 pdelta = proj_p-pos; | ||
158 | float ds = dot(ref, proj_n); | ||
159 | |||
160 | if (ds < 0.0) | ||
161 | { | ||
162 | vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; | ||
163 | |||
164 | vec3 stc = (proj_mat * vec4(pfinal.xyz, 1.0)).xyz; | ||
165 | |||
166 | if (stc.z > 0.0) | ||
167 | { | ||
168 | stc.xy /= stc.z+proj_near; | ||
169 | |||
170 | if (stc.x < 1.0 && | ||
171 | stc.y < 1.0 && | ||
172 | stc.x > 0.0 && | ||
173 | stc.y > 0.0) | ||
174 | { | ||
175 | vec4 scol = texture2DLod(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); | ||
176 | col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow; | ||
177 | } | ||
178 | } | ||
179 | } | ||
180 | } | ||
181 | |||
182 | /*if (spec.a > 0.0) | ||
183 | { | ||
184 | //vec3 ref = reflect(normalize(pos), norm); | ||
185 | float sa = dot(normalize(lv-normalize(pos)),norm);; | ||
186 | //sa = max(sa, 0.0); | ||
187 | //sa = pow(sa, 128.0 * spec.a*spec.a/dist_atten)*min(dist_atten*4.0, 1.0); | ||
188 | sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); | ||
189 | sa *= noise; | ||
190 | col += da*sa*lcol*spec.rgb; | ||
191 | }*/ | ||
192 | |||
193 | //attenuate point light contribution by SSAO component | ||
194 | col *= texture2DRect(lightMap, frag.xy).g; | ||
195 | |||
196 | |||
197 | gl_FragColor.rgb = col; | ||
198 | gl_FragColor.a = 0.0; | ||
199 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl deleted file mode 100644 index 8ced94e..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ /dev/null | |||
@@ -1,203 +0,0 @@ | |||
1 | /** | ||
2 | * @file sunLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #extension GL_ARB_texture_rectangle : enable | ||
9 | |||
10 | uniform sampler2DRect depthMap; | ||
11 | uniform sampler2DRect normalMap; | ||
12 | uniform sampler2DRectShadow shadowMap0; | ||
13 | uniform sampler2DRectShadow shadowMap1; | ||
14 | uniform sampler2DRectShadow shadowMap2; | ||
15 | uniform sampler2DRectShadow shadowMap3; | ||
16 | uniform sampler2DRectShadow shadowMap4; | ||
17 | uniform sampler2DRectShadow shadowMap5; | ||
18 | uniform sampler2D noiseMap; | ||
19 | |||
20 | uniform sampler2D lightFunc; | ||
21 | |||
22 | |||
23 | // Inputs | ||
24 | uniform mat4 shadow_matrix[6]; | ||
25 | uniform vec4 shadow_clip; | ||
26 | uniform float ssao_radius; | ||
27 | uniform float ssao_max_radius; | ||
28 | uniform float ssao_factor; | ||
29 | uniform float ssao_factor_inv; | ||
30 | |||
31 | varying vec2 vary_fragcoord; | ||
32 | varying vec4 vary_light; | ||
33 | |||
34 | uniform mat4 inv_proj; | ||
35 | uniform vec2 screen_res; | ||
36 | |||
37 | uniform float shadow_bias; | ||
38 | uniform float shadow_offset; | ||
39 | |||
40 | vec4 getPosition(vec2 pos_screen) | ||
41 | { | ||
42 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
43 | vec2 sc = pos_screen.xy*2.0; | ||
44 | sc /= screen_res; | ||
45 | sc -= vec2(1.0,1.0); | ||
46 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
47 | vec4 pos = inv_proj * ndc; | ||
48 | pos /= pos.w; | ||
49 | pos.w = 1.0; | ||
50 | return pos; | ||
51 | } | ||
52 | |||
53 | //calculate decreases in ambient lighting when crowded out (SSAO) | ||
54 | float calcAmbientOcclusion(vec4 pos, vec3 norm) | ||
55 | { | ||
56 | vec2 kern[8]; | ||
57 | // exponentially (^2) distant occlusion samples spread around origin | ||
58 | kern[0] = vec2(-1.0, 0.0) * 0.125*0.125; | ||
59 | kern[1] = vec2(1.0, 0.0) * 0.250*0.250; | ||
60 | kern[2] = vec2(0.0, 1.0) * 0.375*0.375; | ||
61 | kern[3] = vec2(0.0, -1.0) * 0.500*0.500; | ||
62 | kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625; | ||
63 | kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750; | ||
64 | kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875; | ||
65 | kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000; | ||
66 | |||
67 | vec2 pos_screen = vary_fragcoord.xy; | ||
68 | vec3 pos_world = pos.xyz; | ||
69 | vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy; | ||
70 | |||
71 | float angle_hidden = 0.0; | ||
72 | int points = 0; | ||
73 | |||
74 | float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); | ||
75 | |||
76 | // it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?) | ||
77 | for (int i = 0; i < 8; i++) | ||
78 | { | ||
79 | vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect); | ||
80 | vec3 samppos_world = getPosition(samppos_screen).xyz; | ||
81 | |||
82 | vec3 diff = pos_world - samppos_world; | ||
83 | float dist2 = dot(diff, diff); | ||
84 | |||
85 | // assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area | ||
86 | // --> solid angle shrinking by the square of distance | ||
87 | //radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2 | ||
88 | //(k should vary inversely with # of samples, but this is taken care of later) | ||
89 | |||
90 | //if (dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) // -0.05*norm to shift sample point back slightly for flat surfaces | ||
91 | // angle_hidden += min(1.0/dist2, ssao_factor_inv); // dist != 0 follows from conditional. max of 1.0 (= ssao_factor_inv * ssao_factor) | ||
92 | angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv); | ||
93 | |||
94 | // 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion" | ||
95 | points = points + int(diff.z > -1.0); | ||
96 | } | ||
97 | |||
98 | angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); | ||
99 | |||
100 | return (1.0 - (float(points != 0) * angle_hidden)); | ||
101 | } | ||
102 | |||
103 | void main() | ||
104 | { | ||
105 | vec2 pos_screen = vary_fragcoord.xy; | ||
106 | |||
107 | //try doing an unproject here | ||
108 | |||
109 | vec4 pos = getPosition(pos_screen); | ||
110 | |||
111 | vec3 norm = texture2DRect(normalMap, pos_screen).xyz*2.0-1.0; | ||
112 | |||
113 | /*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL | ||
114 | { | ||
115 | gl_FragColor = vec4(0.0); // doesn't matter | ||
116 | return; | ||
117 | }*/ | ||
118 | |||
119 | float shadow = 1.0; | ||
120 | float dp_directional_light = max(0.0, dot(norm, vary_light.xyz)); | ||
121 | |||
122 | vec4 spos = vec4(pos.xyz + norm.xyz * (-pos.z/64.0*shadow_offset+shadow_bias), 1.0); | ||
123 | |||
124 | //vec3 debug = vec3(0,0,0); | ||
125 | |||
126 | if (spos.z > -shadow_clip.w) | ||
127 | { | ||
128 | if (dp_directional_light == 0.0) | ||
129 | { | ||
130 | // if we know this point is facing away from the sun then we know it's in shadow without having to do a squirrelly shadow-map lookup | ||
131 | shadow = 0.0; | ||
132 | } | ||
133 | else | ||
134 | { | ||
135 | vec4 lpos; | ||
136 | |||
137 | if (spos.z < -shadow_clip.z) | ||
138 | { | ||
139 | lpos = shadow_matrix[3]*spos; | ||
140 | lpos.xy *= screen_res; | ||
141 | shadow = shadow2DRectProj(shadowMap3, lpos).x; | ||
142 | shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0); | ||
143 | } | ||
144 | else if (spos.z < -shadow_clip.y) | ||
145 | { | ||
146 | lpos = shadow_matrix[2]*spos; | ||
147 | lpos.xy *= screen_res; | ||
148 | shadow = shadow2DRectProj(shadowMap2, lpos).x; | ||
149 | } | ||
150 | else if (spos.z < -shadow_clip.x) | ||
151 | { | ||
152 | lpos = shadow_matrix[1]*spos; | ||
153 | lpos.xy *= screen_res; | ||
154 | shadow = shadow2DRectProj(shadowMap1, lpos).x; | ||
155 | } | ||
156 | else | ||
157 | { | ||
158 | lpos = shadow_matrix[0]*spos; | ||
159 | lpos.xy *= screen_res; | ||
160 | shadow = shadow2DRectProj(shadowMap0, lpos).x; | ||
161 | } | ||
162 | |||
163 | // take the most-shadowed value out of these two: | ||
164 | // * the blurred sun shadow in the light (shadow) map | ||
165 | // * an unblurred dot product between the sun and this norm | ||
166 | // the goal is to err on the side of most-shadow to fill-in shadow holes and reduce artifacting | ||
167 | shadow = min(shadow, dp_directional_light); | ||
168 | } | ||
169 | |||
170 | /*debug.r = lpos.y / (lpos.w*screen_res.y); | ||
171 | |||
172 | lpos.xy /= lpos.w*32.0; | ||
173 | if (fract(lpos.x) < 0.1 || fract(lpos.y) < 0.1) | ||
174 | { | ||
175 | debug.gb = vec2(0.5, 0.5); | ||
176 | } | ||
177 | |||
178 | debug += (1.0-shadow)*0.5;*/ | ||
179 | |||
180 | } | ||
181 | else | ||
182 | { | ||
183 | // more distant than the shadow map covers | ||
184 | shadow = 1.0; | ||
185 | } | ||
186 | |||
187 | gl_FragColor[0] = shadow; | ||
188 | gl_FragColor[1] = calcAmbientOcclusion(pos, norm); | ||
189 | |||
190 | //spotlight shadow 1 | ||
191 | vec4 lpos = shadow_matrix[4]*spos; | ||
192 | lpos.xy *= screen_res; | ||
193 | gl_FragColor[2] = shadow2DRectProj(shadowMap4, lpos).x; | ||
194 | |||
195 | //spotlight shadow 2 | ||
196 | lpos = shadow_matrix[5]*spos; | ||
197 | lpos.xy *= screen_res; | ||
198 | gl_FragColor[3] = shadow2DRectProj(shadowMap5, lpos).x; | ||
199 | |||
200 | //gl_FragColor.rgb = pos.xyz; | ||
201 | //gl_FragColor.b = shadow; | ||
202 | //gl_FragColor.rgb = debug; | ||
203 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl deleted file mode 100644 index 5081485..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | /** | ||
2 | * @file sunLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec4 vary_light; | ||
9 | varying vec2 vary_fragcoord; | ||
10 | |||
11 | uniform vec2 screen_res; | ||
12 | |||
13 | void main() | ||
14 | { | ||
15 | //transform vertex | ||
16 | gl_Position = ftransform(); | ||
17 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
18 | vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; | ||
19 | vec4 tex = gl_MultiTexCoord0; | ||
20 | tex.w = 1.0; | ||
21 | |||
22 | vary_light = gl_MultiTexCoord0; | ||
23 | |||
24 | gl_FrontColor = gl_Color; | ||
25 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/waterF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/waterF.glsl deleted file mode 100644 index 7342186..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/waterF.glsl +++ /dev/null | |||
@@ -1,139 +0,0 @@ | |||
1 | /** | ||
2 | * @file waterF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | vec3 scaleSoftClip(vec3 inColor); | ||
9 | vec3 atmosTransport(vec3 inColor); | ||
10 | |||
11 | uniform sampler2D bumpMap; | ||
12 | uniform sampler2D screenTex; | ||
13 | uniform sampler2D refTex; | ||
14 | uniform sampler2DRectShadow shadowMap0; | ||
15 | uniform sampler2DRectShadow shadowMap1; | ||
16 | uniform sampler2DRectShadow shadowMap2; | ||
17 | uniform sampler2DRectShadow shadowMap3; | ||
18 | uniform sampler2D noiseMap; | ||
19 | |||
20 | uniform mat4 shadow_matrix[6]; | ||
21 | uniform vec4 shadow_clip; | ||
22 | |||
23 | uniform float sunAngle; | ||
24 | uniform float sunAngle2; | ||
25 | uniform vec3 lightDir; | ||
26 | uniform vec3 specular; | ||
27 | uniform float lightExp; | ||
28 | uniform float refScale; | ||
29 | uniform float kd; | ||
30 | uniform vec2 screenRes; | ||
31 | uniform vec3 normScale; | ||
32 | uniform float fresnelScale; | ||
33 | uniform float fresnelOffset; | ||
34 | uniform float blurMultiplier; | ||
35 | uniform vec2 screen_res; | ||
36 | uniform mat4 norm_mat; //region space to screen space | ||
37 | |||
38 | //bigWave is (refCoord.w, view.w); | ||
39 | varying vec4 refCoord; | ||
40 | varying vec4 littleWave; | ||
41 | varying vec4 view; | ||
42 | varying vec4 vary_position; | ||
43 | |||
44 | void main() | ||
45 | { | ||
46 | vec4 color; | ||
47 | float dist = length(view.xy); | ||
48 | |||
49 | //normalize view vector | ||
50 | vec3 viewVec = normalize(view.xyz); | ||
51 | |||
52 | //get wave normals | ||
53 | vec3 wave1 = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0; | ||
54 | vec3 wave2 = texture2D(bumpMap, littleWave.xy).xyz*2.0-1.0; | ||
55 | vec3 wave3 = texture2D(bumpMap, littleWave.zw).xyz*2.0-1.0; | ||
56 | //get base fresnel components | ||
57 | |||
58 | vec3 df = vec3( | ||
59 | dot(viewVec, wave1), | ||
60 | dot(viewVec, (wave2 + wave3) * 0.5), | ||
61 | dot(viewVec, wave3) | ||
62 | ) * fresnelScale + fresnelOffset; | ||
63 | df *= df; | ||
64 | |||
65 | vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5; | ||
66 | |||
67 | float dist2 = dist; | ||
68 | dist = max(dist, 5.0); | ||
69 | |||
70 | float dmod = sqrt(dist); | ||
71 | |||
72 | vec2 dmod_scale = vec2(dmod*dmod, dmod); | ||
73 | |||
74 | //get reflected color | ||
75 | vec2 refdistort1 = wave1.xy*normScale.x; | ||
76 | vec2 refvec1 = distort+refdistort1/dmod_scale; | ||
77 | vec4 refcol1 = texture2D(refTex, refvec1); | ||
78 | |||
79 | vec2 refdistort2 = wave2.xy*normScale.y; | ||
80 | vec2 refvec2 = distort+refdistort2/dmod_scale; | ||
81 | vec4 refcol2 = texture2D(refTex, refvec2); | ||
82 | |||
83 | vec2 refdistort3 = wave3.xy*normScale.z; | ||
84 | vec2 refvec3 = distort+refdistort3/dmod_scale; | ||
85 | vec4 refcol3 = texture2D(refTex, refvec3); | ||
86 | |||
87 | vec4 refcol = refcol1 + refcol2 + refcol3; | ||
88 | float df1 = df.x + df.y + df.z; | ||
89 | refcol *= df1 * 0.333; | ||
90 | |||
91 | vec3 wavef = (wave1 + wave2 * 0.4 + wave3 * 0.6) * 0.5; | ||
92 | //wavef.z *= max(-viewVec.z, 0.1); | ||
93 | wavef = normalize(wavef); | ||
94 | |||
95 | float df2 = dot(viewVec, wavef) * fresnelScale+fresnelOffset; | ||
96 | |||
97 | vec2 refdistort4 = wavef.xy*0.125; | ||
98 | refdistort4.y -= abs(refdistort4.y); | ||
99 | vec2 refvec4 = distort+refdistort4/dmod; | ||
100 | float dweight = min(dist2*blurMultiplier, 1.0); | ||
101 | vec4 baseCol = texture2D(refTex, refvec4); | ||
102 | refcol = mix(baseCol*df2, refcol, dweight); | ||
103 | |||
104 | //get specular component | ||
105 | //float spec = clamp(dot(lightDir, (reflect(viewVec,wavef))),0.0,1.0); | ||
106 | |||
107 | //harden specular | ||
108 | //spec = pow(spec, 128.0); | ||
109 | |||
110 | //figure out distortion vector (ripply) | ||
111 | vec2 distort2 = distort+wavef.xy*refScale/max(dmod*df1, 1.0); | ||
112 | |||
113 | vec4 fb = texture2D(screenTex, distort2); | ||
114 | |||
115 | //mix with reflection | ||
116 | // Note we actually want to use just df1, but multiplying by 0.999999 gets around and nvidia compiler bug | ||
117 | color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.99999); | ||
118 | |||
119 | float shadow = 1.0; | ||
120 | vec4 pos = vary_position; | ||
121 | |||
122 | vec3 nz = texture2D(noiseMap, gl_FragCoord.xy/128.0).xyz; | ||
123 | vec4 spos = pos; | ||
124 | |||
125 | //spec *= shadow; | ||
126 | //color.rgb += spec * specular; | ||
127 | |||
128 | //color.rgb = atmosTransport(color.rgb); | ||
129 | //color.rgb = scaleSoftClip(color.rgb); | ||
130 | //color.a = spec * sunAngle2; | ||
131 | |||
132 | //wavef.z *= 0.1f; | ||
133 | wavef = normalize(wavef); | ||
134 | wavef = (norm_mat*vec4(wavef, 1.0)).xyz; | ||
135 | |||
136 | gl_FragData[0] = vec4(color.rgb, 0.75); | ||
137 | gl_FragData[1] = vec4(1,1,1, 0.8); | ||
138 | gl_FragData[2] = vec4(wavef*0.5+0.5, 0.f); | ||
139 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/waterV.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/waterV.glsl deleted file mode 100644 index b45e5c5..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/waterV.glsl +++ /dev/null | |||
@@ -1,76 +0,0 @@ | |||
1 | /** | ||
2 | * @file waterV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | void calcAtmospherics(vec3 inPositionEye); | ||
9 | |||
10 | uniform vec2 d1; | ||
11 | uniform vec2 d2; | ||
12 | uniform float time; | ||
13 | uniform vec3 eyeVec; | ||
14 | uniform float waterHeight; | ||
15 | |||
16 | varying vec4 refCoord; | ||
17 | varying vec4 littleWave; | ||
18 | varying vec4 view; | ||
19 | |||
20 | varying vec4 vary_position; | ||
21 | |||
22 | float wave(vec2 v, float t, float f, vec2 d, float s) | ||
23 | { | ||
24 | return (dot(d, v)*f + t*s)*f; | ||
25 | } | ||
26 | |||
27 | void main() | ||
28 | { | ||
29 | //transform vertex | ||
30 | vec4 position = gl_Vertex; | ||
31 | mat4 modelViewProj = gl_ModelViewProjectionMatrix; | ||
32 | |||
33 | vec4 oPosition; | ||
34 | |||
35 | //get view vector | ||
36 | vec3 oEyeVec; | ||
37 | oEyeVec.xyz = position.xyz-eyeVec; | ||
38 | |||
39 | float d = length(oEyeVec.xy); | ||
40 | float ld = min(d, 2560.0); | ||
41 | |||
42 | position.xy = eyeVec.xy + oEyeVec.xy/d*ld; | ||
43 | view.xyz = oEyeVec; | ||
44 | |||
45 | d = clamp(ld/1536.0-0.5, 0.0, 1.0); | ||
46 | d *= d; | ||
47 | |||
48 | oPosition = position; | ||
49 | oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d); | ||
50 | vary_position = gl_ModelViewMatrix * oPosition; | ||
51 | oPosition = modelViewProj * oPosition; | ||
52 | |||
53 | refCoord.xyz = oPosition.xyz + vec3(0,0,0.2); | ||
54 | |||
55 | //get wave position parameter (create sweeping horizontal waves) | ||
56 | vec3 v = position.xyz; | ||
57 | v.x += (cos(v.x*0.08/*+time*0.01*/)+sin(v.y*0.02))*6.0; | ||
58 | |||
59 | //push position for further horizon effect. | ||
60 | position.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z); | ||
61 | position.w = 1.0; | ||
62 | position = position*gl_ModelViewMatrix; | ||
63 | |||
64 | calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz); | ||
65 | |||
66 | |||
67 | //pass wave parameters to pixel shader | ||
68 | vec2 bigWave = (v.xy) * vec2(0.04,0.04) + d1 * time * 0.055; | ||
69 | //get two normal map (detail map) texture coordinates | ||
70 | littleWave.xy = (v.xy) * vec2(0.45, 0.9) + d2 * time * 0.13; | ||
71 | littleWave.zw = (v.xy) * vec2(0.1, 0.2) + d1 * time * 0.1; | ||
72 | view.w = bigWave.y; | ||
73 | refCoord.w = bigWave.x; | ||
74 | |||
75 | gl_Position = oPosition; | ||
76 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/avatarF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/avatarF.glsl deleted file mode 100644 index 9cc71a7..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/avatarF.glsl +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | /** | ||
2 | * @file avatarF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2D diffuseMap; | ||
9 | |||
10 | varying vec3 vary_normal; | ||
11 | |||
12 | void main() | ||
13 | { | ||
14 | gl_FragData[0] = vec4(gl_Color.rgb * texture2D(diffuseMap, gl_TexCoord[0].xy).rgb, 0.0); | ||
15 | gl_FragData[1] = vec4(0,0,0,0); | ||
16 | gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0); | ||
17 | } | ||
18 | |||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/bumpF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/bumpF.glsl deleted file mode 100644 index 6eb4a51..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/bumpF.glsl +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | /** | ||
2 | * @file bumpF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2D diffuseMap; | ||
9 | uniform sampler2D bumpMap; | ||
10 | |||
11 | varying vec3 vary_mat0; | ||
12 | varying vec3 vary_mat1; | ||
13 | varying vec3 vary_mat2; | ||
14 | |||
15 | void main() | ||
16 | { | ||
17 | vec3 col = texture2D(diffuseMap, gl_TexCoord[0].xy).rgb; | ||
18 | vec3 norm = texture2D(bumpMap, gl_TexCoord[0].xy).rgb * 2.0 - 1.0; | ||
19 | |||
20 | vec3 tnorm = vec3(dot(norm,vary_mat0), | ||
21 | dot(norm,vary_mat1), | ||
22 | dot(norm,vary_mat2)); | ||
23 | |||
24 | gl_FragData[0] = vec4(gl_Color.rgb*col, 0.0); | ||
25 | gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); | ||
26 | gl_FragData[2] = vec4(normalize(tnorm)*0.5+0.5, 0.0); | ||
27 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/diffuseF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/diffuseF.glsl deleted file mode 100644 index c9f75f7..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/diffuseF.glsl +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | /** | ||
2 | * @file diffuseF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2D diffuseMap; | ||
9 | |||
10 | varying vec3 vary_normal; | ||
11 | |||
12 | void main() | ||
13 | { | ||
14 | vec3 col = texture2D(diffuseMap, gl_TexCoord[0].xy).rgb; | ||
15 | gl_FragData[0] = vec4(gl_Color.rgb*col, 0.0); | ||
16 | gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); | ||
17 | gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0); | ||
18 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl deleted file mode 100644 index 7325825..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl +++ /dev/null | |||
@@ -1,84 +0,0 @@ | |||
1 | /** | ||
2 | * @file giDownsampleF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect giLightMap; | ||
9 | |||
10 | uniform vec2 kern[32]; | ||
11 | uniform float dist_factor; | ||
12 | uniform float blur_size; | ||
13 | uniform vec2 delta; | ||
14 | uniform int kern_length; | ||
15 | uniform float kern_scale; | ||
16 | uniform vec3 blur_quad; | ||
17 | |||
18 | varying vec2 vary_fragcoord; | ||
19 | |||
20 | uniform mat4 inv_proj; | ||
21 | uniform vec2 screen_res; | ||
22 | |||
23 | vec4 getPosition(vec2 pos_screen) | ||
24 | { | ||
25 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
26 | vec2 sc = pos_screen.xy*2.0; | ||
27 | sc /= screen_res; | ||
28 | sc -= vec2(1.0,1.0); | ||
29 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
30 | vec4 pos = inv_proj * ndc; | ||
31 | pos /= pos.w; | ||
32 | pos.w = 1.0; | ||
33 | return pos; | ||
34 | } | ||
35 | |||
36 | float getDepth(vec2 pos_screen) | ||
37 | { | ||
38 | float z = texture2DRect(depthMap, pos_screen.xy).a; | ||
39 | z = z*2.0-1.0; | ||
40 | vec4 ndc = vec4(0.0, 0.0, z, 1.0); | ||
41 | vec4 p = inv_proj*ndc; | ||
42 | return p.z/p.w; | ||
43 | } | ||
44 | |||
45 | void main() | ||
46 | { | ||
47 | vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz*2.0-1.0; | ||
48 | float depth = getDepth(vary_fragcoord.xy); | ||
49 | |||
50 | vec3 ccol = texture2DRect(giLightMap, vary_fragcoord.xy).rgb; | ||
51 | vec2 dlt = kern_scale * delta/(vec2(1.0,1.0)+norm.xy*norm.xy); | ||
52 | dlt /= clamp(-depth*blur_quad.x, 1.0, 3.0); | ||
53 | float defined_weight = kern[0].x; | ||
54 | vec3 col = ccol*kern[0].x; | ||
55 | |||
56 | for (int i = 0; i < kern_length; i++) | ||
57 | { | ||
58 | vec2 tc = vary_fragcoord.xy + kern[i].y*dlt; | ||
59 | vec3 sampNorm = texture2DRect(normalMap, tc.xy).xyz*2.0-1.0; | ||
60 | |||
61 | float d = dot(norm.xyz, sampNorm); | ||
62 | |||
63 | if (d > 0.5) | ||
64 | { | ||
65 | float sampdepth = getDepth(tc.xy); | ||
66 | sampdepth -= depth; | ||
67 | if (sampdepth*sampdepth < blur_quad.z) | ||
68 | { | ||
69 | col += texture2DRect(giLightMap, tc).rgb*kern[i].x; | ||
70 | defined_weight += kern[i].x; | ||
71 | } | ||
72 | } | ||
73 | } | ||
74 | |||
75 | col /= defined_weight; | ||
76 | |||
77 | //col = ccol; | ||
78 | |||
79 | col = col*blur_quad.y; | ||
80 | |||
81 | gl_FragData[0].xyz = col; | ||
82 | |||
83 | //gl_FragColor = ccol; | ||
84 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl deleted file mode 100644 index 6adcda8..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /** | ||
2 | * @file postgiV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | uniform vec2 screen_res; | ||
10 | |||
11 | void main() | ||
12 | { | ||
13 | //transform vertex | ||
14 | gl_Position = ftransform(); | ||
15 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
16 | vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; | ||
17 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/giF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/giF.glsl deleted file mode 100644 index 43da836..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/giF.glsl +++ /dev/null | |||
@@ -1,219 +0,0 @@ | |||
1 | /** | ||
2 | * @file giF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #extension GL_ARB_texture_rectangle : enable | ||
9 | |||
10 | uniform sampler2DRect depthMap; | ||
11 | uniform sampler2DRect normalMap; | ||
12 | uniform sampler2DRect lightMap; | ||
13 | uniform sampler2DRect specularRect; | ||
14 | |||
15 | uniform sampler2D noiseMap; | ||
16 | |||
17 | uniform sampler2D diffuseGIMap; | ||
18 | uniform sampler2D specularGIMap; | ||
19 | uniform sampler2D normalGIMap; | ||
20 | uniform sampler2D depthGIMap; | ||
21 | |||
22 | uniform sampler2D lightFunc; | ||
23 | |||
24 | // Inputs | ||
25 | varying vec2 vary_fragcoord; | ||
26 | |||
27 | uniform vec2 screen_res; | ||
28 | |||
29 | uniform vec4 sunlight_color; | ||
30 | |||
31 | uniform mat4 inv_proj; | ||
32 | uniform mat4 gi_mat; //gPipeline.mGIMatrix - eye space to sun space | ||
33 | uniform mat4 gi_mat_proj; //gPipeline.mGIMatrixProj - eye space to projected sun space | ||
34 | uniform mat4 gi_norm_mat; //gPipeline.mGINormalMatrix - eye space normal to sun space normal matrix | ||
35 | uniform mat4 gi_inv_proj; //gPipeline.mGIInvProj - projected sun space to sun space | ||
36 | uniform float gi_radius; | ||
37 | uniform float gi_intensity; | ||
38 | uniform int gi_samples; | ||
39 | uniform vec2 gi_kern[25]; | ||
40 | uniform vec2 gi_scale; | ||
41 | uniform vec3 gi_quad; | ||
42 | uniform vec3 gi_spec; | ||
43 | uniform float gi_direction_weight; | ||
44 | uniform float gi_light_offset; | ||
45 | uniform float gi_range; | ||
46 | |||
47 | vec4 getPosition(vec2 pos_screen) | ||
48 | { | ||
49 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
50 | vec2 sc = pos_screen.xy*2.0; | ||
51 | sc /= screen_res; | ||
52 | sc -= vec2(1.0,1.0); | ||
53 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
54 | vec4 pos = inv_proj * ndc; | ||
55 | pos /= pos.w; | ||
56 | pos.w = 1.0; | ||
57 | return pos; | ||
58 | } | ||
59 | |||
60 | vec4 getGIPosition(vec2 gi_tc) | ||
61 | { | ||
62 | float depth = texture2D(depthGIMap, gi_tc).a; | ||
63 | vec2 sc = gi_tc*2.0; | ||
64 | sc -= vec2(1.0, 1.0); | ||
65 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
66 | vec4 pos = gi_inv_proj*ndc; | ||
67 | pos.xyz /= pos.w; | ||
68 | pos.w = 1.0; | ||
69 | return pos; | ||
70 | } | ||
71 | |||
72 | vec3 giAmbient(vec3 pos, vec3 norm) | ||
73 | { | ||
74 | vec4 gi_c = gi_mat_proj * vec4(pos, 1.0); | ||
75 | gi_c.xyz /= gi_c.w; | ||
76 | |||
77 | vec4 gi_pos = gi_mat*vec4(pos,1.0); | ||
78 | vec3 gi_norm = (gi_norm_mat*vec4(norm,1.0)).xyz; | ||
79 | gi_norm = normalize(gi_norm); | ||
80 | |||
81 | vec4 c_spec = texture2DRect(specularRect, vary_fragcoord.xy); | ||
82 | gi_pos.xyz += (texture2D(noiseMap, vary_fragcoord.xy/128.0).x)*gi_spec.z*gi_norm.xyz; | ||
83 | vec2 tcx = gi_norm.xy; | ||
84 | vec2 tcy = gi_norm.yx; | ||
85 | |||
86 | vec4 eye_pos = gi_mat*vec4(0,0,0,1.0); | ||
87 | |||
88 | vec3 eye_dir = normalize(gi_pos.xyz-eye_pos.xyz); | ||
89 | vec3 eye_ref = reflect(eye_dir, gi_norm); | ||
90 | |||
91 | //vec3 eye_dir = vec3(0,0,-1); | ||
92 | //eye_dir = (gi_norm_mat*vec4(eye_dir, 1.0)).xyz; | ||
93 | //eye_dir = normalize(eye_dir); | ||
94 | |||
95 | //float round_x = gi_scale.x; | ||
96 | //float round_y = gi_scale.y; | ||
97 | |||
98 | vec3 debug = texture2D(normalGIMap, gi_c.xy).rgb; | ||
99 | //debug.xz = vec2(0.0,0.0); | ||
100 | //debug = fract(debug); | ||
101 | |||
102 | float round_x = 1.0/64.0; | ||
103 | float round_y = 1.0/64.0; | ||
104 | |||
105 | //gi_c.x = floor(gi_c.x/round_x+0.5)*round_x; | ||
106 | //gi_c.y = floor(gi_c.y/round_y+0.5)*round_y; | ||
107 | |||
108 | float da = texture2DRect(lightMap, vary_fragcoord.xy).r; | ||
109 | |||
110 | vec3 fdiff = vec3(da); | ||
111 | |||
112 | if (da > 0.0) | ||
113 | { | ||
114 | vec3 ha = -eye_dir; | ||
115 | ha.z += 1.0; | ||
116 | ha = normalize(ha); | ||
117 | |||
118 | float sa = dot(ha,gi_norm); | ||
119 | da = min(da, texture2D(lightFunc, vec2(sa, c_spec.a)).a); | ||
120 | fdiff += da*(c_spec.rgb*c_spec.a*2.0); | ||
121 | } | ||
122 | |||
123 | float fda = da; | ||
124 | |||
125 | vec3 rcol = vec3(0,0,0); | ||
126 | |||
127 | float fsa = 0.0; | ||
128 | |||
129 | |||
130 | for (int i = -1; i <= 1; i += 1 ) | ||
131 | { | ||
132 | for (int j = -1; j <= 1; j+= 1) | ||
133 | { | ||
134 | vec2 tc = vec2(i, j)*0.75+gi_norm.xy; | ||
135 | vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0+tc*0.5).xyz; | ||
136 | tc += gi_norm.xy*nz.z; | ||
137 | tc += nz.xy*2.0; | ||
138 | tc /= gi_samples; | ||
139 | tc += gi_c.xy; | ||
140 | |||
141 | vec3 lnorm = -normalize(texture2D(normalGIMap, tc.xy).xyz*2.0-1.0); | ||
142 | vec3 lpos = getGIPosition(tc.xy).xyz; | ||
143 | |||
144 | vec3 at = lpos-gi_pos.xyz; | ||
145 | float dist = dot(at,at); | ||
146 | float da = clamp(1.0/(gi_spec.x*dist), 0.0, 1.0); | ||
147 | |||
148 | |||
149 | if (da > 0.01) | ||
150 | { //possible contribution of indirect light to this surface | ||
151 | vec3 ldir = at; | ||
152 | |||
153 | float ld = -dot(ldir, lnorm); | ||
154 | |||
155 | if (ld < 0.0) | ||
156 | { | ||
157 | float ang_atten = dot(ldir, gi_norm); | ||
158 | |||
159 | if (ang_atten > 0.0) | ||
160 | { | ||
161 | vec4 spec = texture2D(specularGIMap, tc.xy); | ||
162 | at = normalize(at); | ||
163 | vec3 diff; | ||
164 | |||
165 | { //contribution from indirect source to visible pixel | ||
166 | vec3 ha = at; | ||
167 | ha.z -= 1.0; | ||
168 | ha = normalize(ha); | ||
169 | float sa = dot(ha,lnorm); | ||
170 | da = min(da, texture2D(lightFunc, vec2(sa, spec.a)).a); | ||
171 | |||
172 | diff = texture2D(diffuseGIMap, tc.xy).rgb+spec.rgb*spec.a*2.0; | ||
173 | } | ||
174 | |||
175 | if (da > 0.0) | ||
176 | { //contribution from visible pixel to eye | ||
177 | vec3 ha = normalize(at-eye_dir); | ||
178 | float sa = dot(ha, gi_norm); | ||
179 | da = min(da, texture2D(lightFunc, vec2(sa, c_spec.a)).a); | ||
180 | fda += da; | ||
181 | fdiff += da*(c_spec.rgb*c_spec.a*2.0+vec3(1,1,1))*diff.rgb; | ||
182 | } | ||
183 | } | ||
184 | } | ||
185 | } | ||
186 | } | ||
187 | } | ||
188 | |||
189 | //fdiff /= max(gi_spec.y*fda, gi_quad.z); | ||
190 | //fdiff = clamp(fdiff, vec3(0), vec3(1)); | ||
191 | fdiff *= 64.0; | ||
192 | fdiff *= sunlight_color.rgb; | ||
193 | |||
194 | vec3 ret = fda*fdiff; | ||
195 | //ret = ret*ret*gi_quad.x+ret*gi_quad.y+gi_quad.z; | ||
196 | |||
197 | //fda *= nz.z; | ||
198 | |||
199 | //rcol.rgb *= gi_intensity; | ||
200 | //return rcol.rgb+vary_AmblitColor.rgb*0.25; | ||
201 | //return vec4(debug, 0.0); | ||
202 | //return vec4(fda*fdiff, 0.0); | ||
203 | return clamp(ret,vec3(0.0), vec3(1.0)); | ||
204 | //return debug.xyz; | ||
205 | } | ||
206 | |||
207 | void main() | ||
208 | { | ||
209 | vec2 pos_screen = vary_fragcoord.xy; | ||
210 | vec4 pos = getPosition(pos_screen); | ||
211 | |||
212 | float rad = gi_range*0.5; | ||
213 | |||
214 | vec3 norm = texture2DRect(normalMap, pos_screen).xyz*2.0-1.0; | ||
215 | float dist = max(length(pos.xyz)-rad, 0.0); | ||
216 | |||
217 | float da = clamp(1.0-dist/rad, 0.0, 1.0); | ||
218 | gl_FragData[0].xyz = da > 0.0 ? giAmbient(pos, norm)*da : vec3(0,0,0); | ||
219 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/giV.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/giV.glsl deleted file mode 100644 index 71dcea9..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/giV.glsl +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /** | ||
2 | * @file giV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | |||
10 | uniform vec2 screen_res; | ||
11 | |||
12 | void main() | ||
13 | { | ||
14 | //transform vertex | ||
15 | gl_Position = ftransform(); | ||
16 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
17 | vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; | ||
18 | vec4 tex = gl_MultiTexCoord0; | ||
19 | tex.w = 1.0; | ||
20 | |||
21 | gl_FrontColor = gl_Color; | ||
22 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl deleted file mode 100644 index 0de0d11..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | /** | ||
2 | * @file luminanceF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect diffuseMap; | ||
9 | |||
10 | varying vec2 vary_fragcoord; | ||
11 | uniform float fade; | ||
12 | void main() | ||
13 | { | ||
14 | gl_FragColor.rgb = texture2DRect(diffuseMap, vary_fragcoord.xy).rgb; | ||
15 | gl_FragColor.a = fade; | ||
16 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl deleted file mode 100644 index db8775f..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | /** | ||
2 | * @file giV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | |||
10 | uniform vec2 screen_res; | ||
11 | |||
12 | void main() | ||
13 | { | ||
14 | //transform vertex | ||
15 | gl_Position = ftransform(); | ||
16 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
17 | vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; | ||
18 | |||
19 | gl_FrontColor = gl_Color; | ||
20 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl deleted file mode 100644 index 609fb1d..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl +++ /dev/null | |||
@@ -1,76 +0,0 @@ | |||
1 | /** | ||
2 | * @file postDeferredF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect diffuseRect; | ||
9 | uniform sampler2DRect specularRect; | ||
10 | uniform sampler2DRect localLightMap; | ||
11 | uniform sampler2DRect sunLightMap; | ||
12 | uniform sampler2DRect giLightMap; | ||
13 | uniform sampler2D luminanceMap; | ||
14 | uniform sampler2DRect lightMap; | ||
15 | uniform sampler2D lightFunc; | ||
16 | |||
17 | |||
18 | uniform vec3 gi_lum_quad; | ||
19 | uniform vec3 sun_lum_quad; | ||
20 | uniform vec3 lum_quad; | ||
21 | uniform float lum_lod; | ||
22 | uniform vec4 ambient; | ||
23 | |||
24 | uniform vec3 gi_quad; | ||
25 | |||
26 | uniform vec2 screen_res; | ||
27 | varying vec2 vary_fragcoord; | ||
28 | |||
29 | void main() | ||
30 | { | ||
31 | vec2 tc = vary_fragcoord.xy; | ||
32 | vec3 lcol = texture2DLod(luminanceMap, tc/screen_res, lum_lod).rgb; | ||
33 | |||
34 | float lum = sqrt(lcol.r)*lum_quad.x+lcol.r*lcol.r*lum_quad.y+lcol.r*lum_quad.z; | ||
35 | |||
36 | vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); | ||
37 | vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); | ||
38 | |||
39 | float ambocc = texture2DRect(lightMap, vary_fragcoord.xy).g; | ||
40 | |||
41 | vec3 ccol = texture2DRect(giLightMap, vary_fragcoord.xy).rgb; | ||
42 | vec3 gi_col = ccol; | ||
43 | /*for (int i = -1; i <= 1; i+=1) | ||
44 | { | ||
45 | for (int j = -1; j <= 1; j+=1) | ||
46 | { | ||
47 | vec2 tc = vec2(i,j); | ||
48 | float wght = 1.0/(length(tc)+1.0); | ||
49 | gi_col += texture2DRect(giLightMap, vary_fragcoord.xy+vec2(i,j)).rgb * wght; | ||
50 | } | ||
51 | }*/ | ||
52 | |||
53 | //gi_col *= 1.0+spec.a*4.0; | ||
54 | gi_col = (sqrt(gi_col)*gi_quad.x + gi_col*gi_quad.y)*(diff.rgb+spec.rgb*spec.a)+gi_quad.z*ambocc*ambient.rgb*diff.rgb; | ||
55 | |||
56 | vec4 sun_col = texture2DRect(sunLightMap, vary_fragcoord.xy); | ||
57 | |||
58 | vec3 local_col = texture2DRect(localLightMap, vary_fragcoord.xy).rgb; | ||
59 | |||
60 | |||
61 | float sun_lum = 1.0-lum; | ||
62 | sun_lum = sun_lum*sun_lum*sun_lum_quad.x + sun_lum*sun_lum_quad.y+sun_lum_quad.z; | ||
63 | |||
64 | float gi_lum = lum; | ||
65 | gi_lum = gi_lum*gi_lum*gi_lum_quad.x+gi_lum*gi_lum_quad.y+gi_lum_quad.z; | ||
66 | gi_col *= 1.0/gi_lum; | ||
67 | |||
68 | |||
69 | vec3 col = sun_col.rgb*(1.0+max(sun_lum,0.0))+gi_col+local_col; | ||
70 | |||
71 | gl_FragColor.rgb = col.rgb; | ||
72 | gl_FragColor.a = max(sun_lum*min(sun_col.r+sun_col.g+sun_col.b, 1.0), sun_col.a); | ||
73 | |||
74 | //gl_FragColor.rgb = texture2DRect(giLightMap, vary_fragcoord.xy).rgb; | ||
75 | //gl_FragColor.rgb = vec3(texture2D(lightFunc, vary_fragcoord.xy/512.0-vec2(0.5, 0.5)).a); | ||
76 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl deleted file mode 100644 index 9819232..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /** | ||
2 | * @file postDeferredV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | uniform vec2 screen_res; | ||
10 | |||
11 | void main() | ||
12 | { | ||
13 | //transform vertex | ||
14 | gl_Position = ftransform(); | ||
15 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
16 | vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; | ||
17 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl deleted file mode 100644 index 12a5f39..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl +++ /dev/null | |||
@@ -1,87 +0,0 @@ | |||
1 | /** | ||
2 | * @file postgiF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect depthMap; | ||
9 | uniform sampler2DRect normalMap; | ||
10 | uniform sampler2DRect giLightMap; | ||
11 | uniform sampler2D noiseMap; | ||
12 | |||
13 | uniform vec2 kern[32]; | ||
14 | uniform float dist_factor; | ||
15 | uniform float blur_size; | ||
16 | uniform vec2 delta; | ||
17 | uniform int kern_length; | ||
18 | uniform float kern_scale; | ||
19 | uniform vec3 blur_quad; | ||
20 | |||
21 | varying vec2 vary_fragcoord; | ||
22 | |||
23 | uniform mat4 inv_proj; | ||
24 | uniform vec2 screen_res; | ||
25 | |||
26 | vec4 getPosition(vec2 pos_screen) | ||
27 | { | ||
28 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
29 | vec2 sc = pos_screen.xy*2.0; | ||
30 | sc /= screen_res; | ||
31 | sc -= vec2(1.0,1.0); | ||
32 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
33 | vec4 pos = inv_proj * ndc; | ||
34 | pos /= pos.w; | ||
35 | pos.w = 1.0; | ||
36 | return pos; | ||
37 | } | ||
38 | |||
39 | float getDepth(vec2 pos_screen) | ||
40 | { | ||
41 | float z = texture2DRect(depthMap, pos_screen.xy).a; | ||
42 | z = z*2.0-1.0; | ||
43 | vec4 ndc = vec4(0.0, 0.0, z, 1.0); | ||
44 | vec4 p = inv_proj*ndc; | ||
45 | return p.z/p.w; | ||
46 | } | ||
47 | |||
48 | void main() | ||
49 | { | ||
50 | vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz*2.0-1.0; | ||
51 | float depth = getDepth(vary_fragcoord.xy); | ||
52 | |||
53 | vec3 ccol = texture2DRect(giLightMap, vary_fragcoord.xy).rgb; | ||
54 | vec2 dlt = kern_scale * delta/(vec2(1.0,1.0)+norm.xy*norm.xy); | ||
55 | dlt /= clamp(-depth*blur_quad.x, 1.0, 3.0); | ||
56 | float defined_weight = kern[0].x; | ||
57 | vec3 col = ccol*kern[0].x; | ||
58 | |||
59 | for (int i = 0; i < kern_length; i++) | ||
60 | { | ||
61 | vec2 tc = vary_fragcoord.xy + kern[i].y*dlt; | ||
62 | vec3 sampNorm = texture2DRect(normalMap, tc.xy).xyz*2.0-1.0; | ||
63 | |||
64 | float d = dot(norm.xyz, sampNorm); | ||
65 | |||
66 | if (d > 0.5) | ||
67 | { | ||
68 | float sampdepth = getDepth(tc.xy); | ||
69 | sampdepth -= depth; | ||
70 | if (sampdepth*sampdepth < blur_quad.z) | ||
71 | { | ||
72 | col += texture2DRect(giLightMap, tc).rgb*kern[i].x; | ||
73 | defined_weight += kern[i].x; | ||
74 | } | ||
75 | } | ||
76 | } | ||
77 | |||
78 | col /= defined_weight; | ||
79 | |||
80 | //col = ccol; | ||
81 | |||
82 | col = col*blur_quad.y; | ||
83 | |||
84 | gl_FragData[0].xyz = col; | ||
85 | |||
86 | //gl_FragColor = ccol; | ||
87 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl deleted file mode 100644 index 6adcda8..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /** | ||
2 | * @file postgiV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | uniform vec2 screen_res; | ||
10 | |||
11 | void main() | ||
12 | { | ||
13 | //transform vertex | ||
14 | gl_Position = ftransform(); | ||
15 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
16 | vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; | ||
17 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl deleted file mode 100644 index 654b182..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ /dev/null | |||
@@ -1,312 +0,0 @@ | |||
1 | /** | ||
2 | * @file softenLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #extension GL_ARB_texture_rectangle : enable | ||
9 | |||
10 | uniform sampler2DRect diffuseRect; | ||
11 | uniform sampler2DRect specularRect; | ||
12 | uniform sampler2DRect normalMap; | ||
13 | uniform sampler2DRect lightMap; | ||
14 | uniform sampler2DRect giLightMap; | ||
15 | uniform sampler2D noiseMap; | ||
16 | uniform samplerCube environmentMap; | ||
17 | uniform sampler2D lightFunc; | ||
18 | uniform sampler2D luminanceMap; | ||
19 | |||
20 | uniform vec3 gi_quad; | ||
21 | uniform vec3 lum_quad; | ||
22 | uniform float lum_lod; | ||
23 | |||
24 | uniform float blur_size; | ||
25 | uniform float blur_fidelity; | ||
26 | |||
27 | // Inputs | ||
28 | uniform vec4 morphFactor; | ||
29 | uniform vec3 camPosLocal; | ||
30 | //uniform vec4 camPosWorld; | ||
31 | uniform vec4 gamma; | ||
32 | uniform vec4 lightnorm; | ||
33 | uniform vec4 sunlight_color; | ||
34 | uniform vec4 ambient; | ||
35 | uniform vec4 blue_horizon; | ||
36 | uniform vec4 blue_density; | ||
37 | uniform vec4 haze_horizon; | ||
38 | uniform vec4 haze_density; | ||
39 | uniform vec4 cloud_shadow; | ||
40 | uniform vec4 density_multiplier; | ||
41 | uniform vec4 distance_multiplier; | ||
42 | uniform vec4 max_y; | ||
43 | uniform vec4 glow; | ||
44 | uniform float scene_light_strength; | ||
45 | uniform vec3 env_mat[3]; | ||
46 | uniform vec4 shadow_clip; | ||
47 | uniform mat3 ssao_effect_mat; | ||
48 | |||
49 | uniform sampler2DRect depthMap; | ||
50 | uniform mat4 inv_proj; | ||
51 | uniform vec2 screen_res; | ||
52 | |||
53 | varying vec4 vary_light; | ||
54 | varying vec2 vary_fragcoord; | ||
55 | |||
56 | vec3 vary_PositionEye; | ||
57 | |||
58 | vec3 vary_SunlitColor; | ||
59 | vec3 vary_AmblitColor; | ||
60 | vec3 vary_AdditiveColor; | ||
61 | vec3 vary_AtmosAttenuation; | ||
62 | |||
63 | vec4 getPosition(vec2 pos_screen) | ||
64 | { //get position in screen space (world units) given window coordinate and depth map | ||
65 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
66 | vec2 sc = pos_screen.xy*2.0; | ||
67 | sc /= screen_res; | ||
68 | sc -= vec2(1.0,1.0); | ||
69 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
70 | vec4 pos = inv_proj * ndc; | ||
71 | pos /= pos.w; | ||
72 | pos.w = 1.0; | ||
73 | return pos; | ||
74 | } | ||
75 | |||
76 | vec3 getPositionEye() | ||
77 | { | ||
78 | return vary_PositionEye; | ||
79 | } | ||
80 | vec3 getSunlitColor() | ||
81 | { | ||
82 | return vary_SunlitColor; | ||
83 | } | ||
84 | vec3 getAmblitColor() | ||
85 | { | ||
86 | return vary_AmblitColor; | ||
87 | } | ||
88 | vec3 getAdditiveColor() | ||
89 | { | ||
90 | return vary_AdditiveColor; | ||
91 | } | ||
92 | vec3 getAtmosAttenuation() | ||
93 | { | ||
94 | return vary_AtmosAttenuation; | ||
95 | } | ||
96 | |||
97 | |||
98 | void setPositionEye(vec3 v) | ||
99 | { | ||
100 | vary_PositionEye = v; | ||
101 | } | ||
102 | |||
103 | void setSunlitColor(vec3 v) | ||
104 | { | ||
105 | vary_SunlitColor = v; | ||
106 | } | ||
107 | |||
108 | void setAmblitColor(vec3 v) | ||
109 | { | ||
110 | vary_AmblitColor = v; | ||
111 | } | ||
112 | |||
113 | void setAdditiveColor(vec3 v) | ||
114 | { | ||
115 | vary_AdditiveColor = v; | ||
116 | } | ||
117 | |||
118 | void setAtmosAttenuation(vec3 v) | ||
119 | { | ||
120 | vary_AtmosAttenuation = v; | ||
121 | } | ||
122 | |||
123 | void calcAtmospherics(vec3 inPositionEye, float ambFactor) { | ||
124 | |||
125 | vec3 P = inPositionEye; | ||
126 | setPositionEye(P); | ||
127 | |||
128 | //(TERRAIN) limit altitude | ||
129 | if (P.y > max_y.x) P *= (max_y.x / P.y); | ||
130 | if (P.y < -max_y.x) P *= (-max_y.x / P.y); | ||
131 | |||
132 | vec3 tmpLightnorm = lightnorm.xyz; | ||
133 | |||
134 | vec3 Pn = normalize(P); | ||
135 | float Plen = length(P); | ||
136 | |||
137 | vec4 temp1 = vec4(0); | ||
138 | vec3 temp2 = vec3(0); | ||
139 | vec4 blue_weight; | ||
140 | vec4 haze_weight; | ||
141 | vec4 sunlight = sunlight_color; | ||
142 | vec4 light_atten; | ||
143 | |||
144 | //sunlight attenuation effect (hue and brightness) due to atmosphere | ||
145 | //this is used later for sunlight modulation at various altitudes | ||
146 | light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x); | ||
147 | //I had thought blue_density and haze_density should have equal weighting, | ||
148 | //but attenuation due to haze_density tends to seem too strong | ||
149 | |||
150 | temp1 = blue_density + vec4(haze_density.r); | ||
151 | blue_weight = blue_density / temp1; | ||
152 | haze_weight = vec4(haze_density.r) / temp1; | ||
153 | |||
154 | //(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain) | ||
155 | temp2.y = max(0.0, tmpLightnorm.y); | ||
156 | temp2.y = 1. / temp2.y; | ||
157 | sunlight *= exp( - light_atten * temp2.y); | ||
158 | |||
159 | // main atmospheric scattering line integral | ||
160 | temp2.z = Plen * density_multiplier.x; | ||
161 | |||
162 | // Transparency (-> temp1) | ||
163 | // ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati | ||
164 | // compiler gets confused. | ||
165 | temp1 = exp(-temp1 * temp2.z * distance_multiplier.x); | ||
166 | |||
167 | //final atmosphere attenuation factor | ||
168 | setAtmosAttenuation(temp1.rgb); | ||
169 | |||
170 | //compute haze glow | ||
171 | //(can use temp2.x as temp because we haven't used it yet) | ||
172 | temp2.x = dot(Pn, tmpLightnorm.xyz); | ||
173 | temp2.x = 1. - temp2.x; | ||
174 | //temp2.x is 0 at the sun and increases away from sun | ||
175 | temp2.x = max(temp2.x, .03); //was glow.y | ||
176 | //set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) | ||
177 | temp2.x *= glow.x; | ||
178 | //higher glow.x gives dimmer glow (because next step is 1 / "angle") | ||
179 | temp2.x = pow(temp2.x, glow.z); | ||
180 | //glow.z should be negative, so we're doing a sort of (1 / "angle") function | ||
181 | |||
182 | //add "minimum anti-solar illumination" | ||
183 | temp2.x += .25; | ||
184 | |||
185 | //increase ambient when there are more clouds | ||
186 | vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5; | ||
187 | |||
188 | /* decrease value and saturation (that in HSV, not HSL) for occluded areas | ||
189 | * // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html | ||
190 | * // The following line of code performs the equivalent of: | ||
191 | * float ambAlpha = tmpAmbient.a; | ||
192 | * float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis | ||
193 | * vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue); | ||
194 | * tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha); | ||
195 | */ | ||
196 | tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a); | ||
197 | |||
198 | //haze color | ||
199 | setAdditiveColor( | ||
200 | vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient) | ||
201 | + (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x | ||
202 | + tmpAmbient))); | ||
203 | |||
204 | //brightness of surface both sunlight and ambient | ||
205 | setSunlitColor(vec3(sunlight * .5)); | ||
206 | setAmblitColor(vec3(tmpAmbient * .25)); | ||
207 | setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1)); | ||
208 | } | ||
209 | |||
210 | vec3 atmosLighting(vec3 light) | ||
211 | { | ||
212 | light *= getAtmosAttenuation().r; | ||
213 | light += getAdditiveColor(); | ||
214 | return (2.0 * light); | ||
215 | } | ||
216 | |||
217 | vec3 atmosTransport(vec3 light) { | ||
218 | light *= getAtmosAttenuation().r; | ||
219 | light += getAdditiveColor() * 2.0; | ||
220 | return light; | ||
221 | } | ||
222 | vec3 atmosGetDiffuseSunlightColor() | ||
223 | { | ||
224 | return getSunlitColor(); | ||
225 | } | ||
226 | |||
227 | vec3 scaleDownLight(vec3 light) | ||
228 | { | ||
229 | return (light / scene_light_strength ); | ||
230 | } | ||
231 | |||
232 | vec3 scaleUpLight(vec3 light) | ||
233 | { | ||
234 | return (light * scene_light_strength); | ||
235 | } | ||
236 | |||
237 | vec3 atmosAmbient(vec3 light) | ||
238 | { | ||
239 | return getAmblitColor() + light / 2.0; | ||
240 | } | ||
241 | |||
242 | vec3 atmosAffectDirectionalLight(float lightIntensity) | ||
243 | { | ||
244 | return getSunlitColor() * lightIntensity; | ||
245 | } | ||
246 | |||
247 | vec3 scaleSoftClip(vec3 light) | ||
248 | { | ||
249 | //soft clip effect: | ||
250 | light = 1. - clamp(light, vec3(0.), vec3(1.)); | ||
251 | light = 1. - pow(light, gamma.xxx); | ||
252 | |||
253 | return light; | ||
254 | } | ||
255 | |||
256 | void main() | ||
257 | { | ||
258 | vec2 tc = vary_fragcoord.xy; | ||
259 | vec3 pos = getPosition(tc).xyz; | ||
260 | vec3 norm = texture2DRect(normalMap, tc).xyz*2.0-1.0; | ||
261 | vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz; | ||
262 | |||
263 | vec3 at = normalize(pos); | ||
264 | |||
265 | vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); | ||
266 | |||
267 | vec3 lum = texture2DLod(luminanceMap, tc/screen_res, lum_lod).rgb; | ||
268 | |||
269 | vec3 ha = normalize(vary_light.xyz-at); | ||
270 | |||
271 | float da = dot(ha, norm.xyz); | ||
272 | da = texture2D(lightFunc, vec2(da, spec.a)).a; | ||
273 | |||
274 | vec4 diffuse = texture2DRect(diffuseRect, tc); | ||
275 | |||
276 | vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg; | ||
277 | float scol = max(scol_ambocc.r, diffuse.a); | ||
278 | float ambocc = scol_ambocc.g; | ||
279 | |||
280 | calcAtmospherics(pos.xyz, ambocc); | ||
281 | |||
282 | vec3 col = vec3(0,0,0); | ||
283 | |||
284 | col += atmosAffectDirectionalLight(max(min(da, scol), diffuse.a)*(1.0+spec.a)); | ||
285 | |||
286 | col *= diffuse.rgb; | ||
287 | |||
288 | col += da*spec.rgb*spec.a*vary_SunlitColor*scol_ambocc.r; | ||
289 | |||
290 | /*if (spec.a > 0.0) | ||
291 | { | ||
292 | vec3 ref = normalize(reflect(pos.xyz, norm.xyz)); | ||
293 | float sa = dot(ref, vary_light.xyz); | ||
294 | col.rgb += vary_SunlitColor*scol*spec.rgb*texture2D(lightFunc, vec2(sa, spec.a)).a; | ||
295 | }*/ | ||
296 | |||
297 | col = atmosLighting(col); | ||
298 | col = scaleSoftClip(col); | ||
299 | |||
300 | col = col*vec3(1.0+1.0/2.2); | ||
301 | |||
302 | gl_FragColor.rgb = col; | ||
303 | //gl_FragColor.rgb = lum; | ||
304 | |||
305 | gl_FragColor.a = 0.0; | ||
306 | |||
307 | //gl_FragColor.rg = scol_ambocc.rg; | ||
308 | //gl_FragColor.rgb = texture2DRect(lightMap, vary_fragcoord.xy).rgb; | ||
309 | //gl_FragColor.rgb = norm.rgb*0.5+0.5; | ||
310 | //gl_FragColor.rgb = vec3(ambocc); | ||
311 | //gl_FragColor.rgb = vec3(scol); | ||
312 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl deleted file mode 100644 index ad8af47..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /** | ||
2 | * @file softenLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform vec2 screen_res; | ||
9 | |||
10 | varying vec4 vary_light; | ||
11 | varying vec2 vary_fragcoord; | ||
12 | void main() | ||
13 | { | ||
14 | //transform vertex | ||
15 | gl_Position = ftransform(); | ||
16 | |||
17 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
18 | vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; | ||
19 | |||
20 | vec4 tex = gl_MultiTexCoord0; | ||
21 | tex.w = 1.0; | ||
22 | |||
23 | vary_light = gl_MultiTexCoord0; | ||
24 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl deleted file mode 100644 index 258acee..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | /** | ||
2 | * @file treeF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2D diffuseMap; | ||
9 | |||
10 | varying vec3 vary_normal; | ||
11 | |||
12 | void main() | ||
13 | { | ||
14 | vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy); | ||
15 | gl_FragData[0] = vec4(gl_Color.rgb*col.rgb, col.a <= 0.5 ? 0.0 : 0.005); | ||
16 | gl_FragData[1] = vec4(0,0,0,0); | ||
17 | gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0); | ||
18 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/waterF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/waterF.glsl deleted file mode 100644 index bea1515..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/waterF.glsl +++ /dev/null | |||
@@ -1,139 +0,0 @@ | |||
1 | /** | ||
2 | * @file waterF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | vec3 scaleSoftClip(vec3 inColor); | ||
9 | vec3 atmosTransport(vec3 inColor); | ||
10 | |||
11 | uniform sampler2D bumpMap; | ||
12 | uniform sampler2D screenTex; | ||
13 | uniform sampler2D refTex; | ||
14 | uniform sampler2DRectShadow shadowMap0; | ||
15 | uniform sampler2DRectShadow shadowMap1; | ||
16 | uniform sampler2DRectShadow shadowMap2; | ||
17 | uniform sampler2DRectShadow shadowMap3; | ||
18 | uniform sampler2D noiseMap; | ||
19 | |||
20 | uniform mat4 shadow_matrix[6]; | ||
21 | uniform vec4 shadow_clip; | ||
22 | |||
23 | uniform float sunAngle; | ||
24 | uniform float sunAngle2; | ||
25 | uniform vec3 lightDir; | ||
26 | uniform vec3 specular; | ||
27 | uniform float lightExp; | ||
28 | uniform float refScale; | ||
29 | uniform float kd; | ||
30 | uniform vec2 screenRes; | ||
31 | uniform vec3 normScale; | ||
32 | uniform float fresnelScale; | ||
33 | uniform float fresnelOffset; | ||
34 | uniform float blurMultiplier; | ||
35 | uniform vec2 screen_res; | ||
36 | uniform mat4 norm_mat; //region space to screen space | ||
37 | |||
38 | //bigWave is (refCoord.w, view.w); | ||
39 | varying vec4 refCoord; | ||
40 | varying vec4 littleWave; | ||
41 | varying vec4 view; | ||
42 | varying vec4 vary_position; | ||
43 | |||
44 | void main() | ||
45 | { | ||
46 | vec4 color; | ||
47 | float dist = length(view.xy); | ||
48 | |||
49 | //normalize view vector | ||
50 | vec3 viewVec = normalize(view.xyz); | ||
51 | |||
52 | //get wave normals | ||
53 | vec3 wave1 = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0; | ||
54 | vec3 wave2 = texture2D(bumpMap, littleWave.xy).xyz*2.0-1.0; | ||
55 | vec3 wave3 = texture2D(bumpMap, littleWave.zw).xyz*2.0-1.0; | ||
56 | //get base fresnel components | ||
57 | |||
58 | vec3 df = vec3( | ||
59 | dot(viewVec, wave1), | ||
60 | dot(viewVec, (wave2 + wave3) * 0.5), | ||
61 | dot(viewVec, wave3) | ||
62 | ) * fresnelScale + fresnelOffset; | ||
63 | df *= df; | ||
64 | |||
65 | vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5; | ||
66 | |||
67 | float dist2 = dist; | ||
68 | dist = max(dist, 5.0); | ||
69 | |||
70 | float dmod = sqrt(dist); | ||
71 | |||
72 | vec2 dmod_scale = vec2(dmod*dmod, dmod); | ||
73 | |||
74 | //get reflected color | ||
75 | vec2 refdistort1 = wave1.xy*normScale.x; | ||
76 | vec2 refvec1 = distort+refdistort1/dmod_scale; | ||
77 | vec4 refcol1 = texture2D(refTex, refvec1); | ||
78 | |||
79 | vec2 refdistort2 = wave2.xy*normScale.y; | ||
80 | vec2 refvec2 = distort+refdistort2/dmod_scale; | ||
81 | vec4 refcol2 = texture2D(refTex, refvec2); | ||
82 | |||
83 | vec2 refdistort3 = wave3.xy*normScale.z; | ||
84 | vec2 refvec3 = distort+refdistort3/dmod_scale; | ||
85 | vec4 refcol3 = texture2D(refTex, refvec3); | ||
86 | |||
87 | vec4 refcol = refcol1 + refcol2 + refcol3; | ||
88 | float df1 = df.x + df.y + df.z; | ||
89 | refcol *= df1 * 0.333; | ||
90 | |||
91 | vec3 wavef = (wave1 + wave2 * 0.4 + wave3 * 0.6) * 0.5; | ||
92 | //wavef.z *= max(-viewVec.z, 0.1); | ||
93 | wavef = normalize(wavef); | ||
94 | |||
95 | float df2 = dot(viewVec, wavef) * fresnelScale+fresnelOffset; | ||
96 | |||
97 | vec2 refdistort4 = wavef.xy*0.125; | ||
98 | refdistort4.y -= abs(refdistort4.y); | ||
99 | vec2 refvec4 = distort+refdistort4/dmod; | ||
100 | float dweight = min(dist2*blurMultiplier, 1.0); | ||
101 | vec4 baseCol = texture2D(refTex, refvec4); | ||
102 | refcol = mix(baseCol*df2, refcol, dweight); | ||
103 | |||
104 | //get specular component | ||
105 | //float spec = clamp(dot(lightDir, (reflect(viewVec,wavef))),0.0,1.0); | ||
106 | |||
107 | //harden specular | ||
108 | //spec = pow(spec, 128.0); | ||
109 | |||
110 | //figure out distortion vector (ripply) | ||
111 | vec2 distort2 = distort+wavef.xy*refScale/max(dmod*df1, 1.0); | ||
112 | |||
113 | vec4 fb = texture2D(screenTex, distort2); | ||
114 | |||
115 | //mix with reflection | ||
116 | // Note we actually want to use just df1, but multiplying by 0.999999 gets around and nvidia compiler bug | ||
117 | color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.99999); | ||
118 | |||
119 | float shadow = 1.0; | ||
120 | vec4 pos = vary_position; | ||
121 | |||
122 | vec3 nz = texture2D(noiseMap, gl_FragCoord.xy/128.0).xyz; | ||
123 | vec4 spos = pos; | ||
124 | |||
125 | //spec *= shadow; | ||
126 | //color.rgb += spec * specular; | ||
127 | |||
128 | //color.rgb = atmosTransport(color.rgb); | ||
129 | //color.rgb = scaleSoftClip(color.rgb); | ||
130 | //color.a = spec * sunAngle2; | ||
131 | |||
132 | //wavef.z *= 0.1f; | ||
133 | wavef = normalize(wavef); | ||
134 | wavef = (norm_mat*vec4(wavef, 1.0)).xyz; | ||
135 | |||
136 | gl_FragData[0] = vec4(color.rgb, 0.5); | ||
137 | gl_FragData[1] = vec4(0.5,0.5,0.5, 0.95); | ||
138 | gl_FragData[2] = vec4(wavef*0.5+0.5, 0.f); | ||
139 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/blurF.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/blurF.glsl deleted file mode 100644 index 9443320..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/effects/blurF.glsl +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /** | ||
2 | * @file blurf.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | uniform float bloomStrength; | ||
10 | |||
11 | varying vec4 gl_TexCoord[gl_MaxTextureCoords]; | ||
12 | void main(void) | ||
13 | { | ||
14 | float blurWeights[7]; | ||
15 | blurWeights[0] = 0.05; | ||
16 | blurWeights[1] = 0.1; | ||
17 | blurWeights[2] = 0.2; | ||
18 | blurWeights[3] = 0.3; | ||
19 | blurWeights[4] = 0.2; | ||
20 | blurWeights[5] = 0.1; | ||
21 | blurWeights[6] = 0.05; | ||
22 | |||
23 | vec3 color = vec3(0,0,0); | ||
24 | for (int i = 0; i < 7; i++){ | ||
25 | color += vec3(texture2DRect(RenderTexture, gl_TexCoord[i].st)) * blurWeights[i]; | ||
26 | } | ||
27 | |||
28 | color *= bloomStrength; | ||
29 | |||
30 | gl_FragColor = vec4(color, 1.0); | ||
31 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/blurV.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/blurV.glsl deleted file mode 100644 index ba65b16..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/effects/blurV.glsl +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | /** | ||
2 | * @file blurV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform vec2 texelSize; | ||
9 | uniform vec2 blurDirection; | ||
10 | uniform float blurWidth; | ||
11 | |||
12 | void main(void) | ||
13 | { | ||
14 | // Transform vertex | ||
15 | gl_Position = ftransform(); | ||
16 | |||
17 | vec2 blurDelta = texelSize * blurDirection * vec2(blurWidth, blurWidth); | ||
18 | vec2 s = gl_MultiTexCoord0.st - (blurDelta * 3.0); | ||
19 | |||
20 | // for (int i = 0; i < 7; i++) { | ||
21 | // gl_TexCoord[i].st = s + (i * blurDelta); | ||
22 | // } | ||
23 | |||
24 | // MANUALLY UNROLL | ||
25 | gl_TexCoord[0].st = s; | ||
26 | gl_TexCoord[1].st = s + blurDelta; | ||
27 | gl_TexCoord[2].st = s + (2. * blurDelta); | ||
28 | gl_TexCoord[3].st = s + (3. * blurDelta); | ||
29 | gl_TexCoord[4].st = s + (4. * blurDelta); | ||
30 | gl_TexCoord[5].st = s + (5. * blurDelta); | ||
31 | gl_TexCoord[6].st = s + (6. * blurDelta); | ||
32 | |||
33 | // gl_TexCoord[0].st = s; | ||
34 | // gl_TexCoord[1].st = blurDelta; | ||
35 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/colorFilterF.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/colorFilterF.glsl deleted file mode 100644 index 623ef7a..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/effects/colorFilterF.glsl +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /** | ||
2 | * @file colorFilterF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | uniform float brightness; | ||
10 | uniform float contrast; | ||
11 | uniform vec3 contrastBase; | ||
12 | uniform float saturation; | ||
13 | uniform vec3 lumWeights; | ||
14 | |||
15 | const float gamma = 2.0; | ||
16 | |||
17 | void main(void) | ||
18 | { | ||
19 | vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st)); | ||
20 | |||
21 | /// Modulate brightness | ||
22 | color *= brightness; | ||
23 | |||
24 | /// Modulate contrast | ||
25 | color = mix(contrastBase, color, contrast); | ||
26 | |||
27 | /// Modulate saturation | ||
28 | color = mix(vec3(dot(color, lumWeights)), color, saturation); | ||
29 | |||
30 | gl_FragColor = vec4(color, 1.0); | ||
31 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/drawQuadV.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/drawQuadV.glsl deleted file mode 100644 index 29c2a09..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/effects/drawQuadV.glsl +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /** | ||
2 | * @file drawQuadV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | void main(void) | ||
9 | { | ||
10 | //transform vertex | ||
11 | gl_Position = ftransform(); | ||
12 | gl_TexCoord[0] = gl_MultiTexCoord0; | ||
13 | gl_TexCoord[1] = gl_MultiTexCoord1; | ||
14 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/extractF.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/extractF.glsl deleted file mode 100644 index a1583b1..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/effects/extractF.glsl +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /** | ||
2 | * @file extractF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | uniform float extractLow; | ||
10 | uniform float extractHigh; | ||
11 | uniform vec3 lumWeights; | ||
12 | |||
13 | void main(void) | ||
14 | { | ||
15 | /// Get scene color | ||
16 | vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st)); | ||
17 | |||
18 | /// Extract luminance and scale up by night vision brightness | ||
19 | float lum = smoothstep(extractLow, extractHigh, dot(color, lumWeights)); | ||
20 | |||
21 | gl_FragColor = vec4(vec3(lum), 1.0); | ||
22 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/nightVisionF.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/nightVisionF.glsl deleted file mode 100644 index 271d5cf..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/effects/nightVisionF.glsl +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /** | ||
2 | * @file nightVisionF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | uniform sampler2D NoiseTexture; | ||
10 | uniform float brightMult; | ||
11 | uniform float noiseStrength; | ||
12 | |||
13 | float luminance(vec3 color) | ||
14 | { | ||
15 | /// CALCULATING LUMINANCE (Using NTSC lum weights) | ||
16 | /// http://en.wikipedia.org/wiki/Luma_%28video%29 | ||
17 | return dot(color, vec3(0.299, 0.587, 0.114)); | ||
18 | } | ||
19 | |||
20 | void main(void) | ||
21 | { | ||
22 | /// Get scene color | ||
23 | vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st)); | ||
24 | |||
25 | /// Extract luminance and scale up by night vision brightness | ||
26 | float lum = luminance(color) * brightMult; | ||
27 | |||
28 | /// Convert into night vision color space | ||
29 | /// Newer NVG colors (crisper and more saturated) | ||
30 | vec3 outColor = (lum * vec3(0.91, 1.21, 0.9)) + vec3(-0.07, 0.1, -0.12); | ||
31 | |||
32 | /// Add noise | ||
33 | float noiseValue = texture2D(NoiseTexture, gl_TexCoord[1].st).r; | ||
34 | noiseValue = (noiseValue - 0.5) * noiseStrength; | ||
35 | |||
36 | /// Older NVG colors (more muted) | ||
37 | // vec3 outColor = (lum * vec3(0.82, 0.75, 0.83)) + vec3(0.05, 0.32, -0.11); | ||
38 | |||
39 | outColor += noiseValue; | ||
40 | |||
41 | gl_FragColor = vec4(outColor, 1.0); | ||
42 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/simpleF.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/simpleF.glsl deleted file mode 100644 index e55d278..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/effects/simpleF.glsl +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /** | ||
2 | * @file simpleF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | |||
10 | void main(void) | ||
11 | { | ||
12 | vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st)); | ||
13 | gl_FragColor = vec4(1.0 - color, 1.0); | ||
14 | } | ||