Merge branch 'development' of https://github.com/GarageGames/Torque3D into ColorPickerAdvanced
BIN
Templates/Empty/game/art/environment/FogMod_heavy.dds
Normal file
BIN
Templates/Empty/game/art/environment/FogMod_light.dds
Normal file
BIN
Templates/Empty/game/art/environment/FogMod_med.dds
Normal file
177
Templates/Empty/game/art/environment/Fog_Cube.DAE
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
|
||||
<asset>
|
||||
<contributor>
|
||||
<author>Richard</author>
|
||||
<authoring_tool>OpenCOLLADA for 3ds Max; Version: 1.4.1; Revision: exported; Platform: x64; Configuration: Release_Max2011_static</authoring_tool>
|
||||
<source_data>file:///G:/Documents%20and%20Settings/Richard/Mijn%20documenten/3dsmax/scenes/FogVolumes.max</source_data>
|
||||
</contributor>
|
||||
<created>2014-08-16T10:10:23</created>
|
||||
<modified>2014-08-16T10:10:23</modified>
|
||||
<unit name="meter" meter="1"/>
|
||||
<up_axis>Z_UP</up_axis>
|
||||
</asset>
|
||||
<library_effects>
|
||||
<effect id="NoMat">
|
||||
<profile_COMMON>
|
||||
<technique sid="common">
|
||||
<blinn>
|
||||
<emission>
|
||||
<color>0 0 0 1</color>
|
||||
</emission>
|
||||
<ambient>
|
||||
<color>0.588 0.588 0.588 1</color>
|
||||
</ambient>
|
||||
<diffuse>
|
||||
<color>0.588 0.588 0.588 1</color>
|
||||
</diffuse>
|
||||
<specular>
|
||||
<color>0.9 0.9 0.9 1</color>
|
||||
</specular>
|
||||
<shininess>
|
||||
<float>0</float>
|
||||
</shininess>
|
||||
<reflective>
|
||||
<color>0 0 0 1</color>
|
||||
</reflective>
|
||||
<transparent opaque="A_ONE">
|
||||
<color>1 1 1 1</color>
|
||||
</transparent>
|
||||
<transparency>
|
||||
<float>1</float>
|
||||
</transparency>
|
||||
</blinn>
|
||||
</technique>
|
||||
</profile_COMMON>
|
||||
<extra>
|
||||
<technique profile="OpenCOLLADA3dsMax">
|
||||
<extended_shader>
|
||||
<apply_reflection_dimming>0</apply_reflection_dimming>
|
||||
<dim_level>0</dim_level>
|
||||
<falloff_type>0</falloff_type>
|
||||
<index_of_refraction>1.5</index_of_refraction>
|
||||
<opacity_type>0</opacity_type>
|
||||
<reflection_level>3</reflection_level>
|
||||
<wire_size>1</wire_size>
|
||||
<wire_units>0</wire_units>
|
||||
</extended_shader>
|
||||
<shader>
|
||||
<ambient_diffuse_lock>1</ambient_diffuse_lock>
|
||||
<ambient_diffuse_texture_lock>1</ambient_diffuse_texture_lock>
|
||||
<diffuse_specular_lock>0</diffuse_specular_lock>
|
||||
<soften>0.1</soften>
|
||||
<use_self_illum_color>0</use_self_illum_color>
|
||||
</shader>
|
||||
</technique>
|
||||
</extra>
|
||||
</effect>
|
||||
</library_effects>
|
||||
<library_materials>
|
||||
<material id="NoMat-material" name="NoMat">
|
||||
<instance_effect url="#NoMat"/>
|
||||
</material>
|
||||
</library_materials>
|
||||
<library_geometries>
|
||||
<geometry id="geom-FogCube1" name="FogCube1">
|
||||
<mesh>
|
||||
<source id="geom-FogCube1-positions">
|
||||
<float_array id="geom-FogCube1-positions-array" count="72">-0.85 -1 -0.85 0.85 -0.85 -1 -1 0.85 -0.85 0.85 0.85 -1 -0.85 -1 0.85 1 -0.85 0.85 -1 0.85 0.85 0.85 1 0.85 -1 -0.85 -0.85 -0.85 -0.85 -1 1 -0.85 -0.85 0.85 -1 -0.85 -0.85 1 -0.85 -0.85 0.85 -1 0.85 1 -0.85 1 0.85 -0.85 -0.85 -0.85 1 -1 -0.85 0.85 0.85 -0.85 1 0.85 -1 0.85 -0.85 0.85 1 -0.85 1 0.85 0.85 0.85 1 1 0.85 0.85</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#geom-FogCube1-positions-array" count="24" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<source id="geom-FogCube1-normals">
|
||||
<float_array id="geom-FogCube1-normals-array" count="72">-0.341586 -0.341586 -0.8755786 -0.341586 0.341586 -0.8755788 0.341586 0.341586 -0.8755788 0.341586 -0.341586 -0.8755788 -0.341586 -0.341586 0.8755786 0.341586 -0.341586 0.8755788 0.341586 0.341586 0.8755788 -0.341586 0.341586 0.8755788 -0.341586 -0.8755786 -0.341586 0.341586 -0.8755788 -0.341586 0.341586 -0.8755786 0.341586 -0.341586 -0.8755788 0.341586 0.8755786 -0.341586 -0.341586 0.8755788 0.341586 -0.341586 0.8755786 0.341586 0.341586 0.8755788 -0.341586 0.341586 0.341586 0.8755786 -0.341586 -0.341586 0.8755788 -0.341586 -0.341586 0.8755786 0.341586 0.341586 0.8755788 0.341586 -0.8755786 0.341586 -0.341586 -0.8755788 -0.341586 -0.341586 -0.8755786 -0.341586 0.341586 -0.8755788 0.341586 0.341586</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#geom-FogCube1-normals-array" count="24" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<source id="geom-FogCube1-map1">
|
||||
<float_array id="geom-FogCube1-map1-array" count="228">0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 1 1 0 0.07542458 0.07542461 4.99755e-4 0.07542479 0.07542461 4.99547e-4 0.07542455 0.07542461 4.99755e-4 0.07542461 0.9245752 4.99547e-4 0.07542458 0.9245754 4.99755e-4 0.07542458 0.9245754 0.9995003 0.07542455 0.9245754 4.99755e-4 0.07542455 0.9245754 0.9995003 0.9245752 0.07542461 4.99576e-4 0.9245754 0.07542479 4.99547e-4 0.07542458 0.07542461 0.9995003 0.9245752 0.07542461 4.99576e-4 0.9245752 0.07542461 0.9995004 0.9245752 0.9245754 4.99547e-4 0.07542455 0.07542461 0.9995003 0.9245752 0.07542461 0.9995004 0.07542461 0.07542479 0.9995005 0.9245752 0.9245754 4.99576e-4 0.9245752 0.07542461 0.9995005 0.9245752 0.9245754 4.99576e-4 0.07542479 0.9245754 0.9995005 0.9245752 0.9245754 0.9995004 0.9245754 0.9245752 0.9995005 0.9245752 0.9245754 0.9995004 0.9995003 0.07542461 0.07542458 0.9245752 4.99547e-4 0.07542461 0.9245752 4.99547e-4 0.07542461 0.9995003 0.07542461 0.07542458 0.9995003 0.07542461 0.9245754 0.9245752 4.99547e-4 0.9245754 0.9245752 4.99547e-4 0.9245754 0.9995003 0.07542461 0.9245754 0.9995003 0.9245754 0.07542458 0.9245752 0.9995005 0.07542461 0.9995003 0.9245754 0.07542458 0.9245752 0.9995005 0.07542461 0.9995003 0.9245754 0.9245754 0.9245752 0.9995005 0.9245754 0.9995003 0.9245754 0.9245754 0.9245752 0.9995005 0.9245754 0.9995004 0.07542482 0.07542461 0.9995003 0.9245754 0.07542461 0.9245752 0.9995004 0.07542461 0.07542455 0.9995003 0.07542461 4.99606e-4 0.9245752 0.07542461 4.99725e-4 0.07542458 0.07542461 0.07542479 4.99576e-4 0.07542461 0.9245754 4.99755e-4 0.07542461 0.07542458 4.99755e-4 0.9245754 0.9245752 4.99576e-4 0.9245754 0.9995003 0.07542458 0.9245754 0.9995004 0.9245752 0.9245754 0.9245754 0.9995003 0.9245754 0.07542482 0.9995004 0.9245754 4.99755e-4 0.9245754 0.9245754 4.99576e-4 0.07542482 0.9245754 0.9995003 0.07542461 0.07542458 0.9995003 0.9245754 0.07542458 0.9995003 0.9245754 0.07542458 0.9995003 0.07542461 0.07542458 0.9995003 0.07542461 0.9245754 0.9995003 0.9245754 0.9245754 0.9995003 0.07542461 0.9245754 0.9995003 0.9245754 0.9245754</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#geom-FogCube1-map1-array" count="76" stride="3">
|
||||
<param name="S" type="float"/>
|
||||
<param name="T" type="float"/>
|
||||
<param name="P" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<source id="geom-FogCube1-map1-textangents">
|
||||
<float_array id="geom-FogCube1-map1-textangents-array" count="192">-0.8644259 0.01841655 0.3300502 -0.8715108 -0.05526615 0.3184382 -0.8644259 0.01841664 -0.3300501 -0.8715108 -0.05526611 -0.3184382 0.8738725 -0.06754867 0.3145678 0.8597026 -0.006149054 -0.3377912 0.8738725 -0.06754874 -0.3145678 0.8597026 -0.006148929 0.3377911 0.883319 -0.2990854 -0.116681 0.8478944 0.3571441 -0.06756432 0.8597026 0.3377913 0.00614921 0.883319 -0.2990854 0.116681 0.2990854 0.883319 -0.116681 -0.3571441 0.8478944 -0.06756432 -0.3377913 0.8597026 0.00614921 0.2990854 0.883319 0.116681 -0.883319 0.2990854 -0.116681 -0.8478944 -0.3571441 -0.06756432 -0.8597026 -0.3377913 0.00614921 -0.883319 0.2990854 0.116681 -0.2990854 -0.883319 -0.116681 0.3571441 -0.8478944 -0.06756432 0.3377913 -0.8597026 0.00614921 -0.2990854 -0.883319 0.116681 0.8360862 -0.3764972 0.1289794 0.7071068 -0.7071068 0 0.7071068 0.7071068 0 0.3764972 0.8360862 0.1289794 -0.3764972 -0.8360862 0.1289794 -0.7071068 -0.7071068 0 -0.7071068 0.7071068 0 -0.8360862 0.3764972 0.1289794 0.8360862 -0.3764971 -0.1289794 0.7071068 -0.7071068 0 0.3764971 0.8360862 -0.1289794 0.7071068 0.7071068 0 -0.3764971 -0.8360862 -0.1289794 -0.7071068 -0.7071068 0 -0.8360862 0.3764971 -0.1289794 -0.7071068 0.7071068 0 -0.376497 0.1289792 0.8360862 -0.3764973 -0.1289798 0.8360861 -0.8833191 -0.2990855 0.1166808 -0.883319 0.2990853 -0.1166812 -0.3764971 0.1289794 -0.8360862 -0.3764972 -0.1289795 -0.8360862 -0.8833191 -0.2990855 -0.1166807 -0.883319 0.2990853 0.1166812 0.883319 -0.2990853 0.1166812 0.8833191 0.2990855 -0.1166807 0.3764971 0.1289797 -0.8360862 0.3764971 -0.1289793 -0.8360862 0.883319 -0.2990853 -0.1166811 0.8833191 0.2990855 0.1166808 0.3764972 0.1289799 0.8360861 0.3764971 -0.128979 0.8360862 0.3764972 0.8360862 0.1289794 0.3764971 0.8360862 -0.1289794 0.8360862 -0.3764971 -0.1289794 0.8360862 -0.3764972 0.1289794 -0.8360862 0.3764972 0.1289794 -0.8360862 0.3764971 -0.1289794 -0.3764972 -0.8360862 0.1289794 -0.3764971 -0.8360862 -0.1289794</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#geom-FogCube1-map1-textangents-array" count="64" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<source id="geom-FogCube1-map1-texbinormals">
|
||||
<float_array id="geom-FogCube1-map1-texbinormals-array" count="192">0.1043954 -0.9396398 0.3258505 -0.06496345 -0.9379679 -0.3405817 0.1043953 -0.9396398 -0.3258505 -0.06496349 -0.937968 0.3405817 0.05187585 -0.9370471 -0.3453283 -0.1307439 -0.939827 -0.3156443 0.05187577 -0.9370471 0.3453283 -0.1307438 -0.939827 0.3156443 0 0.3634471 -0.9316148 -0.196368 0.2889368 -0.9369926 0.1307441 -0.3156442 -0.939827 0 -0.3634471 -0.9316148 -0.3634471 0 -0.9316148 -0.2889368 -0.196368 -0.9369926 0.3156442 0.1307441 -0.939827 0.3634471 0 -0.9316148 0 -0.3634471 -0.9316148 0.196368 -0.2889368 -0.9369926 -0.1307441 0.3156442 -0.939827 0 0.3634471 -0.9316148 0.3634471 0 -0.9316148 0.2889368 0.196368 -0.9369926 -0.3156442 -0.1307441 -0.939827 -0.3634471 0 -0.9316148 0.2608475 0.2608475 -0.9294714 0.6191276 0.6191276 -0.4830755 -0.6191276 0.6191276 -0.4830755 -0.2608475 0.2608475 -0.9294714 0.2608475 -0.2608475 -0.9294714 0.6191276 -0.6191276 -0.4830755 -0.6191276 -0.6191276 -0.4830755 -0.2608475 -0.2608475 -0.9294714 -0.2608475 -0.2608475 -0.9294714 -0.6191276 -0.6191276 -0.4830755 0.2608475 -0.2608475 -0.9294714 0.6191276 -0.6191276 -0.4830755 -0.2608475 0.2608475 -0.9294714 -0.6191276 0.6191276 -0.4830755 0.2608475 0.2608475 -0.9294714 0.6191276 0.6191276 -0.4830755 0.2608476 -0.9294715 0.2608473 -0.2608474 -0.9294714 -0.2608479 1.81809e-7 -0.363447 -0.9316149 2.27262e-7 -0.3634472 -0.9316148 0.2608475 -0.9294714 -0.2608475 -0.2608475 -0.9294714 0.2608477 2.72714e-7 -0.363447 0.9316149 2.72714e-7 -0.3634472 0.9316148 2.72714e-7 -0.3634472 -0.9316148 2.72714e-7 -0.363447 -0.9316149 -0.2608474 -0.9294714 -0.2608478 0.2608476 -0.9294714 0.2608474 1.81809e-7 -0.3634472 0.9316148 2.27262e-7 -0.3634471 0.9316149 -0.2608473 -0.9294714 0.260848 0.2608477 -0.9294715 -0.2608472 -0.2608475 0.2608475 -0.9294714 0.2608475 -0.2608475 -0.9294714 -0.2608475 -0.2608475 -0.9294714 0.2608475 0.2608475 -0.9294714 -0.2608475 -0.2608475 -0.9294714 0.2608475 0.2608475 -0.9294714 0.2608475 -0.2608475 -0.9294714 -0.2608475 0.2608475 -0.9294714</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#geom-FogCube1-map1-texbinormals-array" count="64" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<vertices id="geom-FogCube1-vertices">
|
||||
<input semantic="POSITION" source="#geom-FogCube1-positions"/>
|
||||
</vertices>
|
||||
<triangles material="NoMat" count="44">
|
||||
<input semantic="VERTEX" source="#geom-FogCube1-vertices" offset="0"/>
|
||||
<input semantic="NORMAL" source="#geom-FogCube1-normals" offset="1"/>
|
||||
<input semantic="TEXCOORD" source="#geom-FogCube1-map1" offset="2" set="0"/>
|
||||
<input semantic="TEXTANGENT" source="#geom-FogCube1-map1-textangents" offset="3" set="1"/>
|
||||
<input semantic="TEXBINORMAL" source="#geom-FogCube1-map1-texbinormals" offset="3" set="1"/>
|
||||
<p>9 0 21 0 13 1 25 1 3 2 15 2 3 2 15 2 1 3 13 3 9 0 21 0 16 4 28 4 18 5 30 5 22 6 34 6 22 6 34 6 20 7 32 7 16 4 28 4 0 8 12 8 11 9 23 9 19 10 31 10 19 10 31 10 4 11 16 11 0 8 12 8 10 12 22 12 15 13 27 13 23 14 35 14 23 14 35 14 5 15 17 15 10 12 22 12 14 16 26 16 12 17 24 17 21 18 33 18 21 18 33 18 7 19 19 19 14 16 26 16 2 20 14 20 8 21 20 21 17 22 29 22 17 22 29 22 6 23 18 23 2 20 14 20 0 8 36 24 8 21 20 21 9 0 37 25 1 3 38 26 10 12 39 27 11 9 23 9 2 20 40 28 12 17 24 17 13 1 41 29 3 2 42 30 14 16 43 31 15 13 27 13 4 11 44 32 16 4 45 33 17 22 29 22 5 15 46 34 18 5 47 35 19 10 31 10 6 23 48 36 20 7 49 37 21 18 33 18 7 19 50 38 22 6 51 39 23 14 35 14 9 0 21 0 8 21 52 40 2 20 53 41 2 20 53 41 13 1 25 1 9 0 21 0 13 1 25 1 12 17 54 42 14 16 55 43 14 16 55 43 3 2 15 2 13 1 25 1 3 2 15 2 15 13 56 44 10 12 57 45 10 12 57 45 1 3 13 3 3 2 15 2 1 3 13 3 11 9 58 46 0 8 59 47 0 8 59 47 9 0 21 0 1 3 13 3 16 4 28 4 4 11 60 48 19 10 61 49 19 10 61 49 18 5 30 5 16 4 28 4 18 5 30 5 5 15 62 50 23 14 63 51 23 14 63 51 22 6 34 6 18 5 30 5 22 6 34 6 7 19 64 52 21 18 65 53 21 18 65 53 20 7 32 7 22 6 34 6 20 7 32 7 6 23 66 54 17 22 67 55 17 22 67 55 16 4 28 4 20 7 32 7 11 9 23 9 10 12 68 56 5 15 69 57 5 15 69 57 19 10 31 10 11 9 23 9 4 11 70 58 17 22 29 22 8 21 20 21 8 21 20 21 0 8 71 59 4 11 70 58 15 13 27 13 14 16 72 60 7 19 73 61 7 19 73 61 23 14 35 14 15 13 27 13 12 17 24 17 2 20 74 62 6 23 75 63 6 23 75 63 21 18 33 18 12 17 24 17</p>
|
||||
</triangles>
|
||||
</mesh>
|
||||
</geometry>
|
||||
</library_geometries>
|
||||
<library_lights>
|
||||
<light id="EnvironmentAmbientLight" name="EnvironmentAmbientLight">
|
||||
<technique_common>
|
||||
<ambient>
|
||||
<color>0 0 0</color>
|
||||
</ambient>
|
||||
</technique_common>
|
||||
</light>
|
||||
</library_lights>
|
||||
<library_visual_scenes>
|
||||
<visual_scene id="MaxScene">
|
||||
<node name="EnvironmentAmbientLight">
|
||||
<instance_light url="#EnvironmentAmbientLight"/>
|
||||
</node>
|
||||
<node id="node-FogCube1" name="FogCube1">
|
||||
<instance_geometry url="#geom-FogCube1">
|
||||
<bind_material>
|
||||
<technique_common>
|
||||
<instance_material symbol="NoMat" target="#NoMat-material"/>
|
||||
</technique_common>
|
||||
</bind_material>
|
||||
</instance_geometry>
|
||||
<extra>
|
||||
<technique profile="OpenCOLLADA">
|
||||
<cast_shadows>1</cast_shadows>
|
||||
<primary_visibility>1</primary_visibility>
|
||||
<receive_shadows>1</receive_shadows>
|
||||
<secondary_visibility>1</secondary_visibility>
|
||||
</technique>
|
||||
</extra>
|
||||
</node>
|
||||
</visual_scene>
|
||||
</library_visual_scenes>
|
||||
<scene>
|
||||
<instance_visual_scene url="#MaxScene"/>
|
||||
</scene>
|
||||
</COLLADA>
|
||||
8
Templates/Empty/game/art/environment/Fog_Cube.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
singleton TSShapeConstructor(Fog_CubeDAE)
|
||||
{
|
||||
baseShape = "./Fog_Cube.DAE";
|
||||
lodType = "TrailingNumber";
|
||||
neverImport = "env*";
|
||||
loadLights = "0";
|
||||
};
|
||||
|
|
@ -41,4 +41,6 @@ datablock RibbonData(BasicRibbon)
|
|||
fadeAwayStep = 0.1;
|
||||
UseFadeOut = true;
|
||||
RibbonMaterial = BasicRibbonMat;
|
||||
|
||||
category = "FX";
|
||||
};
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 843 B After Width: | Height: | Size: 769 B |
|
|
@ -141,11 +141,11 @@ function parseArgs()
|
|||
switch$ (%arg)
|
||||
{
|
||||
case "-fullscreen":
|
||||
setFullScreen(true);
|
||||
$cliFullscreen = true;
|
||||
$argUsed[%i]++;
|
||||
|
||||
case "-windowed":
|
||||
setFullScreen(false);
|
||||
$cliFullscreen = false;
|
||||
$argUsed[%i]++;
|
||||
|
||||
case "-openGL":
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ function defaultParseArgs()
|
|||
$argUsed[$i]++;
|
||||
if ($hasNextArg)
|
||||
{
|
||||
playJournal($nextArg,false);
|
||||
playJournal($nextArg);
|
||||
$argUsed[$i+1]++;
|
||||
$i++;
|
||||
}
|
||||
|
|
@ -240,18 +240,6 @@ function defaultParseArgs()
|
|||
else
|
||||
error("Error: Missing Command Line argument. Usage: -vidCapHeight <ouput_video_height>");
|
||||
|
||||
//--------------------
|
||||
case "-jDebug":
|
||||
$argUsed[$i]++;
|
||||
if ($hasNextArg)
|
||||
{
|
||||
playJournal($nextArg,true);
|
||||
$argUsed[$i+1]++;
|
||||
$i++;
|
||||
}
|
||||
else
|
||||
error("Error: Missing Command Line argument. Usage: -jDebug <journal_name>");
|
||||
|
||||
//--------------------
|
||||
case "-level":
|
||||
$argUsed[$i]++;
|
||||
|
|
|
|||
|
|
@ -239,26 +239,26 @@ function sfxCompareProvider( %providerA, %providerB )
|
|||
case "FMOD":
|
||||
return 1;
|
||||
|
||||
case "XAudio":
|
||||
if( %providerB !$= "FMOD" )
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
|
||||
// Prefer OpenAL over anything but FMOD.
|
||||
case "OpenAL":
|
||||
if( %providerB $= "FMOD" && %providerB !$= "XAudio")
|
||||
if( %providerB $= "FMOD" )
|
||||
return -1;
|
||||
else
|
||||
return 1;
|
||||
|
||||
// DSound is just about deprecated, so make that one the last fallback
|
||||
case "DirectSound":
|
||||
if( %providerB $= "FMOD" || %providerB $= "OpenAL" && %providerB !$= "XAudio")
|
||||
|
||||
// choose XAudio over DirectSound
|
||||
case "XAudio":
|
||||
if( %providerB $= "FMOD" || %providerB $= "OpenAL" )
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
case "DirectSound":
|
||||
if( %providerB !$= "FMOD" && %providerB !$= "OpenAL" && %providerB !$= "XAudio" )
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,9 +39,14 @@ function configureCanvas()
|
|||
%rate = getWord($pref::Video::mode, $WORD::REFRESH);
|
||||
%fsaa = getWord($pref::Video::mode, $WORD::AA);
|
||||
|
||||
echo("--------------");
|
||||
echo("Attempting to set resolution to \"" @ $pref::Video::mode @ "\"");
|
||||
if($cliFullscreen !$= "") {
|
||||
%fs = $cliFullscreen;
|
||||
$cliFullscreen = "";
|
||||
}
|
||||
|
||||
echo("--------------");
|
||||
echo("Attempting to set resolution to \"" @ %resX SPC %resY SPC %fs SPC %bpp SPC %rate SPC %fsaa @ "\"");
|
||||
|
||||
%deskRes = getDesktopResolution();
|
||||
%deskResX = getWord(%deskRes, $WORD::RES_X);
|
||||
%deskResY = getWord(%deskRes, $WORD::RES_Y);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ $pref::Input::KeyboardEnabled = 1;
|
|||
$pref::Input::MouseEnabled = 1;
|
||||
$pref::Input::JoystickEnabled = 0;
|
||||
$pref::Input::KeyboardTurnSpeed = 0.1;
|
||||
$pref::Input::MouseWheelSpeed = 120;
|
||||
|
||||
$sceneLighting::cacheSize = 20000;
|
||||
$sceneLighting::purgeMethod = "lastCreated";
|
||||
|
|
|
|||
|
|
@ -84,6 +84,26 @@ function AL_DepthVisualize::onEnabled( %this )
|
|||
return true;
|
||||
}
|
||||
|
||||
new ShaderData( AL_GlowVisualizeShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/dbgGlowVisualizeP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgGlowVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "glowBuffer";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( AL_GlowVisualize )
|
||||
{
|
||||
shader = AL_GlowVisualizeShader;
|
||||
stateBlock = AL_DefaultVisualizeState;
|
||||
texture[0] = "#glowbuffer";
|
||||
target = "$backBuffer";
|
||||
renderPriority = 9999;
|
||||
};
|
||||
|
||||
new ShaderData( AL_NormalsVisualizeShader )
|
||||
{
|
||||
|
|
@ -204,6 +224,20 @@ function toggleDepthViz( %enable )
|
|||
AL_DepthVisualize.disable();
|
||||
}
|
||||
|
||||
/// Toggles the visualization of the AL depth buffer.
|
||||
function toggleGlowViz( %enable )
|
||||
{
|
||||
if ( %enable $= "" )
|
||||
{
|
||||
$AL_GlowVisualizeVar = AL_GlowVisualize.isEnabled() ? false : true;
|
||||
AL_GlowVisualize.toggle();
|
||||
}
|
||||
else if ( %enable )
|
||||
AL_GlowVisualize.enable();
|
||||
else if ( !%enable )
|
||||
AL_GlowVisualize.disable();
|
||||
}
|
||||
|
||||
/// Toggles the visualization of the AL normals buffer.
|
||||
function toggleNormalsViz( %enable )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -62,9 +62,10 @@ new ShaderData( AL_VectorLightShader )
|
|||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/vectorLightP.glsl";
|
||||
|
||||
samplerNames[0] = "$prePassBuffer";
|
||||
samplerNames[1] = "$ShadowMap";
|
||||
samplerNames[2] = "$ssaoMask";
|
||||
samplerNames[3] = "$gTapRotationTex";
|
||||
samplerNames[1] = "$shadowMap";
|
||||
samplerNames[2] = "$dynamicShadowMap";
|
||||
samplerNames[3] = "$ssaoMask";
|
||||
samplerNames[4] = "$gTapRotationTex";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
|
@ -75,7 +76,8 @@ new CustomMaterial( AL_VectorLightMaterial )
|
|||
stateBlock = AL_VectorLightState;
|
||||
|
||||
sampler["prePassBuffer"] = "#prepass";
|
||||
sampler["ShadowMap"] = "$dynamiclight";
|
||||
sampler["shadowMap"] = "$dynamiclight";
|
||||
sampler["dynamicShadowMap"] = "$dynamicShadowMap";
|
||||
sampler["ssaoMask"] = "#ssaoMask";
|
||||
|
||||
target = "lightinfo";
|
||||
|
|
@ -128,8 +130,9 @@ new ShaderData( AL_PointLightShader )
|
|||
|
||||
samplerNames[0] = "$prePassBuffer";
|
||||
samplerNames[1] = "$shadowMap";
|
||||
samplerNames[2] = "$cookieMap";
|
||||
samplerNames[3] = "$gTapRotationTex";
|
||||
samplerNames[2] = "$dynamicShadowMap";
|
||||
samplerNames[3] = "$cookieMap";
|
||||
samplerNames[4] = "$gTapRotationTex";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
|
@ -141,6 +144,7 @@ new CustomMaterial( AL_PointLightMaterial )
|
|||
|
||||
sampler["prePassBuffer"] = "#prepass";
|
||||
sampler["shadowMap"] = "$dynamiclight";
|
||||
sampler["dynamicShadowMap"] = "$dynamicShadowMap";
|
||||
sampler["cookieMap"] = "$dynamiclightmask";
|
||||
|
||||
target = "lightinfo";
|
||||
|
|
@ -159,8 +163,9 @@ new ShaderData( AL_SpotLightShader )
|
|||
|
||||
samplerNames[0] = "$prePassBuffer";
|
||||
samplerNames[1] = "$shadowMap";
|
||||
samplerNames[2] = "$cookieMap";
|
||||
samplerNames[3] = "$gTapRotationTex";
|
||||
samplerNames[2] = "$dynamicShadowMap";
|
||||
samplerNames[3] = "$cookieMap";
|
||||
samplerNames[4] = "$gTapRotationTex";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
|
@ -172,6 +177,7 @@ new CustomMaterial( AL_SpotLightMaterial )
|
|||
|
||||
sampler["prePassBuffer"] = "#prepass";
|
||||
sampler["shadowMap"] = "$dynamiclight";
|
||||
sampler["dynamicShadowMap"] = "$dynamicShadowMap";
|
||||
sampler["cookieMap"] = "$dynamiclightmask";
|
||||
|
||||
target = "lightinfo";
|
||||
|
|
|
|||
|
|
@ -106,3 +106,79 @@ singleton PostEffect( GlowPostFx )
|
|||
target = "$backBuffer";
|
||||
};
|
||||
};
|
||||
|
||||
singleton ShaderData( PFX_VolFogGlowBlurVertShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/glowBlurV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/VolFogGlowP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/glowBlurV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/gl/VolFogGlowP.glsl";
|
||||
|
||||
defines = "BLUR_DIR=float2(0.0,1.0)";
|
||||
samplerNames[0] = "$diffuseMap";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
singleton ShaderData( PFX_VolFogGlowBlurHorzShader : PFX_VolFogGlowBlurVertShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/glowBlurV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/VolFogGlowP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/glowBlurV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/gl/VolFogGlowP.glsl";
|
||||
|
||||
defines = "BLUR_DIR=float2(1.0,0.0)";
|
||||
};
|
||||
|
||||
$VolFogGlowPostFx::glowStrength = 0.3;
|
||||
|
||||
singleton PostEffect( VolFogGlowPostFx )
|
||||
{
|
||||
// Do not allow the glow effect to work in reflection
|
||||
// passes by default so we don't do the extra drawing.
|
||||
allowReflectPass = false;
|
||||
renderTime = "PFXAfterBin";
|
||||
renderBin = "FogBin";
|
||||
renderPriority = 1;
|
||||
// First we down sample the glow buffer.
|
||||
shader = PFX_PassthruShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
texture[0] = "$backbuffer";
|
||||
target = "$outTex";
|
||||
targetScale = "0.5 0.5";
|
||||
isEnabled = true;
|
||||
// Blur vertically
|
||||
new PostEffect()
|
||||
{
|
||||
shader = PFX_VolFogGlowBlurVertShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
internalName = "vert";
|
||||
texture[0] = "$inTex";
|
||||
target = "$outTex";
|
||||
};
|
||||
// Blur horizontally
|
||||
new PostEffect()
|
||||
{
|
||||
shader = PFX_VolFogGlowBlurHorzShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
internalName = "hor";
|
||||
texture[0] = "$inTex";
|
||||
target = "$outTex";
|
||||
};
|
||||
// Upsample and combine with the back buffer.
|
||||
new PostEffect()
|
||||
{
|
||||
shader = PFX_PassthruShader;
|
||||
stateBlock = PFX_GlowCombineStateBlock;
|
||||
texture[0] = "$inTex";
|
||||
target = "$backBuffer";
|
||||
};
|
||||
};
|
||||
|
||||
function VolFogGlowPostFx::setShaderConsts( %this )
|
||||
{
|
||||
%vp=%this-->vert;
|
||||
%vp.setShaderConst( "$strength", $VolFogGlowPostFx::glowStrength );
|
||||
%vp=%this-->hor;
|
||||
%vp.setShaderConst( "$strength", $VolFogGlowPostFx::glowStrength );
|
||||
}
|
||||
|
|
@ -70,6 +70,7 @@ function PostFXManager::settingsSetEnabled(%this, %bEnablePostFX)
|
|||
|
||||
postVerbose("% - PostFX Manager - PostFX disabled");
|
||||
}
|
||||
VolFogGlowPostFx.disable();
|
||||
}
|
||||
|
||||
function PostFXManager::settingsEffectSetEnabled(%this, %sName, %bEnable)
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ function initRenderManager()
|
|||
DiffuseRenderPassManager.addManager( new RenderParticleMgr() { renderOrder = 1.35; processAddOrder = 1.35; } );
|
||||
DiffuseRenderPassManager.addManager( new RenderTranslucentMgr() { renderOrder = 1.4; processAddOrder = 1.4; } );
|
||||
|
||||
DiffuseRenderPassManager.addManager(new RenderObjectMgr(FogBin){ bintype = "ObjectVolumetricFog"; renderOrder = 1.45; processAddOrder = 1.45; } );
|
||||
|
||||
// Note that the GlowPostFx is triggered after this bin.
|
||||
DiffuseRenderPassManager.addManager( new RenderGlowMgr(GlowBin) { renderOrder = 1.5; processAddOrder = 1.5; } );
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
if($GameCanvas == OculusCanvas)
|
||||
$GameCanvas = 0;
|
||||
$GameCanvas = Canvas;
|
||||
|
||||
// Cleanup Dialog created by 'core'
|
||||
if( isObject( MessagePopupDlg ) )
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ $displayHelp = false;
|
|||
|
||||
// Use these to record and play back crashes
|
||||
//saveJournal("editorOnFileQuitCrash.jrn");
|
||||
//playJournal("editorOnFileQuitCrash.jrn", false);
|
||||
//playJournal("editorOnFileQuitCrash.jrn");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Check if a script file exists, compiled or not.
|
||||
|
|
@ -186,10 +186,8 @@ function displayHelp() {
|
|||
" <game_name> Works like the -game argument\n"@
|
||||
" -dir <dir_name> Add <dir_name> to list of directories\n"@
|
||||
" -console Open a separate console\n"@
|
||||
" -show <shape> Deprecated\n"@
|
||||
" -jSave <file_name> Record a journal\n"@
|
||||
" -jPlay <file_name> Play back a journal\n"@
|
||||
" -jDebug <file_name> Play back a journal and issue an int3 at the end\n"@
|
||||
" -help Display this help message\n"
|
||||
);
|
||||
}
|
||||
|
|
@ -252,6 +250,11 @@ else {
|
|||
onStart();
|
||||
echo("Engine initialized...");
|
||||
|
||||
ModuleDatabase.scanModules( "" );
|
||||
|
||||
//You can also explicitly decalre some modules here to be loaded by default if they are part of your game
|
||||
//Ex: ModuleDatabase.LoadExplicit( "AppCore" );
|
||||
|
||||
if( !$isDedicated )
|
||||
{
|
||||
// As we know at this point that the initial load is complete,
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ $displayHelp = false;
|
|||
|
||||
// Use these to record and play back crashes
|
||||
//saveJournal("editorOnFileQuitCrash.jrn");
|
||||
//playJournal("editorOnFileQuitCrash.jrn", false);
|
||||
//playJournal("editorOnFileQuitCrash.jrn");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Check if a script file exists, compiled or not.
|
||||
|
|
@ -186,10 +186,8 @@ function displayHelp() {
|
|||
" <game_name> Works like the -game argument\n"@
|
||||
" -dir <dir_name> Add <dir_name> to list of directories\n"@
|
||||
" -console Open a separate console\n"@
|
||||
" -show <shape> Deprecated\n"@
|
||||
" -jSave <file_name> Record a journal\n"@
|
||||
" -jPlay <file_name> Play back a journal\n"@
|
||||
" -jDebug <file_name> Play back a journal and issue an int3 at the end\n"@
|
||||
" -help Display this help message\n"
|
||||
);
|
||||
}
|
||||
|
|
|
|||
106
Templates/Empty/game/scripts/server/VolumetricFog.cs
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VolumetricFog::onEnterFog(%this,%obj)
|
||||
{
|
||||
// This method is called whenever the control object (Camera or Player)
|
||||
// %obj enters the fog area.
|
||||
|
||||
// echo("Control Object " @ %obj @ " enters fog " @ %this);
|
||||
}
|
||||
|
||||
function VolumetricFog::onLeaveFog(%this,%obj)
|
||||
{
|
||||
// This method is called whenever the control object (Camera or Player)
|
||||
// %obj leaves the fog area.
|
||||
|
||||
// echo("Control Object " @ %obj @ " left fog " @ %this);
|
||||
}
|
||||
|
||||
function VolumetricFog::Dissolve(%this,%speed,%delete)
|
||||
{
|
||||
// This method dissolves the fog at speed milliseconds
|
||||
%this.isBuilding = true;
|
||||
if (%this.FogDensity > 0)
|
||||
{
|
||||
%this.setFogDensity(%this.FogDensity - 0.005);
|
||||
%this.schedule(%speed,Dissolve,%speed,%delete);
|
||||
}
|
||||
else
|
||||
{
|
||||
%this.isBuilding = false;
|
||||
%this.SetFogDensity(0.0);
|
||||
if (%delete !$= "" && %delete !$="0" && %delete !$="false")
|
||||
%this.schedule(250,delete);
|
||||
}
|
||||
}
|
||||
|
||||
function VolumetricFog::Thicken(%this,%speed, %end_density)
|
||||
{
|
||||
// This method thickens the fog at speed milliseconds to a density of %end_density
|
||||
|
||||
%this.isBuilding = true;
|
||||
if (%this.FogDensity + 0.005 < %end_density)
|
||||
{
|
||||
%this.setFogDensity(%this.FogDensity + 0.005);
|
||||
%this.schedule(%speed,Thicken,%speed, %end_density);
|
||||
}
|
||||
else
|
||||
{
|
||||
%this.setFogDensity(%end_density);
|
||||
%this.isBuilding = false;
|
||||
}
|
||||
}
|
||||
|
||||
function GenerateFog(%pos,%scale,%color,%density)
|
||||
{
|
||||
// This function can be used to generate some fog caused by massive gunfire etc.
|
||||
// Change shape and modulation data to your likings.
|
||||
|
||||
%fog=new VolumetricFog() {
|
||||
shapeName = "art/environment/Fog_Sphere.dts";
|
||||
fogColor = %color;
|
||||
fogDensity = "0.0";
|
||||
ignoreWater = "0";
|
||||
MinSize = "250";
|
||||
FadeSize = "750";
|
||||
texture = "art/environment/FogMod_heavy.dds";
|
||||
tiles = "1";
|
||||
modStrength = "0.2";
|
||||
PrimSpeed = "-0.01 0.04";
|
||||
SecSpeed = "0.02 0.02";
|
||||
position = %pos;
|
||||
rotation = "0 0 1 20.354";
|
||||
scale = %scale;
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
};
|
||||
|
||||
if (isObject(%fog))
|
||||
{
|
||||
MissionCleanup.add(%fog);
|
||||
|
||||
%fog.Thicken(500,%density);
|
||||
}
|
||||
|
||||
return %fog;
|
||||
}
|
||||
|
|
@ -22,3 +22,4 @@
|
|||
|
||||
// Load up all scripts. This function is called when
|
||||
// a server is constructed.
|
||||
exec("./VolumetricFog.cs");
|
||||
87
Templates/Empty/game/shaders/common/VolumetricFog/VFogP.hlsl
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog final pixel shader V2.00
|
||||
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../torque.hlsl"
|
||||
|
||||
uniform sampler2D prepassTex : register(S0);
|
||||
uniform sampler2D depthBuffer : register(S1);
|
||||
uniform sampler2D frontBuffer : register(S2);
|
||||
uniform sampler2D density : register(S3);
|
||||
|
||||
uniform float accumTime;
|
||||
uniform float4 fogColor;
|
||||
uniform float fogDensity;
|
||||
uniform float preBias;
|
||||
uniform float textured;
|
||||
uniform float modstrength;
|
||||
uniform float4 modspeed;//xy speed layer 1, zw speed layer 2
|
||||
uniform float2 viewpoint;
|
||||
uniform float2 texscale;
|
||||
uniform float3 ambientColor;
|
||||
uniform float numtiles;
|
||||
uniform float fadesize;
|
||||
uniform float2 PixelSize;
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 htpos : TEXCOORD0;
|
||||
float2 uv0 : TEXCOORD1;
|
||||
};
|
||||
|
||||
float4 main( ConnectData IN ) : COLOR0
|
||||
{
|
||||
float2 uvscreen=((IN.htpos.xy/IN.htpos.w) + 1.0 ) / 2.0;
|
||||
uvscreen.y = 1.0 - uvscreen.y;
|
||||
|
||||
float obj_test = prepassUncondition( prepassTex, uvscreen).w * preBias;
|
||||
float depth = tex2D(depthBuffer,uvscreen).r;
|
||||
float front = tex2D(frontBuffer,uvscreen).r;
|
||||
|
||||
if (depth <= front)
|
||||
return float4(0,0,0,0);
|
||||
else if ( obj_test < depth )
|
||||
depth = obj_test;
|
||||
if ( front >= 0.0)
|
||||
depth -= front;
|
||||
|
||||
float diff = 1.0;
|
||||
float3 col = fogColor.rgb;
|
||||
if (textured != 0.0)
|
||||
{
|
||||
float2 offset = viewpoint + ((-0.5 + (texscale * uvscreen)) * numtiles);
|
||||
|
||||
float2 mod1 = tex2D(density,(offset + (modspeed.xy*accumTime))).rg;
|
||||
float2 mod2= tex2D(density,(offset + (modspeed.zw*accumTime))).rg;
|
||||
diff = (mod2.r + mod1.r) * modstrength;
|
||||
col *= (2.0 - ((mod1.g + mod2.g) * fadesize))/2.0;
|
||||
}
|
||||
|
||||
col *= ambientColor;
|
||||
|
||||
float4 resultColor = float4(col, 1.0 - saturate(exp(-fogDensity * depth * diff * fadesize)));
|
||||
|
||||
return hdrEncode(resultColor);
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog prepass pixel shader V1.00
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 pos : TEXCOORD0;
|
||||
};
|
||||
|
||||
float4 main( ConnectData IN ) : COLOR0
|
||||
{
|
||||
float OUT;
|
||||
|
||||
clip( IN.pos.w );
|
||||
OUT = IN.pos.w;
|
||||
|
||||
return float4(OUT,0,0,1);
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog prepass vertex shader V1.00
|
||||
|
||||
#include "shaders/common/hlslstructs.h"
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 pos : TEXCOORD0;
|
||||
};
|
||||
|
||||
uniform float4x4 modelView;
|
||||
|
||||
ConnectData main( VertexIn_P IN)
|
||||
{
|
||||
ConnectData OUT;
|
||||
|
||||
float4 inPos = IN.pos;
|
||||
inPos.w = 1.0;
|
||||
|
||||
OUT.hpos = mul( modelView, inPos );
|
||||
OUT.pos = OUT.hpos;
|
||||
|
||||
return OUT;
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
uniform float4 fogColor;
|
||||
uniform float fogDensity;
|
||||
uniform float reflStrength;
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 pos : TEXCOORD0;
|
||||
};
|
||||
|
||||
float4 main( ConnectData IN ) : COLOR0
|
||||
{
|
||||
return float4(fogColor.rgb,saturate(fogDensity*reflStrength));
|
||||
}
|
||||
45
Templates/Empty/game/shaders/common/VolumetricFog/VFogV.hlsl
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog final vertex shader V1.00
|
||||
|
||||
#include "shaders/common/hlslstructs.h"
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 htpos : TEXCOORD0;
|
||||
float2 uv0 : TEXCOORD1;
|
||||
};
|
||||
|
||||
uniform float4x4 modelView;
|
||||
|
||||
ConnectData main( VertexIn_PNT IN)
|
||||
{
|
||||
ConnectData OUT;
|
||||
|
||||
OUT.hpos = mul(modelView, IN.pos);
|
||||
OUT.htpos = OUT.hpos;
|
||||
OUT.uv0 = IN.uv0;
|
||||
|
||||
return OUT;
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../../gl/torque.glsl"
|
||||
|
||||
uniform sampler2D prepassTex;
|
||||
uniform sampler2D depthBuffer;
|
||||
uniform sampler2D frontBuffer;
|
||||
uniform sampler2D density;
|
||||
|
||||
uniform float accumTime;
|
||||
uniform vec4 fogColor;
|
||||
uniform float fogDensity;
|
||||
uniform float preBias;
|
||||
uniform float textured;
|
||||
uniform float modstrength;
|
||||
uniform vec4 modspeed;//xy speed layer 1, zw speed layer 2
|
||||
uniform vec2 viewpoint;
|
||||
uniform vec2 texscale;
|
||||
uniform vec3 ambientColor;
|
||||
uniform float numtiles;
|
||||
uniform float fadesize;
|
||||
uniform vec2 PixelSize;
|
||||
|
||||
in vec4 _hpos;
|
||||
#define IN_hpos _hpos
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uvscreen=((IN_hpos.xy/IN_hpos.w) + 1.0 ) / 2.0;
|
||||
uvscreen.y = 1.0 - uvscreen.y;
|
||||
|
||||
float obj_test = prepassUncondition( prepassTex, uvscreen).w * preBias;
|
||||
float depth = tex2D(depthBuffer,uvscreen).r;
|
||||
float front = tex2D(frontBuffer,uvscreen).r;
|
||||
|
||||
if (depth <= front)
|
||||
{
|
||||
OUT_col = vec4(0,0,0,0);
|
||||
return;
|
||||
}
|
||||
|
||||
else if ( obj_test < depth )
|
||||
depth = obj_test;
|
||||
if ( front >= 0.0)
|
||||
depth -= front;
|
||||
|
||||
float diff = 1.0;
|
||||
vec3 col = fogColor.rgb;
|
||||
if (textured != 0.0)
|
||||
{
|
||||
vec2 offset = viewpoint + ((-0.5 + (texscale * uvscreen)) * numtiles);
|
||||
|
||||
vec2 mod1 = tex2D(density,(offset + (modspeed.xy*accumTime))).rg;
|
||||
vec2 mod2= tex2D(density,(offset + (modspeed.zw*accumTime))).rg;
|
||||
diff = (mod2.r + mod1.r) * modstrength;
|
||||
col *= (2.0 - ((mod1.g + mod2.g) * fadesize))/2.0;
|
||||
}
|
||||
|
||||
col *= ambientColor;
|
||||
|
||||
vec4 returnColor = vec4(col, 1.0 - saturate(exp(-fogDensity * depth * diff * fadesize)));
|
||||
|
||||
OUT_col = hdrEncode(returnColor);
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
in vec4 _hpos;
|
||||
#define IN_hpos _hpos
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
float OUT;
|
||||
clip( IN_hpos.w );
|
||||
OUT = IN_hpos.w;
|
||||
|
||||
OUT_col = vec4(OUT,0,0,1);
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
in vec4 vPosition;
|
||||
#define IN_position vPosition
|
||||
|
||||
out vec4 _hpos;
|
||||
#define OUT_hpos _hpos
|
||||
|
||||
uniform mat4 modelView;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 inPos = IN_position;
|
||||
inPos.w = 1.0;
|
||||
|
||||
OUT_hpos = tMul( modelView, inPos );
|
||||
|
||||
gl_Position = OUT_hpos;
|
||||
correctSSP(gl_Position);
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
uniform vec4 fogColor;
|
||||
uniform float fogDensity;
|
||||
uniform float reflStrength;
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_col = vec4(fogColor.rgb,saturate(fogDensity*reflStrength));
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
in vec4 vPosition;
|
||||
#define IN_position vPosition
|
||||
|
||||
out vec4 _hpos;
|
||||
#define OUT_hpos _hpos
|
||||
|
||||
uniform mat4 modelView;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_hpos = tMul(modelView, IN_position);
|
||||
gl_Position = OUT_hpos;
|
||||
correctSSP(gl_Position);
|
||||
}
|
||||
|
|
@ -36,14 +36,9 @@ float vernierScale(float fCos)
|
|||
}
|
||||
|
||||
in vec4 vPosition;
|
||||
in vec3 vNormal;
|
||||
in vec4 vColor;
|
||||
in vec2 vTexCoord0;
|
||||
|
||||
// This is the shader input vertex structure.
|
||||
#define IN_position vPosition
|
||||
#define IN_normal vNormal
|
||||
#define IN_color vColor
|
||||
|
||||
// This is the shader output data.
|
||||
out vec4 rayleighColor;
|
||||
|
|
|
|||
|
|
@ -139,12 +139,27 @@ mat3x3 quatToMat( vec4 quat )
|
|||
vec2 parallaxOffset( sampler2D texMap, vec2 texCoord, vec3 negViewTS, float depthScale )
|
||||
{
|
||||
float depth = texture( texMap, texCoord ).a;
|
||||
vec2 offset = negViewTS.xy * ( depth * depthScale );
|
||||
vec2 offset = negViewTS.xy * vec2( depth * depthScale );
|
||||
|
||||
for ( int i=0; i < PARALLAX_REFINE_STEPS; i++ )
|
||||
{
|
||||
depth = ( depth + texture( texMap, texCoord + offset ).a ) * 0.5;
|
||||
offset = negViewTS.xy * ( depth * depthScale );
|
||||
offset = negViewTS.xy * vec2( depth * depthScale );
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
/// Same as parallaxOffset but for dxtnm where depth is stored in the red channel instead of the alpha
|
||||
vec2 parallaxOffsetDxtnm(sampler2D texMap, vec2 texCoord, vec3 negViewTS, float depthScale)
|
||||
{
|
||||
float depth = texture(texMap, texCoord).r;
|
||||
vec2 offset = negViewTS.xy * vec2(depth * depthScale);
|
||||
|
||||
for (int i = 0; i < PARALLAX_REFINE_STEPS; i++)
|
||||
{
|
||||
depth = (depth + texture(texMap, texCoord + offset).r) * 0.5;
|
||||
offset = negViewTS.xy * vec2(depth * depthScale);
|
||||
}
|
||||
|
||||
return offset;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../../postfx/postFx.hlsl"
|
||||
|
||||
|
||||
float4 main( PFXVertToPix IN,
|
||||
uniform sampler2D glowBuffer : register(S0) ) : COLOR0
|
||||
{
|
||||
return tex2D(glowBuffer, IN.uv0);
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../../../postFx/gl/postFX.glsl"
|
||||
|
||||
uniform sampler2D glowBuffer;
|
||||
|
||||
out vec4 OUT_FragColor0;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_FragColor0 = texture(glowBuffer, uv0);
|
||||
}
|
||||
|
|
@ -28,6 +28,7 @@
|
|||
#include "../../../gl/lighting.glsl"
|
||||
#include "../../shadowMap/shadowMapIO_GLSL.h"
|
||||
#include "softShadow.glsl"
|
||||
#include "../../../gl/torque.glsl"
|
||||
|
||||
in vec4 wsEyeDir;
|
||||
in vec4 ssPos;
|
||||
|
|
@ -107,6 +108,7 @@ uniform sampler2D prePassBuffer;
|
|||
uniform samplerCube shadowMap;
|
||||
#else
|
||||
uniform sampler2D shadowMap;
|
||||
uniform sampler2D dynamicShadowMap;
|
||||
#endif
|
||||
|
||||
uniform vec4 rtParams0;
|
||||
|
|
@ -119,9 +121,10 @@ uniform vec2 lightAttenuation;
|
|||
uniform vec4 lightMapParams;
|
||||
uniform vec4 vsFarPlane;
|
||||
uniform mat3 viewToLightProj;
|
||||
uniform mat3 dynamicViewToLightProj;
|
||||
uniform vec4 lightParams;
|
||||
uniform float shadowSoftness;
|
||||
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
|
|
@ -175,7 +178,7 @@ void main()
|
|||
|
||||
vec2 shadowCoord = decodeShadowCoord( tMul( viewToLightProj, -lightVec ) ).xy;
|
||||
|
||||
float shadowed = softShadow_filter( shadowMap,
|
||||
float static_shadowed = softShadow_filter( shadowMap,
|
||||
ssPos.xy,
|
||||
shadowCoord,
|
||||
shadowSoftness,
|
||||
|
|
@ -183,17 +186,28 @@ void main()
|
|||
nDotL,
|
||||
lightParams.y );
|
||||
|
||||
vec2 dynamicShadowCoord = decodeShadowCoord( tMul( dynamicViewToLightProj, -lightVec ) ).xy;
|
||||
float dynamic_shadowed = softShadow_filter( dynamicShadowMap,
|
||||
ssPos.xy,
|
||||
dynamicShadowCoord,
|
||||
shadowSoftness,
|
||||
distToLight,
|
||||
nDotL,
|
||||
lightParams.y );
|
||||
|
||||
float shadowed = min(static_shadowed, dynamic_shadowed);
|
||||
#endif
|
||||
|
||||
#endif // !NO_SHADOW
|
||||
|
||||
vec3 lightcol = lightColor.rgb;
|
||||
#ifdef USE_COOKIE_TEX
|
||||
|
||||
// Lookup the cookie sample.
|
||||
vec4 cookie = texture( cookieMap, tMul( viewToLightProj, -lightVec ) );
|
||||
|
||||
// Multiply the light with the cookie tex.
|
||||
lightColor.rgb *= cookie.rgb;
|
||||
lightcol *= cookie.rgb;
|
||||
|
||||
// Use a maximum channel luminance to attenuate
|
||||
// the lighting else we get specular in the dark
|
||||
|
|
@ -211,7 +225,7 @@ void main()
|
|||
normalize( -eyeRay ) ) * lightBrightness * atten * shadowed;
|
||||
|
||||
float Sat_NL_Att = saturate( nDotL * atten * shadowed ) * lightBrightness;
|
||||
vec3 lightColorOut = lightMapParams.rgb * lightColor.rgb;
|
||||
vec3 lightColorOut = lightMapParams.rgb * lightcol;
|
||||
vec4 addToResult = vec4(0.0);
|
||||
|
||||
// TODO: This needs to be removed when lightmapping is disabled
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "softShadow.glsl"
|
||||
#include "../../../gl/lighting.glsl"
|
||||
#include "../../../gl/torque.glsl"
|
||||
|
||||
in vec4 wsEyeDir;
|
||||
in vec4 ssPos;
|
||||
|
|
@ -45,6 +46,7 @@ uniform sampler2D cookieMap;
|
|||
|
||||
uniform sampler2D prePassBuffer;
|
||||
uniform sampler2D shadowMap;
|
||||
uniform sampler2D dynamicShadowMap;
|
||||
|
||||
uniform vec4 rtParams0;
|
||||
|
||||
|
|
@ -59,6 +61,7 @@ uniform vec4 lightMapParams;
|
|||
|
||||
uniform vec4 vsFarPlane;
|
||||
uniform mat4 viewToLightProj;
|
||||
uniform mat4 dynamicViewToLightProj;
|
||||
|
||||
uniform vec4 lightParams;
|
||||
uniform float shadowSoftness;
|
||||
|
|
@ -70,7 +73,7 @@ void main()
|
|||
// Compute scene UV
|
||||
vec3 ssPos = IN_ssPos.xyz / IN_ssPos.w;
|
||||
vec2 uvScene = getUVFromSSPos( ssPos, rtParams0 );
|
||||
|
||||
|
||||
// Sample/unpack the normal/z data
|
||||
vec4 prepassSample = prepassUncondition( prePassBuffer, uvScene );
|
||||
vec3 normal = prepassSample.rgb;
|
||||
|
|
@ -102,6 +105,10 @@ void main()
|
|||
vec2 shadowCoord = ( ( pxlPosLightProj.xy / pxlPosLightProj.w ) * 0.5 ) + vec2( 0.5, 0.5 );
|
||||
shadowCoord.y = 1.0f - shadowCoord.y;
|
||||
|
||||
// Get the dynamic shadow texture coordinate
|
||||
vec4 dynpxlPosLightProj = tMul( dynamicViewToLightProj, vec4( viewSpacePos, 1 ) );
|
||||
vec2 dynshadowCoord = ( ( dynpxlPosLightProj.xy / dynpxlPosLightProj.w ) * 0.5 ) + vec2( 0.5, 0.5 );
|
||||
dynshadowCoord.y = 1.0f - dynshadowCoord.y;
|
||||
#ifdef NO_SHADOW
|
||||
|
||||
float shadowed = 1.0;
|
||||
|
|
@ -111,7 +118,7 @@ void main()
|
|||
// Get a linear depth from the light source.
|
||||
float distToLight = pxlPosLightProj.z / lightRange;
|
||||
|
||||
float shadowed = softShadow_filter( shadowMap,
|
||||
float static_shadowed = softShadow_filter( shadowMap,
|
||||
ssPos.xy,
|
||||
shadowCoord,
|
||||
shadowSoftness,
|
||||
|
|
@ -119,15 +126,24 @@ void main()
|
|||
nDotL,
|
||||
lightParams.y );
|
||||
|
||||
float dynamic_shadowed = softShadow_filter( dynamicShadowMap,
|
||||
ssPos.xy,
|
||||
dynshadowCoord,
|
||||
shadowSoftness,
|
||||
distToLight,
|
||||
nDotL,
|
||||
lightParams.y );
|
||||
float shadowed = min(static_shadowed, dynamic_shadowed);
|
||||
#endif // !NO_SHADOW
|
||||
|
||||
vec3 lightcol = lightColor.rgb;
|
||||
#ifdef USE_COOKIE_TEX
|
||||
|
||||
// Lookup the cookie sample.
|
||||
vec4 cookie = texture( cookieMap, shadowCoord );
|
||||
|
||||
// Multiply the light with the cookie tex.
|
||||
lightColor.rgb *= cookie.rgb;
|
||||
lightcol *= cookie.rgb;
|
||||
|
||||
// Use a maximum channel luminance to attenuate
|
||||
// the lighting else we get specular in the dark
|
||||
|
|
@ -145,7 +161,7 @@ void main()
|
|||
normalize( -eyeRay ) ) * lightBrightness * atten * shadowed;
|
||||
|
||||
float Sat_NL_Att = saturate( nDotL * atten * shadowed ) * lightBrightness;
|
||||
vec3 lightColorOut = lightMapParams.rgb * lightColor.rgb;
|
||||
vec3 lightColorOut = lightMapParams.rgb * lightcol;
|
||||
vec4 addToResult = vec4(0.0);
|
||||
|
||||
// TODO: This needs to be removed when lightmapping is disabled
|
||||
|
|
|
|||
|
|
@ -34,38 +34,162 @@ in vec2 uv0;
|
|||
in vec3 wsEyeRay;
|
||||
in vec3 vsEyeRay;
|
||||
|
||||
uniform sampler2D ShadowMap ;
|
||||
uniform sampler2D shadowMap;
|
||||
uniform sampler2D dynamicShadowMap;
|
||||
|
||||
#ifdef USE_SSAO_MASK
|
||||
uniform sampler2D ssaoMask ;
|
||||
uniform vec4 rtParams2;
|
||||
#endif
|
||||
|
||||
uniform sampler2D prePassBuffer;
|
||||
uniform sampler2D prePassBuffer;
|
||||
uniform vec3 lightDirection;
|
||||
uniform vec4 lightColor;
|
||||
uniform float lightBrightness;
|
||||
uniform vec4 lightAmbient;
|
||||
uniform vec3 eyePosWorld;
|
||||
uniform mat4x4 worldToLightProj;
|
||||
uniform vec4 scaleX;
|
||||
uniform vec4 scaleY;
|
||||
uniform vec4 offsetX;
|
||||
uniform vec4 offsetY;
|
||||
uniform mat4x4 eyeMat;
|
||||
uniform vec4 atlasXOffset;
|
||||
uniform vec4 atlasYOffset;
|
||||
uniform vec2 atlasScale;
|
||||
uniform vec4 zNearFarInvNearFar;
|
||||
uniform vec4 lightMapParams;
|
||||
uniform vec2 fadeStartLength;
|
||||
uniform vec4 farPlaneScalePSSM;
|
||||
uniform vec4 overDarkPSSM;
|
||||
uniform float shadowSoftness;
|
||||
|
||||
//static shadowMap
|
||||
uniform mat4x4 worldToLightProj;
|
||||
uniform vec4 scaleX;
|
||||
uniform vec4 scaleY;
|
||||
uniform vec4 offsetX;
|
||||
uniform vec4 offsetY;
|
||||
uniform vec4 farPlaneScalePSSM;
|
||||
|
||||
//dynamic shadowMap
|
||||
uniform mat4x4 dynamicWorldToLightProj;
|
||||
uniform vec4 dynamicScaleX;
|
||||
uniform vec4 dynamicScaleY;
|
||||
uniform vec4 dynamicOffsetX;
|
||||
uniform vec4 dynamicOffsetY;
|
||||
uniform vec4 dynamicFarPlaneScalePSSM;
|
||||
|
||||
vec4 AL_VectorLightShadowCast( sampler2D _sourceshadowMap,
|
||||
vec2 _texCoord,
|
||||
mat4 _worldToLightProj,
|
||||
vec4 _worldPos,
|
||||
vec4 _scaleX, vec4 _scaleY,
|
||||
vec4 _offsetX, vec4 _offsetY,
|
||||
vec4 _farPlaneScalePSSM,
|
||||
vec4 _atlasXOffset, vec4 _atlasYOffset,
|
||||
vec2 _atlasScale,
|
||||
float _shadowSoftness,
|
||||
float _dotNL ,
|
||||
vec4 _overDarkPSSM
|
||||
)
|
||||
{
|
||||
|
||||
// Compute shadow map coordinate
|
||||
vec4 pxlPosLightProj = tMul(_worldToLightProj, _worldPos);
|
||||
vec2 baseShadowCoord = pxlPosLightProj.xy / pxlPosLightProj.w;
|
||||
|
||||
// Distance to light, in shadowMap space
|
||||
float distToLight = pxlPosLightProj.z / pxlPosLightProj.w;
|
||||
|
||||
// Figure out which split to sample from. Basically, we compute the shadowMap sample coord
|
||||
// for all of the splits and then check if its valid.
|
||||
vec4 shadowCoordX = vec4( baseShadowCoord.x );
|
||||
vec4 shadowCoordY = vec4( baseShadowCoord.y );
|
||||
vec4 farPlaneDists = vec4( distToLight );
|
||||
shadowCoordX *= _scaleX;
|
||||
shadowCoordY *= _scaleY;
|
||||
shadowCoordX += _offsetX;
|
||||
shadowCoordY += _offsetY;
|
||||
farPlaneDists *= _farPlaneScalePSSM;
|
||||
|
||||
// If the shadow sample is within -1..1 and the distance
|
||||
// to the light for this pixel is less than the far plane
|
||||
// of the split, use it.
|
||||
vec4 finalMask;
|
||||
if ( shadowCoordX.x > -0.99 && shadowCoordX.x < 0.99 &&
|
||||
shadowCoordY.x > -0.99 && shadowCoordY.x < 0.99 &&
|
||||
farPlaneDists.x < 1.0 )
|
||||
finalMask = vec4(1, 0, 0, 0);
|
||||
|
||||
else if ( shadowCoordX.y > -0.99 && shadowCoordX.y < 0.99 &&
|
||||
shadowCoordY.y > -0.99 && shadowCoordY.y < 0.99 &&
|
||||
farPlaneDists.y < 1.0 )
|
||||
finalMask = vec4(0, 1, 0, 0);
|
||||
|
||||
else if ( shadowCoordX.z > -0.99 && shadowCoordX.z < 0.99 &&
|
||||
shadowCoordY.z > -0.99 && shadowCoordY.z < 0.99 &&
|
||||
farPlaneDists.z < 1.0 )
|
||||
finalMask = vec4(0, 0, 1, 0);
|
||||
|
||||
else
|
||||
finalMask = vec4(0, 0, 0, 1);
|
||||
|
||||
vec3 debugColor = vec3(0);
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
debugColor = vec3(1.0);
|
||||
#endif
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
if ( finalMask.x > 0 )
|
||||
debugColor += vec3( 1, 0, 0 );
|
||||
else if ( finalMask.y > 0 )
|
||||
debugColor += vec3( 0, 1, 0 );
|
||||
else if ( finalMask.z > 0 )
|
||||
debugColor += vec3( 0, 0, 1 );
|
||||
else if ( finalMask.w > 0 )
|
||||
debugColor += vec3( 1, 1, 0 );
|
||||
#endif
|
||||
|
||||
// Here we know what split we're sampling from, so recompute the _texCoord location
|
||||
// Yes, we could just use the result from above, but doing it this way actually saves
|
||||
// shader instructions.
|
||||
vec2 finalScale;
|
||||
finalScale.x = dot(finalMask, _scaleX);
|
||||
finalScale.y = dot(finalMask, _scaleY);
|
||||
|
||||
vec2 finalOffset;
|
||||
finalOffset.x = dot(finalMask, _offsetX);
|
||||
finalOffset.y = dot(finalMask, _offsetY);
|
||||
|
||||
vec2 shadowCoord;
|
||||
shadowCoord = baseShadowCoord * finalScale;
|
||||
shadowCoord += finalOffset;
|
||||
|
||||
// Convert to _texCoord space
|
||||
shadowCoord = 0.5 * shadowCoord + vec2(0.5, 0.5);
|
||||
shadowCoord.y = 1.0f - shadowCoord.y;
|
||||
|
||||
// Move around inside of atlas
|
||||
vec2 aOffset;
|
||||
aOffset.x = dot(finalMask, _atlasXOffset);
|
||||
aOffset.y = dot(finalMask, _atlasYOffset);
|
||||
|
||||
shadowCoord *= _atlasScale;
|
||||
shadowCoord += aOffset;
|
||||
|
||||
// Each split has a different far plane, take this into account.
|
||||
float farPlaneScale = dot( _farPlaneScalePSSM, finalMask );
|
||||
distToLight *= farPlaneScale;
|
||||
|
||||
return vec4(debugColor,
|
||||
softShadow_filter( _sourceshadowMap,
|
||||
_texCoord,
|
||||
shadowCoord,
|
||||
farPlaneScale * _shadowSoftness,
|
||||
distToLight,
|
||||
_dotNL,
|
||||
dot( finalMask, _overDarkPSSM ) ) );
|
||||
}
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
{
|
||||
// Sample/unpack the normal/z data
|
||||
vec4 prepassSample = prepassUncondition( prePassBuffer, uv0 );
|
||||
vec3 normal = prepassSample.rgb;
|
||||
|
|
@ -92,102 +216,52 @@ void main()
|
|||
|
||||
#else
|
||||
|
||||
// Compute shadow map coordinate
|
||||
vec4 pxlPosLightProj = tMul(worldToLightProj, worldPos);
|
||||
vec2 baseShadowCoord = pxlPosLightProj.xy / pxlPosLightProj.w;
|
||||
vec4 static_shadowed_colors = AL_VectorLightShadowCast( shadowMap,
|
||||
uv0.xy,
|
||||
worldToLightProj,
|
||||
worldPos,
|
||||
scaleX, scaleY,
|
||||
offsetX, offsetY,
|
||||
farPlaneScalePSSM,
|
||||
atlasXOffset, atlasYOffset,
|
||||
atlasScale,
|
||||
shadowSoftness,
|
||||
dotNL,
|
||||
overDarkPSSM);
|
||||
|
||||
// Distance to light, in shadowmap space
|
||||
float distToLight = pxlPosLightProj.z / pxlPosLightProj.w;
|
||||
|
||||
// Figure out which split to sample from. Basically, we compute the shadowmap sample coord
|
||||
// for all of the splits and then check if its valid.
|
||||
vec4 shadowCoordX = vec4( baseShadowCoord.x );
|
||||
vec4 shadowCoordY = vec4( baseShadowCoord.y );
|
||||
vec4 farPlaneDists = vec4( distToLight );
|
||||
shadowCoordX *= scaleX;
|
||||
shadowCoordY *= scaleY;
|
||||
shadowCoordX += offsetX;
|
||||
shadowCoordY += offsetY;
|
||||
farPlaneDists *= farPlaneScalePSSM;
|
||||
|
||||
vec4 dynamic_shadowed_colors = AL_VectorLightShadowCast( dynamicShadowMap,
|
||||
uv0.xy,
|
||||
dynamicWorldToLightProj,
|
||||
worldPos,
|
||||
dynamicScaleX, dynamicScaleY,
|
||||
dynamicOffsetX, dynamicOffsetY,
|
||||
dynamicFarPlaneScalePSSM,
|
||||
atlasXOffset, atlasYOffset,
|
||||
atlasScale,
|
||||
shadowSoftness,
|
||||
dotNL,
|
||||
overDarkPSSM);
|
||||
|
||||
// If the shadow sample is within -1..1 and the distance
|
||||
// to the light for this pixel is less than the far plane
|
||||
// of the split, use it.
|
||||
vec4 finalMask;
|
||||
if ( shadowCoordX.x > -0.99 && shadowCoordX.x < 0.99 &&
|
||||
shadowCoordY.x > -0.99 && shadowCoordY.x < 0.99 &&
|
||||
farPlaneDists.x < 1.0 )
|
||||
finalMask = vec4(1, 0, 0, 0);
|
||||
|
||||
else if ( shadowCoordX.y > -0.99 && shadowCoordX.y < 0.99 &&
|
||||
shadowCoordY.y > -0.99 && shadowCoordY.y < 0.99 &&
|
||||
farPlaneDists.y < 1.0 )
|
||||
finalMask = vec4(0, 1, 0, 0);
|
||||
|
||||
else if ( shadowCoordX.z > -0.99 && shadowCoordX.z < 0.99 &&
|
||||
shadowCoordY.z > -0.99 && shadowCoordY.z < 0.99 &&
|
||||
farPlaneDists.z < 1.0 )
|
||||
finalMask = vec4(0, 0, 1, 0);
|
||||
|
||||
else
|
||||
finalMask = vec4(0, 0, 0, 1);
|
||||
|
||||
|
||||
float static_shadowed = static_shadowed_colors.a;
|
||||
float dynamic_shadowed = dynamic_shadowed_colors.a;
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
if ( finalMask.x > 0 )
|
||||
debugColor += vec3( 1, 0, 0 );
|
||||
else if ( finalMask.y > 0 )
|
||||
debugColor += vec3( 0, 1, 0 );
|
||||
else if ( finalMask.z > 0 )
|
||||
debugColor += vec3( 0, 0, 1 );
|
||||
else if ( finalMask.w > 0 )
|
||||
debugColor += vec3( 1, 1, 0 );
|
||||
debugColor = static_shadowed_colors.rgb*0.5+dynamic_shadowed_colors.rgb*0.5;
|
||||
#endif
|
||||
|
||||
// Here we know what split we're sampling from, so recompute the texcoord location
|
||||
// Yes, we could just use the result from above, but doing it this way actually saves
|
||||
// shader instructions.
|
||||
vec2 finalScale;
|
||||
finalScale.x = dot(finalMask, scaleX);
|
||||
finalScale.y = dot(finalMask, scaleY);
|
||||
|
||||
vec2 finalOffset;
|
||||
finalOffset.x = dot(finalMask, offsetX);
|
||||
finalOffset.y = dot(finalMask, offsetY);
|
||||
|
||||
vec2 shadowCoord;
|
||||
shadowCoord = baseShadowCoord * finalScale;
|
||||
shadowCoord += finalOffset;
|
||||
|
||||
// Convert to texcoord space
|
||||
shadowCoord = 0.5 * shadowCoord + vec2(0.5, 0.5);
|
||||
shadowCoord.y = 1.0f - shadowCoord.y;
|
||||
|
||||
// Move around inside of atlas
|
||||
vec2 aOffset;
|
||||
aOffset.x = dot(finalMask, atlasXOffset);
|
||||
aOffset.y = dot(finalMask, atlasYOffset);
|
||||
|
||||
shadowCoord *= atlasScale;
|
||||
shadowCoord += aOffset;
|
||||
|
||||
// Each split has a different far plane, take this into account.
|
||||
float farPlaneScale = dot( farPlaneScalePSSM, finalMask );
|
||||
distToLight *= farPlaneScale;
|
||||
|
||||
float shadowed = softShadow_filter( ShadowMap,
|
||||
uv0.xy,
|
||||
shadowCoord,
|
||||
farPlaneScale * shadowSoftness,
|
||||
distToLight,
|
||||
dotNL,
|
||||
dot( finalMask, overDarkPSSM ) );
|
||||
|
||||
|
||||
// Fade out the shadow at the end of the range.
|
||||
vec4 zDist = vec4(zNearFarInvNearFar.x + zNearFarInvNearFar.y * depth);
|
||||
float fadeOutAmt = ( zDist.x - fadeStartLength.x ) * fadeStartLength.y;
|
||||
shadowed = mix( shadowed, 1.0, saturate( fadeOutAmt ) );
|
||||
|
||||
|
||||
static_shadowed = mix( static_shadowed, 1.0, saturate( fadeOutAmt ) );
|
||||
dynamic_shadowed = mix( dynamic_shadowed, 1.0, saturate( fadeOutAmt ) );
|
||||
|
||||
// temp for debugging. uncomment one or the other.
|
||||
//float shadowed = static_shadowed;
|
||||
//float shadowed = dynamic_shadowed;
|
||||
float shadowed = min(static_shadowed, dynamic_shadowed);
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
if ( fadeOutAmt > 1.0 )
|
||||
debugColor = vec3(1.0);
|
||||
|
|
@ -228,7 +302,7 @@ void main()
|
|||
#ifdef PSSM_DEBUG_RENDER
|
||||
lightColorOut = debugColor;
|
||||
#endif
|
||||
|
||||
|
||||
OUT_col = lightinfoCondition( lightColorOut, Sat_NL_Att, specular, addToResult );
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "../../lighting.hlsl"
|
||||
#include "../shadowMap/shadowMapIO_HLSL.h"
|
||||
#include "softShadow.hlsl"
|
||||
|
||||
#include "../../torque.hlsl"
|
||||
|
||||
struct ConvexConnectP
|
||||
{
|
||||
|
|
@ -40,7 +40,7 @@ struct ConvexConnectP
|
|||
#ifdef USE_COOKIE_TEX
|
||||
|
||||
/// The texture for cookie rendering.
|
||||
uniform samplerCUBE cookieMap : register(S2);
|
||||
uniform samplerCUBE cookieMap : register(S3);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -114,6 +114,7 @@ float4 main( ConvexConnectP IN,
|
|||
uniform samplerCUBE shadowMap : register(S1),
|
||||
#else
|
||||
uniform sampler2D shadowMap : register(S1),
|
||||
uniform sampler2D dynamicShadowMap : register(S2),
|
||||
#endif
|
||||
|
||||
uniform float4 rtParams0,
|
||||
|
|
@ -127,6 +128,7 @@ float4 main( ConvexConnectP IN,
|
|||
|
||||
uniform float4 vsFarPlane,
|
||||
uniform float3x3 viewToLightProj,
|
||||
uniform float3x3 dynamicViewToLightProj,
|
||||
|
||||
uniform float4 lightParams,
|
||||
uniform float shadowSoftness ) : COLOR0
|
||||
|
|
@ -134,7 +136,7 @@ float4 main( ConvexConnectP IN,
|
|||
// Compute scene UV
|
||||
float3 ssPos = IN.ssPos.xyz / IN.ssPos.w;
|
||||
float2 uvScene = getUVFromSSPos( ssPos, rtParams0 );
|
||||
|
||||
|
||||
// Sample/unpack the normal/z data
|
||||
float4 prepassSample = prepassUncondition( prePassBuffer, uvScene );
|
||||
float3 normal = prepassSample.rgb;
|
||||
|
|
@ -178,9 +180,9 @@ float4 main( ConvexConnectP IN,
|
|||
|
||||
#else
|
||||
|
||||
// Static
|
||||
float2 shadowCoord = decodeShadowCoord( mul( viewToLightProj, -lightVec ) ).xy;
|
||||
|
||||
float shadowed = softShadow_filter( shadowMap,
|
||||
float static_shadowed = softShadow_filter( shadowMap,
|
||||
ssPos.xy,
|
||||
shadowCoord,
|
||||
shadowSoftness,
|
||||
|
|
@ -188,17 +190,30 @@ float4 main( ConvexConnectP IN,
|
|||
nDotL,
|
||||
lightParams.y );
|
||||
|
||||
// Dynamic
|
||||
float2 dynamicShadowCoord = decodeShadowCoord( mul( dynamicViewToLightProj, -lightVec ) ).xy;
|
||||
float dynamic_shadowed = softShadow_filter( dynamicShadowMap,
|
||||
ssPos.xy,
|
||||
dynamicShadowCoord,
|
||||
shadowSoftness,
|
||||
distToLight,
|
||||
nDotL,
|
||||
lightParams.y );
|
||||
|
||||
float shadowed = min(static_shadowed, dynamic_shadowed);
|
||||
|
||||
#endif
|
||||
|
||||
#endif // !NO_SHADOW
|
||||
|
||||
float3 lightcol = lightColor.rgb;
|
||||
#ifdef USE_COOKIE_TEX
|
||||
|
||||
// Lookup the cookie sample.
|
||||
float4 cookie = texCUBE( cookieMap, mul( viewToLightProj, -lightVec ) );
|
||||
|
||||
// Multiply the light with the cookie tex.
|
||||
lightColor.rgb *= cookie.rgb;
|
||||
lightcol *= cookie.rgb;
|
||||
|
||||
// Use a maximum channel luminance to attenuate
|
||||
// the lighting else we get specular in the dark
|
||||
|
|
@ -216,7 +231,7 @@ float4 main( ConvexConnectP IN,
|
|||
normalize( -eyeRay ) ) * lightBrightness * atten * shadowed;
|
||||
|
||||
float Sat_NL_Att = saturate( nDotL * atten * shadowed ) * lightBrightness;
|
||||
float3 lightColorOut = lightMapParams.rgb * lightColor.rgb;
|
||||
float3 lightColorOut = lightMapParams.rgb * lightcol;
|
||||
float4 addToResult = 0.0;
|
||||
|
||||
// TODO: This needs to be removed when lightmapping is disabled
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ static float2 sNonUniformTaps[NUM_PRE_TAPS] =
|
|||
|
||||
/// The texture used to do per-pixel pseudorandom
|
||||
/// rotations of the filter taps.
|
||||
uniform sampler2D gTapRotationTex : register(S3);
|
||||
uniform sampler2D gTapRotationTex : register(S4);
|
||||
|
||||
|
||||
float softShadow_sampleTaps( sampler2D shadowMap,
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "../../lighting.hlsl"
|
||||
#include "../shadowMap/shadowMapIO_HLSL.h"
|
||||
#include "softShadow.hlsl"
|
||||
|
||||
#include "../../torque.hlsl"
|
||||
|
||||
struct ConvexConnectP
|
||||
{
|
||||
|
|
@ -39,7 +39,7 @@ struct ConvexConnectP
|
|||
#ifdef USE_COOKIE_TEX
|
||||
|
||||
/// The texture for cookie rendering.
|
||||
uniform sampler2D cookieMap : register(S2);
|
||||
uniform sampler2D cookieMap : register(S3);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -48,6 +48,7 @@ float4 main( ConvexConnectP IN,
|
|||
|
||||
uniform sampler2D prePassBuffer : register(S0),
|
||||
uniform sampler2D shadowMap : register(S1),
|
||||
uniform sampler2D dynamicShadowMap : register(S2),
|
||||
|
||||
uniform float4 rtParams0,
|
||||
|
||||
|
|
@ -62,6 +63,7 @@ float4 main( ConvexConnectP IN,
|
|||
|
||||
uniform float4 vsFarPlane,
|
||||
uniform float4x4 viewToLightProj,
|
||||
uniform float4x4 dynamicViewToLightProj,
|
||||
|
||||
uniform float4 lightParams,
|
||||
uniform float shadowSoftness ) : COLOR0
|
||||
|
|
@ -101,6 +103,11 @@ float4 main( ConvexConnectP IN,
|
|||
float2 shadowCoord = ( ( pxlPosLightProj.xy / pxlPosLightProj.w ) * 0.5 ) + float2( 0.5, 0.5 );
|
||||
shadowCoord.y = 1.0f - shadowCoord.y;
|
||||
|
||||
// Get the dynamic shadow texture coordinate
|
||||
float4 dynpxlPosLightProj = mul( dynamicViewToLightProj, float4( viewSpacePos, 1 ) );
|
||||
float2 dynshadowCoord = ( ( dynpxlPosLightProj.xy / dynpxlPosLightProj.w ) * 0.5 ) + float2( 0.5, 0.5 );
|
||||
dynshadowCoord.y = 1.0f - dynshadowCoord.y;
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
|
||||
float shadowed = 1.0;
|
||||
|
|
@ -110,23 +117,32 @@ float4 main( ConvexConnectP IN,
|
|||
// Get a linear depth from the light source.
|
||||
float distToLight = pxlPosLightProj.z / lightRange;
|
||||
|
||||
float shadowed = softShadow_filter( shadowMap,
|
||||
float static_shadowed = softShadow_filter( shadowMap,
|
||||
ssPos.xy,
|
||||
shadowCoord,
|
||||
shadowSoftness,
|
||||
distToLight,
|
||||
nDotL,
|
||||
lightParams.y );
|
||||
|
||||
|
||||
float dynamic_shadowed = softShadow_filter( dynamicShadowMap,
|
||||
ssPos.xy,
|
||||
dynshadowCoord,
|
||||
shadowSoftness,
|
||||
distToLight,
|
||||
nDotL,
|
||||
lightParams.y );
|
||||
float shadowed = min(static_shadowed, dynamic_shadowed);
|
||||
#endif // !NO_SHADOW
|
||||
|
||||
float3 lightcol = lightColor.rgb;
|
||||
#ifdef USE_COOKIE_TEX
|
||||
|
||||
// Lookup the cookie sample.
|
||||
float4 cookie = tex2D( cookieMap, shadowCoord );
|
||||
|
||||
// Multiply the light with the cookie tex.
|
||||
lightColor.rgb *= cookie.rgb;
|
||||
lightcol *= cookie.rgb;
|
||||
|
||||
// Use a maximum channel luminance to attenuate
|
||||
// the lighting else we get specular in the dark
|
||||
|
|
@ -144,7 +160,7 @@ float4 main( ConvexConnectP IN,
|
|||
normalize( -eyeRay ) ) * lightBrightness * atten * shadowed;
|
||||
|
||||
float Sat_NL_Att = saturate( nDotL * atten * shadowed ) * lightBrightness;
|
||||
float3 lightColorOut = lightMapParams.rgb * lightColor.rgb;
|
||||
float3 lightColorOut = lightMapParams.rgb * lightcol;
|
||||
float4 addToResult = 0.0;
|
||||
|
||||
// TODO: This needs to be removed when lightmapping is disabled
|
||||
|
|
|
|||
|
|
@ -30,68 +30,31 @@
|
|||
#include "softShadow.hlsl"
|
||||
|
||||
|
||||
uniform sampler2D ShadowMap : register(S1);
|
||||
uniform sampler2D shadowMap : register(S1);
|
||||
uniform sampler2D dynamicShadowMap : register(S2);
|
||||
|
||||
#ifdef USE_SSAO_MASK
|
||||
uniform sampler2D ssaoMask : register(S2);
|
||||
uniform sampler2D ssaoMask : register(S3);
|
||||
uniform float4 rtParams2;
|
||||
#endif
|
||||
|
||||
|
||||
float4 main( FarFrustumQuadConnectP IN,
|
||||
|
||||
uniform sampler2D prePassBuffer : register(S0),
|
||||
|
||||
uniform float3 lightDirection,
|
||||
uniform float4 lightColor,
|
||||
uniform float lightBrightness,
|
||||
uniform float4 lightAmbient,
|
||||
|
||||
uniform float3 eyePosWorld,
|
||||
|
||||
uniform float4x4 worldToLightProj,
|
||||
|
||||
uniform float4 scaleX,
|
||||
uniform float4 scaleY,
|
||||
uniform float4 offsetX,
|
||||
uniform float4 offsetY,
|
||||
uniform float4 atlasXOffset,
|
||||
uniform float4 atlasYOffset,
|
||||
uniform float2 atlasScale,
|
||||
uniform float4 zNearFarInvNearFar,
|
||||
uniform float4 lightMapParams,
|
||||
|
||||
uniform float2 fadeStartLength,
|
||||
uniform float4 farPlaneScalePSSM,
|
||||
uniform float4 overDarkPSSM,
|
||||
uniform float shadowSoftness ) : COLOR0
|
||||
float4 AL_VectorLightShadowCast( sampler2D sourceShadowMap,
|
||||
float2 texCoord,
|
||||
float4x4 worldToLightProj,
|
||||
float4 worldPos,
|
||||
float4 scaleX,
|
||||
float4 scaleY,
|
||||
float4 offsetX,
|
||||
float4 offsetY,
|
||||
float4 farPlaneScalePSSM,
|
||||
float4 atlasXOffset,
|
||||
float4 atlasYOffset,
|
||||
float2 atlasScale,
|
||||
float shadowSoftness,
|
||||
float dotNL ,
|
||||
float4 overDarkPSSM
|
||||
)
|
||||
{
|
||||
// Sample/unpack the normal/z data
|
||||
float4 prepassSample = prepassUncondition( prePassBuffer, IN.uv0 );
|
||||
float3 normal = prepassSample.rgb;
|
||||
float depth = prepassSample.a;
|
||||
|
||||
// Use eye ray to get ws pos
|
||||
float4 worldPos = float4(eyePosWorld + IN.wsEyeRay * depth, 1.0f);
|
||||
|
||||
// Get the light attenuation.
|
||||
float dotNL = dot(-lightDirection, normal);
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
float3 debugColor = 0;
|
||||
#endif
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
|
||||
// Fully unshadowed.
|
||||
float shadowed = 1.0;
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
debugColor = 1.0;
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
// Compute shadow map coordinate
|
||||
float4 pxlPosLightProj = mul(worldToLightProj, worldPos);
|
||||
float2 baseShadowCoord = pxlPosLightProj.xy / pxlPosLightProj.w;
|
||||
|
|
@ -132,6 +95,11 @@ float4 main( FarFrustumQuadConnectP IN,
|
|||
else
|
||||
finalMask = float4(0, 0, 0, 1);
|
||||
|
||||
float3 debugColor = float3(0,0,0);
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
debugColor = float3(1.0,1.0,1.0);
|
||||
#endif
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
if ( finalMask.x > 0 )
|
||||
|
|
@ -174,19 +142,125 @@ float4 main( FarFrustumQuadConnectP IN,
|
|||
// Each split has a different far plane, take this into account.
|
||||
float farPlaneScale = dot( farPlaneScalePSSM, finalMask );
|
||||
distToLight *= farPlaneScale;
|
||||
|
||||
return float4(debugColor,
|
||||
softShadow_filter( sourceShadowMap,
|
||||
texCoord,
|
||||
shadowCoord,
|
||||
farPlaneScale * shadowSoftness,
|
||||
distToLight,
|
||||
dotNL,
|
||||
dot( finalMask, overDarkPSSM ) ) );
|
||||
};
|
||||
|
||||
float4 main( FarFrustumQuadConnectP IN,
|
||||
|
||||
uniform sampler2D prePassBuffer : register(S0),
|
||||
|
||||
uniform float3 lightDirection,
|
||||
uniform float4 lightColor,
|
||||
uniform float lightBrightness,
|
||||
uniform float4 lightAmbient,
|
||||
uniform float4x4 eyeMat,
|
||||
|
||||
uniform float3 eyePosWorld,
|
||||
uniform float4 atlasXOffset,
|
||||
uniform float4 atlasYOffset,
|
||||
uniform float2 atlasScale,
|
||||
uniform float4 zNearFarInvNearFar,
|
||||
uniform float4 lightMapParams,
|
||||
uniform float2 fadeStartLength,
|
||||
uniform float4 overDarkPSSM,
|
||||
uniform float shadowSoftness,
|
||||
|
||||
// Static Shadows
|
||||
uniform float4x4 worldToLightProj,
|
||||
uniform float4 scaleX,
|
||||
uniform float4 scaleY,
|
||||
uniform float4 offsetX,
|
||||
uniform float4 offsetY,
|
||||
uniform float4 farPlaneScalePSSM,
|
||||
|
||||
// Dynamic Shadows
|
||||
uniform float4x4 dynamicWorldToLightProj,
|
||||
uniform float4 dynamicScaleX,
|
||||
uniform float4 dynamicScaleY,
|
||||
uniform float4 dynamicOffsetX,
|
||||
uniform float4 dynamicOffsetY,
|
||||
uniform float4 dynamicFarPlaneScalePSSM
|
||||
|
||||
) : COLOR0
|
||||
{
|
||||
// Sample/unpack the normal/z data
|
||||
float4 prepassSample = prepassUncondition( prePassBuffer, IN.uv0 );
|
||||
float3 normal = prepassSample.rgb;
|
||||
float depth = prepassSample.a;
|
||||
|
||||
// Use eye ray to get ws pos
|
||||
float4 worldPos = float4(eyePosWorld + IN.wsEyeRay * depth, 1.0f);
|
||||
|
||||
// Get the light attenuation.
|
||||
float dotNL = dot(-lightDirection, normal);
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
float3 debugColor = float3(0,0,0);
|
||||
#endif
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
|
||||
// Fully unshadowed.
|
||||
float shadowed = 1.0;
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
debugColor = float3(1.0,1.0,1.0);
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
float shadowed = softShadow_filter( ShadowMap,
|
||||
IN.uv0.xy,
|
||||
shadowCoord,
|
||||
farPlaneScale * shadowSoftness,
|
||||
distToLight,
|
||||
dotNL,
|
||||
dot( finalMask, overDarkPSSM ) );
|
||||
float4 static_shadowed_colors = AL_VectorLightShadowCast( shadowMap,
|
||||
IN.uv0.xy,
|
||||
worldToLightProj,
|
||||
worldPos,
|
||||
scaleX, scaleY,
|
||||
offsetX, offsetY,
|
||||
farPlaneScalePSSM,
|
||||
atlasXOffset, atlasYOffset,
|
||||
atlasScale,
|
||||
shadowSoftness,
|
||||
dotNL,
|
||||
overDarkPSSM);
|
||||
|
||||
float4 dynamic_shadowed_colors = AL_VectorLightShadowCast( dynamicShadowMap,
|
||||
IN.uv0.xy,
|
||||
dynamicWorldToLightProj,
|
||||
worldPos,
|
||||
dynamicScaleX, dynamicScaleY,
|
||||
dynamicOffsetX, dynamicOffsetY,
|
||||
dynamicFarPlaneScalePSSM,
|
||||
atlasXOffset, atlasYOffset,
|
||||
atlasScale,
|
||||
shadowSoftness,
|
||||
dotNL,
|
||||
overDarkPSSM);
|
||||
|
||||
float static_shadowed = static_shadowed_colors.a;
|
||||
float dynamic_shadowed = dynamic_shadowed_colors.a;
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
debugColor = static_shadowed_colors.rgb*0.5+dynamic_shadowed_colors.rgb*0.5;
|
||||
#endif
|
||||
|
||||
// Fade out the shadow at the end of the range.
|
||||
float4 zDist = (zNearFarInvNearFar.x + zNearFarInvNearFar.y * depth);
|
||||
float fadeOutAmt = ( zDist.x - fadeStartLength.x ) * fadeStartLength.y;
|
||||
shadowed = lerp( shadowed, 1.0, saturate( fadeOutAmt ) );
|
||||
|
||||
static_shadowed = lerp( static_shadowed, 1.0, saturate( fadeOutAmt ) );
|
||||
dynamic_shadowed = lerp( dynamic_shadowed, 1.0, saturate( fadeOutAmt ) );
|
||||
|
||||
// temp for debugging. uncomment one or the other.
|
||||
//float shadowed = static_shadowed;
|
||||
//float shadowed = dynamic_shadowed;
|
||||
float shadowed = min(static_shadowed, dynamic_shadowed);
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
if ( fadeOutAmt > 1.0 )
|
||||
|
|
|
|||
74
Templates/Empty/game/shaders/common/postFx/VolFogGlowP.hlsl
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2014 R.G.S. - Richards Game Studio, the Netherlands
|
||||
// http://www.richardsgamestudio.com/
|
||||
//
|
||||
// If you find this code useful or you are feeling particularly generous I
|
||||
// would ask that you please go to http://www.richardsgamestudio.com/ then
|
||||
// choose Donations from the menu on the left side and make a donation to
|
||||
// Richards Game Studio. It will be highly appreciated.
|
||||
//
|
||||
// The MIT License:
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog Glow postFx pixel shader V1.00
|
||||
|
||||
#include "./postFx.hlsl"
|
||||
|
||||
uniform sampler2D diffuseMap : register(S0);
|
||||
uniform float strength;
|
||||
|
||||
struct VertToPix
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float2 uv1 : TEXCOORD1;
|
||||
float2 uv2 : TEXCOORD2;
|
||||
float2 uv3 : TEXCOORD3;
|
||||
|
||||
float2 uv4 : TEXCOORD4;
|
||||
float2 uv5 : TEXCOORD5;
|
||||
float2 uv6 : TEXCOORD6;
|
||||
float2 uv7 : TEXCOORD7;
|
||||
};
|
||||
|
||||
float4 main( VertToPix IN ) : COLOR
|
||||
{
|
||||
float4 kernel = float4( 0.175, 0.275, 0.375, 0.475 ) * strength;
|
||||
|
||||
float4 OUT = 0;
|
||||
OUT += tex2D( diffuseMap, IN.uv0 ) * kernel.x;
|
||||
OUT += tex2D( diffuseMap, IN.uv1 ) * kernel.y;
|
||||
OUT += tex2D( diffuseMap, IN.uv2 ) * kernel.z;
|
||||
OUT += tex2D( diffuseMap, IN.uv3 ) * kernel.w;
|
||||
|
||||
OUT += tex2D( diffuseMap, IN.uv4 ) * kernel.x;
|
||||
OUT += tex2D( diffuseMap, IN.uv5 ) * kernel.y;
|
||||
OUT += tex2D( diffuseMap, IN.uv6 ) * kernel.z;
|
||||
OUT += tex2D( diffuseMap, IN.uv7 ) * kernel.w;
|
||||
|
||||
// Calculate a lumenance value in the alpha so we
|
||||
// can use alpha test to save fillrate.
|
||||
float3 rgb2lum = float3( 0.30, 0.59, 0.11 );
|
||||
OUT.a = dot( OUT.rgb, rgb2lum );
|
||||
|
||||
return OUT;
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2014 R.G.S. - Richards Game Studio, the Netherlands
|
||||
// http://www.richardsgamestudio.com/
|
||||
//
|
||||
// If you find this code useful or you are feeling particularly generous I
|
||||
// would ask that you please go to http://www.richardsgamestudio.com/ then
|
||||
// choose Donations from the menu on the left side and make a donation to
|
||||
// Richards Game Studio. It will be highly appreciated.
|
||||
//
|
||||
// The MIT License:
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog Glow postFx pixel shader V1.00
|
||||
|
||||
uniform sampler2D diffuseMap;
|
||||
uniform float strength;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
in vec2 uv0;
|
||||
in vec2 uv1;
|
||||
in vec2 uv2;
|
||||
in vec2 uv3;
|
||||
|
||||
in vec2 uv4;
|
||||
in vec2 uv5;
|
||||
in vec2 uv6;
|
||||
in vec2 uv7;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 kernel = vec4( 0.175, 0.275, 0.375, 0.475 ) * strength;
|
||||
|
||||
OUT_col = vec4(0);
|
||||
OUT_col += texture( diffuseMap, uv0 ) * kernel.x;
|
||||
OUT_col += texture( diffuseMap, uv1 ) * kernel.y;
|
||||
OUT_col += texture( diffuseMap, uv2 ) * kernel.z;
|
||||
OUT_col += texture( diffuseMap, uv3 ) * kernel.w;
|
||||
|
||||
OUT_col += texture( diffuseMap, uv4 ) * kernel.x;
|
||||
OUT_col += texture( diffuseMap, uv5 ) * kernel.y;
|
||||
OUT_col += texture( diffuseMap, uv6 ) * kernel.z;
|
||||
OUT_col += texture( diffuseMap, uv7 ) * kernel.w;
|
||||
|
||||
// Calculate a lumenance value in the alpha so we
|
||||
// can use alpha test to save fillrate.
|
||||
vec3 rgb2lum = vec3( 0.30, 0.59, 0.11 );
|
||||
OUT_col.a = dot( OUT_col.rgb, rgb2lum );
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#define IN_HLSL
|
||||
#include "../shdrConsts.h"
|
||||
#include "../torque.hlsl"
|
||||
|
||||
uniform sampler2D ribTex : register(S0);
|
||||
|
||||
struct v2f
|
||||
{
|
||||
|
||||
float2 texCoord : TEXCOORD0;
|
||||
float2 shiftdata : TEXCOORD1;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
|
||||
float4 main(v2f IN) : COLOR0
|
||||
{
|
||||
float4 Tex = tex2D(ribTex,IN.texCoord);
|
||||
Tex.a *= IN.color.a;
|
||||
return hdrEncode(Tex);
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#define IN_HLSL
|
||||
#include "../shdrConsts.h"
|
||||
|
||||
struct a2v
|
||||
{
|
||||
float2 texCoord : TEXCOORD0;
|
||||
float2 shiftdata : TEXCOORD1;
|
||||
float3 normal : NORMAL;
|
||||
float4 position : POSITION;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 texCoord : TEXCOORD0;
|
||||
float2 shiftdata : TEXCOORD1;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
|
||||
uniform float4x4 modelview;
|
||||
uniform float3 eyePos;
|
||||
|
||||
v2f main(a2v IN)
|
||||
{
|
||||
v2f OUT;
|
||||
|
||||
OUT.hpos = mul(modelview, IN.position);
|
||||
OUT.color = IN.color;
|
||||
OUT.texCoord = IN.texCoord;
|
||||
OUT.shiftdata = IN.shiftdata;
|
||||
|
||||
return OUT;
|
||||
}
|
||||
|
|
@ -39,10 +39,6 @@ struct Vert
|
|||
{
|
||||
// .xyz = point
|
||||
float4 position : POSITION;
|
||||
|
||||
float3 normal : NORMAL;
|
||||
|
||||
float4 color : TEXCOORD0;
|
||||
};
|
||||
|
||||
// This is the shader output data.
|
||||
|
|
|
|||
|
|
@ -151,6 +151,21 @@ float2 parallaxOffset( sampler2D texMap, float2 texCoord, float3 negViewTS, floa
|
|||
return offset;
|
||||
}
|
||||
|
||||
/// Same as parallaxOffset but for dxtnm where depth is stored in the red channel instead of the alpha
|
||||
float2 parallaxOffsetDxtnm(sampler2D texMap, float2 texCoord, float3 negViewTS, float depthScale)
|
||||
{
|
||||
float depth = tex2D(texMap, texCoord).r;
|
||||
float2 offset = negViewTS.xy * (depth * depthScale);
|
||||
|
||||
for (int i = 0; i < PARALLAX_REFINE_STEPS; i++)
|
||||
{
|
||||
depth = (depth + tex2D(texMap, texCoord + offset).r) * 0.5;
|
||||
offset = negViewTS.xy * (depth * depthScale);
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
/// The maximum value for 16bit per component integer HDR encoding.
|
||||
static const float HDR_RGB16_MAX = 100.0;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ uniform float undulateMaxDist;
|
|||
|
||||
in vec4 vPosition;
|
||||
in vec3 vNormal;
|
||||
in vec4 vColor;
|
||||
in vec2 vTexCoord0;
|
||||
in vec4 vTexCoord1;
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ function MenuBuilder::addItem(%this, %pos, %item)
|
|||
}
|
||||
else
|
||||
{
|
||||
%this.insertItem(%pos, %name !$= "-" ? %name : "", %accel);
|
||||
%this.insertItem(%pos, %name !$= "-" ? %name : "", %accel, %cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 502 B |
|
Before Width: | Height: | Size: 526 B After Width: | Height: | Size: 526 B |
|
Before Width: | Height: | Size: 526 B After Width: | Height: | Size: 526 B |
|
Before Width: | Height: | Size: 652 B After Width: | Height: | Size: 652 B |
|
Before Width: | Height: | Size: 374 B After Width: | Height: | Size: 374 B |
|
Before Width: | Height: | Size: 514 B After Width: | Height: | Size: 514 B |
|
Before Width: | Height: | Size: 800 B After Width: | Height: | Size: 800 B |
|
Before Width: | Height: | Size: 710 B After Width: | Height: | Size: 710 B |
|
Before Width: | Height: | Size: 368 B After Width: | Height: | Size: 368 B |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 132 B |
|
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 233 B |
|
Before Width: | Height: | Size: 596 B After Width: | Height: | Size: 596 B |
|
Before Width: | Height: | Size: 505 B After Width: | Height: | Size: 538 B |
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
|
Before Width: | Height: | Size: 744 B After Width: | Height: | Size: 744 B |
|
Before Width: | Height: | Size: 470 B After Width: | Height: | Size: 470 B |
|
Before Width: | Height: | Size: 169 B After Width: | Height: | Size: 169 B |
|
Before Width: | Height: | Size: 430 B After Width: | Height: | Size: 430 B |
|
Before Width: | Height: | Size: 591 B After Width: | Height: | Size: 591 B |
|
Before Width: | Height: | Size: 773 B After Width: | Height: | Size: 773 B |
|
Before Width: | Height: | Size: 426 B After Width: | Height: | Size: 426 B |
|
Before Width: | Height: | Size: 323 B After Width: | Height: | Size: 323 B |
|
Before Width: | Height: | Size: 464 B After Width: | Height: | Size: 464 B |
|
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 480 B |
|
Before Width: | Height: | Size: 503 B After Width: | Height: | Size: 503 B |
|
Before Width: | Height: | Size: 390 B After Width: | Height: | Size: 390 B |
|
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 381 B |
|
Before Width: | Height: | Size: 688 B After Width: | Height: | Size: 688 B |
|
Before Width: | Height: | Size: 789 B After Width: | Height: | Size: 789 B |
|
Before Width: | Height: | Size: 368 B After Width: | Height: | Size: 368 B |
|
Before Width: | Height: | Size: 624 B After Width: | Height: | Size: 624 B |
|
Before Width: | Height: | Size: 369 B After Width: | Height: | Size: 369 B |
|
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 358 B |
|
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 236 B |
|
Before Width: | Height: | Size: 749 B After Width: | Height: | Size: 749 B |
|
Before Width: | Height: | Size: 748 B After Width: | Height: | Size: 748 B |
|
Before Width: | Height: | Size: 732 B After Width: | Height: | Size: 732 B |
|
Before Width: | Height: | Size: 419 B After Width: | Height: | Size: 419 B |
|
Before Width: | Height: | Size: 767 B After Width: | Height: | Size: 767 B |
|
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 607 B |
|
Before Width: | Height: | Size: 744 B After Width: | Height: | Size: 744 B |
|
Before Width: | Height: | Size: 513 B After Width: | Height: | Size: 513 B |
BIN
Templates/Empty/game/tools/classIcons/VolumetricFog.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 543 B After Width: | Height: | Size: 543 B |
|
Before Width: | Height: | Size: 787 B After Width: | Height: | Size: 787 B |
|
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 406 B |
|
Before Width: | Height: | Size: 560 B After Width: | Height: | Size: 560 B |
|
|
@ -33,15 +33,15 @@ function initializeDebugger()
|
|||
echo(" % - Initializing Debugger");
|
||||
|
||||
// Load the scripts.
|
||||
exec("./Scripts/debugger.ed.cs");
|
||||
exec("./scripts/debugger.ed.cs");
|
||||
|
||||
// And the guis.
|
||||
exec("./Gui/breakConditionDlg.ed.gui");
|
||||
exec("./Gui/connectDlg.ed.gui");
|
||||
exec("./Gui/editWatchDlg.ed.gui");
|
||||
exec("./Gui/findDlg.ed.gui");
|
||||
exec("./Gui/debugger.ed.gui");
|
||||
exec("./Gui/watchDlg.ed.gui");
|
||||
exec("./gui/breakConditionDlg.ed.gui");
|
||||
exec("./gui/connectDlg.ed.gui");
|
||||
exec("./gui/editWatchDlg.ed.gui");
|
||||
exec("./gui/findDlg.ed.gui");
|
||||
exec("./gui/debugger.ed.gui");
|
||||
exec("./gui/watchDlg.ed.gui");
|
||||
}
|
||||
|
||||
function destroyDebugger()
|
||||
|
|
@ -64,5 +64,5 @@ function startDebugger()
|
|||
|
||||
// Set up the GUI.
|
||||
DebuggerConsoleView.setActive(false);
|
||||
Canvas.pushDialog(DebuggerGui);
|
||||
$GameCanvas.pushDialog(DebuggerGui);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,3 @@ exec("./guiObjectInspector.ed.cs");
|
|||
exec("./uvEditor.ed.gui");
|
||||
exec("./objectSelection.ed.cs");
|
||||
exec("./guiPlatformGenericMenubar.ed.cs");
|
||||
|
||||
if (isDemo())
|
||||
exec("./messageBoxOKBuy.ed.gui");
|
||||
|
|
|
|||