diff options
Diffstat (limited to 'indra/newview/app_settings')
229 files changed, 6096 insertions, 796 deletions
diff --git a/indra/newview/app_settings/high_graphics.xml b/indra/newview/app_settings/high_graphics.xml index 4e137d971a..5bc2e1b7e6 100644 --- a/indra/newview/app_settings/high_graphics.xml +++ b/indra/newview/app_settings/high_graphics.xml @@ -4,15 +4,15 @@  	<RenderAvatarCloth value="FALSE"/>  	<!--Default for now-->  	<RenderAvatarLODFactor value="1.0"/> -  <!--Default for now--> -  <RenderAvatarPhysicsLODFactor value="0.9"/> +	<!--Default for now--> +	<RenderAvatarPhysicsLODFactor value="0.9"/>  	<!--NO SHADERS-->  	<RenderAvatarVP value="TRUE"/>  	<!--Short Range-->  	<RenderFarClip value="128"/>  	<!--Default for now-->  	<RenderFlexTimeFactor value="1"/> -	<!--256... but they don't use this--> +	<!--256... but they do not use this-->  	<RenderGlowResolutionPow value="9"/>  	<!--Low number-->  	<RenderMaxPartCount value="4096"/> @@ -26,8 +26,6 @@  	<RenderTerrainLODFactor value="2"/>  	<!--Default for now-->  	<RenderTreeLODFactor value="0.5"/> -	<!--Default for now--> -	<RenderUseFBO value="1"/>  	<!--Try Impostors-->  	<RenderUseImpostors value="TRUE"/>  	<!--Default for now--> @@ -36,11 +34,10 @@  	<VertexShaderEnable value="TRUE"/>  	<!--NO SHADERS-->  	<WindLightUseAtmosShaders value="TRUE"/> -  <!--Deferred Shading--> -  <RenderDeferred value="FALSE"/> -  <!--SSAO Disabled--> -  <RenderDeferredSSAO value="FALSE"/> -  <!--Sun Shadows--> -  <RenderShadowDetail value="0"/> - +	<!--Deferred Shading--> +	<RenderDeferred value="FALSE"/> +	<!--SSAO Disabled--> +	<RenderDeferredSSAO value="FALSE"/> +	<!--Sun Shadows--> +	<RenderShadowDetail value="0"/>  </settings> diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 937c4e4c6a..9f4e89691f 100644 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -20,6 +20,7 @@  					<key>tags</key>  						<array>  							<string>AppInit</string> +              <string>Capabilities</string>  							<string>SystemInfo</string>  							<string>TextureCache</string>  							<string>AppCache</string> @@ -43,6 +44,7 @@  						<array>  							<!-- sample entry for debugging a specific item	-->  <!--						<string>Voice</string>							--> +              <string>Capabilities</string>  						</array>  				</map>  			</array> diff --git a/indra/newview/app_settings/low_graphics.xml b/indra/newview/app_settings/low_graphics.xml index 79463b475c..ca1dae0b86 100644 --- a/indra/newview/app_settings/low_graphics.xml +++ b/indra/newview/app_settings/low_graphics.xml @@ -4,17 +4,17 @@  	<RenderAvatarCloth value="FALSE"/>  	<!--Default for now-->  	<RenderAvatarLODFactor value="0.5"/> -  <!--Default for now--> -  <RenderAvatarPhysicsLODFactor value="0.0"/> -  <!--Default for now--> -  <RenderAvatarMaxVisible value="3"/> +	<!--Default for now--> +	<RenderAvatarPhysicsLODFactor value="0.0"/> +	<!--Default for now--> +	<RenderAvatarMaxVisible value="3"/>  	<!--NO SHADERS-->  	<RenderAvatarVP value="FALSE"/>  	<!--Short Range-->  	<RenderFarClip value="64"/>  	<!--Default for now-->  	<RenderFlexTimeFactor value="0.5"/> -	<!--256... but they don't use this--> +	<!--256... but they do not use this-->  	<RenderGlowResolutionPow value="8"/>  	<!--Low number-->  	<RenderMaxPartCount value="1024"/> @@ -28,8 +28,6 @@  	<RenderTerrainLODFactor value="1.0"/>  	<!--Default for now-->  	<RenderTreeLODFactor value="0.5"/> -	<!--Default for now--> -	<RenderUseFBO value="0"/>  	<!--Try Impostors-->  	<RenderUseImpostors value="TRUE"/>  	<!--Default for now--> @@ -38,11 +36,10 @@  	<VertexShaderEnable value="FALSE"/>  	<!--NO SHADERS-->  	<WindLightUseAtmosShaders value="FALSE"/> -  <!--No Deferred Shading--> -  <RenderDeferred value="FALSE"/> -  <!--SSAO Disabled--> -  <RenderDeferredSSAO value="FALSE"/> -  <!--No Shadows--> -  <RenderShadowDetail value="0"/> - +	<!--No Deferred Shading--> +	<RenderDeferred value="FALSE"/> +	<!--SSAO Disabled--> +	<RenderDeferredSSAO value="FALSE"/> +	<!--No Shadows--> +	<RenderShadowDetail value="0"/>  </settings> diff --git a/indra/newview/app_settings/mid_graphics.xml b/indra/newview/app_settings/mid_graphics.xml index ab1e2a2e1c..01822fe64c 100644 --- a/indra/newview/app_settings/mid_graphics.xml +++ b/indra/newview/app_settings/mid_graphics.xml @@ -4,15 +4,15 @@  	<RenderAvatarCloth value="FALSE"/>  	<!--Default for now-->  	<RenderAvatarLODFactor value="0.5"/> -  <!--Default for now--> -  <RenderAvatarPhysicsLODFactor value="0.75"/> +	<!--Default for now--> +	<RenderAvatarPhysicsLODFactor value="0.75"/>  	<!--NO SHADERS-->  	<RenderAvatarVP value="TRUE"/>  	<!--Short Range-->  	<RenderFarClip value="96"/>  	<!--Default for now-->  	<RenderFlexTimeFactor value="1"/> -	<!--256... but they don't use this--> +	<!--256... but they do not use this-->  	<RenderGlowResolutionPow value="8"/>  	<!--Low number-->  	<RenderMaxPartCount value="2048"/> @@ -26,8 +26,6 @@  	<RenderTerrainLODFactor value="1.0"/>  	<!--Default for now-->  	<RenderTreeLODFactor value="0.5"/> -	<!--Default for now--> -	<RenderUseFBO value="0"/>  	<!--Try Impostors-->  	<RenderUseImpostors value="TRUE"/>  	<!--Default for now--> @@ -36,11 +34,10 @@  	<VertexShaderEnable value="TRUE"/>  	<!--NO SHADERS-->  	<WindLightUseAtmosShaders value="FALSE"/> -  <!--No Deferred Shading--> -  <RenderDeferred value="FALSE"/> -  <!--SSAO Disabled--> -  <RenderDeferredSSAO value="FALSE"/> -  <!--No Shadows--> -  <RenderShadowDetail value="0"/> - +	<!--No Deferred Shading--> +	<RenderDeferred value="FALSE"/> +	<!--SSAO Disabled--> +	<RenderDeferredSSAO value="FALSE"/> +	<!--No Shadows--> +	<RenderShadowDetail value="0"/>  </settings> diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3048f8d492..76fecdf05e 100644..100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -652,17 +652,6 @@        <key>Value</key>        <integer>1</integer>      </map> -  <key>AvatarPhysicsTest</key> -  <map> -    <key>Comment</key> -    <string>Simulate continuous physics behavior on all nearby avatars.</string> -    <key>Persist</key> -    <integer>1</integer> -    <key>Type</key> -    <string>Boolean</string> -    <key>Value</key> -    <integer>0</integer> -  </map>      <key>AvatarSex</key>      <map>        <key>Comment</key> @@ -719,6 +708,17 @@        <key>Value</key>        <integer>0</integer>      </map> +    <key>BrowserEnableJSObject</key> +    <map> +      <key>Comment</key> +      <string>(WARNING: Advanced feature. Use if you are aware of the implications). Enable or disable the viewer to Javascript bridge object.</string> +      <key>Persist</key> +      <integer>0</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>0</integer> +    </map>      <key>BlockAvatarAppearanceMessages</key>          <map>          <key>Comment</key> @@ -1344,7 +1344,68 @@        <key>Value</key>        <integer>0</integer>      </map> -    <key>CertStore</key> + +  <key>CameraFocusTransitionTime</key> +  <map> +    <key>Comment</key> +    <string>How many seconds it takes the camera to transition between focal distances</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>F32</string> +    <key>Value</key> +    <real>0.5</real> +  </map> + +  <key>CameraFNumber</key> +  <map> +    <key>Comment</key> +    <string>Camera f-number value for DoF effect</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>F32</string> +    <key>Value</key> +    <real>9.0</real> +  </map> + +  <key>CameraFocalLength</key> +  <map> +    <key>Comment</key> +    <string>Camera focal length for DoF effect (in millimeters)</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>F32</string> +    <key>Value</key> +    <real>50</real> +  </map> + +  <key>CameraFieldOfView</key> +  <map> +    <key>Comment</key> +    <string>Vertical camera field of view for DoF effect (in degrees)</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>F32</string> +    <key>Value</key> +    <real>60.0</real> +  </map> + +  <key>CameraAspectRatio</key> +  <map> +    <key>Comment</key> +    <string>Camera aspect ratio for DoF effect</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>F32</string> +    <key>Value</key> +    <real>1.5</real> +  </map> + +  <key>CertStore</key>      <map>        <key>Comment</key>        <string>Specifies the Certificate Store for certificate trust verification</string> @@ -1866,7 +1927,7 @@      <key>DebugShowRenderInfo</key>      <map>        <key>Comment</key> -      <string>Show depth buffer contents</string> +      <string>Show stats about current scene</string>        <key>Persist</key>        <integer>1</integer>        <key>Type</key> @@ -1874,6 +1935,17 @@        <key>Value</key>        <integer>0</integer>      </map> +  <key>DebugShowUploadCost</key> +  <map> +    <key>Comment</key> +    <string>Show what it would cost to upload assets in current scene</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Boolean</string> +    <key>Value</key> +    <integer>0</integer> +  </map>    <key>DebugShowRenderMatrices</key>    <map>      <key>Comment</key> @@ -2986,6 +3058,17 @@        <key>Value</key>        <integer>1</integer>      </map> +    <key>EnableGestureSounds</key> +    <map> +      <key>Comment</key> +      <string>Play sounds from gestures</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>1</integer> +    </map>      <key>EnableMouselook</key>      <map>        <key>Comment</key> @@ -3184,17 +3267,6 @@        <key>Value</key>        <integer>1</integer>      </map> -    <key>FirstLoginThisInstall</key> -    <map> -      <key>Comment</key> -      <string>Specifies that you have not successfully logged in since you installed the latest update</string> -      <key>Persist</key> -      <integer>1</integer> -      <key>Type</key> -      <string>Boolean</string> -      <key>Value</key> -      <integer>1</integer> -    </map>      <key>FirstName</key>      <map>        <key>Comment</key> @@ -3232,14 +3304,14 @@    <map>      <key>Comment</key>      <string>Specifies that you have not logged in with the viewer since you performed a clean install</string> -    <key>Persist</key> -    <integer>1</integer> -    <key>Type</key> -    <string>Boolean</string> -    <key>Value</key> -    <integer>1</integer> -  </map> -  <key>FirstSelectedDisabledPopups</key> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>1</integer> +    </map> +    <key>FirstSelectedDisabledPopups</key>      <map>        <key>Comment</key>        <string>Return false if there is not disabled popup selected in the list of floater preferences popups</string> @@ -3919,7 +3991,7 @@        <key>Type</key>        <string>String</string>        <key>Value</key> -      <string>http://search.secondlife.com/viewer/[CATEGORY]/?q=[QUERY]&p=[AUTH_TOKEN]&r=[MATURITY]&lang=[LANGUAGE]&g=[GODLIKE]&sid=[SESSION_ID]&rid=[REGION_ID]&pid=[PARCEL_ID]&channel=[CHANNEL]&version=[VERSION]&major=[VERSION_MAJOR]&minor=[VERSION_MINOR]&patch=[VERSION_PATCH]&build=[VERSION_BUILD]</string> +      <string>http://search-beta.secondlife.com/viewer/[CATEGORY]/?q=[QUERY]&p=[AUTH_TOKEN]&r=[MATURITY]&lang=[LANGUAGE]&g=[GODLIKE]&sid=[SESSION_ID]&rid=[REGION_ID]&pid=[PARCEL_ID]&channel=[CHANNEL]&version=[VERSION]&major=[VERSION_MAJOR]&minor=[VERSION_MINOR]&patch=[VERSION_PATCH]&build=[VERSION_BUILD]</string>      </map>      <key>WebProfileURL</key>      <map> @@ -4295,6 +4367,39 @@        <key>Value</key>          <real>0.25</real>        </map> +	<key>Jpeg2000AdvancedCompression</key> +	  <map> +      <key>Comment</key> +        <string>Use advanced Jpeg2000 compression options (precincts, blocks, ordering, markers)</string> +      <key>Persist</key> +        <integer>1</integer> +      <key>Type</key> +        <string>Boolean</string> +      <key>Value</key> +        <integer>0</integer> +	  </map> +	<key>Jpeg2000PrecinctsSize</key> +	  <map> +      <key>Comment</key> +        <string>Size of image precincts. Assumed square and same for all levels. Must be power of 2.</string> +      <key>Persist</key> +        <integer>1</integer> +      <key>Type</key> +        <string>S32</string> +      <key>Value</key> +        <integer>256</integer> +	  </map> +	<key>Jpeg2000BlocksSize</key> +	  <map> +      <key>Comment</key> +        <string>Size of encoding blocks. Assumed square and same for all levels. Must be power of 2. Max 64, Min 4.</string> +      <key>Persist</key> +        <integer>1</integer> +      <key>Type</key> +        <string>S32</string> +      <key>Value</key> +        <integer>64</integer> +	  </map>      <key>KeepAspectForSnapshot</key>      <map>        <key>Comment</key> @@ -5462,7 +5567,51 @@        <key>Value</key>        <real>0</real>      </map> -    <key>MigrateCacheDirectory</key> +  <key>MeshEnabled</key> +  <map> +    <key>Comment</key> +    <string>Expose UI for mesh functionality (may require restart to take effect).</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Boolean</string> +    <key>Value</key> +    <real>1</real> +  </map> +  <key>MeshImportUseSLM</key> +  <map> +    <key>Comment</key> +    <string>Use cached copy of last upload for a dae if available instead of loading dae file from scratch.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Boolean</string> +    <key>Value</key> +    <real>0</real> +  </map> +  <key>MeshUploadLogXML</key> +  <map> +    <key>Comment</key> +    <string>Verbose XML logging on mesh upload</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Boolean</string> +    <key>Value</key> +    <real>0</real> +  </map> +  <key>MeshUploadFakeErrors</key> +  <map> +    <key>Comment</key> +    <string>Force upload errors (for testing)</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>S32</string> +    <key>Value</key> +    <real>0</real> +  </map> +  <key>MigrateCacheDirectory</key>      <map>        <key>Comment</key>        <string>Check for old version of disk cache to migrate to current location</string> @@ -6125,6 +6274,66 @@        <key>Value</key>        <real>0.0</real>      </map> +  <key>ObjectCostHighThreshold</key> +  <map> +    <key>Comment</key> +    <string>Threshold at which object cost is considered high (displayed in red).</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>F32</string> +    <key>Value</key> +    <real>50.0</real> +  </map> +  <key>ObjectCostLowColor</key> +  <map> +    <key>Comment</key> +    <string>Color for object with a low object cost.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Color4</string> +    <key>Value</key> +    <array> +      <real>0.0</real> +      <real>0.5</real> +      <real>1.0</real> +      <real>0.5</real> +    </array> +  </map> +  <key>ObjectCostMidColor</key> +  <map> +    <key>Comment</key> +    <string>Color for object with a medium object cost.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Color4</string> +    <key>Value</key> +    <array> +      <real>1.0</real> +      <real>0.75</real> +      <real>0.0</real> +      <real>0.65</real> +    </array> +  </map> +  <key>ObjectCostHighColor</key> +  <map> +    <key>Comment</key> +    <string>Color for object a high object cost.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Color4</string> +    <key>Value</key> +    <array> +      <real>1.0</real> +      <real>0.0</real> +      <real>0.0</real> +      <real>0.75</real> +    </array> +  </map> +        <key>ParcelMediaAutoPlayEnable</key>      <map>        <key>Comment</key> @@ -6360,7 +6569,177 @@        <key>Value</key>  	  <integer>13</integer>      </map> -	<key>PrimMediaMasterEnabled</key> + +  <key>PreviewAmbientColor</key> +  <map> +    <key>Comment</key> +    <string>Ambient color of preview render.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Color4</string> +    <key>Value</key> +    <array> +      <real>0.0</real> +      <real>0.0</real> +      <real>0.0</real> +      <real>1.0</real> +    </array> +  </map> + + +  <key>PreviewDiffuse0</key> +  <map> +    <key>Comment</key> +    <string>Diffise color of preview light 0.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Color4</string> +    <key>Value</key> +    <array> +      <real>1.0</real> +      <real>1.0</real> +      <real>1.0</real> +      <real>1.0</real> +    </array> +  </map> + +  <key>PreviewDiffuse1</key> +  <map> +    <key>Comment</key> +    <string>Diffise color of preview light 1.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Color4</string> +    <key>Value</key> +    <array> +      <real>0.25</real> +      <real>0.25</real> +      <real>0.25</real> +      <real>1.0</real> +    </array> +  </map> + +  <key>PreviewDiffuse2</key> +  <map> +    <key>Comment</key> +    <string>Diffise color of preview light 2.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Color4</string> +    <key>Value</key> +    <array> +      <real>1.0</real> +      <real>1.0</real> +      <real>1.0</real> +      <real>1.0</real> +    </array> +  </map> + +  <key>PreviewSpecular0</key> +  <map> +    <key>Comment</key> +    <string>Diffise color of preview light 0.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Color4</string> +    <key>Value</key> +    <array> +      <real>1.0</real> +      <real>1.0</real> +      <real>1.0</real> +      <real>1.0</real> +    </array> +  </map> + +  <key>PreviewSpecular1</key> +  <map> +    <key>Comment</key> +    <string>Diffise color of preview light 1.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Color4</string> +    <key>Value</key> +    <array> +      <real>1.0</real> +      <real>1.0</real> +      <real>1.0</real> +      <real>1.0</real> +    </array> +  </map> + +  <key>PreviewSpecular2</key> +  <map> +    <key>Comment</key> +    <string>Diffise color of preview light 2.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Color4</string> +    <key>Value</key> +    <array> +      <real>1.0</real> +      <real>1.0</real> +      <real>1.0</real> +      <real>1.0</real> +    </array> +  </map> + + +  <key>PreviewDirection0</key> +  <map> +    <key>Comment</key> +    <string>Direction of light 0 for preview render.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Vector3</string> +    <key>Value</key> +    <array> +      <real>-0.75</real> +      <real>1</real> +      <real>1.0</real> +    </array> +  </map> + +  <key>PreviewDirection1</key> +  <map> +    <key>Comment</key> +    <string>Direction of light 1 for preview render.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Vector3</string> +    <key>Value</key> +    <array> +      <real>0.5</real> +      <real>-0.6</real> +      <real>0.4</real> +    </array> +  </map> +   +  <key>PreviewDirection2</key> +  <map> +    <key>Comment</key> +    <string>Direction of light 2 for preview render.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Vector3</string> +    <key>Value</key> +    <array> +      <real>0.5</real> +      <real>-0.8</real> +      <real>0.3</real> +    </array> +  </map> + +  <key>PrimMediaMasterEnabled</key>  	<map>  	  <key>Comment</key>        <string>Whether or not Media on a Prim is enabled.</string> @@ -6734,7 +7113,76 @@        <key>Value</key>        <integer>1</integer>      </map> -    <key>RenderAnisotropic</key> + +  <key>OctreeMaxNodeCapacity</key> +  <map> +    <key>Comment</key> +    <string>Maximum number of elements to store in a single octree node</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>U32</string> +    <key>Value</key> +    <integer>128</integer> +  </map> + +  <key>OctreeStaticObjectSizeFactor</key> +  <map> +    <key>Comment</key> +    <string>Multiplier on static object size for determining octree node size </string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>S32</string> +    <key>Value</key> +    <integer>4</integer> +  </map> + +  <key>OctreeAlphaDistanceFactor</key> +  <map> +    <key>Comment</key> +    <string>Multiplier on alpha object distance for determining octree node size </string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Vector3</string> +    <key>Value</key> +    <array> +      <real>0.1</real> +      <real>0.0</real> +      <real>0.0</real> +    </array> +  </map> + +  <key>OctreeAttachmentSizeFactor</key> +  <map> +    <key>Comment</key> +    <string>Multiplier on attachment size for determining octree node size </string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>S32</string> +    <key>Value</key> +    <integer>4</integer> +  </map> + +  <key>OctreeDistanceFactor</key> +  <map> +    <key>Comment</key> +    <string>Multiplier on distance for determining octree node size </string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Vector3</string> +    <key>Value</key> +    <array> +      <real>0.01</real> +      <real>0.0</real> +      <real>0.0</real> +    </array> +  </map> + +  <key>RenderAnisotropic</key>      <map>        <key>Comment</key>        <string>Render textures using anisotropic filtering</string> @@ -6831,7 +7279,7 @@        <key>Type</key>        <string>F32</string>        <key>Value</key> -      <integer>1.0</integer> +      <real>1.0</real>      </map>      <key>RenderAvatarVP</key>      <map> @@ -6844,7 +7292,31 @@        <key>Value</key>        <integer>1</integer>      </map> -   +    <key>RenderPerformanceTest</key> +    <map> +      <key>Comment</key> +      <string>Disable rendering of everything but in-world content for  +        performance testing</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>0</integer> +    </map> +    +  <key>RenderLocalLights</key> +  <map> +    <key>Comment</key> +    <string>Whether or not to render local lights.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Boolean</string> +    <key>Value</key> +    <integer>1</integer> +  </map> +    <key>RenderShadowNearDist</key>    <map>      <key>Comment</key> @@ -6981,7 +7453,7 @@      <string>Vector3</string>      <key>Value</key>      <array> -      <real>0.40</real> +      <real>0.80</real>        <real>1.00</real>        <real>0.00</real>      </array> @@ -7041,7 +7513,18 @@        <key>Value</key>        <integer>0</integer>      </map> -    <key>RenderDebugPipeline</key> +  <key>RenderDebugNormalScale</key> +  <map> +    <key>Comment</key> +    <string>Scale of normals in debug display.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>F32</string> +    <key>Value</key> +    <real>0.03</real> +  </map> +  <key>RenderDebugPipeline</key>      <map>        <key>Comment</key>        <string>Enable strict pipeline debugging.</string> @@ -7052,6 +7535,17 @@        <key>Value</key>        <integer>0</integer>      </map> +  <key>RenderMaxTextureIndex</key> +  <map> +    <key>Comment</key> +    <string>Maximum texture index to use for indexed texture rendering.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>U32</string> +    <key>Value</key> +    <integer>6</integer> +  </map>      <key>RenderDebugTextureBind</key>      <map>        <key>Comment</key> @@ -7074,6 +7568,7 @@      <key>Value</key>      <integer>0</integer>    </map> +     <key>RenderAnimateRes</key>    <map>      <key>Comment</key> @@ -7085,7 +7580,31 @@      <key>Value</key>      <integer>0</integer>    </map> -   + +  <key>RenderBakeSunlight</key> +  <map> +    <key>Comment</key> +    <string>Bake sunlight into vertex buffers for static objects.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Boolean</string> +    <key>Value</key> +    <integer>0</integer> +  </map> + +  <key>RenderNoAlpha</key> +  <map> +    <key>Comment</key> +    <string>Disable rendering of alpha objects (render all alpha objects as alpha masks).</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Boolean</string> +    <key>Value</key> +    <integer>0</integer> +  </map> +    <key>RenderAnimateTrees</key>    <map>      <key>Comment</key> @@ -7242,6 +7761,18 @@      <real>16.0</real>     </map> +  <key>RenderMinimumLODTriangleCount</key> +  <map> +    <key>Comment</key> +    <string>Triangle count threshold at which automatic LOD generation stops</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>U32</string> +    <key>Value</key> +    <real>16</real> +  </map> +    <key>RenderEdgeDepthCutoff</key>    <map>      <key>Comment</key> @@ -7332,7 +7863,6 @@      <key>Value</key>      <real>0.01</real>    </map> -    <key>RenderShadowBiasError</key>    <map>      <key>Comment</key> @@ -7355,6 +7885,18 @@      <key>Value</key>      <real>0</real>    </map> + +  <key>RenderDepthOfField</key> +  <map> +    <key>Comment</key> +    <string>Whether to use depth of field effect when lighting and shadows are enabled</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Boolean</string> +    <key>Value</key> +    <integer>0</integer> +  </map>    <key>RenderSpotLightsInNondeferred</key>    <map> @@ -7377,7 +7919,7 @@      <key>Type</key>      <string>F32</string>      <key>Value</key> -    <real>0.0</real> +    <real>-0.001</real>    </map>    <key>RenderSpotShadowOffset</key>    <map> @@ -7599,30 +8141,6 @@      <integer>1</integer>    </map> -  <key>RenderDeferredLocalLights</key> -  <map> -    <key>Comment</key> -    <string>Execute local lighting shader in deferred renderer.</string> -    <key>Persist</key> -    <integer>1</integer> -    <key>Type</key> -    <string>Boolean</string> -    <key>Value</key> -    <integer>1</integer> -  </map> - -  <key>RenderDeferredFullscreenLights</key> -  <map> -    <key>Comment</key> -    <string>Execute local lighting shader in deferred renderer.</string> -    <key>Persist</key> -    <integer>1</integer> -    <key>Type</key> -    <string>Boolean</string> -    <key>Value</key> -    <integer>1</integer> -  </map> -    <key>RenderDeferredSunWash</key>    <map>      <key>Comment</key> @@ -7665,7 +8183,7 @@      <key>Type</key>      <string>F32</string>      <key>Value</key> -    <real>1.1</real> +    <real>0.8</real>    </map>    <key>RenderShadowGaussian</key> @@ -7715,7 +8233,7 @@      <key>Type</key>      <string>F32</string>      <key>Value</key> -    <real>0.1</real> +    <real>0</real>    </map>    <key>RenderGIAmbiance</key> @@ -7935,9 +8453,9 @@        <string>Vector3</string>        <key>Value</key>        <array> -        <real>0.299</real> -        <real>0.587</real> -        <real>0.114</real> +        <real>1</real> +        <real>0</real> +        <real>0</real>        </array>      </map>      <key>RenderGlowMaxExtractAlpha</key> @@ -7949,7 +8467,7 @@        <key>Type</key>        <string>F32</string>        <key>Value</key> -      <real>0.065</real> +      <real>0.25</real>      </map>      <key>RenderGlowMinLuminance</key>      <map> @@ -7960,7 +8478,7 @@        <key>Type</key>        <string>F32</string>        <key>Value</key> -      <real>2.5</real> +      <real>9999</real>      </map>      <key>RenderGlowResolutionPow</key>      <map> @@ -8074,7 +8592,7 @@        <key>Type</key>        <string>Boolean</string>        <key>Value</key> -      <integer>1</integer> +      <integer>0</integer>      </map>      <key>RenderHideGroupTitle</key>      <map> @@ -8173,7 +8691,7 @@      <key>Type</key>      <string>S32</string>      <key>Value</key> -    <integer>8192</integer> +    <integer>65536</integer>    </map>      <key>RenderMaxVBOSize</key>      <map> @@ -8440,17 +8958,6 @@        <key>Value</key>        <integer>0</integer>      </map> -    <key>RenderUseFBO</key> -    <map> -      <key>Comment</key> -      <string>Whether we want to use GL_EXT_framebuffer_objects.</string> -      <key>Persist</key> -      <integer>1</integer> -      <key>Type</key> -      <string>Boolean</string> -      <key>Value</key> -      <integer>1</integer> -    </map>    <key>RenderUseTriStrips</key>    <map>      <key>Comment</key> @@ -8526,7 +9033,7 @@        <key>Type</key>        <string>Boolean</string>        <key>Value</key> -      <integer>1</integer> +      <integer>0</integer>      </map>    <key>RenderUseStreamVBO</key>    <map> @@ -8539,7 +9046,18 @@      <key>Value</key>      <integer>1</integer>    </map> -    <key>RenderVolumeLODFactor</key> +	<key>RenderPreferStreamDraw</key> +	<map> +		<key>Comment</key> +		<string>Use GL_STREAM_DRAW in place of GL_DYNAMIC_DRAW</string> +		<key>Persist</key> +		<integer>1</integer> +		<key>Type</key> +		<string>Boolean</string> +		<key>Value</key> +		<integer>0</integer> +	</map> +	<key>RenderVolumeLODFactor</key>      <map>        <key>Comment</key>        <string>Controls level of detail of primitives (multiplier for current screen area when calculated level of detail)</string> @@ -8616,7 +9134,51 @@        <key>Value</key>        <real>1.0</real>      </map> -    <key>SafeMode</key> +  <key>MeshStreamingCostScaler</key> +  <map> +    <key>Comment</key> +    <string>DEBUG</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>F32</string> +    <key>Value</key> +    <real>2.0</real> +  </map> +  <key>MeshThreadCount</key> +  <map> +    <key>Comment</key> +    <string>Number of threads to use for loading meshes.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>U32</string> +    <key>Value</key> +    <integer>8</integer> +  </map> +  <key>MeshMaxConcurrentRequests</key> +  <map> +    <key>Comment</key> +    <string>Number of threads to use for loading meshes.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>U32</string> +    <key>Value</key> +    <integer>32</integer> +  </map> +   <key>RunMultipleThreads</key> +    <map> +      <key>Comment</key> +      <string>If TRUE keep background threads active during render</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>0</integer> +    </map> +  <key>SafeMode</key>      <map>        <key>Comment</key>        <string>Reset preferences, run in safe mode.</string> @@ -9177,6 +9739,17 @@        <key>Value</key>        <integer>1</integer>      </map> +    <key>NearbyListShowMap</key> +    <map> +      <key>Comment</key> +      <string>Show/hide map above nearby people list</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>1</integer> +    </map>      <key>NearbyListShowIcons</key>      <map>        <key>Comment</key> @@ -9557,7 +10130,7 @@      <key>ShowNetStats</key>      <map>        <key>Comment</key> -      <string>Show the Search Bar in the Status Overlay</string> +      <string>Show the Status Indicators for the Viewer and Network Usage in the Status Overlay</string>        <key>Persist</key>        <integer>1</integer>        <key>Type</key> @@ -9892,6 +10465,17 @@        <key>Value</key>        <string>pilot.txt</string>      </map> +    <key>StatsPilotXMLFile</key> +    <map> +      <key>Comment</key> +      <string>Filename for stats logging extended autopilot path</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>String</string> +      <key>Value</key> +      <string>pilot.xml</string> +    </map>      <key>StatsQuitAfterRuns</key>      <map>        <key>Comment</key> @@ -11375,7 +11959,7 @@        <key>Type</key>        <string>Boolean</string>        <key>Value</key> -      <integer>1</integer> +      <integer>0</integer>      </map>      <key>SpeakerParticipantDefaultOrder</key>      <map> @@ -11662,10 +12246,10 @@        <key>Value</key>        <integer>0</integer>      </map> -    <key>VoiceCallsRejectAll</key> +    <key>VoiceCallsRejectGroup</key>      <map>        <key>Comment</key> -      <string>Silently reject all incoming voice calls.</string> +      <string>Silently reject all incoming group voice calls.</string>        <key>Persist</key>        <integer>1</integer>        <key>Type</key> @@ -11913,7 +12497,7 @@        <key>Type</key>        <string>S32</string>        <key>Value</key> -      <integer>-1</integer> +      <integer>20</integer>      </map>      <key>WaterEditPresets</key>      <map> @@ -11926,6 +12510,33 @@        <key>Value</key>        <integer>0</integer>      </map> +    <key>WaterFogColor</key> +    <map> +      <key>Comment</key> +      <string>Water fog color</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Color4</string> +      <key>Value</key> +      <array> +        <real>0.0863</real> +        <real>0.168</real> +        <real>0.212</real> +        <real>0</real> +      </array> +    </map> +    <key>WaterFogDensity</key> +    <map> +      <key>Comment</key> +      <string>Water fog density</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>F32</string> +      <key>Value</key> +      <real>16.0</real> +    </map>      <key>WaterGLFogDensityScale</key>      <map>        <key>Comment</key> @@ -12234,6 +12845,17 @@  		<key>Value</key>  		<integer>1</integer>  	</map> +    <key>SLURLPassToOtherInstance</key> +    <map> +    <key>Comment</key> +    <string>Pass execution to prevoius viewer instances if there is a given slurl</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Boolean</string> +    <key>Value</key> +    <integer>1</integer> +    </map>      <key>soundsbeacon</key>      <map>        <key>Comment</key> @@ -12530,6 +13152,17 @@        <string>Boolean</string>        <key>Value</key>        <integer>1</integer> +    </map>     +    <key>EnablePlaceProfile</key> +    <map> +      <key>Comment</key> +      <string>Enable viewing of place profile from web link</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>1</integer>      </map>      <key>EnablePicks</key>      <map> @@ -12586,6 +13219,39 @@      <key>Value</key>      <integer>1</integer>    </map> +  <key>EnableInventory</key> +  <map> +    <key>Comment</key> +    <string>Enable opening inventory from web link</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Boolean</string> +    <key>Value</key> +    <integer>1</integer> +  </map> +  <key>EnableSearch</key> +  <map> +    <key>Comment</key> +    <string>Enable opening search from web link</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Boolean</string> +    <key>Value</key> +    <integer>1</integer> +  </map> +  <key>EnableAppearance</key> +  <map> +    <key>Comment</key> +    <string>Enable opening appearance from web link</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Boolean</string> +    <key>Value</key> +    <integer>1</integer> +  </map>      <key>SearchFromAddressBar</key>      <map>        <key>Comment</key> @@ -12641,5 +13307,49 @@        <key>Value</key>        <integer>1</integer>      </map> +    <key>GenericErrorPageURL</key> +    <map> +      <key>Comment</key> +      <string>URL to set as a property on LLMediaControl to navigate to if the a page completes with a 400-499 HTTP status code</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>String</string> +      <key>Value</key> +      <string>http://common-flash-secondlife-com.s3.amazonaws.com/viewer/v2.6/agni/404.html</string> +    </map> +    <key>DestinationsAndAvatarsVisibility</key> +    <map> +      <key>Comment</key> +      <string>Whether destination panel or avatar picker are open (0=destination guide, 1=avatar picker, default=nothing)</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>S32</string> +      <key>Value</key> +      <integer>0</integer> +    </map> +    <key>OpenIMOnVoice</key> +    <map> +      <key>Comment</key> +      <string>Open the corresponding IM window when connecting to a voice call.</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>0</integer> +    </map> +     <key>AllowBottomTrayButtonReordering</key> +    <map> +      <key>Comment</key> +      <string>Allow user to move and hide bottom tray buttons</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>1</integer> +    </map>  </map>  </llsd> diff --git a/indra/newview/app_settings/settings_crash_behavior.xml b/indra/newview/app_settings/settings_crash_behavior.xml index cc7f5ac88b..97651ff4ca 100644 --- a/indra/newview/app_settings/settings_crash_behavior.xml +++ b/indra/newview/app_settings/settings_crash_behavior.xml @@ -9,7 +9,7 @@          <key>Type</key>              <string>S32</string>          <key>Value</key> -            <integer>0</integer> +            <integer>1</integer>          </map>      </map>  </llsd> diff --git a/indra/newview/app_settings/settings_minimal.xml b/indra/newview/app_settings/settings_minimal.xml index 03656f2a53..70a75cb4ca 100644 --- a/indra/newview/app_settings/settings_minimal.xml +++ b/indra/newview/app_settings/settings_minimal.xml @@ -45,15 +45,6 @@          <key>Value</key>              <integer>0</integer>          </map> -    <key>EnableVoiceChat</key> -        <map> -        <key>Comment</key> -            <string>Enable talking to other residents with a microphone</string> -        <key>Type</key> -            <string>Boolean</string> -        <key>Value</key> -            <integer>0</integer> -        </map>      <key>HelpURLFormat</key>          <map>          <key>Comment</key> @@ -61,7 +52,7 @@          <key>Type</key>              <string>String</string>          <key>Value</key> -            <string>http://common-flash-secondlife-com.s3.amazonaws.com/viewer/v2.6/damballah/howto/index.html?topic=[TOPIC]</string> +            <string>http://common-flash-secondlife-com.s3.amazonaws.com/viewer/v2.6/agni/howto/index.html?topic=[TOPIC]</string>          </map>      <key>PreferredMaturity</key>          <map> @@ -117,10 +108,10 @@          <key>Value</key>              <integer>0</integer>          </map> -    <key>VoiceCallsRejectAll</key> +    <key>VoiceCallsRejectGroup</key>          <map>          <key>Comment</key> -            <string>Silently reject all incoming voice calls.</string> +            <string>Silently reject all incoming group voice calls.</string>          <key>Type</key>              <string>Boolean</string>          <key>Value</key> @@ -133,7 +124,7 @@          <key>Type</key>              <string>Boolean</string>          <key>Value</key> -            <integer>1</integer> +            <integer>0</integer>          </map>        <key>ScriptsCanShowUI</key>        <map> @@ -248,6 +239,17 @@        <key>Value</key>        <integer>0</integer>      </map> +    <key>EnablePlaceProfile</key> +    <map> +      <key>Comment</key> +      <string>Enable viewing of place profile from web link</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>0</integer> +    </map>      <key>EnablePicks</key>      <map>        <key>Comment</key> @@ -290,7 +292,7 @@        <key>Type</key>        <string>Boolean</string>        <key>Value</key> -      <integer>0</integer> +      <integer>1</integer>      </map>      <key>EnableAvatarShare</key>      <map> @@ -303,6 +305,39 @@        <key>Value</key>        <integer>0</integer>      </map> +    <key>EnableInventory</key> +    <map> +      <key>Comment</key> +      <string>Enable opening inventory from web link</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>0</integer> +    </map> +    <key>EnableSearch</key> +    <map> +      <key>Comment</key> +      <string>Enable opening search from web link</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>0</integer> +    </map> +    <key>EnableAppearance</key> +    <map> +      <key>Comment</key> +      <string>Enable opening appearance from web link</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>0</integer> +    </map>      <key>DoubleClickShowWorldMap</key>      <map>        <key>Comment</key> @@ -345,7 +380,7 @@        <key>Type</key>        <string>String</string>        <key>Value</key> -      <string>http://common-flash-secondlife-com.s3.amazonaws.com/viewer/v2.6/damballah/guide.html</string> +      <string>http://common-flash-secondlife-com.s3.amazonaws.com/viewer/v2.6/agni/guide.html</string>      </map>      <key>AvatarPickerURL</key>      <map> @@ -356,7 +391,7 @@        <key>Type</key>        <string>String</string>        <key>Value</key> -      <string>http://common-flash-secondlife-com.s3.amazonaws.com/viewer/v2.6/damballah/avatars.html</string> +      <string>http://common-flash-secondlife-com.s3.amazonaws.com/viewer/v2.6/agni/avatars.html</string>      </map>      <key>LogInventoryDecline</key>      <map> @@ -402,5 +437,27 @@        <key>Value</key>        <integer>0</integer>      </map> +    <key>OpenIMOnVoice</key> +    <map> +      <key>Comment</key> +      <string>Open the corresponding IM window when connecting to a voice call.</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>1</integer> +    </map> +    <key>AllowBottomTrayButtonReordering</key> +    <map> +      <key>Comment</key> +      <string>Allow user to move and hide bottom tray buttons</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>0</integer> +    </map>    </map>  </llsd> diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index 8efec1cff0..ff24efaf2c 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -44,6 +44,17 @@          <key>Value</key>              <integer>0</integer>          </map> +    <key>LastPostcardRecipient</key> +      <map> +        <key>Comment</key> +          <string>Last recipient of postcard</string> +        <key>Persist</key> +          <integer>1</integer> +        <key>Type</key> +          <string>String</string> +        <key>Value</key> +          <string /> +      </map>      <key>LogNearbyChat</key>          <map>          <key>Comment</key> diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarF.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarF.glsl index 5de9cb0790..b0fa0ddd3e 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/avatarF.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/avatarF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void default_lighting(); diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl index 7e9818e54a..d9f29ced4f 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  attribute vec4 weight;  //1 diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl index 9f06301cc7..2796222c68 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);  mat4 getSkinnedTransform(); diff --git a/indra/newview/app_settings/shaders/class1/avatar/eyeballF.glsl b/indra/newview/app_settings/shaders/class1/avatar/eyeballF.glsl index 0feb88535a..d86ef19a04 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/eyeballF.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/eyeballF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void default_lighting(); diff --git a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl index 30a2f10f62..2eb814bd91 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);  void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl new file mode 100644 index 0000000000..7613e50dca --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl @@ -0,0 +1,30 @@ +/**  + * @file objectSkinV.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + + + +attribute vec4 object_weight;   + +uniform mat4 matrixPalette[32]; + +mat4 getObjectSkinnedTransform() +{ +	int i;  +	 +	vec4 w = fract(object_weight); +	vec4 index = floor(object_weight); +	 +	float scale = 1.0/(w.x+w.y+w.z+w.w); +	w *= scale; +	 +	mat4 mat = matrixPalette[int(index.x)]*w.x; +	mat += matrixPalette[int(index.y)]*w.y; +	mat += matrixPalette[int(index.z)]*w.z; +	mat += matrixPalette[int(index.w)]*w.w; +		 +	return mat; +} diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl index bcd710dc57..2638351e96 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl index 299def1927..86b189b282 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  mat4 getSkinnedTransform(); diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 171a0e76f7..4a0815a163 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -4,13 +4,15 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  #extension GL_ARB_texture_rectangle : enable -uniform sampler2D diffuseMap; -uniform sampler2D noiseMap;  uniform sampler2DRect depthMap; +vec4 diffuseLookup(vec2 texcoord); +  uniform mat4 shadow_matrix[6];  uniform vec4 shadow_clip;  uniform vec2 screen_res; @@ -22,7 +24,7 @@ varying vec3 vary_ambient;  varying vec3 vary_directional;  varying vec3 vary_fragcoord;  varying vec3 vary_position; -varying vec3 vary_light; +varying vec3 vary_pointlight_col;  uniform mat4 inv_proj; @@ -44,18 +46,19 @@ void main()  	vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;  	frag *= screen_res; -	vec3 samp_pos = getPosition(frag).xyz; -	  	vec4 pos = vec4(vary_position, 1.0); +	vec4 diff= diffuseLookup(gl_TexCoord[0].xy); +  	vec4 col = vec4(vary_ambient + vary_directional.rgb, gl_Color.a); -	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * col; +	vec4 color = diff * col;  	color.rgb = atmosLighting(color.rgb);  	color.rgb = scaleSoftClip(color.rgb); -	//gl_FragColor = gl_Color; +	color.rgb += diff.rgb * vary_pointlight_col.rgb; +  	gl_FragColor = color;  	//gl_FragColor = vec4(1,0,1,1);  	//gl_FragColor = vec4(1,0,1,1)*shadow; diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl new file mode 100644 index 0000000000..b0d029dbf4 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl @@ -0,0 +1,67 @@ +/**  + * @file alphaF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +#extension GL_ARB_texture_rectangle : enable + +uniform sampler2DRect depthMap; +uniform sampler2D diffuseMap; + + +uniform mat4 shadow_matrix[6]; +uniform vec4 shadow_clip; +uniform vec2 screen_res; + +vec3 atmosLighting(vec3 light); +vec3 scaleSoftClip(vec3 light); + +varying vec3 vary_ambient; +varying vec3 vary_directional; +varying vec3 vary_fragcoord; +varying vec3 vary_position; +varying vec3 vary_pointlight_col; + +uniform mat4 inv_proj; + +vec4 getPosition(vec2 pos_screen) +{ +	float depth = texture2DRect(depthMap, pos_screen.xy).a; +	vec2 sc = pos_screen.xy*2.0; +	sc /= screen_res; +	sc -= vec2(1.0,1.0); +	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); +	vec4 pos = inv_proj * ndc; +	pos /= pos.w; +	pos.w = 1.0; +	return pos; +} + +void main()  +{ +	vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; +	frag *= screen_res; +	 +	vec4 pos = vec4(vary_position, 1.0); +	 +	vec4 diff= texture2D(diffuseMap,gl_TexCoord[0].xy); + +	vec4 col = vec4(vary_ambient + vary_directional.rgb, gl_Color.a); +	vec4 color = diff * col; +	 +	color.rgb = atmosLighting(color.rgb); + +	color.rgb = scaleSoftClip(color.rgb); + +	color.rgb += diff.rgb * vary_pointlight_col.rgb; + +	gl_FragColor = color; +	//gl_FragColor = vec4(1,0,1,1); +	//gl_FragColor = vec4(1,0,1,1)*shadow; +	 +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl new file mode 100644 index 0000000000..ac3f7189c2 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl @@ -0,0 +1,112 @@ +/**  + * @file alphaSkinnedV.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ +  + + +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +mat4 getObjectSkinnedTransform(); +void calcAtmospherics(vec3 inPositionEye); + +float calcDirectionalLight(vec3 n, vec3 l); + +vec3 atmosAmbient(vec3 light); +vec3 atmosAffectDirectionalLight(float lightIntensity); +vec3 scaleDownLight(vec3 light); +vec3 scaleUpLight(vec3 light); + +varying vec3 vary_position; +varying vec3 vary_ambient; +varying vec3 vary_directional; +varying vec3 vary_normal; +varying vec3 vary_fragcoord; +varying vec3 vary_pointlight_col; + +uniform float near_clip; + +float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) +{ +	//get light vector +	vec3 lv = lp.xyz-v; +	 +	//get distance +	float d = length(lv); +	 +	float da = 0.0; + +	if (d > 0.0 && la > 0.0 && fa > 0.0) +	{ +		//normalize light vector +		lv *= 1.0/d; +	 +		//distance attenuation +		float dist2 = d*d/(la*la); +		da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + +		// spotlight coefficient. +		float spot = max(dot(-ln, lv), is_pointlight); +		da *= spot*spot; // GL_SPOT_EXPONENT=2 + +		//angular attenuation +		da *= calcDirectionalLight(n, lv); +	} + +	return da;	 +} + +void main() +{ +	gl_TexCoord[0] = gl_MultiTexCoord0; +				 +	vec4 pos; +	vec3 norm; +	 +	mat4 trans = getObjectSkinnedTransform(); +	trans = gl_ModelViewMatrix * trans; +	 +	pos = trans * gl_Vertex; +	 +	norm = gl_Vertex.xyz + gl_Normal.xyz; +	norm = normalize(( trans*vec4(norm, 1.0) ).xyz-pos.xyz); +	 +	vec4 frag_pos = gl_ProjectionMatrix * pos; +	gl_Position = frag_pos; +	 +	vary_position = pos.xyz; +	vary_normal = norm;	 +	 +	calcAtmospherics(pos.xyz); + +	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a); + +	// Collect normal lights +	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a); +	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a); +	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a); +	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a); +	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a); +	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a); +	 +	vary_pointlight_col = col.rgb*gl_Color.rgb; + +	col.rgb = vec3(0,0,0); + +	// Add windlight lights +	col.rgb = atmosAmbient(vec3(0.)); +	 +	vary_ambient = col.rgb*gl_Color.rgb; +	vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); +	 +	col.rgb = min(col.rgb*gl_Color.rgb, 1.0); +	 +	gl_FrontColor = col; + +	gl_FogFragCoord = pos.z; +	 +	vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip); +} + + diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index fabbce0824..44cb78e914 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl @@ -5,11 +5,12 @@   * $/LicenseInfo$   */ + +  vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);  void calcAtmospherics(vec3 inPositionEye);  float calcDirectionalLight(vec3 n, vec3 l); -float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);  vec3 atmosAmbient(vec3 light);  vec3 atmosAffectDirectionalLight(float lightIntensity); @@ -21,54 +22,90 @@ varying vec3 vary_directional;  varying vec3 vary_fragcoord;  varying vec3 vary_position;  varying vec3 vary_light; +varying vec3 vary_pointlight_col; +varying float vary_texture_index;  uniform float near_clip;  uniform float shadow_offset;  uniform float shadow_bias; +float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) +{ +	//get light vector +	vec3 lv = lp.xyz-v; +	 +	//get distance +	float d = length(lv); +	 +	float da = 0.0; + +	if (d > 0.0 && la > 0.0 && fa > 0.0) +	{ +		//normalize light vector +		lv *= 1.0/d; +	 +		//distance attenuation +		float dist2 = d*d/(la*la); +		da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + +		// spotlight coefficient. +		float spot = max(dot(-ln, lv), is_pointlight); +		da *= spot*spot; // GL_SPOT_EXPONENT=2 + +		//angular attenuation +		da *= calcDirectionalLight(n, lv); +	} + +	return da;	 +} +  void main()  {  	//transform vertex -	gl_Position = ftransform();  +	vec4 vert = vec4(gl_Vertex.xyz, 1.0); +	vary_texture_index = gl_Vertex.w; +	gl_Position = gl_ModelViewProjectionMatrix * vert;   	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; -	vec4 pos = (gl_ModelViewMatrix * gl_Vertex); +	vec4 pos = (gl_ModelViewMatrix * vert);  	vec3 norm = normalize(gl_NormalMatrix * gl_Normal); -	vary_position = pos.xyz + norm.xyz * (-pos.z/64.0*shadow_offset+shadow_bias); +	float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz)); +	vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset;  	calcAtmospherics(pos.xyz);  	//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); -  	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a); -	// Collect normal lights (need to be divided by two, as we later multiply by 2) -	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a); -	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].specular.a); -	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].specular.a); -	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].specular.a); -	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].specular.a); -	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].specular.a); -	col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz); -	col.rgb = scaleDownLight(col.rgb); +	// Collect normal lights +	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a); +	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a); +	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a); +	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a); +	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a); +	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a); +	vary_pointlight_col = col.rgb*gl_Color.rgb; + +	col.rgb = vec3(0,0,0); +  	// Add windlight lights -	col.rgb += atmosAmbient(vec3(0.)); +	col.rgb = atmosAmbient(vec3(0.));  	vary_light = gl_LightSource[0].position.xyz;  	vary_ambient = col.rgb*gl_Color.rgb;  	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))); -	col.rgb = min(col.rgb*gl_Color.rgb, 1.0); +	col.rgb = col.rgb*gl_Color.rgb;  	gl_FrontColor = col;  	gl_FogFragCoord = pos.z; -	pos = gl_ModelViewProjectionMatrix * gl_Vertex; +	pos = gl_ModelViewProjectionMatrix * vert;  	vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl new file mode 100644 index 0000000000..870d593311 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl @@ -0,0 +1,18 @@ +/**  + * @file avatarShadowF.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + + + +uniform sampler2D diffuseMap; + + +void main()  +{ +	//gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy).a); +	gl_FragColor = vec4(1,1,1,1); +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl new file mode 100644 index 0000000000..c7a4f86727 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl @@ -0,0 +1,27 @@ +/**  + * @file attachmentShadowV.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + + + +mat4 getObjectSkinnedTransform(); + +void main() +{ +	//transform vertex +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	 +	mat4 mat = getObjectSkinnedTransform(); +	 +	mat = gl_ModelViewMatrix * mat; +	vec3 pos = (mat*gl_Vertex).xyz; +	 +	gl_FrontColor = gl_Color; +	 +	vec4 p = gl_ProjectionMatrix * vec4(pos, 1.0); +	p.z = max(p.z, -p.w+0.01); +	gl_Position = p; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaF.glsl deleted file mode 100644 index 82ce6d7377..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaF.glsl +++ /dev/null @@ -1,68 +0,0 @@ -/**  - * @file avatarAlphaF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * $/LicenseInfo$ - */ - -uniform sampler2D diffuseMap; -uniform sampler2DShadow shadowMap0; -uniform sampler2DShadow shadowMap1; -uniform sampler2DShadow shadowMap2; -uniform sampler2DShadow shadowMap3; -uniform sampler2D noiseMap; - -uniform mat4 shadow_matrix[6]; -uniform vec4 shadow_clip; - -vec3 atmosLighting(vec3 light); -vec3 scaleSoftClip(vec3 light); - -varying vec3 vary_ambient; -varying vec3 vary_directional; -varying vec4 vary_position; -varying vec3 vary_normal; - -void main()  -{ -	float shadow = 1.0; -	vec4 pos = vary_position; -	vec3 norm = normalize(vary_normal); -	 -	vec3 nz = texture2D(noiseMap, gl_FragCoord.xy/128.0).xyz; - -	if (pos.z > -shadow_clip.w) -	{	 -		 -		if (pos.z < -shadow_clip.z) -		{ -			vec4 lpos = shadow_matrix[3]*pos; -			shadow = shadow2DProj(shadowMap3, lpos).x; -		} -		else if (pos.z < -shadow_clip.y) -		{ -			vec4 lpos = shadow_matrix[2]*pos; -			shadow = shadow2DProj(shadowMap2, lpos).x; -		} -		else if (pos.z < -shadow_clip.x) -		{ -			vec4 lpos = shadow_matrix[1]*pos; -			shadow = shadow2DProj(shadowMap1, lpos).x; -		} -		else -		{ -			vec4 lpos = shadow_matrix[0]*pos; -			shadow = shadow2DProj(shadowMap0, lpos).x; -		} -	} -	 -	 -	vec4 col = vec4(vary_ambient + vary_directional*shadow, gl_Color.a);	 -	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * col; -	 -	color.rgb = atmosLighting(color.rgb); - -	color.rgb = scaleSoftClip(color.rgb); - -	gl_FragColor = color; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl index 21ddc2fad8..68e4055cf2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);  mat4 getSkinnedTransform(); @@ -17,10 +19,43 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);  vec3 scaleDownLight(vec3 light);  vec3 scaleUpLight(vec3 light); -varying vec4 vary_position; +varying vec3 vary_position;  varying vec3 vary_ambient;  varying vec3 vary_directional; -varying vec3 vary_normal; +varying vec3 vary_fragcoord; +varying vec3 vary_pointlight_col; + +uniform float near_clip; + +float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) +{ +	//get light vector +	vec3 lv = lp.xyz-v; +	 +	//get distance +	float d = length(lv); +	 +	float da = 0.0; + +	if (d > 0.0 && la > 0.0 && fa > 0.0) +	{ +		//normalize light vector +		lv *= 1.0/d; +	 +		//distance attenuation +		float dist2 = d*d/(la*la); +		da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + +		// spotlight coefficient. +		float spot = max(dot(-ln, lv), is_pointlight); +		da *= spot*spot; // GL_SPOT_EXPONENT=2 + +		//angular attenuation +		da *= calcDirectionalLight(n, lv); +	} + +	return da;	 +}  void main()  { @@ -40,9 +75,10 @@ void main()  	norm.z = dot(trans[2].xyz, gl_Normal);  	norm = normalize(norm); -	gl_Position = gl_ProjectionMatrix * pos; -	vary_position = pos; -	vary_normal = norm;	 +	vec4 frag_pos = gl_ProjectionMatrix * pos; +	gl_Position = frag_pos; +	 +	vary_position = pos.xyz;  	calcAtmospherics(pos.xyz); @@ -50,18 +86,20 @@ void main()  	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a); -	// Collect normal lights (need to be divided by two, as we later multiply by 2) -	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a); -	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].specular.a); -	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].specular.a); -	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].specular.a); -	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].specular.a); -	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].specular.a); -	col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz); -	col.rgb = scaleDownLight(col.rgb); +	// Collect normal lights +	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a); +	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a); +	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a); +	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a); +	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a); +	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a); +	vary_pointlight_col = col.rgb*gl_Color.rgb; + +	col.rgb = vec3(0,0,0); +  	// Add windlight lights -	col.rgb += atmosAmbient(vec3(0.)); +	col.rgb = atmosAmbient(vec3(0.));  	vary_ambient = col.rgb*gl_Color.rgb;  	vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); @@ -71,7 +109,8 @@ void main()  	gl_FrontColor = col;  	gl_FogFragCoord = pos.z; - +	 +	vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip);  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl new file mode 100644 index 0000000000..7bc78fe407 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl @@ -0,0 +1,21 @@ +/**  + * @file avatarEyesV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +varying vec3 vary_normal; + +void main() +{ +	//transform vertex +	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;  +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	 +	vary_normal = normalize(gl_NormalMatrix * gl_Normal); + +	gl_FrontColor = gl_Color; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl index e376892e0a..3268618093 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl index d88e3ecfd8..78986ab12e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl @@ -4,13 +4,18 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap; +varying vec4 post_pos;  void main()   {  	//gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy).a);  	gl_FragColor = vec4(1,1,1,1); + +	gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0);  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl index 2af8c8f5f7..f177fcd8f1 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl @@ -4,11 +4,15 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  mat4 getSkinnedTransform();  attribute vec4 weight; +varying vec4 post_pos; +  void main()  {  	gl_TexCoord[0] = gl_MultiTexCoord0; @@ -28,8 +32,9 @@ void main()  	norm = normalize(norm);  	pos = gl_ProjectionMatrix * pos; -	pos.z = max(pos.z, -pos.w+0.01); -	gl_Position = pos; +	post_pos = pos; + +	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);  	gl_FrontColor = gl_Color;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl index 988226fb7c..7eac11287a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  mat4 getSkinnedTransform(); diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index 258a9b7c40..8c75c8045a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  #extension GL_ARB_texture_rectangle : enable @@ -24,7 +26,7 @@ uniform vec2 screen_res;  vec4 getPosition(vec2 pos_screen)  { -	float depth = texture2DRect(depthMap, pos_screen.xy).a; +	float depth = texture2DRect(depthMap, pos_screen.xy).r;  	vec2 sc = pos_screen.xy*2.0;  	sc /= screen_res;  	sc -= vec2(1.0,1.0); @@ -37,44 +39,49 @@ vec4 getPosition(vec2 pos_screen)  void main()   { -	vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz; +    vec2 tc = vary_fragcoord.xy; +	vec3 norm = texture2DRect(normalMap, tc).xyz;  	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm -	vec3 pos = getPosition(vary_fragcoord.xy).xyz; -	vec4 ccol = texture2DRect(lightMap, vary_fragcoord.xy).rgba; +	vec3 pos = getPosition(tc).xyz; +	vec4 ccol = texture2DRect(lightMap, tc).rgba;  	vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); -	  	dlt /= max(-pos.z*dist_factor, 1.0);  	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'  	vec4 col = defined_weight.xyxx * ccol; -	 + +	// relax tolerance according to distance to avoid speckling artifacts, as angles and distances are a lot more abrupt within a small screen area at larger distances +	float pointplanedist_tolerance_pow2 = pos.z*pos.z*0.00005; + +	// perturb sampling origin slightly in screen-space to hide edge-ghosting artifacts where smoothing radius is quite large +	tc += ( (mod(tc.x+tc.y,2) - 0.5) * kern[1].z * dlt * 0.5 ); +  	for (int i = 1; i < 4; i++)  	{ -		vec2 tc = vary_fragcoord.xy + kern[i].z*dlt; -	        vec3 samppos = getPosition(tc).xyz;  +		vec2 samptc = tc + kern[i].z*dlt; +	        vec3 samppos = getPosition(samptc).xyz;   		float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane -		if (d*d <= 0.003) +		if (d*d <= pointplanedist_tolerance_pow2)  		{ -			col += texture2DRect(lightMap, tc)*kern[i].xyxx; +			col += texture2DRect(lightMap, samptc)*kern[i].xyxx;  			defined_weight += kern[i].xy;  		}  	}  	for (int i = 1; i < 4; i++)  	{ -		vec2 tc = vary_fragcoord.xy - kern[i].z*dlt; -	        vec3 samppos = getPosition(tc).xyz;  +		vec2 samptc = tc - kern[i].z*dlt; +	        vec3 samppos = getPosition(samptc).xyz;   		float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane -		if (d*d <= 0.003) +		if (d*d <= pointplanedist_tolerance_pow2)  		{ -			col += texture2DRect(lightMap, tc)*kern[i].xyxx; +			col += texture2DRect(lightMap, samptc)*kern[i].xyxx;  			defined_weight += kern[i].xy;  		}  	} - -  	col /= defined_weight.xyxx; +	col.y *= col.y;  	gl_FragColor = col;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl new file mode 100644 index 0000000000..6ca51377c1 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl @@ -0,0 +1,113 @@ +/**  + * @file blurLightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; +uniform sampler2DRect lightMap; + +uniform float dist_factor; +uniform float blur_size; +uniform vec2 delta; +uniform vec3 kern[4]; +uniform float kern_scale; + +varying vec2 vary_fragcoord; + +uniform mat4 inv_proj; +uniform vec2 screen_res; + +vec3 texture2DMS3(sampler2DMS tex, ivec2 tc) +{ +	vec3 ret = vec3(0,0,0); +	for (int i = 0; i < samples; i++) +	{ +		ret += texelFetch(tex, tc, i).rgb; +	} + +	return ret/samples; +} + +float texture2DMS1(sampler2DMS tex, ivec2 tc) +{ +	float ret = 0; +	for (int i = 0; i < samples; i++) +	{ +		ret += texelFetch(tex, tc, i).r; +	} + +	return ret/samples; +} + +vec4 getPosition(ivec2 pos_screen) +{ +	float depth = texture2DMS1(depthMap, pos_screen.xy); +	vec2 sc = pos_screen.xy*2.0; +	sc /= screen_res; +	sc -= vec2(1.0,1.0); +	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); +	vec4 pos = inv_proj * ndc; +	pos /= pos.w; +	pos.w = 1.0; +	return pos; +} + +void main()  +{ +    vec2 tc = vary_fragcoord.xy; +	ivec2 itc = ivec2(tc); + +	vec3 norm = texture2DMS3(normalMap, itc).xyz; +	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm +	vec3 pos = getPosition(itc).xyz; +	vec4 ccol = texture2DRect(lightMap, tc).rgba; +	 +	vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); +	dlt /= max(-pos.z*dist_factor, 1.0); +	 +	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' +	vec4 col = defined_weight.xyxx * ccol; + +	// relax tolerance according to distance to avoid speckling artifacts, as angles and distances are a lot more abrupt within a small screen area at larger distances +	float pointplanedist_tolerance_pow2 = pos.z*pos.z*0.00005; + +	// perturb sampling origin slightly in screen-space to hide edge-ghosting artifacts where smoothing radius is quite large +	tc += ( (mod(tc.x+tc.y,2) - 0.5) * kern[1].z * dlt * 0.5 ); + +	for (int i = 1; i < 4; i++) +	{ +		vec2 samptc = tc + kern[i].z*dlt; +		vec3 samppos = getPosition(ivec2(samptc)).xyz;  +		float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane +		if (d*d <= pointplanedist_tolerance_pow2) +		{ +			col += texture2DRect(lightMap, samptc)*kern[i].xyxx; +			defined_weight += kern[i].xy; +		} +	} +	for (int i = 1; i < 4; i++) +	{ +		vec2 samptc = vec2(tc - kern[i].z*dlt); +		vec3 samppos = getPosition(ivec2(samptc)).xyz;  +		float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane +		if (d*d <= pointplanedist_tolerance_pow2) +		{ +			col += texture2DRect(lightMap, samptc)*kern[i].xyxx; +			defined_weight += kern[i].xy; +		} +	} + +	col /= defined_weight.xyxx; +	col.y *= col.y; + +	gl_FragColor = col; +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl index b1b3f55f00..862f809de5 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec2 vary_fragcoord;  uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl index 35f334d58e..75b4dc624a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap;  uniform sampler2D bumpMap; diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl new file mode 100644 index 0000000000..dc69519a85 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl @@ -0,0 +1,37 @@ +/**  + * @file bumpV.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + + + +varying vec3 vary_mat0; +varying vec3 vary_mat1; +varying vec3 vary_mat2; + +mat4 getObjectSkinnedTransform(); + +void main() +{ +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	 +	mat4 mat = getObjectSkinnedTransform(); +	 +	mat = gl_ModelViewMatrix * mat; +	 +	vec3 pos = (mat*gl_Vertex).xyz; +	 +	 +	vec3 n = normalize((mat * vec4(gl_Normal.xyz+gl_Vertex.xyz, 1.0)).xyz-pos.xyz); +	vec3 b = normalize((mat * vec4(gl_MultiTexCoord2.xyz+gl_Vertex.xyz, 1.0)).xyz-pos.xyz); +	vec3 t = cross(b, n); +	 +	vary_mat0 = vec3(t.x, b.x, n.x); +	vary_mat1 = vec3(t.y, b.y, n.y); +	vary_mat2 = vec3(t.z, b.z, n.z); +	 +	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); +	gl_FrontColor = gl_Color; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl index 6c8550cb5b..5b6726488b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec3 vary_mat0;  varying vec3 vary_mat1; diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl new file mode 100644 index 0000000000..ef300d5631 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl @@ -0,0 +1,79 @@ +/**  + * @file WLCloudsF.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +///////////////////////////////////////////////////////////////////////// +// The fragment shader for the sky +///////////////////////////////////////////////////////////////////////// + +varying vec4 vary_CloudColorSun; +varying vec4 vary_CloudColorAmbient; +varying float vary_CloudDensity; + +uniform sampler2D cloud_noise_texture; +uniform vec4 cloud_pos_density1; +uniform vec4 cloud_pos_density2; +uniform vec4 gamma; + +/// Soft clips the light with a gamma correction +vec3 scaleSoftClip(vec3 light) { +	//soft clip effect: +	light = 1. - clamp(light, vec3(0.), vec3(1.)); +	light = 1. - pow(light, gamma.xxx); + +	return light; +} + +void main() +{ +	// Set variables +	vec2 uv1 = gl_TexCoord[0].xy; +	vec2 uv2 = gl_TexCoord[1].xy; + +	vec4 cloudColorSun = vary_CloudColorSun; +	vec4 cloudColorAmbient = vary_CloudColorAmbient; +	float cloudDensity = vary_CloudDensity; +	vec2 uv3 = gl_TexCoord[2].xy; +	vec2 uv4 = gl_TexCoord[3].xy; + +	// Offset texture coords +	uv1 += cloud_pos_density1.xy;	//large texture, visible density +	uv2 += cloud_pos_density1.xy;	//large texture, self shadow +	uv3 += cloud_pos_density2.xy;	//small texture, visible density +	uv4 += cloud_pos_density2.xy;	//small texture, self shadow + + +	// Compute alpha1, the main cloud opacity +	float alpha1 = (texture2D(cloud_noise_texture, uv1).x - 0.5) + (texture2D(cloud_noise_texture, uv3).x - 0.5) * cloud_pos_density2.z; +	alpha1 = min(max(alpha1 + cloudDensity, 0.) * 10. * cloud_pos_density1.z, 1.); + +	// And smooth +	alpha1 = 1. - alpha1 * alpha1; +	alpha1 = 1. - alpha1 * alpha1;	 + + +	// Compute alpha2, for self shadowing effect +	// (1 - alpha2) will later be used as percentage of incoming sunlight +	float alpha2 = (texture2D(cloud_noise_texture, uv2).x - 0.5); +	alpha2 = min(max(alpha2 + cloudDensity, 0.) * 2.5 * cloud_pos_density1.z, 1.); + +	// And smooth +	alpha2 = 1. - alpha2; +	alpha2 = 1. - alpha2 * alpha2;	 + +	// Combine +	vec4 color; +	color = (cloudColorSun*(1.-alpha2) + cloudColorAmbient); +	color *= 2.; + +	/// Gamma correct for WL (soft clip effect). +	gl_FragData[0] = vec4(scaleSoftClip(color.rgb), alpha1); +	gl_FragData[1] = vec4(0.0,0.0,0.0,0.0); +	gl_FragData[2] = vec4(0,0,1,0); +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl new file mode 100644 index 0000000000..3eac63076c --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl @@ -0,0 +1,165 @@ +/**  + * @file WLCloudsV.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +////////////////////////////////////////////////////////////////////////// +// The vertex shader for creating the atmospheric sky +/////////////////////////////////////////////////////////////////////////////// + +// Output parameters +varying vec4 vary_CloudColorSun; +varying vec4 vary_CloudColorAmbient; +varying float vary_CloudDensity; + +// Inputs +uniform vec3 camPosLocal; + +uniform vec4 lightnorm; +uniform vec4 sunlight_color; +uniform vec4 ambient; +uniform vec4 blue_horizon; +uniform vec4 blue_density; +uniform vec4 haze_horizon; +uniform vec4 haze_density; + +uniform vec4 cloud_shadow; +uniform vec4 density_multiplier; +uniform vec4 max_y; + +uniform vec4 glow; + +uniform vec4 cloud_color; + +uniform vec4 cloud_scale; + +void main() +{ + +	// World / view / projection +	gl_Position = ftransform(); + +	gl_TexCoord[0] = gl_MultiTexCoord0; + +	// Get relative position +	vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0); + +	// Set altitude +	if (P.y > 0.) +	{ +		P *= (max_y.x / P.y); +	} +	else +	{ +		P *= (-32000. / P.y); +	} + +	// Can normalize then +	vec3 Pn = normalize(P); +	float  Plen = length(P); + +	// Initialize temp variables +	vec4 temp1 = vec4(0.); +	vec4 temp2 = vec4(0.); +	vec4 blue_weight; +	vec4 haze_weight; +	vec4 sunlight = sunlight_color; +	vec4 light_atten; + + +	// Sunlight attenuation effect (hue and brightness) due to atmosphere +	// this is used later for sunlight modulation at various altitudes +	light_atten = (blue_density * 1.0 + haze_density.x * 0.25) * (density_multiplier.x * max_y.x); + +	// Calculate relative weights +	temp1 = blue_density + haze_density.x; +	blue_weight = blue_density / temp1; +	haze_weight = haze_density.x / temp1; + +	// Compute sunlight from P & lightnorm (for long rays like sky) +	temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y ); +	temp2.y = 1. / temp2.y; +	sunlight *= exp( - light_atten * temp2.y); + +	// Distance +	temp2.z = Plen * density_multiplier.x; + +	// Transparency (-> temp1) +	// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati +	// compiler gets confused. +	temp1 = exp(-temp1 * temp2.z); + + +	// Compute haze glow +	temp2.x = dot(Pn, lightnorm.xyz); +	temp2.x = 1. - temp2.x; +		// temp2.x is 0 at the sun and increases away from sun +	temp2.x = max(temp2.x, .001);	 +		// Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) +	temp2.x *= glow.x; +		// Higher glow.x gives dimmer glow (because next step is 1 / "angle") +	temp2.x = pow(temp2.x, glow.z); +		// glow.z should be negative, so we're doing a sort of (1 / "angle") function + +	// Add "minimum anti-solar illumination" +	temp2.x += .25; + +	// Increase ambient when there are more clouds +	vec4 tmpAmbient = ambient; +	tmpAmbient += (1. - tmpAmbient) * cloud_shadow.x * 0.5;  + +	// Dim sunlight by cloud shadow percentage +	sunlight *= (1. - cloud_shadow.x); + +	// Haze color below cloud +	vec4 additiveColorBelowCloud = (	  blue_horizon * blue_weight * (sunlight + tmpAmbient) +				+ (haze_horizon.r * haze_weight) * (sunlight * temp2.x + tmpAmbient) +			 );	 + +	// CLOUDS + +	sunlight = sunlight_color; +	temp2.y = max(0., lightnorm.y * 2.); +	temp2.y = 1. / temp2.y; +	sunlight *= exp( - light_atten * temp2.y); + +	// Cloud color out +	vary_CloudColorSun = (sunlight * temp2.x) * cloud_color; +	vary_CloudColorAmbient = tmpAmbient * cloud_color; +	 +	// Attenuate cloud color by atmosphere +	temp1 = sqrt(temp1);	//less atmos opacity (more transparency) below clouds +	vary_CloudColorSun *= temp1; +	vary_CloudColorAmbient *= temp1; +	vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - temp1); + +	// Make a nice cloud density based on the cloud_shadow value that was passed in. +	vary_CloudDensity = 2. * (cloud_shadow.x - 0.25); + + +	// Texture coords +	gl_TexCoord[0] = gl_MultiTexCoord0; +	gl_TexCoord[0].xy -= 0.5; +	gl_TexCoord[0].xy /= cloud_scale.x; +	gl_TexCoord[0].xy += 0.5; + +	gl_TexCoord[1] = gl_TexCoord[0]; +	gl_TexCoord[1].x += lightnorm.x * 0.0125; +	gl_TexCoord[1].y += lightnorm.z * 0.0125; + +	gl_TexCoord[2] = gl_TexCoord[0] * 16.; +	gl_TexCoord[3] = gl_TexCoord[1] * 16.; + +	// Combine these to minimize register use +	vary_CloudColorAmbient += oHazeColorBelowCloud; + +	// needs this to compile on mac +	//vary_AtmosAttenuation = vec3(0.0,0.0,0.0); + +	// END CLOUDS +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl index 9bd622a506..43af480c50 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap; @@ -18,3 +20,4 @@ void main()  	vec3 nvn = normalize(vary_normal);  	gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);  } + diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl new file mode 100644 index 0000000000..e7b5dcce7f --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl @@ -0,0 +1,19 @@ +/**  + * @file diffuseIndexedF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  +varying vec3 vary_normal; + +void main()  +{ +	vec3 col = gl_Color.rgb * diffuseLookup(gl_TexCoord[0].xy).rgb; + +	gl_FragData[0] = vec4(col, 0.0); +	gl_FragData[1] = gl_Color.aaaa; // spec +	//gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); // spec - from former class3 - maybe better, but not so well tested +	vec3 nvn = normalize(vary_normal); +	gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl new file mode 100644 index 0000000000..2c4caea109 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl @@ -0,0 +1,33 @@ +/**  + * @file diffuseSkinnedV.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + + + +varying vec3 vary_normal; + +mat4 getObjectSkinnedTransform(); + +void main() +{ +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	 +	mat4 mat = getObjectSkinnedTransform(); +	 +	mat = gl_ModelViewMatrix * mat; +	vec3 pos = (mat*gl_Vertex).xyz; +	 +	vec4 norm = gl_Vertex; +	norm.xyz += gl_Normal.xyz; +	norm.xyz = (mat*norm).xyz; +	norm.xyz = normalize(norm.xyz-pos.xyz); + +	vary_normal = norm.xyz; +			 +	gl_FrontColor = gl_Color; +	 +	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl index bd58096317..b56d1493c3 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl @@ -4,15 +4,19 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec3 vary_normal; +varying float vary_texture_index;  void main()  {  	//transform vertex -	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;  +	gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_Vertex.xyz, 1.0);   	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	vary_texture_index = gl_Vertex.w;  	vary_normal = normalize(gl_NormalMatrix * gl_Normal);  	gl_FrontColor = gl_Color; diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index f53e15c6cc..d781e08548 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -4,59 +4,25 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  -#extension GL_ARB_texture_rectangle : enable - -uniform sampler2D diffuseMap; -uniform sampler2DRect depthMap; -uniform sampler2D noiseMap; -uniform vec4 shadow_clip; -uniform vec2 screen_res; +#extension GL_ARB_texture_rectangle : enable  vec3 fullbrightAtmosTransport(vec3 light);  vec3 fullbrightScaleSoftClip(vec3 light); -varying vec3 vary_ambient; -varying vec3 vary_directional; -varying vec4 vary_position; -varying vec3 vary_normal; -varying vec3 vary_fragcoord; - -uniform mat4 inv_proj; - -vec4 getPosition(vec2 pos_screen) -{ -	float depth = texture2DRect(depthMap, pos_screen.xy).a; -	vec2 sc = pos_screen.xy*2.0; -	sc /= screen_res; -	sc -= vec2(1.0,1.0); -	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); -	vec4 pos = inv_proj * ndc; -	pos /= pos.w; -	pos.w = 1.0; -	return pos; -}  void main()   { -	vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; -	frag *= screen_res; -	 -	vec3 samp_pos = getPosition(frag).xyz;  -	  	float shadow = 1.0; -	vec4 pos = vary_position; -	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy)*gl_Color; +	vec4 color = diffuseLookup(gl_TexCoord[0].xy)*gl_Color;  	color.rgb = fullbrightAtmosTransport(color.rgb);  	color.rgb = fullbrightScaleSoftClip(color.rgb); -	//gl_FragColor = gl_Color;  	gl_FragColor = color; -	//gl_FragColor = vec4(1,0,1,1); -	  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl index dc8b2c6be4..2eed044b7c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void calcAtmospherics(vec3 inPositionEye); @@ -12,30 +14,23 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);  vec3 scaleDownLight(vec3 light);  vec3 scaleUpLight(vec3 light); -varying vec3 vary_ambient; -varying vec3 vary_directional; -varying vec3 vary_normal; -varying vec3 vary_fragcoord; -uniform float near_clip; -varying vec4 vary_position; +varying float vary_texture_index;  void main()  {  	//transform vertex -	gl_Position = ftransform();  +	vec4 vert = vec4(gl_Vertex.xyz, 1.0); +	vary_texture_index = gl_Vertex.w; + +	gl_Position = gl_ModelViewProjectionMatrix*vert;   	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; -	vec4 pos = (gl_ModelViewMatrix * gl_Vertex); -	vary_position = pos; -		 +	vec4 pos = (gl_ModelViewMatrix * vert); +				  	calcAtmospherics(pos.xyz);  	gl_FrontColor = gl_Color;  	gl_FogFragCoord = pos.z; -	 -	pos = gl_ModelViewProjectionMatrix * gl_Vertex; -	vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); -	  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/giF.glsl b/indra/newview/app_settings/shaders/class1/deferred/giF.glsl index e64e29a0d2..41c149e774 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/giF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/giF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl b/indra/newview/app_settings/shaders/class1/deferred/giV.glsl index 543527612e..e86f2896da 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/giV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec2 vary_fragcoord; diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl index 7f365fedc8..fa811f0d55 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap;  uniform sampler2D normalMap; @@ -12,7 +14,7 @@ uniform sampler2D specularMap;  void main()   {  	vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy); -	gl_FragData[0] = vec4(col.rgb, col.a <= 0.5 ? 0.0 : 0.005); +	gl_FragData[0] = vec4(col.rgb, col.a * 0.005);  	gl_FragData[1] = texture2D(specularMap, gl_TexCoord[0].xy);  	gl_FragData[2] = vec4(texture2D(normalMap, gl_TexCoord[0].xy).xyz, 0.0);  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl index 4fc27d4412..723777bd3a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void main()  { diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl index acb3014d18..25e93ae266 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl @@ -5,6 +5,8 @@   * $/LicenseInfo$   */ + +  uniform sampler2DRect diffuseMap;  varying vec2 vary_fragcoord; diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl index 6368def830..4baf1fc65a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl @@ -5,6 +5,9 @@   * $/LicenseInfo$   */ + + +  varying vec2 vary_fragcoord;  uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index 6fca08ae6a..3c5c780d94 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -5,6 +5,8 @@   * $/LicenseInfo$   */ + +  #extension GL_ARB_texture_rectangle : enable  uniform sampler2DRect depthMap; @@ -21,8 +23,9 @@ uniform float sun_wash;  uniform int light_count; -uniform vec4 light[16]; -uniform vec4 light_col[16]; +#define MAX_LIGHT_COUNT		16 +uniform vec4 light[MAX_LIGHT_COUNT]; +uniform vec4 light_col[MAX_LIGHT_COUNT];  varying vec4 vary_fragcoord;  uniform vec2 screen_res; @@ -33,7 +36,7 @@ uniform mat4 inv_proj;  vec4 getPosition(vec2 pos_screen)  { -	float depth = texture2DRect(depthMap, pos_screen.xy).a; +	float depth = texture2DRect(depthMap, pos_screen.xy).r;  	vec2 sc = pos_screen.xy*2.0;  	sc /= screen_res;  	sc -= vec2(1.0,1.0); @@ -61,50 +64,56 @@ void main()  	float noise = texture2D(noiseMap, frag.xy/128.0).b;  	vec3 out_col = vec3(0,0,0);  	vec3 npos = normalize(-pos); -	 -	for (int i = 0; i < light_count; ++i) + +	// As of OSX 10.6.7 ATI Apple's crash when using a variable size loop +	for (int i = 0; i < MAX_LIGHT_COUNT; ++i)  	{ +		bool light_contrib = (i < light_count); +		  		vec3 lv = light[i].xyz-pos;  		float dist2 = dot(lv,lv);  		dist2 /= light[i].w;  		if (dist2 > 1.0)  		{ -			continue; +			light_contrib = false;  		}  		float da = dot(norm, lv);  		if (da < 0.0)  		{ -			continue; +			light_contrib = false;  		} -				 -		lv = normalize(lv); -		da = dot(norm, lv); -				 -		float fa = light_col[i].a+1.0; -		float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); -		dist_atten *= noise; - -		float lit = da * dist_atten; -		 -		vec3 col = light_col[i].rgb*lit*diff; -		//vec3 col = vec3(dist2, light_col[i].a, lit); -		if (spec.a > 0.0) +		if (light_contrib)  		{ -			//vec3 ref = dot(pos+lv, norm); +			lv = normalize(lv); +			da = dot(norm, lv); +					 +			float fa = light_col[i].a+1.0; +			float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); +			dist_atten *= noise; + +			float lit = da * dist_atten; -			float sa = dot(normalize(lv+npos),norm); +			vec3 col = light_col[i].rgb*lit*diff; +			//vec3 col = vec3(dist2, light_col[i].a, lit); -			if (sa > 0.0) +			if (spec.a > 0.0)  			{ -				sa = texture2D(lightFunc,vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); -				sa *= noise; -				col += da*sa*light_col[i].rgb*spec.rgb; +				//vec3 ref = dot(pos+lv, norm); +				 +				float sa = dot(normalize(lv+npos),norm); +				 +				if (sa > 0.0) +				{ +					sa = texture2D(lightFunc,vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); +					sa *= noise; +					col += da*sa*light_col[i].rgb*spec.rgb; +				}  			} +			 +			out_col += col;  		} -		 -		out_col += col;	  	}  	if (dot(out_col, out_col) <= 0.0) diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl new file mode 100644 index 0000000000..6c43679acf --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl @@ -0,0 +1,137 @@ +/**  + * @file multiPointLightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + + + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS depthMap; +uniform sampler2DMS diffuseRect; +uniform sampler2DMS specularRect; +uniform sampler2DMS normalMap; +uniform sampler2D noiseMap; +uniform sampler2D lightFunc; + + +uniform vec3 env_mat[3]; +uniform float sun_wash; + +uniform int light_count; + +#define MAX_LIGHT_COUNT		16 +uniform vec4 light[MAX_LIGHT_COUNT]; +uniform vec4 light_col[MAX_LIGHT_COUNT]; + +varying vec4 vary_fragcoord; +uniform vec2 screen_res; + +uniform float far_z; + +uniform mat4 inv_proj; + +vec4 getPosition(ivec2 pos_screen, int sample) +{ +	float depth = texelFetch(depthMap, pos_screen, sample).r; +	vec2 sc = vec2(pos_screen.xy)*2.0; +	sc /= screen_res; +	sc -= vec2(1.0,1.0); +	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); +	vec4 pos = inv_proj * ndc; +	pos /= pos.w; +	pos.w = 1.0; +	return pos; +} + +void main()  +{ +	vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res; +	ivec2 itc = ivec2(frag); + +	int wght = 0; +	vec3 fcol = vec3(0,0,0); + +	for (int s = 0; s < samples; ++s) +	{ +		vec3 pos = getPosition(itc, s).xyz; +		if (pos.z >= far_z) +		{ +			vec3 norm = texelFetch(normalMap, itc, s).xyz; +			norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm +			norm = normalize(norm); +			vec4 spec = texelFetch(specularRect, itc, s); +			vec3 diff = texelFetch(diffuseRect, itc, s).rgb; +			float noise = texture2D(noiseMap, frag.xy/128.0).b; +			vec3 out_col = vec3(0,0,0); +			vec3 npos = normalize(-pos); + +			// As of OSX 10.6.7 ATI Apple's crash when using a variable size loop +			for (int i = 0; i < MAX_LIGHT_COUNT; ++i) +			{ +				bool light_contrib = (i < light_count); +		 +				vec3 lv = light[i].xyz-pos; +				float dist2 = dot(lv,lv); +				dist2 /= light[i].w; +				if (dist2 > 1.0) +				{ +					light_contrib = false; +				} +		 +				float da = dot(norm, lv); +				if (da < 0.0) +				{ +					light_contrib = false; +				} +		 +				if (light_contrib) +				{ +					lv = normalize(lv); +					da = dot(norm, lv); +					 +					float fa = light_col[i].a+1.0; +					float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); +					dist_atten *= noise; + +					float lit = da * dist_atten; +			 +					vec3 col = light_col[i].rgb*lit*diff; +					//vec3 col = vec3(dist2, light_col[i].a, lit); +			 +					if (spec.a > 0.0) +					{ +						//vec3 ref = dot(pos+lv, norm); +				 +						float sa = dot(normalize(lv+npos),norm); +				 +						if (sa > 0.0) +						{ +							sa = texture2D(lightFunc,vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); +							sa *= noise; +							col += da*sa*light_col[i].rgb*spec.rgb; +						} +					} +			 +					out_col += col; +				} +			} +	 +			fcol += out_col; +			++wght; +		} +	} + +	if (wght <= 0) +	{ +		discard; +	} + +	gl_FragColor.rgb = fcol/samples; +	gl_FragColor.a = 0.0; + +	 +} diff --git a/indra/newview/app_settings/shaders/class2/deferred/blurLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl index b1b3f55f00..434fb6f534 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/blurLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl @@ -1,17 +1,20 @@  /**  - * @file blurLightF.glsl + * @file multiPointLightV.glsl   *   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ -varying vec2 vary_fragcoord; -uniform vec2 screen_res; + + +varying vec4 vary_fragcoord;  void main()  {  	//transform vertex -	gl_Position = ftransform();   	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; -	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; +	vary_fragcoord = pos; + +	gl_Position = pos; +	gl_FrontColor = gl_Color;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index a9f03f7615..0d25d7792d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -5,7 +5,7 @@   * $/LicenseInfo$   */ -#version 120 +  //class 1 -- no shadows diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl new file mode 100644 index 0000000000..c80a54346e --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl @@ -0,0 +1,232 @@ +/**  + * @file multiSpotLightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + + + +//class 1 -- no shadows + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS diffuseRect; +uniform sampler2DMS specularRect; +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; +uniform sampler2D noiseMap; +uniform sampler2D lightFunc; +uniform sampler2D projectionMap; + +uniform mat4 proj_mat; //screen space to light space +uniform float proj_near; //near clip for projection +uniform vec3 proj_p; //plane projection is emitting from (in screen space) +uniform vec3 proj_n; +uniform float proj_focus; //distance from plane to begin blurring +uniform float proj_lod;  //(number of mips in proj map) +uniform float proj_range; //range between near clip and far clip plane of projection +uniform float proj_ambient_lod; +uniform float proj_ambiance; +uniform float near_clip; +uniform float far_clip; + +uniform vec3 proj_origin; //origin of projection to be used for angular attenuation +uniform float sun_wash; +uniform float shadow_fade; + +varying vec4 vary_light; + +varying vec4 vary_fragcoord; +uniform vec2 screen_res; + +uniform mat4 inv_proj; + +vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) +{ +	vec4 ret = texture2DLod(projectionMap, tc, lod); +	 +	vec2 dist = tc-vec2(0.5); +	 +	float det = max(1.0-lod/(proj_lod*0.5), 0.0); +	 +	float d = dot(dist,dist); +		 +	ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0); +	 +	return ret; +} + +vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) +{ +	vec4 ret = texture2DLod(projectionMap, tc, lod); +	 +	vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); +	 +	float det = min(lod/(proj_lod*0.5), 1.0); +	 +	float d = min(dist.x, dist.y); +	 +	float edge = 0.25*det; +		 +	ret *= clamp(d/edge, 0.0, 1.0); +	 +	return ret; +} + +vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) +{ +	vec4 ret = texture2DLod(projectionMap, tc, lod); +	 +	vec2 dist = tc-vec2(0.5); +	 +	float d = dot(dist,dist); +		 +	ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0); +	 +	return ret; +} + + +vec4 getPosition(ivec2 pos_screen, int sample) +{ +	float depth = texelFetch(depthMap, pos_screen, sample).r; +	vec2 sc = vec2(pos_screen.xy)*2.0; +	sc /= screen_res; +	sc -= vec2(1.0,1.0); +	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); +	vec4 pos = inv_proj * ndc; +	pos /= pos.w; +	pos.w = 1.0; +	return pos; +} + +void main()  +{ +	int wght = 0; + +	vec3 fcol = vec3(0,0,0); + +	vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res; +	 +	ivec2 itc = ivec2(frag.xy); + +	for (int i = 0; i < samples; ++i) +	{ +		vec3 pos = getPosition(itc, i).xyz; +		vec3 lv = vary_light.xyz-pos.xyz; +		float dist2 = dot(lv,lv); +		dist2 /= vary_light.w; +		if (dist2 <= 1.0) +		{ +			vec3 norm = texelFetch(normalMap, itc, i).xyz*2.0-1.0; +	 +			norm = normalize(norm); +			float l_dist = -dot(lv, proj_n); +	 +			vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); +			if (proj_tc.z >= 0.0) +			{ +				proj_tc.xyz /= proj_tc.w; +	 +				float fa = gl_Color.a+1.0; +				float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); +				if (dist_atten > 0.0) +				{ +					lv = proj_origin-pos.xyz; +					lv = normalize(lv); +					float da = dot(norm, lv); +		 +					vec3 col = vec3(0,0,0); +		 +					vec3 diff_tex = texelFetch(diffuseRect, itc, i).rgb; +		 +					float noise = texture2D(noiseMap, frag.xy/128.0).b; +					if (proj_tc.z > 0.0 && +						proj_tc.x < 1.0 && +						proj_tc.y < 1.0 && +						proj_tc.x > 0.0 && +						proj_tc.y > 0.0) +					{ +						float lit = 0.0; +						float amb_da = proj_ambiance; +		 +						if (da > 0.0) +						{ +							float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); +							float lod = diff * proj_lod; +			 +							vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); +		 +							vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; +			 +							lit = da * dist_atten * noise; +			 +							col = lcol*lit*diff_tex; +							amb_da += (da*0.5)*proj_ambiance; +						} +		 +						//float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); +						vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod); +							 +						amb_da += (da*da*0.5+0.5)*proj_ambiance; +				 +						amb_da *= dist_atten * noise; +			 +						amb_da = min(amb_da, 1.0-lit); +			 +						col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; +					} +	 +	 +					vec4 spec = texelFetch(specularRect, itc, i); +					if (spec.a > 0.0) +					{ +						vec3 ref = reflect(normalize(pos), norm); +		 +						//project from point pos in direction ref to plane proj_p, proj_n +						vec3 pdelta = proj_p-pos; +						float ds = dot(ref, proj_n); +		 +						if (ds < 0.0) +						{ +							vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; +			 +							vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); + +							if (stc.z > 0.0) +							{ +								stc.xy /= stc.w; + +								float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0); +				 +								stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5); +								 +								if (stc.x < 1.0 && +									stc.y < 1.0 && +									stc.x > 0.0 && +									stc.y > 0.0) +								{ +									vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); +									col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb; +								} +							} +						} +					} +	 +					fcol += col; +					++wght; +				} +			} +		} +	} + +	if (wght <= 0) +	{ +		discard; +	} + +	gl_FragColor.rgb = fcol/samples;	 +	gl_FragColor.a = 0.0; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index 43da16436b..5efa3200d4 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +   #extension GL_ARB_texture_rectangle : enable @@ -28,7 +30,7 @@ uniform vec4 viewport;  vec4 getPosition(vec2 pos_screen)  { -	float depth = texture2DRect(depthMap, pos_screen.xy).a; +	float depth = texture2DRect(depthMap, pos_screen.xy).r;  	vec2 sc = (pos_screen.xy-viewport.xy)*2.0;  	sc /= viewport.zw;  	sc -= vec2(1.0,1.0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl new file mode 100644 index 0000000000..feaf38115d --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl @@ -0,0 +1,108 @@ +/**  + * @file pointLightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  +  + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS depthMap; +uniform sampler2DMS diffuseRect; +uniform sampler2DMS specularRect; +uniform sampler2DMS normalMap; +uniform sampler2D noiseMap; +uniform sampler2D lightFunc; + + +uniform vec3 env_mat[3]; +uniform float sun_wash; + +varying vec4 vary_light; + +varying vec4 vary_fragcoord; +uniform vec2 screen_res; + +uniform mat4 inv_proj; +uniform vec4 viewport; + +vec4 getPosition(ivec2 pos_screen, int sample) +{ +	float depth = texelFetch(depthMap, pos_screen, sample).r; +	vec2 sc = (vec2(pos_screen.xy)-viewport.xy)*2.0; +	sc /= viewport.zw; +	sc -= vec2(1.0,1.0); +	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); +	vec4 pos = inv_proj * ndc; +	pos /= pos.w; +	pos.w = 1.0; +	return pos; +} + +void main()  +{ +	vec4 frag = vary_fragcoord; +	frag.xyz /= frag.w; +	frag.xyz = frag.xyz*0.5+0.5; +	frag.xy *= screen_res; +	 +	ivec2 itc = ivec2(frag.xy); + +	int wght = 0; +	vec3 fcol = vec3(0,0,0); + +	for (int s = 0; s < samples; ++s) +	{ +		vec3 pos = getPosition(itc, s).xyz; +		vec3 lv = vary_light.xyz-pos; +		float dist2 = dot(lv,lv); +		dist2 /= vary_light.w; +		if (dist2 <= 1.0) +		{ +			vec3 norm = texelFetch(normalMap, itc, s).xyz; +			norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm +			float da = dot(norm, lv); +			if (da >= 0.0) +			{ +				norm = normalize(norm); +				lv = normalize(lv); +				da = dot(norm, lv); +	 +				float noise = texture2D(noiseMap, frag.xy/128.0).b; +	 +				vec3 col = texelFetch(diffuseRect, itc, s).rgb; +				float fa = gl_Color.a+1.0; +				float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); +				float lit = da * dist_atten * noise; +	 +				col = gl_Color.rgb*lit*col; + +				vec4 spec = texelFetch(specularRect, itc, s); +				if (spec.a > 0.0) +				{ +					float sa = dot(normalize(lv-normalize(pos)),norm); +					if (sa > 0.0) +					{ +						sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); +						sa *= noise; +						col += da*sa*gl_Color.rgb*spec.rgb; +					} +				} + +				fcol += col; +				++wght; +			} +		} +	} +	 +	if (wght <= 0) +	{ +		discard; +	} +		 +	gl_FragColor.rgb = fcol/samples;	 +	gl_FragColor.a = 0.0; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl index e056c3e896..c510d8ad77 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl @@ -5,17 +5,14 @@   * $/LicenseInfo$   */ + +  varying vec4 vary_light;  varying vec4 vary_fragcoord; -uniform vec2 screen_res; -uniform float near_clip; -  void main()  {  	//transform vertex -	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;  -  	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;  	vary_fragcoord = pos; @@ -23,6 +20,8 @@ void main()  	tex.w = 1.0;  	vary_light = gl_MultiTexCoord0; +	 +	gl_Position = pos;  	gl_FrontColor = gl_Color;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl index 650e1a91a8..f6b0402bb9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl @@ -4,54 +4,134 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  #extension GL_ARB_texture_rectangle : enable  uniform sampler2DRect diffuseRect; -uniform sampler2DRect localLightMap; -uniform sampler2DRect sunLightMap; -uniform sampler2DRect giLightMap; -uniform sampler2D	  luminanceMap; -uniform sampler2DRect lightMap; - -uniform vec3 lum_quad; -uniform float lum_lod; -uniform vec4 ambient; +uniform sampler2DRect edgeMap; +uniform sampler2DRect depthMap; +uniform sampler2DRect normalMap; +uniform sampler2D bloomMap; -uniform vec3 gi_quad; +uniform float depth_cutoff; +uniform float norm_cutoff; +uniform float focal_distance; +uniform float blur_constant; +uniform float tan_pixel_angle; +uniform float magnification; +uniform mat4 inv_proj;  uniform vec2 screen_res; +  varying vec2 vary_fragcoord; -void main()  +float getDepth(vec2 pos_screen)  { -	vec2 tc = vary_fragcoord.xy; -	vec3 lum = texture2DLod(luminanceMap, tc/screen_res, lum_lod).rgb; -	float luminance = lum.r; -	luminance = luminance*lum_quad.y+lum_quad.z; +	float z = texture2DRect(depthMap, pos_screen.xy).r; +	z = z*2.0-1.0; +	vec4 ndc = vec4(0.0, 0.0, z, 1.0); +	vec4 p = inv_proj*ndc; +	return p.z/p.w; +} -	vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); +float calc_cof(float depth) +{ +	float sc = abs(depth-focal_distance)/-depth*blur_constant; +		 +	sc /= magnification; +	 +	// tan_pixel_angle = pixel_length/-depth; +	float pixel_length =  tan_pixel_angle*-focal_distance; +	 +	sc = sc/pixel_length; +	sc *= 1.414; +	 +	return sc; +} + +void dofSampleNear(inout vec4 diff, inout float w, float cur_sc, vec2 tc) +{ +	float d = getDepth(tc); +	 +	float sc = calc_cof(d); +	 +	float wg = 0.25; +		 +	vec4 s = texture2DRect(diffuseRect, tc); +	// de-weight dull areas to make highlights 'pop' +	wg += s.r+s.g+s.b; +	 +	diff += wg*s; +	 +	w += wg; +} -	float ambocc = texture2DRect(lightMap, vary_fragcoord.xy).g; -			 -	vec3 gi_col = texture2DRect(giLightMap, vary_fragcoord.xy).rgb; -	gi_col = gi_col*gi_col*gi_quad.x + gi_col*gi_quad.y+gi_quad.z*ambocc*ambient.rgb; -	gi_col *= diff; +void dofSample(inout vec4 diff, inout float w, float min_sc, float cur_depth, vec2 tc) +{ +	float d = getDepth(tc); -	vec4 sun_col =	texture2DRect(sunLightMap, vary_fragcoord.xy); +	float sc = calc_cof(d); -	vec3 local_col = texture2DRect(localLightMap, vary_fragcoord.xy).rgb; +	if (sc > min_sc //sampled pixel is more "out of focus" than current sample radius +	   || d < cur_depth) //sampled pixel is further away than current pixel +	{ +		float wg = 0.25; +		vec4 s = texture2DRect(diffuseRect, tc); +		// de-weight dull areas to make highlights 'pop' +		wg += s.r+s.g+s.b; +	 +		diff += wg*s; -	sun_col *= 1.0/min(luminance, 1.0); -	gi_col *= 1.0/luminance; +		w += wg; +	} +} + + +void main()  +{ +	vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz; +	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm -	vec3 col = sun_col.rgb+gi_col+local_col; +	vec2 tc = vary_fragcoord.xy; -	gl_FragColor.rgb = col.rgb; -	col.rgb = max(col.rgb-vec3(1.0,1.0,1.0), vec3(0.0, 0.0, 0.0));  +	float depth = getDepth(tc); -	gl_FragColor.a = 0.0; // max(dot(col.rgb,col.rgb)*lum_quad.x, sun_col.a); +	vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); -	//gl_FragColor.rgb = vec3(lum_lod); +	{  +		float w = 1.0; +		 +		float sc = calc_cof(depth); +		sc = min(abs(sc), 10.0); +		 +		float fd = depth*0.5f; +		 +		float PI = 3.14159265358979323846264; + +		// sample quite uniformly spaced points within a circle, for a circular 'bokeh'		 +		//if (depth < focal_distance) +		{ +			while (sc > 0.5) +			{ +				int its = int(max(1.0,(sc*3.7))); +				for (int i=0; i<its; ++i) +				{ +					float ang = sc+i*2*PI/its; // sc is added for rotary perturbance +					float samp_x = sc*sin(ang); +					float samp_y = sc*cos(ang); +					// you could test sample coords against an interesting non-circular aperture shape here, if desired. +					dofSample(diff, w, sc, depth, vary_fragcoord.xy + vec2(samp_x,samp_y)); +				} +				sc -= 1.0; +			} +		} +		 +		diff /= w; +	} +		 +	vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res); +	gl_FragColor = diff + bloom;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl new file mode 100644 index 0000000000..62ae5f917a --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl @@ -0,0 +1,133 @@ +/**  + * @file postDeferredF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS diffuseRect; +uniform sampler2DMS edgeMap; +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; +uniform sampler2D bloomMap; + +uniform float depth_cutoff; +uniform float norm_cutoff; +uniform float focal_distance; +uniform float blur_constant; +uniform float tan_pixel_angle; +uniform float magnification; + +uniform mat4 inv_proj; +uniform vec2 screen_res; + +varying vec2 vary_fragcoord; + +vec4 texture2DMS(sampler2DMS tex, ivec2 tc) +{ +	vec4 ret = vec4(0,0,0,0); +	for (int i = 0; i < samples; ++i) +	{ +		ret += texelFetch(tex, tc, i); +	} + +	return ret/samples; +} + +float getDepth(ivec2 pos_screen) +{ +	float z = texture2DMS(depthMap, pos_screen.xy).r; +	z = z*2.0-1.0; +	vec4 ndc = vec4(0.0, 0.0, z, 1.0); +	vec4 p = inv_proj*ndc; +	return p.z/p.w; +} + +float calc_cof(float depth) +{ +	float sc = abs(depth-focal_distance)/-depth*blur_constant; +		 +	sc /= magnification; +	 +	// tan_pixel_angle = pixel_length/-depth; +	float pixel_length =  tan_pixel_angle*-focal_distance; +	 +	sc = sc/pixel_length; +	sc *= 1.414; +	 +	return sc; +} + +void dofSample(inout vec4 diff, inout float w, float min_sc, float cur_depth, ivec2 tc) +{ +	float d = getDepth(tc); +	 +	float sc = calc_cof(d); +	 +	if (sc > min_sc //sampled pixel is more "out of focus" than current sample radius +	   || d < cur_depth) //sampled pixel is further away than current pixel +	{ +		float wg = 0.25; +		 +		vec4 s = texture2DMS(diffuseRect, tc); +		// de-weight dull areas to make highlights 'pop' +		wg += s.r+s.g+s.b; +	 +		diff += wg*s; +		 +		w += wg; +	} +} + + +void main()  +{ +	ivec2 itc = ivec2(vary_fragcoord.xy); + +	vec3 norm = texture2DMS(normalMap, itc).xyz; +	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm +		 +	float depth = getDepth(itc); +	 +	vec4 diff = texture2DMS(diffuseRect, itc); +	 +	{  +		float w = 1.0; +		 +		float sc = calc_cof(depth); +		sc = min(abs(sc), 10.0); +		 +		float fd = depth*0.5f; +		 +		float PI = 3.14159265358979323846264; + +		int isc = int(sc); +		 +		// sample quite uniformly spaced points within a circle, for a circular 'bokeh'		 +		//if (depth < focal_distance) +		{ +			for (int x = -isc; x <= isc; x+=2) +			{ +				for (int y = -isc; y <= isc; y+=2) +				{ +					ivec2 cur_samp = ivec2(x,y); +					float cur_sc = length(vec2(cur_samp)); +					if (cur_sc < sc) +					{ +						dofSample(diff, w, cur_sc, depth, itc+cur_samp); +					} +				} +			} +		} +		 +		diff /= w; +	} +		 +	vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res); +	gl_FragColor = diff + bloom; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl new file mode 100644 index 0000000000..bf829bfc56 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl @@ -0,0 +1,24 @@ +/**  + * @file postDeferredF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +#extension GL_ARB_texture_rectangle : enable + +uniform sampler2DRect diffuseRect; +uniform sampler2D bloomMap; + +uniform vec2 screen_res; +varying vec2 vary_fragcoord; + +void main()  +{ +	vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); +	 +	vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res); +	gl_FragColor = diff + bloom; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl new file mode 100644 index 0000000000..bf35dfe11c --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl @@ -0,0 +1,37 @@ +/**  + * @file postDeferredF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS diffuseRect; +uniform sampler2D bloomMap; + +uniform vec2 screen_res; +varying vec2 vary_fragcoord; + +vec4 texture2DMS(sampler2DMS tex, ivec2 tc) +{ +	vec4 ret = vec4(0,0,0,0); + +	for (int i = 0; i < samples; ++i) +	{ +		 ret += texelFetch(tex,tc,i); +	} + +	return ret/samples; +} + +void main()  +{ +	vec4 diff = texture2DMS(diffuseRect, ivec2(vary_fragcoord.xy)); + +	vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res); +	gl_FragColor = diff + bloom; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl index 0ec81dcb02..876f65ee3a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec2 vary_fragcoord;  uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl index e8e58f50e1..fa3f04bcc8 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2DRect depthMap;  uniform sampler2DRect normalMap; diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl index e5f6217644..eebe930666 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec2 vary_fragcoord;  uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl index 378a3295ec..e0c5406483 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl index 666f909f01..9271a5115c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec4 post_pos; diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl new file mode 100644 index 0000000000..820c82ffd7 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl @@ -0,0 +1,44 @@ +/**  + * @file WLSkyF.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +///////////////////////////////////////////////////////////////////////// +// The fragment shader for the sky +///////////////////////////////////////////////////////////////////////// + +varying vec4 vary_HazeColor; + +uniform sampler2D cloud_noise_texture; +uniform vec4 gamma; + +/// Soft clips the light with a gamma correction +vec3 scaleSoftClip(vec3 light) { +	//soft clip effect: +	light = 1. - clamp(light, vec3(0.), vec3(1.)); +	light = 1. - pow(light, gamma.xxx); + +	return light; +} + +void main() +{ +	// Potential Fill-rate optimization.  Add cloud calculation  +	// back in and output alpha of 0 (so that alpha culling kills  +	// the fragment) if the sky wouldn't show up because the clouds  +	// are fully opaque. + +	vec4 color; +	color = vary_HazeColor; +	color *= 2.; + +	/// Gamma correct for WL (soft clip effect). +	gl_FragData[0] = vec4(scaleSoftClip(color.rgb), 1.0); +	gl_FragData[1] = vec4(0.0,0.0,0.0,0.0); +	gl_FragData[2] = vec4(0,0,1,0); +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl new file mode 100644 index 0000000000..1ea00f723a --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl @@ -0,0 +1,140 @@ +/**  + * @file WLSkyV.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +// SKY //////////////////////////////////////////////////////////////////////// +// The vertex shader for creating the atmospheric sky +/////////////////////////////////////////////////////////////////////////////// + +// Output parameters +varying vec4 vary_HazeColor; + +// Inputs +uniform vec3 camPosLocal; + +uniform vec4 lightnorm; +uniform vec4 sunlight_color; +uniform vec4 ambient; +uniform vec4 blue_horizon; +uniform vec4 blue_density; +uniform vec4 haze_horizon; +uniform vec4 haze_density; + +uniform vec4 cloud_shadow; +uniform vec4 density_multiplier; +uniform vec4 max_y; + +uniform vec4 glow; + +uniform vec4 cloud_color; + +uniform vec4 cloud_scale; + +void main() +{ + +	// World / view / projection +	gl_Position = ftransform(); +	gl_TexCoord[0] = gl_MultiTexCoord0; + +	// Get relative position +	vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0); +	//vec3 P = gl_Vertex.xyz + vec3(0,50,0); + +	// Set altitude +	if (P.y > 0.) +	{ +		P *= (max_y.x / P.y); +	} +	else +	{ +		P *= (-32000. / P.y); +	} + +	// Can normalize then +	vec3 Pn = normalize(P); +	float  Plen = length(P); + +	// Initialize temp variables +	vec4 temp1 = vec4(0.); +	vec4 temp2 = vec4(0.); +	vec4 blue_weight; +	vec4 haze_weight; +	vec4 sunlight = sunlight_color; +	vec4 light_atten; + + +	// Sunlight attenuation effect (hue and brightness) due to atmosphere +	// this is used later for sunlight modulation at various altitudes +	light_atten = (blue_density * 1.0 + haze_density.x * 0.25) * (density_multiplier.x * max_y.x); + +	// Calculate relative weights +	temp1 = blue_density + haze_density.x; +	blue_weight = blue_density / temp1; +	haze_weight = haze_density.x / temp1; + +	// Compute sunlight from P & lightnorm (for long rays like sky) +	temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y ); +	temp2.y = 1. / temp2.y; +	sunlight *= exp( - light_atten * temp2.y); + +	// Distance +	temp2.z = Plen * density_multiplier.x; + +	// Transparency (-> temp1) +	// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati +	// compiler gets confused. +	temp1 = exp(-temp1 * temp2.z); + + +	// Compute haze glow +	temp2.x = dot(Pn, lightnorm.xyz); +	temp2.x = 1. - temp2.x; +		// temp2.x is 0 at the sun and increases away from sun +	temp2.x = max(temp2.x, .001);	 +		// Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) +	temp2.x *= glow.x; +		// Higher glow.x gives dimmer glow (because next step is 1 / "angle") +	temp2.x = pow(temp2.x, glow.z); +		// glow.z should be negative, so we're doing a sort of (1 / "angle") function + +	// Add "minimum anti-solar illumination" +	temp2.x += .25; + + +	// Haze color above cloud +	vary_HazeColor = (	  blue_horizon * blue_weight * (sunlight + ambient) +				+ (haze_horizon.r * haze_weight) * (sunlight * temp2.x + ambient) +			 );	 + + +	// Increase ambient when there are more clouds +	vec4 tmpAmbient = ambient; +	tmpAmbient += (1. - tmpAmbient) * cloud_shadow.x * 0.5;  + +	// Dim sunlight by cloud shadow percentage +	sunlight *= (1. - cloud_shadow.x); + +	// Haze color below cloud +	vec4 additiveColorBelowCloud = (	  blue_horizon * blue_weight * (sunlight + tmpAmbient) +				+ (haze_horizon.r * haze_weight) * (sunlight * temp2.x + tmpAmbient) +			 );	 + +	// Final atmosphere additive +	vary_HazeColor *= (1. - temp1); +	 +	// Attenuate cloud color by atmosphere +	temp1 = sqrt(temp1);	//less atmos opacity (more transparency) below clouds + +	// At horizon, blend high altitude sky color towards the darker color below the clouds +	vary_HazeColor += (additiveColorBelowCloud - vary_HazeColor) * (1. - sqrt(temp1)); +	 +	// won't compile on mac without this being set +	//vary_AtmosAttenuation = vec3(0.0,0.0,0.0); +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 5fbeceba81..60082f40d6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  #extension GL_ARB_texture_rectangle : enable @@ -257,7 +259,7 @@ vec3 scaleSoftClip(vec3 light)  void main()   {  	vec2 tc = vary_fragcoord.xy; -	float depth = texture2DRect(depthMap, tc.xy).a; +	float depth = texture2DRect(depthMap, tc.xy).r;  	vec3 pos = getPosition_d(tc, depth).xyz;  	vec3 norm = texture2DRect(normalMap, tc).xyz;  	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm @@ -268,14 +270,10 @@ void main()  	vec4 diffuse = texture2DRect(diffuseRect, tc);  	vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); -	vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg; -	float scol = max(scol_ambocc.r, diffuse.a);  -	float ambocc = scol_ambocc.g; -	 -	calcAtmospherics(pos.xyz, ambocc); +	calcAtmospherics(pos.xyz, 1.0);  	vec3 col = atmosAmbient(vec3(0)); -	col += atmosAffectDirectionalLight(max(min(da, scol), diffuse.a)); +	col += atmosAffectDirectionalLight(max(min(da, 1.0), diffuse.a));  	col *= diffuse.rgb; @@ -285,7 +283,7 @@ void main()  		//  		vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));  		float sa = dot(refnormpersp, vary_light.xyz); -		vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a; +		vec3 dumbshiny = vary_SunlitColor*texture2D(lightFunc, vec2(sa, spec.a)).a;  		/*  		// screen-space cheap fakey reflection map diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl new file mode 100644 index 0000000000..9dfacfb520 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl @@ -0,0 +1,318 @@ +/**  + * @file softenLightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS diffuseRect; +uniform sampler2DMS specularRect; +uniform sampler2DMS normalMap; +uniform sampler2DMS depthMap; +uniform sampler2D	  noiseMap; +uniform samplerCube environmentMap; +uniform sampler2D	  lightFunc; + +uniform float blur_size; +uniform float blur_fidelity; + +// Inputs +uniform vec4 morphFactor; +uniform vec3 camPosLocal; +//uniform vec4 camPosWorld; +uniform vec4 gamma; +uniform vec4 lightnorm; +uniform vec4 sunlight_color; +uniform vec4 ambient; +uniform vec4 blue_horizon; +uniform vec4 blue_density; +uniform vec4 haze_horizon; +uniform vec4 haze_density; +uniform vec4 cloud_shadow; +uniform vec4 density_multiplier; +uniform vec4 distance_multiplier; +uniform vec4 max_y; +uniform vec4 glow; +uniform float scene_light_strength; +uniform vec3 env_mat[3]; +//uniform mat4 shadow_matrix[3]; +//uniform vec4 shadow_clip; +uniform mat3 ssao_effect_mat; + +varying vec4 vary_light; +varying vec2 vary_fragcoord; + +vec3 vary_PositionEye; + +vec3 vary_SunlitColor; +vec3 vary_AmblitColor; +vec3 vary_AdditiveColor; +vec3 vary_AtmosAttenuation; + +uniform mat4 inv_proj; +uniform vec2 screen_res; + +vec4 getPosition_d(vec2 pos_screen, float depth) +{ +	vec2 sc = pos_screen.xy*2.0; +	sc /= screen_res; +	sc -= vec2(1.0,1.0); +	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); +	vec4 pos = inv_proj * ndc; +	pos /= pos.w; +	pos.w = 1.0; +	return pos; +} + +vec3 getPositionEye() +{ +	return vary_PositionEye; +} +vec3 getSunlitColor() +{ +	return vary_SunlitColor; +} +vec3 getAmblitColor() +{ +	return vary_AmblitColor; +} +vec3 getAdditiveColor() +{ +	return vary_AdditiveColor; +} +vec3 getAtmosAttenuation() +{ +	return vary_AtmosAttenuation; +} + + +void setPositionEye(vec3 v) +{ +	vary_PositionEye = v; +} + +void setSunlitColor(vec3 v) +{ +	vary_SunlitColor = v; +} + +void setAmblitColor(vec3 v) +{ +	vary_AmblitColor = v; +} + +void setAdditiveColor(vec3 v) +{ +	vary_AdditiveColor = v; +} + +void setAtmosAttenuation(vec3 v) +{ +	vary_AtmosAttenuation = v; +} + +void calcAtmospherics(vec3 inPositionEye, float ambFactor) { + +	vec3 P = inPositionEye; +	setPositionEye(P); +	 +	//(TERRAIN) limit altitude +	if (P.y > max_y.x) P *= (max_y.x / P.y); +	if (P.y < -max_y.x) P *= (-max_y.x / P.y); + +	vec3 tmpLightnorm = lightnorm.xyz; + +	vec3 Pn = normalize(P); +	float Plen = length(P); + +	vec4 temp1 = vec4(0); +	vec3 temp2 = vec3(0); +	vec4 blue_weight; +	vec4 haze_weight; +	vec4 sunlight = sunlight_color; +	vec4 light_atten; + +	//sunlight attenuation effect (hue and brightness) due to atmosphere +	//this is used later for sunlight modulation at various altitudes +	light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x); +		//I had thought blue_density and haze_density should have equal weighting, +		//but attenuation due to haze_density tends to seem too strong + +	temp1 = blue_density + vec4(haze_density.r); +	blue_weight = blue_density / temp1; +	haze_weight = vec4(haze_density.r) / temp1; + +	//(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain) +	temp2.y = max(0.0, tmpLightnorm.y); +	temp2.y = 1. / temp2.y; +	sunlight *= exp( - light_atten * temp2.y); + +	// main atmospheric scattering line integral +	temp2.z = Plen * density_multiplier.x; + +	// Transparency (-> temp1) +	// ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati +	// compiler gets confused. +	temp1 = exp(-temp1 * temp2.z * distance_multiplier.x); + +	//final atmosphere attenuation factor +	setAtmosAttenuation(temp1.rgb); +	 +	//compute haze glow +	//(can use temp2.x as temp because we haven't used it yet) +	temp2.x = dot(Pn, tmpLightnorm.xyz); +	temp2.x = 1. - temp2.x; +		//temp2.x is 0 at the sun and increases away from sun +	temp2.x = max(temp2.x, .03);	//was glow.y +		//set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) +	temp2.x *= glow.x; +		//higher glow.x gives dimmer glow (because next step is 1 / "angle") +	temp2.x = pow(temp2.x, glow.z); +		//glow.z should be negative, so we're doing a sort of (1 / "angle") function + +	//add "minimum anti-solar illumination" +	temp2.x += .25; +	 +	//increase ambient when there are more clouds +	vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5; +	 +	/*  decrease value and saturation (that in HSV, not HSL) for occluded areas +	 * // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html +	 * // The following line of code performs the equivalent of: +	 * float ambAlpha = tmpAmbient.a; +	 * float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis +	 * vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue); +	 * tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha); +	 */ +	tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a); + +	//haze color +	setAdditiveColor( +		vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient) +	  + (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x +		  + tmpAmbient))); + +	//brightness of surface both sunlight and ambient +	setSunlitColor(vec3(sunlight * .5)); +	setAmblitColor(vec3(tmpAmbient * .25)); +	setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1)); +} + +vec3 atmosLighting(vec3 light) +{ +	light *= getAtmosAttenuation().r; +	light += getAdditiveColor(); +	return (2.0 * light); +} + +vec3 atmosTransport(vec3 light) { +	light *= getAtmosAttenuation().r; +	light += getAdditiveColor() * 2.0; +	return light; +} +vec3 atmosGetDiffuseSunlightColor() +{ +	return getSunlitColor(); +} + +vec3 scaleDownLight(vec3 light) +{ +	return (light / scene_light_strength ); +} + +vec3 scaleUpLight(vec3 light) +{ +	return (light * scene_light_strength); +} + +vec3 atmosAmbient(vec3 light) +{ +	return getAmblitColor() + light / 2.0; +} + +vec3 atmosAffectDirectionalLight(float lightIntensity) +{ +	return getSunlitColor() * lightIntensity; +} + +vec3 scaleSoftClip(vec3 light) +{ +	//soft clip effect: +	light = 1. - clamp(light, vec3(0.), vec3(1.)); +	light = 1. - pow(light, gamma.xxx); + +	return light; +} + +vec4 texture2DMS(sampler2DMS tex, ivec2 tc) +{ +	vec4 ret = vec4(0,0,0,0); + +	for (int i = 0; i < samples; ++i) +	{ +		 ret += texelFetch(tex,tc,i); +	} + +	return ret/samples; +} + +void main()  +{ +	vec2 tc = vary_fragcoord.xy; +	ivec2 itc = ivec2(tc); + +	vec3 fcol = vec3(0,0,0); + +	for (int i = 0; i < samples; ++i) +	{ +		float depth = texelFetch(depthMap, itc, i).r; +		vec3 pos = getPosition_d(tc, depth).xyz; +		vec3 norm = texelFetch(normalMap, itc, i).xyz; + +		norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm +		//vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz; +	 +		float da = max(dot(norm.xyz, vary_light.xyz), 0.0); +	 +		vec4 diffuse = texelFetch(diffuseRect, itc, i); +		if (diffuse.a >= 1.0) +		{ +			fcol += diffuse.rgb; +		} +		else +		{ +			vec4 spec = texelFetch(specularRect, itc, i); +	 +			calcAtmospherics(pos.xyz, 1.0); +	 +			vec3 col = atmosAmbient(vec3(0)); +			col += atmosAffectDirectionalLight(max(min(da, 1.0), diffuse.a)); +	 +			col *= diffuse.rgb; +	 +			if (spec.a > 0.0) // specular reflection +			{ +				// the old infinite-sky shiny reflection +				// +				vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); +				float sa = dot(refnormpersp, vary_light.xyz); +				vec3 dumbshiny = vary_SunlitColor*texture2D(lightFunc, vec2(sa, spec.a)).a; + +				// add the two types of shiny together +				col += dumbshiny * spec.rgb; +			} + +			col = atmosLighting(col); +			col = scaleSoftClip(col); +			fcol += col; +		} +	} +				 +	gl_FragColor.rgb = fcol.rgb/samples; +	gl_FragColor.a = 0.0; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl index 9d187b46e2..745cc01992 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index 29fac46bfe..9aaffc15bf 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -5,7 +5,7 @@   * $/LicenseInfo$   */ -#version 120 +  #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl new file mode 100644 index 0000000000..4bb9bad275 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl @@ -0,0 +1,234 @@ +/**  + * @file multiSpotLightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + + + +//class 1 -- no shadows + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS diffuseRect; +uniform sampler2DMS specularRect; +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; +uniform sampler2D noiseMap; +uniform sampler2D lightFunc; +uniform sampler2D projectionMap; + +uniform mat4 proj_mat; //screen space to light space +uniform float proj_near; //near clip for projection +uniform vec3 proj_p; //plane projection is emitting from (in screen space) +uniform vec3 proj_n; +uniform float proj_focus; //distance from plane to begin blurring +uniform float proj_lod;  //(number of mips in proj map) +uniform float proj_range; //range between near clip and far clip plane of projection +uniform float proj_ambient_lod; +uniform float proj_ambiance; +uniform float near_clip; +uniform float far_clip; + +uniform vec3 proj_origin; //origin of projection to be used for angular attenuation +uniform float sun_wash; +uniform int proj_shadow_idx; +uniform float shadow_fade; + +varying vec4 vary_light; + +varying vec4 vary_fragcoord; +uniform vec2 screen_res; + +uniform mat4 inv_proj; + +vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) +{ +	vec4 ret = texture2DLod(projectionMap, tc, lod); +	 +	vec2 dist = tc-vec2(0.5); +	 +	float det = max(1.0-lod/(proj_lod*0.5), 0.0); +	 +	float d = dot(dist,dist); +		 +	ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0); +	 +	return ret; +} + +vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) +{ +	vec4 ret = texture2DLod(projectionMap, tc, lod); +	 +	vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); +	 +	float det = min(lod/(proj_lod*0.5), 1.0); +	 +	float d = min(dist.x, dist.y); +	 +	float edge = 0.25*det; +		 +	ret *= clamp(d/edge, 0.0, 1.0); +	 +	return ret; +} + +vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) +{ +	vec4 ret = texture2DLod(projectionMap, tc, lod); +	 +	vec2 dist = tc-vec2(0.5); +	 +	float d = dot(dist,dist); +		 +	ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0); +	 +	return ret; +} + + +vec4 getPosition(ivec2 pos_screen, int sample) +{ +	float depth = texelFetch(depthMap, pos_screen, sample).r; +	vec2 sc = vec2(pos_screen.xy)*2.0; +	sc /= screen_res; +	sc -= vec2(1.0,1.0); +	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); +	vec4 pos = inv_proj * ndc; +	pos /= pos.w; +	pos.w = 1.0; +	return pos; +} + +void main()  +{ +	vec4 frag = vary_fragcoord; +	frag.xyz /= frag.w; +	frag.xyz = frag.xyz*0.5+0.5; +	frag.xy *= screen_res; +	ivec2 itc = ivec2(frag.xy); + +	vec3 fcol = vec3(0,0,0); +	int wght = 0; +	 +	for (int i = 0; i < samples; ++i) +	{ +		vec3 pos = getPosition(itc, i).xyz; +		vec3 lv = vary_light.xyz-pos.xyz; +		float dist2 = dot(lv,lv); +		dist2 /= vary_light.w; +		if (dist2 <= 1.0) +		{ +			vec3 norm = texelFetch(normalMap, itc, i).xyz*2.0-1.0; +	 +			norm = normalize(norm); +			float l_dist = -dot(lv, proj_n); +	 +			vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); +			if (proj_tc.z >= 0.0) +			{ +				proj_tc.xyz /= proj_tc.w; +	 +				float fa = gl_Color.a+1.0; +				float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); +				if (dist_atten > 0.0) +				{ +					lv = proj_origin-pos.xyz; +					lv = normalize(lv); +					float da = dot(norm, lv); +		 +					vec3 col = vec3(0,0,0); +		 +					vec3 diff_tex = texelFetch(diffuseRect, itc, i).rgb; +		 +					float noise = texture2D(noiseMap, frag.xy/128.0).b; +					if (proj_tc.z > 0.0 && +						proj_tc.x < 1.0 && +						proj_tc.y < 1.0 && +						proj_tc.x > 0.0 && +						proj_tc.y > 0.0) +					{ +						float lit = 0.0; +						float amb_da = proj_ambiance; +		 +						if (da > 0.0) +						{ +							float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); +							float lod = diff * proj_lod; +			 +							vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); +		 +							vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; +			 +							lit = da * dist_atten * noise; +			 +							col = lcol*lit*diff_tex; +							amb_da += (da*0.5)*proj_ambiance; +						} +		 +						//float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); +						vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod); +							 +						amb_da += (da*da*0.5+0.5)*proj_ambiance; +				 +						amb_da *= dist_atten * noise; +			 +						amb_da = min(amb_da, 1.0-lit); +			 +						col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; +					} +	 +	 +					vec4 spec = texelFetch(specularRect, itc, i); +					if (spec.a > 0.0) +					{ +						vec3 ref = reflect(normalize(pos), norm); +		 +						//project from point pos in direction ref to plane proj_p, proj_n +						vec3 pdelta = proj_p-pos; +						float ds = dot(ref, proj_n); +		 +						if (ds < 0.0) +						{ +							vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; +			 +							vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); + +							if (stc.z > 0.0) +							{ +								stc.xy /= stc.w; + +								float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0); +				 +								stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5); +								 +								if (stc.x < 1.0 && +									stc.y < 1.0 && +									stc.x > 0.0 && +									stc.y > 0.0) +								{ +									vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); +									col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb; +								} +							} +						} +					} +	 +					fcol += col; +					++wght; +				} +			} +		} +	} + +	if (wght <= 0) +	{ +		discard; +	} + +	gl_FragColor.rgb = fcol/samples;	 +	gl_FragColor.a = 0.0; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl new file mode 100644 index 0000000000..2cf7d194cc --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl @@ -0,0 +1,19 @@ +/**  + * @file starsF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +uniform sampler2D diffuseMap; + +void main()  +{ +	vec4 col = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy); +	 +	gl_FragData[0] = col; +	gl_FragData[1] = vec4(0,0,0,0); +	gl_FragData[2] = vec4(0,0,1,0);	 +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl new file mode 100644 index 0000000000..c43125dad9 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl @@ -0,0 +1,17 @@ +/**  + * @file starsV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + + +void main() +{ +	//transform vertex +	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;  +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	gl_FrontColor = gl_Color; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl index d4d686bbb7..f20886565a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  //class 1, no shadow, no SSAO, should never be called diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl new file mode 100644 index 0000000000..f20886565a --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl @@ -0,0 +1,17 @@ +/**  + * @file sunLightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +//class 1, no shadow, no SSAO, should never be called + +#extension GL_ARB_texture_rectangle : enable + +void main()  +{ +	gl_FragColor = vec4(0,0,0,0); +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl index cdbed4b791..665d8126a0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl @@ -4,6 +4,8 @@   * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.   * $License$   */ +  +  #extension GL_ARB_texture_rectangle : enable @@ -13,8 +15,6 @@ uniform sampler2DRect depthMap;  uniform sampler2DRect normalMap;  uniform sampler2D noiseMap; -uniform sampler2D		lightFunc; -  // Inputs  uniform mat4 shadow_matrix[6]; @@ -35,7 +35,7 @@ uniform float shadow_offset;  vec4 getPosition(vec2 pos_screen)  { -	float depth = texture2DRect(depthMap, pos_screen.xy).a; +	float depth = texture2DRect(depthMap, pos_screen.xy).r;  	vec2 sc = pos_screen.xy*2.0;  	sc /= screen_res;  	sc -= vec2(1.0,1.0); @@ -51,57 +51,49 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm)  {  	float ret = 1.0; -	float dist = dot(pos.xyz,pos.xyz); -	 -	if (dist < 64.0*64.0) -	{ -		vec2 kern[8]; -		// exponentially (^2) distant occlusion samples spread around origin -		kern[0] = vec2(-1.0, 0.0) * 0.125*0.125; -		kern[1] = vec2(1.0, 0.0) * 0.250*0.250; -		kern[2] = vec2(0.0, 1.0) * 0.375*0.375; -		kern[3] = vec2(0.0, -1.0) * 0.500*0.500; -		kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625; -		kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750; -		kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875; -		kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000; +	vec2 kern[8]; +	// exponentially (^2) distant occlusion samples spread around origin +	kern[0] = vec2(-1.0, 0.0) * 0.125*0.125; +	kern[1] = vec2(1.0, 0.0) * 0.250*0.250; +	kern[2] = vec2(0.0, 1.0) * 0.375*0.375; +	kern[3] = vec2(0.0, -1.0) * 0.500*0.500; +	kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625; +	kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750; +	kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875; +	kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000; -		vec2 pos_screen = vary_fragcoord.xy; -		vec3 pos_world = pos.xyz; -		vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy; +	vec2 pos_screen = vary_fragcoord.xy; +	vec3 pos_world = pos.xyz; +	vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy; -		float angle_hidden = 0.0; -		int points = 0; +	float angle_hidden = 0.0; +	int points = 0; -		float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); +	float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); -		// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?) -		for (int i = 0; i < 8; i++) -		{ -			vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect); -			vec3 samppos_world = getPosition(samppos_screen).xyz;  +	// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations unrolling?) +	for (int i = 0; i < 8; i++) +	{ +		vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect); +		vec3 samppos_world = getPosition(samppos_screen).xyz;  -			vec3 diff = pos_world - samppos_world; -			float dist2 = dot(diff, diff); +		vec3 diff = pos_world - samppos_world; +		float dist2 = dot(diff, diff); -			// assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area -			// --> solid angle shrinking by the square of distance -			//radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2 -			//(k should vary inversely with # of samples, but this is taken care of later) +		// assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area +		// --> solid angle shrinking by the square of distance +		//radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2 +		//(k should vary inversely with # of samples, but this is taken care of later) -			//if (dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0)  // -0.05*norm to shift sample point back slightly for flat surfaces -			//	angle_hidden += min(1.0/dist2, ssao_factor_inv); // dist != 0 follows from conditional.  max of 1.0 (= ssao_factor_inv * ssao_factor) -			angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv); +		angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv); -			// 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion"  -			points = points + int(diff.z > -1.0); -		} +		// 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion"  +		points = points + int(diff.z > -1.0); +	} -		angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); +	angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); -		ret = (1.0 - (float(points != 0) * angle_hidden)); -		ret += max((dist-32.0*32.0)/(32.0*32.0), 0.0); -	} +	ret = (1.0 - (float(points != 0) * angle_hidden));  	return min(ret, 1.0);  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl new file mode 100644 index 0000000000..32d1b2149a --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl @@ -0,0 +1,123 @@ +/**  + * @file sunLightSSAOF.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ +  + + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +//class 1 -- no shadow, SSAO only + +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; +uniform sampler2D noiseMap; + + +// Inputs +uniform mat4 shadow_matrix[6]; +uniform vec4 shadow_clip; +uniform float ssao_radius; +uniform float ssao_max_radius; +uniform float ssao_factor; +uniform float ssao_factor_inv; + +varying vec2 vary_fragcoord; +varying vec4 vary_light; + +uniform mat4 inv_proj; +uniform vec2 screen_res; + +uniform float shadow_bias; +uniform float shadow_offset; + +vec4 getPosition(ivec2 pos_screen, int sample) +{ +	float depth = texelFetch(depthMap, pos_screen, sample).r; +	vec2 sc = pos_screen.xy*2.0; +	sc /= screen_res; +	sc -= vec2(1.0,1.0); +	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); +	vec4 pos = inv_proj * ndc; +	pos /= pos.w; +	pos.w = 1.0; +	return pos; +} + +//calculate decreases in ambient lighting when crowded out (SSAO) +float calcAmbientOcclusion(vec4 pos, vec3 norm, int sample) +{ +	float ret = 1.0; +	 +	vec2 kern[8]; +	// exponentially (^2) distant occlusion samples spread around origin +	kern[0] = vec2(-1.0, 0.0) * 0.125*0.125; +	kern[1] = vec2(1.0, 0.0) * 0.250*0.250; +	kern[2] = vec2(0.0, 1.0) * 0.375*0.375; +	kern[3] = vec2(0.0, -1.0) * 0.500*0.500; +	kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625; +	kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750; +	kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875; +	kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000; + +	vec2 pos_screen = vary_fragcoord.xy; +	vec3 pos_world = pos.xyz; +	vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy; +		 +	float angle_hidden = 0.0; +	int points = 0; +		 +	float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); +		 +	// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations unrolling?) +	for (int i = 0; i < 8; i++) +	{ +		ivec2 samppos_screen = ivec2(pos_screen + scale * reflect(kern[i], noise_reflect)); +		vec3 samppos_world = getPosition(samppos_screen, sample).xyz;  +			 +		vec3 diff = pos_world - samppos_world; +		float dist2 = dot(diff, diff); +			 +		// assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area +		// --> solid angle shrinking by the square of distance +		//radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2 +		//(k should vary inversely with # of samples, but this is taken care of later) +			 +		angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv); +			 +		// 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion"  +		points = points + int(diff.z > -1.0); +	} +		 +	angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); +		 +	ret = (1.0 - (float(points != 0) * angle_hidden)); +	 +	return min(ret, 1.0); +} + +void main()  +{ +	vec2 pos_screen = vary_fragcoord.xy; +	ivec2 itc = ivec2(pos_screen); +		 +	float col = 0; + +	for (int i = 0; i < samples; i++) +	{ +		vec4 pos = getPosition(itc, i); +		vec3 norm = texelFetch(normalMap, itc, i).xyz; +		norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm +		col += calcAmbientOcclusion(pos,norm,i); +	} + +	col /= samples; + +	gl_FragColor[0] = 1.0; +	gl_FragColor[1] = col; +	gl_FragColor[2] = 1.0;  +	gl_FragColor[3] = 1.0; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl index 9d092d9cea..814deb3677 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec4 vary_light;  varying vec2 vary_fragcoord; diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl index 9ba508a30c..d005f67bf6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D detail_0;  uniform sampler2D detail_1; diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl index 789e53b789..3038fd2966 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec3 vary_normal; diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl index 1c1725a95c..de7e038402 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl index 45832e350f..a9bef4292d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec3 vary_normal; diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl index ea531de24a..2710422d32 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl index e002d75ebe..5397290b11 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl index 2d40a19fa6..32f5f5f236 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl new file mode 100644 index 0000000000..9267a8585d --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl @@ -0,0 +1,38 @@ +/**  + * @file glowExtractF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS diffuseMap; +uniform float minLuminance; +uniform float maxExtractAlpha; +uniform vec3 lumWeights; +uniform vec3 warmthWeights; +uniform float warmthAmount; + +void main() +{ +	ivec2 itc = ivec2(gl_TexCoord[0].xy); +	vec4 fcol = vec4(0,0,0,0); + +	for (int i = 0; i < samples; i++) +	{ +		vec4 col = texelFetch(diffuseMap, itc, i);	 + +		/// CALCULATING LUMINANCE (Using NTSC lum weights) +		/// http://en.wikipedia.org/wiki/Luma_%28video%29 +		float lum = smoothstep(minLuminance, minLuminance+1.0, dot(col.rgb, lumWeights ) ); +		float warmth = smoothstep(minLuminance, minLuminance+1.0, max(col.r * warmthWeights.r, max(col.g * warmthWeights.g, col.b * warmthWeights.b)) );  +	 +		fcol += vec4(col.rgb, max(col.a, mix(lum, warmth, warmthAmount) * maxExtractAlpha)); +	} + +	gl_FragColor = fcol/samples; +} diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl index fe45898ed2..76736fed53 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl @@ -6,6 +6,7 @@   */ +  void main()   {  	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; diff --git a/indra/newview/app_settings/shaders/class1/effects/glowF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowF.glsl index 5b4e8b3ecc..d3225546b3 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowF.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap;  uniform float glowStrength; diff --git a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl index 97696e4719..9bb41626ae 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform vec2 glowDelta; diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl index 3a852239fb..cdc2ca3da2 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D detail0;  uniform sampler2D detail1; diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl index 0d781fd849..8af981915b 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl index 99c340d91a..d94d986581 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  // this class1 shader is just a copy of terrainF diff --git a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl index 66458ec66d..06854fcc0a 100644 --- a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap;  uniform sampler2D bumpMap;    diff --git a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl index 5f1fbee1df..0f24e3c35a 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  vec3 scaleSoftClip(vec3 inColor);  vec3 atmosTransport(vec3 inColor); diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl index e5eb25f3fa..630459b324 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  vec4 applyWaterFog(vec4 color)  { diff --git a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl index 608a7a5807..831d6a761c 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl index 5ac9e96601..f6c6d945de 100644 --- a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl index c5f69c4ad4..f114f766bf 100644 --- a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void main()  { diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl index ad128dae8d..1796730c92 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl index 1742b9fc1c..bfe0be9fdf 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl index 68b6603b4a..6f1fe91007 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl new file mode 100644 index 0000000000..19072cd052 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl @@ -0,0 +1,17 @@ +/**  + * @file lightFullbrightShinyWaterF.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +  + + +uniform sampler2D diffuseMap; +uniform samplerCube environmentMap; + +void fullbright_shiny_lighting_water()  +{ +	gl_FragColor = texture2D(diffuseMap, gl_TexCoord[0].xy); +} diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl index 693ed289f2..0ae6dc89e2 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl @@ -5,6 +5,8 @@   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl index b888e70325..5d4bf2c33e 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  float calcDirectionalLight(vec3 n, vec3 l)  { diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl index 4b6d95e177..574252af12 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  float calcDirectionalLight(vec3 n, vec3 l) diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl index b127b1f8ea..29f575b7e5 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl index 05ad3256af..65da5a6825 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl index b1a7cb46ff..d491f1102e 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  float calcDirectionalLight(vec3 n, vec3 l); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl index f6afa6a3ae..ef38ee9699 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  float calcDirectionalLight(vec3 n, vec3 l); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl index e5e6ddc2d8..286c92326b 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl index a0649aea88..772a420e33 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl @@ -4,6 +4,9 @@   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * $/LicenseInfo$   */ +   + +  float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da);  vec3 atmosAmbient(vec3 light);  vec3 atmosAffectDirectionalLight(float lightIntensity); diff --git a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl index c7d40d853f..da60a3ddf5 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  float calcDirectionalLight(vec3 n, vec3 l); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl index 9da4c2c92b..c0b72115dd 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void fullbright_lighting(); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyF.glsl index 1c8a9a1a30..391c06edc8 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void fullbright_shiny_lighting(); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl new file mode 100644 index 0000000000..f44a5ce32e --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl @@ -0,0 +1,39 @@ +/**  + * @file shinySimpleSkinnedV.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + + + +void calcAtmospherics(vec3 inPositionEye); +mat4 getObjectSkinnedTransform(); + +attribute vec4 object_weight; + +void main() +{ +	mat4 mat = getObjectSkinnedTransform(); +	 +	mat = gl_ModelViewMatrix * mat; +	vec3 pos = (mat*gl_Vertex).xyz; +	 +	vec4 norm = gl_Vertex; +	norm.xyz += gl_Normal.xyz; +	norm.xyz = (mat*norm).xyz; +	norm.xyz = normalize(norm.xyz-pos.xyz); +		 +	vec3 ref = reflect(pos.xyz, -norm.xyz); + +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0); + +	calcAtmospherics(pos.xyz); + +	gl_FrontColor = gl_Color; +	 +	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); +	 +	gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl index 032def63b3..31e0f0a429 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyWaterF.glsl new file mode 100644 index 0000000000..8ffb252f57 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyWaterF.glsl @@ -0,0 +1,15 @@ +/**  + * @file fullbrightShinyWaterF.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ +  + + +void fullbright_shiny_lighting_water(); + +void main()  +{ +	fullbright_shiny_lighting_water(); +} diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl new file mode 100644 index 0000000000..e5dafa8c78 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl @@ -0,0 +1,37 @@ +/**  + * @file fullbrightSkinnedV.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + + + +void calcAtmospherics(vec3 inPositionEye); +mat4 getObjectSkinnedTransform(); + +attribute vec4 object_weight; + +void main() +{ +	//transform vertex +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	 +	mat4 mat = getObjectSkinnedTransform(); +	 +	mat = gl_ModelViewMatrix * mat; +	vec3 pos = (mat*gl_Vertex).xyz; +	 +	vec4 norm = gl_Vertex; +	norm.xyz += gl_Normal.xyz; +	norm.xyz = (mat*norm).xyz; +	norm.xyz = normalize(norm.xyz-pos.xyz); +		 +	calcAtmospherics(pos.xyz); + +	gl_FrontColor = gl_Color; +	 +	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); +		 +	gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl index 914e417ca0..3382384c99 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightWaterF.glsl index df76e9e1eb..220f26614f 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightWaterF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void fullbright_lighting_water(); diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyF.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyF.glsl index 6bcd44506d..d079de5377 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinyF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void shiny_lighting(); diff --git a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl new file mode 100644 index 0000000000..cd655f3bb5 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl @@ -0,0 +1,39 @@ +/**  + * @file shinySimpleSkinnedV.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + + + +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +void calcAtmospherics(vec3 inPositionEye); +mat4 getObjectSkinnedTransform(); + +attribute vec4 object_weight; + +void main() +{ +	mat4 mat = getObjectSkinnedTransform(); +	 +	mat = gl_ModelViewMatrix * mat; +	vec3 pos = (mat*gl_Vertex).xyz; +	 +	vec4 norm = gl_Vertex; +	norm.xyz += gl_Normal.xyz; +	norm.xyz = (mat*norm).xyz; +	norm.xyz = normalize(norm.xyz-pos.xyz); +		 +	vec3 ref = reflect(pos.xyz, -norm.xyz); + +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0); + +	calcAtmospherics(pos.xyz); + +	vec4 color = calcLighting(pos.xyz, norm.xyz, gl_Color, vec4(0.)); +	gl_FrontColor = color; +	 +	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); +} diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl index 074892c98e..68a086dbc1 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void calcAtmospherics(vec3 inPositionEye); @@ -12,7 +14,7 @@ uniform vec4 origin;  void main()  {  	//transform vertex -	gl_Position = ftransform(); //gl_ModelViewProjectionMatrix * gl_Vertex; +	gl_Position = ftransform();  	vec4 pos = (gl_ModelViewMatrix * gl_Vertex);  	vec3 norm = normalize(gl_NormalMatrix * gl_Normal); diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyWaterF.glsl index 54b30573e7..4649d1c47c 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinyWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinyWaterF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void shiny_lighting_water(); diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleF.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleF.glsl index 61c2ce4272..b4e4dcfbbf 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleF.glsl @@ -4,7 +4,7 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ - +   void default_lighting();  void main()  diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl new file mode 100644 index 0000000000..900448035c --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl @@ -0,0 +1,39 @@ +/**  + * @file simpleSkinnedV.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + + + +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +void calcAtmospherics(vec3 inPositionEye); +mat4 getObjectSkinnedTransform(); + +attribute vec4 object_weight; + +void main() +{ +	//transform vertex +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	 +	mat4 mat = getObjectSkinnedTransform(); +	 +	mat = gl_ModelViewMatrix * mat; +	vec3 pos = (mat*gl_Vertex).xyz; +	 +	vec4 norm = gl_Vertex; +	norm.xyz += gl_Normal.xyz; +	norm.xyz = (mat*norm).xyz; +	norm.xyz = normalize(norm.xyz-pos.xyz); +		 +	calcAtmospherics(pos.xyz); + +	vec4 color = calcLighting(pos.xyz, norm.xyz, gl_Color, vec4(0.)); +	gl_FrontColor = color; +	 +	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); +	 +	gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl index ced1a4be01..b493f76fcc 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);  void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleWaterF.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleWaterF.glsl index 5e44212aed..4ec5ee43b4 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleWaterF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void default_lighting_water(); diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl index 7a05b8c8c6..3d05850ab3 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  vec3 atmosLighting(vec3 light)  { diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl index 874f2b4843..f1a0af21af 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  vec3 atmosAmbient(vec3 light)  { diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl index 7ead9ddf26..73bbd57315 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void setPositionEye(vec3 v); diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl index f6032f8d41..e0eb7b3767 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec3 vary_PositionEye; diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl index a696ddf607..a251213ff5 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec3 vary_PositionEye; diff --git a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl index 4a1899798a..4958cb2f72 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform vec4 gamma; diff --git a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl index b78b90545e..75929bc609 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  vec3 atmosTransport(vec3 light)  { diff --git a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl index 47300f0b39..3e8b719f93 100644 --- a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl +++ b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);  void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index e2d7cd94da..681e52de2a 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -4,15 +4,15 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  #extension GL_ARB_texture_rectangle : enable -uniform sampler2D diffuseMap;  uniform sampler2DRectShadow shadowMap0;  uniform sampler2DRectShadow shadowMap1;  uniform sampler2DRectShadow shadowMap2;  uniform sampler2DRectShadow shadowMap3; -uniform sampler2D noiseMap;  uniform sampler2DRect depthMap;  uniform mat4 shadow_matrix[6]; @@ -27,7 +27,7 @@ varying vec3 vary_ambient;  varying vec3 vary_directional;  varying vec3 vary_fragcoord;  varying vec3 vary_position; -varying vec3 vary_light; +varying vec3 vary_pointlight_col;  uniform float shadow_bias; @@ -68,8 +68,6 @@ void main()  	vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;  	frag *= screen_res; -	vec3 samp_pos = getPosition(frag).xyz; -	  	float shadow = 1.0;  	vec4 pos = vec4(vary_position, 1.0); @@ -106,16 +104,21 @@ void main()  		}  	} +	vec4 diff = diffuseLookup(gl_TexCoord[0].xy); +  	vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, gl_Color.a); -	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * col; +	vec4 color = diff * col;  	color.rgb = atmosLighting(color.rgb);  	color.rgb = scaleSoftClip(color.rgb); +	color.rgb += diff.rgb * vary_pointlight_col.rgb; +  	//gl_FragColor = gl_Color;  	gl_FragColor = color; -	//gl_FragColor = vec4(1,0,1,1)*shadow; +	//gl_FragColor.r = 0.0; +	//gl_FragColor = vec4(1,shadow,1,1);  } diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl index 5ecbbd2c4f..5350359f75 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl @@ -1,18 +1,20 @@  /**  - * @file avatarAlphaF.glsl + * @file alphaF.glsl   *   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  #extension GL_ARB_texture_rectangle : enable -uniform sampler2D diffuseMap;  uniform sampler2DRectShadow shadowMap0;  uniform sampler2DRectShadow shadowMap1;  uniform sampler2DRectShadow shadowMap2;  uniform sampler2DRectShadow shadowMap3; -uniform sampler2D noiseMap; +uniform sampler2DRect depthMap; +uniform sampler2D diffuseMap;  uniform mat4 shadow_matrix[6];  uniform vec4 shadow_clip; @@ -24,11 +26,27 @@ vec3 scaleSoftClip(vec3 light);  varying vec3 vary_ambient;  varying vec3 vary_directional; +varying vec3 vary_fragcoord;  varying vec3 vary_position; -varying vec3 vary_normal; +varying vec3 vary_pointlight_col;  uniform float shadow_bias; +uniform mat4 inv_proj; + +vec4 getPosition(vec2 pos_screen) +{ +	float depth = texture2DRect(depthMap, pos_screen.xy).a; +	vec2 sc = pos_screen.xy*2.0; +	sc /= screen_res; +	sc -= vec2(1.0,1.0); +	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); +	vec4 pos = inv_proj * ndc; +	pos.xyz /= pos.w; +	pos.w = 1.0; +	return pos; +} +  float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl)  {  	stc.xyz /= stc.w; @@ -45,16 +63,17 @@ float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl)  	return shadow/5.0;  } +  void main()   { +	vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; +	frag *= screen_res; +	  	float shadow = 1.0;  	vec4 pos = vec4(vary_position, 1.0); -	vec3 norm = normalize(vary_normal); -	//vec3 nz = texture2D(noiseMap, gl_FragCoord.xy/128.0).xyz; -  	vec4 spos = pos; -	 +		  	if (spos.z > -shadow_clip.w)  	{	  		vec4 lpos; @@ -86,13 +105,21 @@ void main()  		}  	} -	 -	vec4 col = vec4(vary_ambient + vary_directional*shadow, gl_Color.a);	 -	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * col; +	vec4 diff = texture2D(diffuseMap,gl_TexCoord[0].xy); + +	vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, gl_Color.a); +	vec4 color = diff * col;  	color.rgb = atmosLighting(color.rgb);  	color.rgb = scaleSoftClip(color.rgb); +	color.rgb += diff.rgb * vary_pointlight_col.rgb; + +	//gl_FragColor = gl_Color;  	gl_FragColor = color; +	//gl_FragColor.r = 0.0; +	//gl_FragColor = vec4(1,shadow,1,1); +	  } + diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl new file mode 100644 index 0000000000..948a52da5b --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl @@ -0,0 +1,115 @@ +/**  + * @file alphaSkinnedV.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ +  + + +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +void calcAtmospherics(vec3 inPositionEye); + +float calcDirectionalLight(vec3 n, vec3 l); +mat4 getObjectSkinnedTransform(); +vec3 atmosAmbient(vec3 light); +vec3 atmosAffectDirectionalLight(float lightIntensity); +vec3 scaleDownLight(vec3 light); +vec3 scaleUpLight(vec3 light); + +varying vec3 vary_ambient; +varying vec3 vary_directional; +varying vec3 vary_fragcoord; +varying vec3 vary_position; +varying vec3 vary_pointlight_col; + +uniform float near_clip; +uniform float shadow_offset; +uniform float shadow_bias; + +float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) +{ +	//get light vector +	vec3 lv = lp.xyz-v; +	 +	//get distance +	float d = length(lv); +	 +	float da = 0.0; + +	if (d > 0.0 && la > 0.0 && fa > 0.0) +	{ +		//normalize light vector +		lv *= 1.0/d; +	 +		//distance attenuation +		float dist2 = d*d/(la*la); +		da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + +		// spotlight coefficient. +		float spot = max(dot(-ln, lv), is_pointlight); +		da *= spot*spot; // GL_SPOT_EXPONENT=2 + +		//angular attenuation +		da *= calcDirectionalLight(n, lv); +	} + +	return da;	 +} + +void main() +{ +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	 +	mat4 mat = getObjectSkinnedTransform(); +	 +	mat = gl_ModelViewMatrix * mat; +	 +	vec3 pos = (mat*gl_Vertex).xyz; +	 +	gl_Position = gl_ProjectionMatrix * vec4(pos, 1.0); +	 +	vec4 n = gl_Vertex; +	n.xyz += gl_Normal.xyz; +	n.xyz = (mat*n).xyz; +	n.xyz = normalize(n.xyz-pos.xyz); +	 +	vec3 norm = n.xyz; +	 +	float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz)); +	vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset; +			 +	calcAtmospherics(pos.xyz); + +	//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); +	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a); + +	// Collect normal lights +	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a); +	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a); +	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a); +	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a); +	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a); +	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a); +	 +	vary_pointlight_col = col.rgb*gl_Color.rgb; + +	col.rgb = vec3(0,0,0); + +	// Add windlight lights +	col.rgb = atmosAmbient(vec3(0.)); +		 +	vary_ambient = col.rgb*gl_Color.rgb; +	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))); +	 +	col.rgb = min(col.rgb*gl_Color.rgb, 1.0); +	 +	gl_FrontColor = col; + +	gl_FogFragCoord = pos.z; +	 +	pos.xyz = (gl_ModelViewProjectionMatrix * gl_Vertex).xyz; +	vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); +	 +} + diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl index 45f727951e..f616ecc872 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl @@ -4,12 +4,13 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);  void calcAtmospherics(vec3 inPositionEye);  float calcDirectionalLight(vec3 n, vec3 l); -float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);  vec3 atmosAmbient(vec3 light);  vec3 atmosAffectDirectionalLight(float lightIntensity); @@ -20,20 +21,53 @@ varying vec3 vary_ambient;  varying vec3 vary_directional;  varying vec3 vary_fragcoord;  varying vec3 vary_position; -varying vec3 vary_light; +varying vec3 vary_pointlight_col; +varying float vary_texture_index;  uniform float near_clip;  uniform float shadow_offset;  uniform float shadow_bias; +float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) +{ +	//get light vector +	vec3 lv = lp.xyz-v; +	 +	//get distance +	float d = length(lv); +	 +	float da = 0.0; + +	if (d > 0.0 && la > 0.0 && fa > 0.0) +	{ +		//normalize light vector +		lv *= 1.0/d; +	 +		//distance attenuation +		float dist2 = d*d/(la*la); +		da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + +		// spotlight coefficient. +		float spot = max(dot(-ln, lv), is_pointlight); +		da *= spot*spot; // GL_SPOT_EXPONENT=2 + +		//angular attenuation +		da *= calcDirectionalLight(n, lv); +	} + +	return da;	 +} +  void main()  {  	//transform vertex -	gl_Position = ftransform();  +	vec4 vert = vec4(gl_Vertex.xyz, 1.0); +	vary_texture_index = gl_Vertex.w; +	gl_Position = gl_ModelViewProjectionMatrix * vert;   	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; -	vec4 pos = (gl_ModelViewMatrix * gl_Vertex); +	vec4 pos = (gl_ModelViewMatrix * vert);  	vec3 norm = normalize(gl_NormalMatrix * gl_Normal);  	float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz)); @@ -44,31 +78,31 @@ void main()  	//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));  	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a); -	// Collect normal lights (need to be divided by two, as we later multiply by 2) -	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a); -	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].specular.a); -	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].specular.a); -	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].specular.a); -	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].specular.a); -	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].specular.a); -	col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz); -	col.rgb = scaleDownLight(col.rgb); +	// Collect normal lights +	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a); +	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a); +	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a); +	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a); +	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a); +	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a); +	vary_pointlight_col = col.rgb*gl_Color.rgb; + +	col.rgb = vec3(0,0,0); +  	// Add windlight lights -	col.rgb += atmosAmbient(vec3(0.)); -	 -	vary_light = gl_LightSource[0].position.xyz; +	col.rgb = atmosAmbient(vec3(0.));  	vary_ambient = col.rgb*gl_Color.rgb;  	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))); -	col.rgb = min(col.rgb*gl_Color.rgb, 1.0); +	col.rgb = col.rgb*gl_Color.rgb;  	gl_FrontColor = col;  	gl_FogFragCoord = pos.z; -	pos = gl_ModelViewProjectionMatrix * gl_Vertex; +	pos = gl_ModelViewProjectionMatrix * vert;  	vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);  } diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl index d7d1111ba8..01e40afc4f 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);  mat4 getSkinnedTransform(); @@ -20,12 +22,43 @@ vec3 scaleUpLight(vec3 light);  varying vec3 vary_position;  varying vec3 vary_ambient;  varying vec3 vary_directional; -varying vec3 vary_normal; +varying vec3 vary_fragcoord; +varying vec3 vary_pointlight_col;  uniform float near_clip;  uniform float shadow_offset;  uniform float shadow_bias; +float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) +{ +	//get light vector +	vec3 lv = lp.xyz-v; +	 +	//get distance +	float d = length(lv); +	 +	float da = 0.0; + +	if (d > 0.0 && la > 0.0 && fa > 0.0) +	{ +		//normalize light vector +		lv *= 1.0/d; +	 +		//distance attenuation +		float dist2 = d*d/(la*la); +		da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + +		// spotlight coefficient. +		float spot = max(dot(-ln, lv), is_pointlight); +		da *= spot*spot; // GL_SPOT_EXPONENT=2 + +		//angular attenuation +		da *= calcDirectionalLight(n, lv); +	} + +	return da;	 +} +  void main()  {  	gl_TexCoord[0] = gl_MultiTexCoord0; @@ -48,7 +81,6 @@ void main()  	float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz));  	vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset; -	vary_normal = norm;	  	calcAtmospherics(pos.xyz); @@ -56,18 +88,20 @@ void main()  	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a); -	// Collect normal lights (need to be divided by two, as we later multiply by 2) -	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a); -	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].specular.a); -	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].specular.a); -	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].specular.a); -	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].specular.a); -	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].specular.a); -	col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz); -	col.rgb = scaleDownLight(col.rgb); +	// Collect normal lights +	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a); +	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a); +	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a); +	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a); +	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a); +	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a); +	vary_pointlight_col = col.rgb*gl_Color.rgb; + +	col.rgb = vec3(0,0,0); +  	// Add windlight lights -	col.rgb += atmosAmbient(vec3(0.)); +	col.rgb = atmosAmbient(vec3(0.));  	vary_ambient = col.rgb*gl_Color.rgb;  	vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); @@ -77,7 +111,7 @@ void main()  	gl_FrontColor = col;  	gl_FogFragCoord = pos.z; - +	vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);  } diff --git a/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl deleted file mode 100644 index 258a9b7c40..0000000000 --- a/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl +++ /dev/null @@ -1,81 +0,0 @@ -/**  - * @file blurLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * $/LicenseInfo$ - */ - -#extension GL_ARB_texture_rectangle : enable - -uniform sampler2DRect depthMap; -uniform sampler2DRect normalMap; -uniform sampler2DRect lightMap; - -uniform float dist_factor; -uniform float blur_size; -uniform vec2 delta; -uniform vec3 kern[4]; -uniform float kern_scale; - -varying vec2 vary_fragcoord; - -uniform mat4 inv_proj; -uniform vec2 screen_res; - -vec4 getPosition(vec2 pos_screen) -{ -	float depth = texture2DRect(depthMap, pos_screen.xy).a; -	vec2 sc = pos_screen.xy*2.0; -	sc /= screen_res; -	sc -= vec2(1.0,1.0); -	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); -	vec4 pos = inv_proj * ndc; -	pos /= pos.w; -	pos.w = 1.0; -	return pos; -} - -void main()  -{ -	vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz; -	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm -	vec3 pos = getPosition(vary_fragcoord.xy).xyz; -	vec4 ccol = texture2DRect(lightMap, vary_fragcoord.xy).rgba; -	 -	vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); -	 -	dlt /= max(-pos.z*dist_factor, 1.0); -	 -	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' -	vec4 col = defined_weight.xyxx * ccol; -	 -	for (int i = 1; i < 4; i++) -	{ -		vec2 tc = vary_fragcoord.xy + kern[i].z*dlt; -	        vec3 samppos = getPosition(tc).xyz;  -		float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane -		if (d*d <= 0.003) -		{ -			col += texture2DRect(lightMap, tc)*kern[i].xyxx; -			defined_weight += kern[i].xy; -		} -	} -	for (int i = 1; i < 4; i++) -	{ -		vec2 tc = vary_fragcoord.xy - kern[i].z*dlt; -	        vec3 samppos = getPosition(tc).xyz;  -		float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane -		if (d*d <= 0.003) -		{ -			col += texture2DRect(lightMap, tc)*kern[i].xyxx; -			defined_weight += kern[i].xy; -		} -	} - - - -	col /= defined_weight.xyxx; -	 -	gl_FragColor = col; -} - diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl index ff32a15c54..729e4b5543 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl @@ -4,14 +4,14 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  #extension GL_ARB_texture_rectangle : enable  uniform sampler2DRect depthMap;  uniform sampler2DRect normalMap; -uniform float gi_dist_cutoff; -  varying vec2 vary_fragcoord;  uniform float depth_cutoff; @@ -22,7 +22,7 @@ uniform vec2 screen_res;  float getDepth(vec2 pos_screen)  { -	float z = texture2DRect(depthMap, pos_screen.xy).a; +	float z = texture2DRect(depthMap, pos_screen.xy).r;  	z = z*2.0-1.0;  	vec4 ndc = vec4(0.0, 0.0, z, 1.0);  	vec4 p = inv_proj*ndc; diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl new file mode 100644 index 0000000000..b22bc5b288 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl @@ -0,0 +1,74 @@ +/**  + * @file edgeF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; + +varying vec2 vary_fragcoord; + +uniform float depth_cutoff; +uniform float norm_cutoff; + +uniform mat4 inv_proj; +uniform vec2 screen_res; + +float getDepth(ivec2 pos_screen, int sample) +{ +	float z = texelFetch(depthMap, pos_screen, sample).r; +	z = z*2.0-1.0; +	vec4 ndc = vec4(0.0, 0.0, z, 1.0); +	vec4 p = inv_proj*ndc; +	return p.z/p.w; +} + +void main()  +{ +	float e = 0; +	 +	ivec2 itc = ivec2(vary_fragcoord.xy); + +	for (int i = 0; i < samples; i++) +	{	 +		vec3 norm = texelFetch(normalMap, itc, i).xyz; +		norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm +		float depth = getDepth(itc, i); +	 +		vec2 tc = vary_fragcoord.xy; +	 +		int sc = 1; +	 +		vec2 de; +		de.x = (depth-getDepth(itc+ivec2(sc, sc),i)) + (depth-getDepth(itc+ivec2(-sc, -sc), i)); +		de.y = (depth-getDepth(itc+ivec2(-sc, sc),i)) + (depth-getDepth(itc+ivec2(sc, -sc), i)); +		de /= depth; +		de *= de; +		de = step(depth_cutoff, de); +	 +		vec2 ne; +		vec3 nexnorm = texelFetch(normalMap, itc+ivec2(-sc,-sc), i).rgb; +		nexnorm = vec3((nexnorm.xy-0.5)*2.0,nexnorm.z); // unpack norm +		ne.x = dot(nexnorm, norm); +		vec3 neynorm = texelFetch(normalMap, itc+ivec2(sc,sc), i).rgb; +		neynorm = vec3((neynorm.xy-0.5)*2.0,neynorm.z); // unpack norm +		ne.y = dot(neynorm, norm); +	 +		ne = 1.0-ne; +	 +		ne = step(norm_cutoff, ne); + +		e += dot(de,de)+dot(ne,ne); +	} + +	e /= samples; +	 +	gl_FragColor.a = e; +} diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl index 74f2bd9818..393084a3db 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec2 vary_fragcoord;  uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index d6cd984ebe..f54186ffca 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -5,7 +5,7 @@   * $/LicenseInfo$   */ -#version 120 +  #extension GL_ARB_texture_rectangle : enable @@ -91,7 +91,7 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)  vec4 getPosition(vec2 pos_screen)  { -	float depth = texture2DRect(depthMap, pos_screen.xy).a; +	float depth = texture2DRect(depthMap, pos_screen.xy).r;  	vec2 sc = pos_screen.xy*2.0;  	sc /= screen_res;  	sc -= vec2(1.0,1.0); diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl new file mode 100644 index 0000000000..fee32be3e3 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl @@ -0,0 +1,244 @@ +/**  + * @file multiSpotLightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + + + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS diffuseRect; +uniform sampler2DMS specularRect; +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; +uniform sampler2DRect lightMap; +uniform sampler2D noiseMap; +uniform sampler2D lightFunc; +uniform sampler2D projectionMap; + +uniform mat4 proj_mat; //screen space to light space +uniform float proj_near; //near clip for projection +uniform vec3 proj_p; //plane projection is emitting from (in screen space) +uniform vec3 proj_n; +uniform float proj_focus; //distance from plane to begin blurring +uniform float proj_lod;  //(number of mips in proj map) +uniform float proj_range; //range between near clip and far clip plane of projection +uniform float proj_ambient_lod; +uniform float proj_ambiance; +uniform float near_clip; +uniform float far_clip; + +uniform vec3 proj_origin; //origin of projection to be used for angular attenuation +uniform float sun_wash; +uniform int proj_shadow_idx; +uniform float shadow_fade; + +varying vec4 vary_light; + +varying vec4 vary_fragcoord; +uniform vec2 screen_res; + +uniform mat4 inv_proj; + +vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) +{ +	vec4 ret = texture2DLod(projectionMap, tc, lod); +	 +	vec2 dist = tc-vec2(0.5); +	 +	float det = max(1.0-lod/(proj_lod*0.5), 0.0); +	 +	float d = dot(dist,dist); +		 +	ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0); +	 +	return ret; +} + +vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) +{ +	vec4 ret = texture2DLod(projectionMap, tc, lod); +	 +	vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); +	 +	float det = min(lod/(proj_lod*0.5), 1.0); +	 +	float d = min(dist.x, dist.y); +	 +	float edge = 0.25*det; +		 +	ret *= clamp(d/edge, 0.0, 1.0); +	 +	return ret; +} + +vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) +{ +	vec4 ret = texture2DLod(projectionMap, tc, lod); +	 +	vec2 dist = tc-vec2(0.5); +	 +	float d = dot(dist,dist); +		 +	ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0); +	 +	return ret; +} + + +vec4 getPosition(ivec2 pos_screen, int sample) +{ +	float depth = texelFetch(depthMap, pos_screen, sample).r; +	vec2 sc = vec2(pos_screen.xy)*2.0; +	sc /= screen_res; +	sc -= vec2(1.0,1.0); +	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); +	vec4 pos = inv_proj * ndc; +	pos /= pos.w; +	pos.w = 1.0; +	return pos; +} + +void main()  +{ +	int wght = 0; + +	vec3 fcol = vec3(0,0,0); + +	vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res; +	 +	ivec2 itc = ivec2(frag.xy); + +	float shadow = 1.0; + +	if (proj_shadow_idx >= 0) +	{ +		vec4 shd = texture2DRect(lightMap, frag); +		float sh[2]; +		sh[0] = shd.b; +		sh[1] = shd.a; +		shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0); +	} +		 +	for (int i = 0; i < samples; i++) +	{ +		vec3 pos = getPosition(itc, i).xyz; +		vec3 lv = vary_light.xyz-pos.xyz; +		float dist2 = dot(lv,lv); +		dist2 /= vary_light.w; +		if (dist2 <= 1.0) +		{ +			vec3 norm = texelFetch(normalMap, itc, i).xyz; +			norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm +	 +			norm = normalize(norm); +			float l_dist = -dot(lv, proj_n); +	 +			vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); +			if (proj_tc.z >= 0.0) +			{ +				proj_tc.xyz /= proj_tc.w; +	 +				float fa = gl_Color.a+1.0; +				float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); +				if (dist_atten > 0.0) +				{ +					lv = proj_origin-pos.xyz; +					lv = normalize(lv); +					float da = dot(norm, lv); +		 +					vec3 col = vec3(0,0,0); +		 +					vec3 diff_tex = texelFetch(diffuseRect, itc, i).rgb; +		 +					float noise = texture2D(noiseMap, frag.xy/128.0).b; +					if (proj_tc.z > 0.0 && +						proj_tc.x < 1.0 && +						proj_tc.y < 1.0 && +						proj_tc.x > 0.0 && +						proj_tc.y > 0.0) +					{ +						float lit = 0.0; +						float amb_da = proj_ambiance; +		 +						if (da > 0.0) +						{ +							float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); +							float lod = diff * proj_lod; +			 +							vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); +		 +							vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; +			 +							lit = da * dist_atten * noise; +			 +							col = lcol*lit*diff_tex*shadow; +							amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance; +						} +		 +						//float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); +						vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod); +							 +						amb_da += (da*da*0.5+0.5)*proj_ambiance; +				 +						amb_da *= dist_atten * noise; +			 +						amb_da = min(amb_da, 1.0-lit); +			 +						col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; +					} +	 +	 +					vec4 spec = texelFetch(specularRect, itc, i); +					if (spec.a > 0.0) +					{ +						vec3 ref = reflect(normalize(pos), norm); +		 +						//project from point pos in direction ref to plane proj_p, proj_n +						vec3 pdelta = proj_p-pos; +						float ds = dot(ref, proj_n); +		 +						if (ds < 0.0) +						{ +							vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; +			 +							vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); + +							if (stc.z > 0.0) +							{ +								stc.xy /= stc.w; + +								float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0); +				 +								stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5); +								 +								if (stc.x < 1.0 && +									stc.y < 1.0 && +									stc.x > 0.0 && +									stc.y > 0.0) +								{ +									vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); +									col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow; +								} +							} +						} +					} + +					fcol += col; +					wght++; +				} +			} +		} +	} +	 +	if (wght <= 0) +	{ +		discard; +	} + +	gl_FragColor.rgb = fcol/samples;	 +	gl_FragColor.a = 0.0; +} diff --git a/indra/newview/app_settings/shaders/class2/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class2/deferred/postDeferredF.glsl deleted file mode 100644 index 757e3e7aab..0000000000 --- a/indra/newview/app_settings/shaders/class2/deferred/postDeferredF.glsl +++ /dev/null @@ -1,59 +0,0 @@ -/**  - * @file postDeferredF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * $/LicenseInfo$ - */ - -uniform sampler2DRect diffuseRect; -uniform sampler2DRect localLightMap; -uniform sampler2DRect sunLightMap; -uniform sampler2DRect giLightMap; -uniform sampler2D	  luminanceMap; -uniform sampler2DRect lightMap; - -uniform vec3 gi_lum_quad; -uniform vec3 sun_lum_quad; -uniform vec3 lum_quad; -uniform float lum_lod; -uniform vec4 ambient; - -uniform vec3 gi_quad; - -uniform vec2 screen_res; -varying vec2 vary_fragcoord; - -void main()  -{ -	vec2 tc = vary_fragcoord.xy; -	vec3 lcol = texture2DLod(luminanceMap, tc/screen_res, lum_lod).rgb; - -	float lum = sqrt(lcol.r)*lum_quad.x+lcol.r*lcol.r*lum_quad.y+lcol.r*lum_quad.z; -	 -	vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); - -	float ambocc = texture2DRect(lightMap, vary_fragcoord.xy).g; -			 -	vec3 gi_col = texture2DRect(giLightMap, vary_fragcoord.xy).rgb; -	gi_col = gi_col*gi_col*gi_quad.x + gi_col*gi_quad.y+gi_quad.z*ambocc*ambient.rgb; -	gi_col *= diff; -	 -	vec4 sun_col =	texture2DRect(sunLightMap, vary_fragcoord.xy); -	 -	vec3 local_col = texture2DRect(localLightMap, vary_fragcoord.xy).rgb; -		 - -	float sun_lum = 1.0-lum; -	sun_lum = sun_lum*sun_lum*sun_lum_quad.x + sun_lum*sun_lum_quad.y+sun_lum_quad.z; -		 -	float gi_lum = lum; -	gi_lum = gi_lum*gi_lum*gi_lum_quad.x+gi_lum*gi_lum_quad.y+gi_lum_quad.z; -	gi_col *= 1.0/gi_lum; -		 -	vec3 col = sun_col.rgb*(1.0+max(sun_lum,0.0))+gi_col+local_col; -	 -	gl_FragColor.rgb = col.rgb; -	gl_FragColor.a = max(sun_lum*min(sun_col.r+sun_col.g+sun_col.b, 1.0), sun_col.a); -	 -	//gl_FragColor.rgb = texture2DRect(giLightMap, vary_fragcoord.xy).rgb; -} diff --git a/indra/newview/app_settings/shaders/class2/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class2/deferred/postDeferredV.glsl deleted file mode 100644 index 0ec81dcb02..0000000000 --- a/indra/newview/app_settings/shaders/class2/deferred/postDeferredV.glsl +++ /dev/null @@ -1,17 +0,0 @@ -/**  - * @file postDeferredV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * $/LicenseInfo$ - */ - -varying vec2 vary_fragcoord; -uniform vec2 screen_res; - -void main() -{ -	//transform vertex -	gl_Position = ftransform();  -	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; -	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; -} diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 1067be1e6e..66a1a8515f 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  #extension GL_ARB_texture_rectangle : enable @@ -69,7 +71,7 @@ vec4 getPosition_d(vec2 pos_screen, float depth)  vec4 getPosition(vec2 pos_screen)  { //get position in screen space (world units) given window coordinate and depth map -	float depth = texture2DRect(depthMap, pos_screen.xy).a; +	float depth = texture2DRect(depthMap, pos_screen.xy).r;  	return getPosition_d(pos_screen, depth);  } @@ -256,7 +258,7 @@ vec3 scaleSoftClip(vec3 light)  void main()   {  	vec2 tc = vary_fragcoord.xy; -	float depth = texture2DRect(depthMap, tc.xy).a; +	float depth = texture2DRect(depthMap, tc.xy).r;  	vec3 pos = getPosition_d(tc, depth).xyz;  	vec3 norm = texture2DRect(normalMap, tc).xyz;  	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm @@ -286,54 +288,8 @@ void main()  		float sa = dot(refnormpersp, vary_light.xyz);  		vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a; -		/* -		// screen-space cheap fakey reflection map -		// -		vec3 refnorm = normalize(reflect(vec3(0,0,-1), norm.xyz)); -		depth -= 0.5; // unbias depth -		// first figure out where we'll make our 2D guess from -		vec2 ref2d = (0.25 * screen_res.y) * (refnorm.xy) * abs(refnorm.z) / depth; -		// Offset the guess source a little according to a trivial -		// checkerboard dither function and spec.a. -		// This is meant to be similar to sampling a blurred version -		// of the diffuse map.  LOD would be better in that regard. -		// The goal of the blur is to soften reflections in surfaces -		// with low shinyness, and also to disguise our lameness. -		float checkerboard = floor(mod(tc.x+tc.y, 2.0)); // 0.0, 1.0 -		float checkoffset = (3.0 + (7.0*(1.0-spec.a)))*(checkerboard-0.5); -		ref2d += vec2(checkoffset, checkoffset); -		ref2d += tc.xy; // use as offset from destination -		// Get attributes from the 2D guess point. -		// We average two samples of diffuse (not of anything else) per -		// pixel to try to reduce aliasing some more. -		vec3 refcol = 0.5 * (texture2DRect(diffuseRect, ref2d + vec2(0.0, -checkoffset)).rgb + -				     texture2DRect(diffuseRect, ref2d + vec2(-checkoffset, 0.0)).rgb); -		float refdepth = texture2DRect(depthMap, ref2d).a; -		vec3 refpos = getPosition_d(ref2d, refdepth).xyz; -		float refshad = texture2DRect(lightMap, ref2d).r; -		vec3 refn = texture2DRect(normalMap, ref2d).rgb; -		refn = vec3((refn.xy-0.5)*2.0,refn.z); // unpack norm -		refn = normalize(refn); -		// figure out how appropriate our guess actually was -		float refapprop = max(0.0, dot(-refnorm, normalize(pos - refpos))); -		// darken reflections from points which face away from the reflected ray - our guess was a back-face -		//refapprop *= step(dot(refnorm, refn), 0.0); -		refapprop = min(refapprop, max(0.0, -dot(refnorm, refn))); // more conservative variant -		// get appropriate light strength for guess-point -		// reflect light direction to increase the illusion that -		// these are reflections. -		vec3 reflight = reflect(lightnorm.xyz, norm.xyz); -		float reflit = min(max(dot(refn, reflight.xyz), 0.0), refshad); -		// apply sun color to guess-point, dampen according to inappropriateness of guess -		float refmod = min(refapprop, reflit); -		vec3 refprod = vary_SunlitColor * refcol.rgb * refmod; -		vec3 ssshiny = (refprod * spec.a); -		ssshiny *= 0.3; // dampen it even more -		*/ -		vec3 ssshiny = vec3(0,0,0); -  		// add the two types of shiny together -		col += (ssshiny + dumbshiny) * spec.rgb; +		col += dumbshiny * spec.rgb;  	}  	col = atmosLighting(col); diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl new file mode 100644 index 0000000000..0bae10ca7d --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl @@ -0,0 +1,307 @@ +/**  + * @file softenLightMSF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS diffuseRect; +uniform sampler2DMS specularRect; +uniform sampler2DMS normalMap; +uniform sampler2DRect lightMap; +uniform sampler2DMS depthMap; +uniform sampler2D	  noiseMap; +uniform samplerCube environmentMap; +uniform sampler2D	  lightFunc; +uniform vec3 gi_quad; + +uniform float blur_size; +uniform float blur_fidelity; + +// Inputs +uniform vec4 morphFactor; +uniform vec3 camPosLocal; +//uniform vec4 camPosWorld; +uniform vec4 gamma; +uniform vec4 lightnorm; +uniform vec4 sunlight_color; +uniform vec4 ambient; +uniform vec4 blue_horizon; +uniform vec4 blue_density; +uniform vec4 haze_horizon; +uniform vec4 haze_density; +uniform vec4 cloud_shadow; +uniform vec4 density_multiplier; +uniform vec4 distance_multiplier; +uniform vec4 max_y; +uniform vec4 glow; +uniform float scene_light_strength; +uniform vec3 env_mat[3]; +uniform vec4 shadow_clip; +uniform mat3 ssao_effect_mat; + +uniform mat4 inv_proj; +uniform vec2 screen_res; + +varying vec4 vary_light; +varying vec2 vary_fragcoord; + +vec3 vary_PositionEye; + +vec3 vary_SunlitColor; +vec3 vary_AmblitColor; +vec3 vary_AdditiveColor; +vec3 vary_AtmosAttenuation; + +vec4 getPosition_d(vec2 pos_screen, float depth) +{ +	vec2 sc = pos_screen.xy*2.0; +	sc /= screen_res; +	sc -= vec2(1.0,1.0); +	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); +	vec4 pos = inv_proj * ndc; +	pos /= pos.w; +	pos.w = 1.0; +	return pos; +} + +vec3 getPositionEye() +{ +	return vary_PositionEye; +} +vec3 getSunlitColor() +{ +	return vary_SunlitColor; +} +vec3 getAmblitColor() +{ +	return vary_AmblitColor; +} +vec3 getAdditiveColor() +{ +	return vary_AdditiveColor; +} +vec3 getAtmosAttenuation() +{ +	return vary_AtmosAttenuation; +} + + +void setPositionEye(vec3 v) +{ +	vary_PositionEye = v; +} + +void setSunlitColor(vec3 v) +{ +	vary_SunlitColor = v; +} + +void setAmblitColor(vec3 v) +{ +	vary_AmblitColor = v; +} + +void setAdditiveColor(vec3 v) +{ +	vary_AdditiveColor = v; +} + +void setAtmosAttenuation(vec3 v) +{ +	vary_AtmosAttenuation = v; +} + +void calcAtmospherics(vec3 inPositionEye, float ambFactor) { + +	vec3 P = inPositionEye; +	setPositionEye(P); +	 +	//(TERRAIN) limit altitude +	if (P.y > max_y.x) P *= (max_y.x / P.y); +	if (P.y < -max_y.x) P *= (-max_y.x / P.y); + +	vec3 tmpLightnorm = lightnorm.xyz; + +	vec3 Pn = normalize(P); +	float Plen = length(P); + +	vec4 temp1 = vec4(0); +	vec3 temp2 = vec3(0); +	vec4 blue_weight; +	vec4 haze_weight; +	vec4 sunlight = sunlight_color; +	vec4 light_atten; + +	//sunlight attenuation effect (hue and brightness) due to atmosphere +	//this is used later for sunlight modulation at various altitudes +	light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x); +		//I had thought blue_density and haze_density should have equal weighting, +		//but attenuation due to haze_density tends to seem too strong + +	temp1 = blue_density + vec4(haze_density.r); +	blue_weight = blue_density / temp1; +	haze_weight = vec4(haze_density.r) / temp1; + +	//(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain) +	temp2.y = max(0.0, tmpLightnorm.y); +	temp2.y = 1. / temp2.y; +	sunlight *= exp( - light_atten * temp2.y); + +	// main atmospheric scattering line integral +	temp2.z = Plen * density_multiplier.x; + +	// Transparency (-> temp1) +	// ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati +	// compiler gets confused. +	temp1 = exp(-temp1 * temp2.z * distance_multiplier.x); + +	//final atmosphere attenuation factor +	setAtmosAttenuation(temp1.rgb); +	 +	//compute haze glow +	//(can use temp2.x as temp because we haven't used it yet) +	temp2.x = dot(Pn, tmpLightnorm.xyz); +	temp2.x = 1. - temp2.x; +		//temp2.x is 0 at the sun and increases away from sun +	temp2.x = max(temp2.x, .03);	//was glow.y +		//set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) +	temp2.x *= glow.x; +		//higher glow.x gives dimmer glow (because next step is 1 / "angle") +	temp2.x = pow(temp2.x, glow.z); +		//glow.z should be negative, so we're doing a sort of (1 / "angle") function + +	//add "minimum anti-solar illumination" +	temp2.x += .25; +	 +	//increase ambient when there are more clouds +	vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5; +	 +	/*  decrease value and saturation (that in HSV, not HSL) for occluded areas +	 * // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html +	 * // The following line of code performs the equivalent of: +	 * float ambAlpha = tmpAmbient.a; +	 * float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis +	 * vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue); +	 * tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha); +	 */ +	tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a); + +	//haze color +	setAdditiveColor( +		vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient) +	  + (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x +		  + tmpAmbient))); + +	//brightness of surface both sunlight and ambient +	setSunlitColor(vec3(sunlight * .5)); +	setAmblitColor(vec3(tmpAmbient * .25)); +	setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1)); +} + +vec3 atmosLighting(vec3 light) +{ +	light *= getAtmosAttenuation().r; +	light += getAdditiveColor(); +	return (2.0 * light); +} + +vec3 atmosTransport(vec3 light) { +	light *= getAtmosAttenuation().r; +	light += getAdditiveColor() * 2.0; +	return light; +} +vec3 atmosGetDiffuseSunlightColor() +{ +	return getSunlitColor(); +} + +vec3 scaleDownLight(vec3 light) +{ +	return (light / scene_light_strength ); +} + +vec3 scaleUpLight(vec3 light) +{ +	return (light * scene_light_strength); +} + +vec3 atmosAmbient(vec3 light) +{ +	return getAmblitColor() + light / 2.0; +} + +vec3 atmosAffectDirectionalLight(float lightIntensity) +{ +	return getSunlitColor() * lightIntensity; +} + +vec3 scaleSoftClip(vec3 light) +{ +	//soft clip effect: +	light = 1. - clamp(light, vec3(0.), vec3(1.)); +	light = 1. - pow(light, gamma.xxx); + +	return light; +} + +void main()  +{ +	vec2 tc = vary_fragcoord.xy; +	ivec2 itc = ivec2(tc); + +	vec3 fcol = vec3(0,0,0); + +	vec2 scol_ambocc = texture2DRect(lightMap, tc).rg; +	float ambocc = scol_ambocc.g; + +	for (int i = 0; i < samples; ++i) +	{ +		float depth = texelFetch(depthMap, itc.xy, i).r; +		vec3 pos = getPosition_d(tc, depth).xyz; +		vec3 norm = texelFetch(normalMap, itc, i).xyz; +		norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm +			 +		float da = max(dot(norm.xyz, vary_light.xyz), 0.0); +	 +		vec4 diffuse = texelFetch(diffuseRect, itc, i); +		vec4 spec = texelFetch(specularRect, itc, i); +	 +		float amb = 0; + +		float scol = max(scol_ambocc.r, diffuse.a);  +		amb += ambocc; + +		calcAtmospherics(pos.xyz, ambocc); +	 +		vec3 col = atmosAmbient(vec3(0)); +		col += atmosAffectDirectionalLight(max(min(da, scol), diffuse.a)); +	 +		col *= diffuse.rgb; +	 +		if (spec.a > 0.0) // specular reflection +		{ +			// the old infinite-sky shiny reflection +			// +			vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); +			float sa = dot(refnormpersp, vary_light.xyz); +			vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a; + +			// add the two types of shiny together +			col += dumbshiny * spec.rgb; +		} +	 +		col = atmosLighting(col); +		col = scaleSoftClip(col); + +		fcol += col; +	} +		 +	gl_FragColor.rgb = fcol/samples;  +	gl_FragColor.a = 0.0; +} diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl index 9d187b46e2..745cc01992 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index d0e242c2d4..cd3828fbd4 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -4,8 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  -#version 120  #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl new file mode 100644 index 0000000000..ec9b547a47 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl @@ -0,0 +1,245 @@ +/**  + * @file multiSpotLightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + + + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS diffuseRect; +uniform sampler2DMS specularRect; +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; +uniform sampler2DRect lightMap; +uniform sampler2D noiseMap; +uniform sampler2D lightFunc; +uniform sampler2D projectionMap; + +uniform mat4 proj_mat; //screen space to light space +uniform float proj_near; //near clip for projection +uniform vec3 proj_p; //plane projection is emitting from (in screen space) +uniform vec3 proj_n; +uniform float proj_focus; //distance from plane to begin blurring +uniform float proj_lod;  //(number of mips in proj map) +uniform float proj_range; //range between near clip and far clip plane of projection +uniform float proj_ambient_lod; +uniform float proj_ambiance; +uniform float near_clip; +uniform float far_clip; + +uniform vec3 proj_origin; //origin of projection to be used for angular attenuation +uniform float sun_wash; +uniform int proj_shadow_idx; +uniform float shadow_fade; + +varying vec4 vary_light; + +varying vec4 vary_fragcoord; +uniform vec2 screen_res; + +uniform mat4 inv_proj; + +vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) +{ +	vec4 ret = texture2DLod(projectionMap, tc, lod); +	 +	vec2 dist = tc-vec2(0.5); +	 +	float det = max(1.0-lod/(proj_lod*0.5), 0.0); +	 +	float d = dot(dist,dist); +		 +	ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0); +	 +	return ret; +} + +vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) +{ +	vec4 ret = texture2DLod(projectionMap, tc, lod); +	 +	vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); +	 +	float det = min(lod/(proj_lod*0.5), 1.0); +	 +	float d = min(dist.x, dist.y); +	 +	float edge = 0.25*det; +		 +	ret *= clamp(d/edge, 0.0, 1.0); +	 +	return ret; +} + +vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) +{ +	vec4 ret = texture2DLod(projectionMap, tc, lod); +	 +	vec2 dist = tc-vec2(0.5); +	 +	float d = dot(dist,dist); +		 +	ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0); +	 +	return ret; +} + + +vec4 getPosition(ivec2 pos_screen, int sample) +{ +	float depth = texelFetch(depthMap, pos_screen, sample).r; +	vec2 sc = vec2(pos_screen.xy)*2.0; +	sc /= screen_res; +	sc -= vec2(1.0,1.0); +	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); +	vec4 pos = inv_proj * ndc; +	pos /= pos.w; +	pos.w = 1.0; +	return pos; +} + +void main()  +{ +	vec4 frag = vary_fragcoord; +	frag.xyz /= frag.w; +	frag.xyz = frag.xyz*0.5+0.5; +	frag.xy *= screen_res; +	ivec2 itc = ivec2(frag.xy); +	 +	vec3 fcol = vec3(0,0,0); +	int wght = 0; + +	float shadow = 1.0; +	 +	if (proj_shadow_idx >= 0) +	{ +		vec4 shd = texture2DRect(lightMap, frag.xy); +		float sh[2]; +		sh[0] = shd.b; +		sh[1] = shd.a; +		shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0); +	} +	 +	for (int i = 0; i < samples; i++) +	{ +		vec3 pos = getPosition(itc, i).xyz; +		vec3 lv = vary_light.xyz-pos.xyz; +		float dist2 = dot(lv,lv); +		dist2 /= vary_light.w; +		if (dist2 <= 1.0) +		{ +			vec3 norm = texelFetch(normalMap, itc, i).xyz; +			norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm +	 +			norm = normalize(norm); +			float l_dist = -dot(lv, proj_n); +	 +			vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); +			if (proj_tc.z >= 0.0) +			{ +				proj_tc.xyz /= proj_tc.w; +	 +				float fa = gl_Color.a+1.0; +				float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); +				if (dist_atten > 0.0) +				{ +					lv = proj_origin-pos.xyz; +					lv = normalize(lv); +					float da = dot(norm, lv); +		 +					vec3 col = vec3(0,0,0); +		 +					vec3 diff_tex = texelFetch(diffuseRect, itc, i).rgb; +		 +					float noise = texture2D(noiseMap, frag.xy/128.0).b; +					if (proj_tc.z > 0.0 && +						proj_tc.x < 1.0 && +						proj_tc.y < 1.0 && +						proj_tc.x > 0.0 && +						proj_tc.y > 0.0) +					{ +						float lit = 0.0; +						float amb_da = proj_ambiance; +		 +						if (da > 0.0) +						{ +							float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); +							float lod = diff * proj_lod; +			 +							vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); +		 +							vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; +			 +							lit = da * dist_atten * noise; +			 +							col = lcol*lit*diff_tex*shadow; +							amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance; +						} +		 +						//float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); +						vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod); +							 +						amb_da += (da*da*0.5+0.5)*proj_ambiance; +				 +						amb_da *= dist_atten * noise; +			 +						amb_da = min(amb_da, 1.0-lit); +			 +						col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; +					} +	 +	 +					vec4 spec = texelFetch(specularRect, itc, i); +					if (spec.a > 0.0) +					{ +						vec3 ref = reflect(normalize(pos), norm); +		 +						//project from point pos in direction ref to plane proj_p, proj_n +						vec3 pdelta = proj_p-pos; +						float ds = dot(ref, proj_n); +		 +						if (ds < 0.0) +						{ +							vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; +			 +							vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); + +							if (stc.z > 0.0) +							{ +								stc.xy /= stc.w; + +								float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0); +				 +								stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5); +								 +								if (stc.x < 1.0 && +									stc.y < 1.0 && +									stc.x > 0.0 && +									stc.y > 0.0) +								{ +									vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); +									col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow; +								} +							} +						} +					} + +					fcol += col; +					wght++; +				} +			} +		} +	} +	 +	if (wght <= 0) +	{ +		discard; +	} + +	gl_FragColor.rgb = fcol/wght;	 +	gl_FragColor.a = 0.0; +} diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index f565d3bdb9..315139b415 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  #extension GL_ARB_texture_rectangle : enable @@ -17,9 +19,6 @@ uniform sampler2DRectShadow shadowMap2;  uniform sampler2DRectShadow shadowMap3;  uniform sampler2DShadow shadowMap4;  uniform sampler2DShadow shadowMap5; -uniform sampler2D noiseMap; - -uniform sampler2D		lightFunc;  // Inputs @@ -46,7 +45,7 @@ uniform float spot_shadow_offset;  vec4 getPosition(vec2 pos_screen)  { -	float depth = texture2DRect(depthMap, pos_screen.xy).a; +	float depth = texture2DRect(depthMap, pos_screen.xy).r;  	vec2 sc = pos_screen.xy*2.0;  	sc /= screen_res;  	sc -= vec2(1.0,1.0); diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl new file mode 100644 index 0000000000..63d13c996d --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl @@ -0,0 +1,202 @@ +/**  + * @file sunLightMSF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +//class 2, shadows, no SSAO + +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; +uniform sampler2DRectShadow shadowMap0; +uniform sampler2DRectShadow shadowMap1; +uniform sampler2DRectShadow shadowMap2; +uniform sampler2DRectShadow shadowMap3; +uniform sampler2DShadow shadowMap4; +uniform sampler2DShadow shadowMap5; + + +// Inputs +uniform mat4 shadow_matrix[6]; +uniform vec4 shadow_clip; +uniform float ssao_radius; +uniform float ssao_max_radius; +uniform float ssao_factor; +uniform float ssao_factor_inv; + +varying vec2 vary_fragcoord; +varying vec4 vary_light; + +uniform mat4 inv_proj; +uniform vec2 screen_res; +uniform vec2 shadow_res; +uniform vec2 proj_shadow_res; + +uniform float shadow_bias; +uniform float shadow_offset; + +uniform float spot_shadow_bias; +uniform float spot_shadow_offset; + +vec4 getPosition(ivec2 pos_screen, int sample) +{ +	float depth = texelFetch(depthMap, pos_screen.xy, sample).r; +	vec2 sc = vec2(pos_screen.xy)*2.0; +	sc /= screen_res; +	sc -= vec2(1.0,1.0); +	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); +	vec4 pos = inv_proj * ndc; +	pos /= pos.w; +	pos.w = 1.0; +	return pos; +} + +float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl) +{ +	stc.xyz /= stc.w; +	stc.z += shadow_bias*scl; +	 +	float cs = shadow2DRect(shadowMap, stc.xyz).x; +	float shadow = cs; + +	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(1.5, 1.5, 0.0)).x, cs); +	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(1.5, -1.5, 0.0)).x, cs); +	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-1.5, 1.5, 0.0)).x, cs); +	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-1.5, -1.5, 0.0)).x, cs); +			 +	return shadow/5.0; +	 +	//return shadow; +} + +float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl) +{ +	stc.xyz /= stc.w; +	stc.z += spot_shadow_bias*scl; +	 +	float cs = shadow2D(shadowMap, stc.xyz).x; +	float shadow = cs; + +	vec2 off = 1.5/proj_shadow_res; +	 +	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)).x, cs); +	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x, cs); +	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x, cs); +	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x, cs); +				 +	return shadow/5.0; +	 +	//return shadow; +} + +void main()  +{ +	vec2 pos_screen = vary_fragcoord.xy; +	ivec2 itc = ivec2(pos_screen); + +	//try doing an unproject here +	 +	vec4 fcol = vec4(0,0,0,0); + +	for (int i = 0; i < samples; i++) +	{ +		vec4 pos = getPosition(itc, i); +	 +		vec4 nmap4 = texelFetch(normalMap, itc, i); +		nmap4 = vec4((nmap4.xy-0.5)*2.0,nmap4.z,nmap4.w); // unpack norm +		float displace = nmap4.w; +		vec3 norm = nmap4.xyz; +	 +		/*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL +		{ +			gl_FragColor = vec4(0.0); // doesn't matter +			return; +		}*/ +	 +		float shadow = 1.0; +		float dp_directional_light = max(0.0, dot(norm, vary_light.xyz)); + +		vec3 shadow_pos = pos.xyz + displace*norm; +		vec3 offset = vary_light.xyz * (1.0-dp_directional_light); +	 +		vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0); +	 +		if (spos.z > -shadow_clip.w) +		{	 +			if (dp_directional_light == 0.0) +			{ +				// 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 +				shadow = 0.0; +			} +			else +			{ +				vec4 lpos; +			 +				if (spos.z < -shadow_clip.z) +				{ +					lpos = shadow_matrix[3]*spos; +					lpos.xy *= shadow_res; +					shadow = pcfShadow(shadowMap3, lpos, 0.25); +					shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0); +				} +				else if (spos.z < -shadow_clip.y) +				{ +					lpos = shadow_matrix[2]*spos; +					lpos.xy *= shadow_res; +					shadow = pcfShadow(shadowMap2, lpos, 0.5); +				} +				else if (spos.z < -shadow_clip.x) +				{ +					lpos = shadow_matrix[1]*spos; +					lpos.xy *= shadow_res; +					shadow = pcfShadow(shadowMap1, lpos, 0.75); +				} +				else +				{ +					lpos = shadow_matrix[0]*spos; +					lpos.xy *= shadow_res; +					shadow = pcfShadow(shadowMap0, lpos, 1.0); +				} +		 +				// take the most-shadowed value out of these two: +				//  * the blurred sun shadow in the light (shadow) map +				//  * an unblurred dot product between the sun and this norm +				// the goal is to err on the side of most-shadow to fill-in shadow holes and reduce artifacting +				shadow = min(shadow, dp_directional_light); +			 +				//lpos.xy /= lpos.w*32.0; +				//if (fract(lpos.x) < 0.1 || fract(lpos.y) < 0.1) +				//{ +				//	shadow = 0.0; +				//} +			 +			} +		} +		else +		{ +			// more distant than the shadow map covers +			shadow = 1.0; +		} +	 +		fcol[0] += shadow; +		fcol[1] += 1.0; + +		spos = vec4(shadow_pos+norm*spot_shadow_offset, 1.0); +	 +		//spotlight shadow 1 +		vec4 lpos = shadow_matrix[4]*spos; +		fcol[2] += pcfShadow(shadowMap4, lpos, 0.8);  +	 +		//spotlight shadow 2 +		lpos = shadow_matrix[5]*spos; +		fcol[3] += pcfShadow(shadowMap5, lpos, 0.8);  +	} + +	gl_FragColor = fcol/samples; +} diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl index 4e33a1af45..d53850b489 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl @@ -4,6 +4,8 @@   * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.   * $License$   */ +  +  #extension GL_ARB_texture_rectangle : enable @@ -19,8 +21,6 @@ uniform sampler2DShadow shadowMap4;  uniform sampler2DShadow shadowMap5;  uniform sampler2D noiseMap; -uniform sampler2D		lightFunc; -  // Inputs  uniform mat4 shadow_matrix[6];  uniform vec4 shadow_clip; @@ -45,7 +45,7 @@ uniform float spot_shadow_offset;  vec4 getPosition(vec2 pos_screen)  { -	float depth = texture2DRect(depthMap, pos_screen.xy).a; +	float depth = texture2DRect(depthMap, pos_screen.xy).r;  	vec2 sc = pos_screen.xy*2.0;  	sc /= screen_res;  	sc -= vec2(1.0,1.0); @@ -60,58 +60,50 @@ vec4 getPosition(vec2 pos_screen)  float calcAmbientOcclusion(vec4 pos, vec3 norm)  {  	float ret = 1.0; -	 -	float dist = dot(pos.xyz,pos.xyz); -	 -	if (dist < 64.0*64.0) -	{ -		vec2 kern[8]; -		// exponentially (^2) distant occlusion samples spread around origin -		kern[0] = vec2(-1.0, 0.0) * 0.125*0.125; -		kern[1] = vec2(1.0, 0.0) * 0.250*0.250; -		kern[2] = vec2(0.0, 1.0) * 0.375*0.375; -		kern[3] = vec2(0.0, -1.0) * 0.500*0.500; -		kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625; -		kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750; -		kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875; -		kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000; -		vec2 pos_screen = vary_fragcoord.xy; -		vec3 pos_world = pos.xyz; -		vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy; +	vec2 kern[8]; +	// exponentially (^2) distant occlusion samples spread around origin +	kern[0] = vec2(-1.0, 0.0) * 0.125*0.125; +	kern[1] = vec2(1.0, 0.0) * 0.250*0.250; +	kern[2] = vec2(0.0, 1.0) * 0.375*0.375; +	kern[3] = vec2(0.0, -1.0) * 0.500*0.500; +	kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625; +	kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750; +	kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875; +	kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000; + +	vec2 pos_screen = vary_fragcoord.xy; +	vec3 pos_world = pos.xyz; +	vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy; -		float angle_hidden = 0.0; -		int points = 0; +	float angle_hidden = 0.0; +	int points = 0; -		float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); +	float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); -		// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?) -		for (int i = 0; i < 8; i++) -		{ -			vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect); -			vec3 samppos_world = getPosition(samppos_screen).xyz;  +	// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?) +	for (int i = 0; i < 8; i++) +	{ +		vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect); +		vec3 samppos_world = getPosition(samppos_screen).xyz;  -			vec3 diff = pos_world - samppos_world; -			float dist2 = dot(diff, diff); +		vec3 diff = pos_world - samppos_world; +		float dist2 = dot(diff, diff); -			// assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area -			// --> solid angle shrinking by the square of distance -			//radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2 -			//(k should vary inversely with # of samples, but this is taken care of later) +		// assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area +		// --> solid angle shrinking by the square of distance +		//radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2 +		//(k should vary inversely with # of samples, but this is taken care of later) -			//if (dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0)  // -0.05*norm to shift sample point back slightly for flat surfaces -			//	angle_hidden += min(1.0/dist2, ssao_factor_inv); // dist != 0 follows from conditional.  max of 1.0 (= ssao_factor_inv * ssao_factor) -			angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv); +		angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv); -			// 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion"  -			points = points + int(diff.z > -1.0); -		} +		// 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion"  +		points = points + int(diff.z > -1.0); +	} -		angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); +	angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); -		ret = (1.0 - (float(points != 0) * angle_hidden)); -		ret += max((dist-32.0*32.0)/(32.0*32.0), 0.0); -	} +	ret = (1.0 - (float(points != 0) * angle_hidden));  	return min(ret, 1.0);  } @@ -242,7 +234,7 @@ void main()  	gl_FragColor[0] = shadow;  	gl_FragColor[1] = calcAmbientOcclusion(pos, norm); -	spos.xyz = shadow_pos+offset*spot_shadow_offset; +	spos.xyz = shadow_pos+norm*spot_shadow_offset;  	//spotlight shadow 1  	vec4 lpos = shadow_matrix[4]*spos; diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl new file mode 100644 index 0000000000..a2a76eed9f --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl @@ -0,0 +1,241 @@ +/**  + * @file sunLightSSAOF.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ +  + + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +//class 2 -- shadows and SSAO + +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; +uniform sampler2DRectShadow shadowMap0; +uniform sampler2DRectShadow shadowMap1; +uniform sampler2DRectShadow shadowMap2; +uniform sampler2DRectShadow shadowMap3; +uniform sampler2DShadow shadowMap4; +uniform sampler2DShadow shadowMap5; +uniform sampler2D noiseMap; + +// Inputs +uniform mat4 shadow_matrix[6]; +uniform vec4 shadow_clip; +uniform float ssao_radius; +uniform float ssao_max_radius; +uniform float ssao_factor; +uniform float ssao_factor_inv; + +varying vec2 vary_fragcoord; +varying vec4 vary_light; + +uniform mat4 inv_proj; +uniform vec2 screen_res; +uniform vec2 shadow_res; +uniform vec2 proj_shadow_res; + +uniform float shadow_bias; +uniform float shadow_offset; + +uniform float spot_shadow_bias; +uniform float spot_shadow_offset; + +vec4 getPosition(ivec2 pos_screen, int sample) +{ +	float depth = texelFetch(depthMap, pos_screen, sample).r; +	vec2 sc = vec2(pos_screen.xy)*2.0; +	sc /= screen_res; +	sc -= vec2(1.0,1.0); +	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); +	vec4 pos = inv_proj * ndc; +	pos /= pos.w; +	pos.w = 1.0; +	return pos; +} + +//calculate decreases in ambient lighting when crowded out (SSAO) +float calcAmbientOcclusion(vec4 pos, vec3 norm, int sample) +{ +	float ret = 1.0; + +	vec2 kern[8]; +	// exponentially (^2) distant occlusion samples spread around origin +	kern[0] = vec2(-1.0, 0.0) * 0.125*0.125; +	kern[1] = vec2(1.0, 0.0) * 0.250*0.250; +	kern[2] = vec2(0.0, 1.0) * 0.375*0.375; +	kern[3] = vec2(0.0, -1.0) * 0.500*0.500; +	kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625; +	kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750; +	kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875; +	kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000; + +	vec2 pos_screen = vary_fragcoord.xy; +	vec3 pos_world = pos.xyz; +	vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy; +		 +	float angle_hidden = 0.0; +	int points = 0; +		 +	float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); +		 +	// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?) +	for (int i = 0; i < 8; i++) +	{ +		ivec2 samppos_screen = ivec2(pos_screen + scale * reflect(kern[i], noise_reflect)); +		vec3 samppos_world = getPosition(samppos_screen, sample).xyz;  +			 +		vec3 diff = pos_world - samppos_world; +		float dist2 = dot(diff, diff); +			 +		// assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area +		// --> solid angle shrinking by the square of distance +		//radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2 +		//(k should vary inversely with # of samples, but this is taken care of later) +			 +		angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv); +			 +		// 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion"  +		points = points + int(diff.z > -1.0); +	} +		 +	angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); +		 +	ret = (1.0 - (float(points != 0) * angle_hidden)); +	 +	return min(ret, 1.0); +} + +float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl) +{ +	stc.xyz /= stc.w; +	stc.z += shadow_bias*scl; +	 +	float cs = shadow2DRect(shadowMap, stc.xyz).x; +	float shadow = cs; + +	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(1.5, 1.5, 0.0)).x, cs); +	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(1.5, -1.5, 0.0)).x, cs); +	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-1.5, 1.5, 0.0)).x, cs); +	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-1.5, -1.5, 0.0)).x, cs); +			 +	return shadow/5.0; +	 +	//return shadow; +} + +float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl) +{ +	stc.xyz /= stc.w; +	stc.z += spot_shadow_bias*scl; +	 +	float cs = shadow2D(shadowMap, stc.xyz).x; +	float shadow = cs; + +	vec2 off = 1.5/proj_shadow_res; +	 +	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)).x, cs); +	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x, cs); +	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x, cs); +	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x, cs); +	 +			 +	return shadow/5.0; +	 +	//return shadow; +} + +void main()  +{ +	vec2 pos_screen = vary_fragcoord.xy; +	ivec2 itc = ivec2(pos_screen); +	vec4 fcol = vec4(0,0,0,0); + +	for (int i = 0; i < samples; i++) +	{ +		vec4 pos = getPosition(itc, i); +	 +		vec4 nmap4 = texelFetch(normalMap, itc, i); +		nmap4 = vec4((nmap4.xy-0.5)*2.0,nmap4.z,nmap4.w); // unpack norm +		float displace = nmap4.w; +		vec3 norm = nmap4.xyz; +	 +		float shadow = 1.0; +		float dp_directional_light = max(0.0, dot(norm, vary_light.xyz)); + +		vec3 shadow_pos = pos.xyz + displace*norm; +		vec3 offset = vary_light.xyz * (1.0-dp_directional_light); +	 +		vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0); +	 +		if (spos.z > -shadow_clip.w) +		{	 +			if (dp_directional_light == 0.0) +			{ +				// 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 +				shadow = 0.0; +			} +			else +			{ +				vec4 lpos; +			 +				if (spos.z < -shadow_clip.z) +				{ +					lpos = shadow_matrix[3]*spos; +					lpos.xy *= shadow_res; +					shadow = pcfShadow(shadowMap3, lpos, 0.25); +					shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0); +				} +				else if (spos.z < -shadow_clip.y) +				{ +					lpos = shadow_matrix[2]*spos; +					lpos.xy *= shadow_res; +					shadow = pcfShadow(shadowMap2, lpos, 0.5); +				} +				else if (spos.z < -shadow_clip.x) +				{ +					lpos = shadow_matrix[1]*spos; +					lpos.xy *= shadow_res; +					shadow = pcfShadow(shadowMap1, lpos, 0.75); +				} +				else +				{ +					lpos = shadow_matrix[0]*spos; +					lpos.xy *= shadow_res; +					shadow = pcfShadow(shadowMap0, lpos, 1.0); +				} +		 +				// take the most-shadowed value out of these two: +				//  * the blurred sun shadow in the light (shadow) map +				//  * an unblurred dot product between the sun and this norm +				// the goal is to err on the side of most-shadow to fill-in shadow holes and reduce artifacting +				shadow = min(shadow, dp_directional_light); +			 +			} +		} +		else +		{ +			// more distant than the shadow map covers +			shadow = 1.0; +		} +	 +		 +		fcol[0] += shadow; +		fcol[1] += calcAmbientOcclusion(pos, norm, i); + +		spos.xyz = shadow_pos+offset*spot_shadow_offset; +	 +		//spotlight shadow 1 +		vec4 lpos = shadow_matrix[4]*spos; +		fcol[2] += pcfShadow(shadowMap4, lpos, 0.8);  +	 +		//spotlight shadow 2 +		lpos = shadow_matrix[5]*spos; +		fcol[3] += pcfShadow(shadowMap5, lpos, 0.8);  +	} +		 +	gl_FragColor = fcol / samples; +} diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl index 9d092d9cea..814deb3677 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec4 vary_light;  varying vec2 vary_fragcoord; diff --git a/indra/newview/app_settings/shaders/class2/effects/blurF.glsl b/indra/newview/app_settings/shaders/class2/effects/blurF.glsl index 4173709298..dff4d4a68f 100644 --- a/indra/newview/app_settings/shaders/class2/effects/blurF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/blurF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2DRect RenderTexture;  uniform float bloomStrength; diff --git a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl index f66609527d..de469542f9 100644 --- a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform vec2 texelSize;  uniform vec2 blurDirection; diff --git a/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl b/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl index df41dae757..8871bb3fc7 100644 --- a/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2DRect RenderTexture;  uniform float brightness; diff --git a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl b/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl index e836caf93f..9c52b8dd5d 100644 --- a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void main(void)  { diff --git a/indra/newview/app_settings/shaders/class2/effects/extractF.glsl b/indra/newview/app_settings/shaders/class2/effects/extractF.glsl index 06d5fc9797..713f8021de 100644 --- a/indra/newview/app_settings/shaders/class2/effects/extractF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/extractF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2DRect RenderTexture;  uniform float extractLow; diff --git a/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl b/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl index 0a2767ad02..fd94b2e95f 100644 --- a/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2DRect RenderTexture;  uniform sampler2D NoiseTexture; diff --git a/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl b/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl index 29ad9a995b..a1a9c9716c 100644 --- a/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2DRect RenderTexture; diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl b/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl index 32259acf1b..9527dc469b 100644 --- a/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D detail_0;  uniform sampler2D detail_1; diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl index 2234f0bd89..2658bee88d 100644 --- a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl b/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl index 1650912fc8..974e227b77 100644 --- a/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D detail_0;  uniform sampler2D detail_1; diff --git a/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl index 9e936a3790..702e0881ac 100644 --- a/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap;  uniform sampler2D bumpMap;    diff --git a/indra/newview/app_settings/shaders/class2/environment/waterF.glsl b/indra/newview/app_settings/shaders/class2/environment/waterF.glsl index e477107c0b..c4e4bc08c5 100644 --- a/indra/newview/app_settings/shaders/class2/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class2/environment/waterF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  vec3 scaleSoftClip(vec3 inColor);  vec3 atmosTransport(vec3 inColor); diff --git a/indra/newview/app_settings/shaders/class2/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class2/environment/waterFogF.glsl index 7bcdcf5d5b..b66b72b401 100644 --- a/indra/newview/app_settings/shaders/class2/environment/waterFogF.glsl +++ b/indra/newview/app_settings/shaders/class2/environment/waterFogF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform vec4 lightnorm;  uniform vec4 waterPlane; diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl index 269d11a085..4c31602736 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl @@ -4,15 +4,15 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  -uniform sampler2D diffuseMap;  vec3 atmosLighting(vec3 light);  vec3 scaleSoftClip(vec3 light);  void default_lighting()   { -	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color; +	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;  	color.rgb = atmosLighting(color.rgb); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl index 9ffe3c6f4a..95bd052b5d 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl @@ -4,15 +4,15 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  -uniform sampler2D diffuseMap;  vec3 fullbrightAtmosTransport(vec3 light);  vec3 fullbrightScaleSoftClip(vec3 light);  void fullbright_lighting()  { -	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color; +	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;  	color.rgb = fullbrightAtmosTransport(color.rgb); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl new file mode 100644 index 0000000000..b1e61e1a33 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl @@ -0,0 +1,25 @@ +/**  + * @file lightFullbrightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +vec3 fullbrightAtmosTransport(vec3 light); +vec3 fullbrightScaleSoftClip(vec3 light); + +uniform sampler2D diffuseMap; + +void fullbright_lighting() +{ +	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color; +	 +	color.rgb = fullbrightAtmosTransport(color.rgb); +	 +	color.rgb = fullbrightScaleSoftClip(color.rgb); + +	gl_FragColor = color; +} + diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl index b7181dec3a..26f0ea84e0 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl @@ -4,8 +4,9 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  + -uniform sampler2D diffuseMap;  uniform samplerCube environmentMap;  vec3 fullbrightShinyAtmosTransport(vec3 light); @@ -13,7 +14,7 @@ vec3 fullbrightScaleSoftClip(vec3 light);  void fullbright_shiny_lighting()  { -	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy); +	vec4 color = diffuseLookup(gl_TexCoord[0].xy);  	color.rgb *= gl_Color.rgb;  	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	 diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl new file mode 100644 index 0000000000..953298da0d --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl @@ -0,0 +1,32 @@ +/**  + * @file lightFullbrightShinyF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +uniform samplerCube environmentMap; +uniform sampler2D diffuseMap; + +vec3 fullbrightShinyAtmosTransport(vec3 light); +vec3 fullbrightScaleSoftClip(vec3 light); + +void fullbright_shiny_lighting() +{ +	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy); +	color.rgb *= gl_Color.rgb; +	 +	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	 +	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a); + +	color.rgb = fullbrightShinyAtmosTransport(color.rgb); + +	color.rgb = fullbrightScaleSoftClip(color.rgb); + +	color.a = max(color.a, gl_Color.a); + +	gl_FragColor = color; +} + diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl new file mode 100644 index 0000000000..a6e10a249d --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl @@ -0,0 +1,31 @@ +/**  + * @file lightFullbrightShinyWaterF.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ +  + + + +uniform samplerCube environmentMap; + +vec3 fullbrightShinyAtmosTransport(vec3 light); +vec3 fullbrightScaleSoftClip(vec3 light); +vec4 applyWaterFog(vec4 color); + +void fullbright_shiny_lighting_water() +{ +	vec4 color = diffuseLookup(gl_TexCoord[0].xy); +	color.rgb *= gl_Color.rgb; +	 +	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	 +	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a); + +	color.rgb = fullbrightShinyAtmosTransport(color.rgb); +	color.rgb = fullbrightScaleSoftClip(color.rgb); +	color.a = max(color.a, gl_Color.a); + +	gl_FragColor = applyWaterFog(color); +} + diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl new file mode 100644 index 0000000000..b4bb665a2b --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl @@ -0,0 +1,32 @@ +/**  + * @file lightFullbrightShinyWaterF.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ +  + + + +uniform samplerCube environmentMap; +uniform sampler2D diffuseMap; + +vec3 fullbrightShinyAtmosTransport(vec3 light); +vec3 fullbrightScaleSoftClip(vec3 light); +vec4 applyWaterFog(vec4 color); + +void fullbright_shiny_lighting_water() +{ +	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy); +	color.rgb *= gl_Color.rgb; +	 +	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	 +	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a); + +	color.rgb = fullbrightShinyAtmosTransport(color.rgb); +	color.rgb = fullbrightScaleSoftClip(color.rgb); +	color.a = max(color.a, gl_Color.a); + +	gl_FragColor = applyWaterFog(color); +} + diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl index ee38790cc4..887d4130e7 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl @@ -4,15 +4,17 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  -uniform sampler2D diffuseMap; + +vec4 diffuseLookup(vec2 texcoord);  vec3 fullbrightAtmosTransport(vec3 light);  vec4 applyWaterFog(vec4 color);  void fullbright_lighting_water()  { -	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color; +	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;  	color.rgb = fullbrightAtmosTransport(color.rgb); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl new file mode 100644 index 0000000000..1234682ae9 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl @@ -0,0 +1,23 @@ +/**  + * @file lightFullbrightWaterF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +uniform sampler2D diffuseMap; + +vec3 fullbrightAtmosTransport(vec3 light); +vec4 applyWaterFog(vec4 color); + +void fullbright_lighting_water() +{ +	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color; + +	color.rgb = fullbrightAtmosTransport(color.rgb); +	 +	gl_FragColor = applyWaterFog(color); +} + diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl new file mode 100644 index 0000000000..149cf791f5 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl @@ -0,0 +1,25 @@ +/**  + * @file lightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +uniform sampler2D diffuseMap; + +vec3 atmosLighting(vec3 light); +vec3 scaleSoftClip(vec3 light); + +void default_lighting()  +{ +	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color; +	 +	color.rgb = atmosLighting(color.rgb); + +	color.rgb = scaleSoftClip(color.rgb); + +	gl_FragColor = color; +} + diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl index b96b5d75bc..300fcac092 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl @@ -4,8 +4,10 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  + + -uniform sampler2D diffuseMap;  uniform samplerCube environmentMap;  vec3 scaleSoftClip(vec3 light); @@ -14,7 +16,7 @@ vec4 applyWaterFog(vec4 color);  void shiny_lighting()  { -	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy); +	vec4 color = diffuseLookup(gl_TexCoord[0].xy);  	color.rgb *= gl_Color.rgb;  	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	 diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl new file mode 100644 index 0000000000..e877c0abb1 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl @@ -0,0 +1,32 @@ +/**  + * @file lightShinyF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + + +uniform samplerCube environmentMap; +uniform sampler2D diffuseMap; + +vec3 scaleSoftClip(vec3 light); +vec3 atmosLighting(vec3 light); +vec4 applyWaterFog(vec4 color); + +void shiny_lighting() +{ +	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy); +	color.rgb *= gl_Color.rgb; +	 +	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	 +	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a); + +	color.rgb = atmosLighting(color.rgb); + +	color.rgb = scaleSoftClip(color.rgb); +	color.a = max(color.a, gl_Color.a); +	gl_FragColor = color; +} + diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl index 0f5b2d6fcf..07572fa915 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl @@ -4,9 +4,10 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  + -uniform sampler2D diffuseMap;  uniform samplerCube environmentMap;  vec3 atmosLighting(vec3 light); @@ -14,7 +15,7 @@ vec4 applyWaterFog(vec4 color);  void shiny_lighting_water()  { -	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy); +	vec4 color = diffuseLookup(gl_TexCoord[0].xy);  	color.rgb *= gl_Color.rgb;  	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	 diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl new file mode 100644 index 0000000000..3904179427 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl @@ -0,0 +1,29 @@ +/**  + * @file lightShinyWaterF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + + +uniform sampler2D diffuseMap; +uniform samplerCube environmentMap; + +vec3 atmosLighting(vec3 light); +vec4 applyWaterFog(vec4 color); + +void shiny_lighting_water() +{ +	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy); +	color.rgb *= gl_Color.rgb; +	 +	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	 +	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a); + +	color.rgb = atmosLighting(color.rgb); +	color.a = max(color.a, gl_Color.a); +	gl_FragColor = applyWaterFog(color); +} + diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightSpecularV.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightSpecularV.glsl index 6400b45d9e..3384f64d07 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightSpecularV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  // All lights, no specular highlights diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightV.glsl index 89ef510d7c..10c770fcc2 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightV.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  // All lights, no specular highlights diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl index 016258bd18..61341a9f1f 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl @@ -4,15 +4,15 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  -uniform sampler2D diffuseMap;  vec3 atmosLighting(vec3 light);  vec4 applyWaterFog(vec4 color);  void default_lighting_water()  { -	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color; +	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;  	color.rgb = atmosLighting(color.rgb); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl new file mode 100644 index 0000000000..ba850b61d0 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl @@ -0,0 +1,23 @@ +/**  + * @file lightWaterF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +uniform sampler2D diffuseMap; + +vec3 atmosLighting(vec3 light); +vec4 applyWaterFog(vec4 color); + +void default_lighting_water() +{ +	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color; + +	color.rgb = atmosLighting(color.rgb); + +	gl_FragColor = applyWaterFog(color); +} + diff --git a/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl index 8cfeeb1cf9..8df2e6f222 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da);  vec3 calcPointLightSpecular(inout vec4 specular, vec3 view, vec3 v, vec3 n, vec3 l, float r, float pw, vec3 lightCol); diff --git a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl index a512b9d6fb..3d43a1813a 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  float calcDirectionalLight(vec3 n, vec3 l);  float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight); diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl new file mode 100644 index 0000000000..f49e74406f --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl @@ -0,0 +1,35 @@ +/** + * @file fullbrightShinyV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +void calcAtmospherics(vec3 inPositionEye); + +uniform vec4 origin; + +varying float vary_texture_index; + +void main() +{ +	//transform vertex +	vec4 vert = vec4(gl_Vertex.xyz,1.0); +	vary_texture_index = gl_Vertex.w; +	gl_Position = gl_ModelViewProjectionMatrix*vert; +	 +	vec4 pos = (gl_ModelViewMatrix * vert); +	vec3 norm = normalize(gl_NormalMatrix * gl_Normal); +	vec3 ref = reflect(pos.xyz, -norm); + +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0); + +	calcAtmospherics(pos.xyz); + +	gl_FrontColor = gl_Color; + +	gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl new file mode 100644 index 0000000000..3076fa3260 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl @@ -0,0 +1,29 @@ +/** + * @file fullbrightV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +void calcAtmospherics(vec3 inPositionEye); + +varying float vary_texture_index; + +void main() +{ +	//transform vertex +	vec4 vert = vec4(gl_Vertex.xyz,1.0); +	vary_texture_index = gl_Vertex.w; +	gl_Position = gl_ModelViewProjectionMatrix*vert; +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	 +	vec4 pos = (gl_ModelViewMatrix * vert); + +	calcAtmospherics(pos.xyz); + +	gl_FrontColor = gl_Color; + +	gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl index c428bbb28e..49992d3535 100644 --- a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl @@ -4,19 +4,25 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);  void calcAtmospherics(vec3 inPositionEye); +varying float vary_texture_index; +  uniform vec4 origin;  void main()  {  	//transform vertex -	gl_Position = ftransform(); +	vec4 vert = vec4(gl_Vertex.xyz,1.0); +	vary_texture_index = gl_Vertex.w; +	gl_Position = gl_ModelViewProjectionMatrix*vert; -	vec4 pos = (gl_ModelViewMatrix * gl_Vertex); +	vec4 pos = (gl_ModelViewMatrix * vert);  	vec3 norm = normalize(gl_NormalMatrix * gl_Normal);  	vec3 ref = reflect(pos.xyz, -norm); diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl new file mode 100644 index 0000000000..5e02391767 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl @@ -0,0 +1,33 @@ +/**  + * @file simpleV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  + + +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +void calcAtmospherics(vec3 inPositionEye); + +varying float vary_texture_index; + +void main() +{ +	//transform vertex +	vec4 vert = vec4(gl_Vertex.xyz,1.0); +	vary_texture_index = gl_Vertex.w; +	gl_Position = gl_ModelViewProjectionMatrix*vert; +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	 +	vec4 pos = (gl_ModelViewMatrix * vert); +	 +	vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + +	calcAtmospherics(pos.xyz); + +	vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); +	gl_FrontColor = color; + +	gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl index 8baff24dbd..21a0812c1b 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  //////////////////////////////////////////////////////////  // The fragment shader for the terrain atmospherics diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl index 6883edc1f1..ab4cf4806d 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  // Output variables  vec3 getSunlitColor(); diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl index f5c513bbdd..b61b0bb396 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  // varying param funcs  void setSunlitColor(vec3 v); diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl index d0b60e918e..3a6585bb33 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec3 vary_PositionEye; diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl index 4b4baf50d0..0f6e231ca6 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec3 vary_PositionEye; diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl index 2a559440fc..20f907a006 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  /////////////////////////////////////////////////////////////////////////  // The fragment shader for the sky diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl index 865c0e9da8..3eac63076c 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  //////////////////////////////////////////////////////////////////////////  // The vertex shader for creating the atmospheric sky diff --git a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl index ce4bd2358f..6570dcb608 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform vec4 gamma; diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl index b69a88a45f..d14c638130 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  /////////////////////////////////////////////////////////////////////////  // The fragment shader for the sky diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl index 397db01378..1ea00f723a 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  // SKY ////////////////////////////////////////////////////////////////////////  // The vertex shader for creating the atmospheric sky diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl index b30313bdc8..28381482c1 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl @@ -4,7 +4,7 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ - +   //////////////////////////////////////////////////////////  // The fragment shader for the terrain atmospherics  ////////////////////////////////////////////////////////// diff --git a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl index c85ba0c734..3d970d252c 100644 --- a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);  mat4 getSkinnedTransform(); diff --git a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl index d26b244fa3..498fee7c66 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2DRect giLightMap; diff --git a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl index e5f6217644..eebe930666 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec2 vary_fragcoord;  uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class3/deferred/giF.glsl b/indra/newview/app_settings/shaders/class3/deferred/giF.glsl index 735150a78c..9896f8dafe 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl b/indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl index e0f4a3e4f5..df4c6b3e0a 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl index fbf2c17370..7e20d71529 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec2 vary_fragcoord;  uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class3/deferred/giV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giV.glsl index 543527612e..e86f2896da 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec2 vary_fragcoord; diff --git a/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl index d9483bc6e4..980def6443 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl index 6368def830..9afeac6ddf 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec2 vary_fragcoord; diff --git a/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl index 51ab579e3c..6d4c20f68c 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl @@ -4,7 +4,9 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ -  +   + +  #extension GL_ARB_texture_rectangle : enable  uniform sampler2DRect diffuseRect; diff --git a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl index 0ec81dcb02..876f65ee3a 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec2 vary_fragcoord;  uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl b/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl index 24fa07f251..fc65881680 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl b/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl index e5f6217644..eebe930666 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  varying vec2 vary_fragcoord;  uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index a2db247331..d38d33cc21 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl index 9d187b46e2..745cc01992 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl index 1c1725a95c..de7e038402 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl index 2b44aedd5a..92347a5b4a 100644 --- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da);  vec3 calcPointLightSpecular(inout vec4 specular, vec3 view, vec3 v, vec3 n, vec3 l, float r, float pw, vec3 lightCol); diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl index 329b0c4305..24bbc0a1a1 100644 --- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl +++ b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl @@ -4,6 +4,8 @@   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * $/LicenseInfo$   */ +  +  float calcDirectionalLight(vec3 n, vec3 l);  float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight); diff --git a/indra/newview/app_settings/ultra_graphics.xml b/indra/newview/app_settings/ultra_graphics.xml index e1f3ca5769..71459e5470 100644 --- a/indra/newview/app_settings/ultra_graphics.xml +++ b/indra/newview/app_settings/ultra_graphics.xml @@ -4,15 +4,15 @@  	<RenderAvatarCloth value="TRUE"/>  	<!--Default for now-->  	<RenderAvatarLODFactor value="1.0"/> -  <!--Default for now--> -  <RenderAvatarPhysicsLODFactor value="1.0"/> +	<!--Default for now--> +	<RenderAvatarPhysicsLODFactor value="1.0"/>  	<!--NO SHADERS-->  	<RenderAvatarVP value="TRUE"/>  	<!--Short Range-->  	<RenderFarClip value="256"/>  	<!--Default for now-->  	<RenderFlexTimeFactor value="1"/> -	<!--256... but they don't use this--> +	<!--256... but they do not use this-->  	<RenderGlowResolutionPow value="9"/>  	<!--Low number-->  	<RenderMaxPartCount value="4096"/> @@ -26,8 +26,6 @@  	<RenderTerrainLODFactor value="2.0"/>  	<!--Default for now-->  	<RenderTreeLODFactor value="1.0"/> -	<!--Default for now--> -	<RenderUseFBO value="1"/>  	<!--Try Impostors-->  	<RenderUseImpostors value="TRUE"/>  	<!--Default for now--> @@ -36,11 +34,10 @@  	<VertexShaderEnable value="TRUE"/>  	<!--NO SHADERS-->  	<WindLightUseAtmosShaders value="TRUE"/> -  <!--Deferred Shading--> -  <RenderDeferred value="TRUE"/> -  <!--SSAO Enabled--> -  <RenderDeferredSSAO value="TRUE"/> -  <!--Full Shadows--> -  <RenderShadowDetail value="2"/> - +	<!--Deferred Shading--> +	<RenderDeferred value="TRUE"/> +	<!--SSAO Enabled--> +	<RenderDeferredSSAO value="TRUE"/> +	<!--Full Shadows--> +	<RenderShadowDetail value="2"/>  </settings> diff --git a/indra/newview/app_settings/windlight/postprocesseffects.xml b/indra/newview/app_settings/windlight/postprocesseffects.xml index 4645215a47..60fbfd3483 100644 --- a/indra/newview/app_settings/windlight/postprocesseffects.xml +++ b/indra/newview/app_settings/windlight/postprocesseffects.xml @@ -1,2 +1 @@  <llsd><map><key>Asi Weird</key><map><key>bloom_strength</key><real>4.5799999237060547</real><key>bloom_width</key><real>12.539999961853027</real><key>brightness</key><real>0.89999997615814209</real><key>brightness_multiplier</key><real>3</real><key>contrast</key><real>0.22999998927116394</real><key>contrast_base</key><array><real>1</real><real>1</real><real>1</real><real>0.5</real></array><key>enable_bloom</key><integer>1</integer><key>enable_color_filter</key><integer>1</integer><key>enable_night_vision</key><boolean>0</boolean><key>extract_high</key><real>1</real><key>extract_low</key><real>0.47999998927116394</real><key>noise_size</key><real>25</real><key>noise_strength</key><real>0.40000000000000002</real><key>saturation</key><real>-1</real></map><key>NegativeSaturation</key><map><key>bloom_strength</key><real>1.5</real><key>bloom_width</key><real>2.25</real><key>brightness</key><real>1</real><key>brightness_multiplier</key><real>3</real><key>contrast</key><real>1</real><key>contrast_base</key><array><real>1</real><real>1</real><real>1</real><real>0.5</real></array><key>enable_bloom</key><boolean>0</boolean><key>enable_color_filter</key><integer>1</integer><key>enable_night_vision</key><boolean>0</boolean><key>extract_high</key><real>1</real><key>extract_low</key><real>0.94999999999999996</real><key>noise_size</key><real>25</real><key>noise_strength</key><real>0.40000000000000002</real><key>saturation</key><real>-1</real></map><key>NightVision</key><map><key>bloom_strength</key><real>1.5</real><key>bloom_width</key><real>2.25</real><key>brightness</key><real>1</real><key>brightness_multiplier</key><real>3</real><key>contrast</key><real>1</real><key>contrast_base</key><array><real>1</real><real>1</real><real>1</real><real>0.5</real></array><key>enable_bloom</key><boolean>0</boolean><key>enable_color_filter</key><boolean>0</boolean><key>enable_night_vision</key><integer>1</integer><key>extract_high</key><real>1</real><key>extract_low</key><real>0.94999999999999996</real><key>noise_size</key><real>25</real><key>noise_strength</key><real>0.40000000000000002</real><key>saturation</key><real>1</real></map><key>WGhost</key><map><key>bloom_strength</key><real>2.0399999618530273</real><key>bloom_width</key><real>2.25</real><key>brightness</key><real>1</real><key>brightness_multiplier</key><real>3</real><key>contrast</key><real>1</real><key>contrast_base</key><array><real>1</real><real>1</real><real>1</real><real>0.5</real></array><key>enable_bloom</key><integer>1</integer><key>enable_color_filter</key><boolean>0</boolean><key>enable_night_vision</key><boolean>0</boolean><key>extract_high</key><real>1</real><key>extract_low</key><real>0.22999998927116394</real><key>noise_size</key><real>25</real><key>noise_strength</key><real>0.40000000000000002</real><key>saturation</key><real>1</real></map><key>default</key><map><key>bloom_strength</key><real>1.5</real><key>bloom_width</key><real>2.25</real><key>brightness</key><real>1</real><key>brightness_multiplier</key><real>3</real><key>contrast</key><real>1</real><key>contrast_base</key><array><real>1</real><real>1</real><real>1</real><real>0.5</real></array><key>enable_bloom</key><boolean>0</boolean><key>enable_color_filter</key><boolean>0</boolean><key>enable_night_vision</key><boolean>0</boolean><key>extract_high</key><real>1</real><key>extract_low</key><real>0.94999999999999996</real><key>noise_size</key><real>25</real><key>noise_strength</key><real>0.40000000000000002</real><key>saturation</key><real>1</real></map></map></llsd> -><map><key>bloom_strength</key><real>1.5</real><key>bloom_width</key><real>2.25</real><key>brightness</key><real>1</real><key>brightness_multiplier</key><real>3</real><key>contrast</key><real>1</real><key>contrast_base</key><array><real>1</real><real>1</real><real>1</real><real>0.5</real></array><key>enable_bloom</key><boolean>0</boolean><key>enable_color_filter</key><boolean>0</boolean><key>enable_night_vision</key><boolean>0</boolean><key>extract_high</key><real>1</real><key>extract_low</key><real>0.94999999999999996</real><key>noise_size</key><real>25</real><key>noise_strength</key><real>0.40000000000000002</real><key>saturation</key><real>1</real></map></map></llsd>  | 
