Skip to content

Commit

Permalink
Traktor: Fixed some minor issues with the clouds shaders.
Browse files Browse the repository at this point in the history
  • Loading branch information
apistol78 committed Feb 21, 2024
1 parent 753b4be commit 0af30e6
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 39 deletions.
6 changes: 2 additions & 4 deletions data/Source/System/Weather/Sky/Modules/Polar.xdi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<object type="traktor.render.ShaderModule">
<text>
<![CDATA[
#define PI 3.142f
#define TWO_PI (PI * 2.0f)
#define HALF_PI (PI / 2.0f)
Expand All @@ -20,12 +19,11 @@ vec3 TexCoordToDirection(in vec2 texCoord)
vec2 DirectionToTexCoord(in vec3 direction)
{
float phi = direction.y; // acos(direction.y) / HALF_PI;
float theta = atan(direction.z, direction.x) / TWO_PI + 0.5f;
float phi = 1 - acos(direction.y) / HALF_PI;
float theta = atan(-direction.z, -direction.x) / TWO_PI + 0.5f;
return vec2( theta, 1 - phi);
}
]]>
</text>
</object>
6 changes: 3 additions & 3 deletions data/Source/System/Weather/Sky/Modules/Sky.xdi
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ vec3 getSkyColor(vec3 sunDirection, vec3 sunColor, vec3 rd)
#define INV_SCENE_SCALE (0.1f)
#define CLOUD_MARCH_STEPS 20
#define CLOUD_SELF_SHADOW_STEPS 6
#define CLOUD_SELF_SHADOW_STEPS 8
#define EARTH_RADIUS (50000.0f)
#define CLOUDS_BOTTOM (1050.)
#define CLOUDS_TOP (2450.)
#define CLOUDS_COVERAGE (0.5f)
#define CLOUDS_DETAIL_STRENGTH (0.2f)
#define CLOUDS_DETAIL_STRENGTH (0.25f)
#define CLOUDS_BASE_EDGE_SOFTNESS (0.15f)
#define CLOUDS_BOTTOM_SOFTNESS (0.01f)
#define CLOUDS_DENSITY (0.1f)
#define CLOUDS_DENSITY (0.15f)
#define CLOUDS_SHADOW_MARGE_STEP_SIZE (6.0f)
#define CLOUDS_SHADOW_MARGE_STEP_MULTIPLY (1.3f)
#define CLOUDS_FORWARD_SCATTERING_G (0.8f)
Expand Down
6 changes: 3 additions & 3 deletions data/Source/System/Weather/Sky/Shaders/Dome.xdi
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ $Output = vec4(direction, 0.0f);
const vec3 ro = vec3(0.0f);
const vec3 rd = normalize($Input.xyz);
float dist = 8000.0f;
float dist = 9000.0f;
const vec4 clr = renderClouds(
ro,
rd,
Expand All @@ -202,6 +202,7 @@ const vec4 clr = renderClouds(
$Output = clr;
$Distance = dist;
]]>
</script>
</item>
Expand Down Expand Up @@ -424,7 +425,7 @@ $Output = imageLoad($Image, $Coord.xy);
<first>584</first>
<second>530</second>
</position>
<value>0.05</value>
<value>0.2</value>
</item>
<item type="traktor.render.Script" version="6,traktor.render.Node:1">
<id>{7352EF91-A455-4C36-8BD3-59F7838C52FE}</id>
Expand Down Expand Up @@ -458,7 +459,6 @@ $Output = imageLoad($Image, $Coord.xy);
<![CDATA[
ivec2 sz = imageSize($Input);
$Output = vec4(sz.x, sz.y, 0.0f, 0.0f);
]]>
</script>
</item>
Expand Down
129 changes: 101 additions & 28 deletions data/Source/System/Weather/Sky/Shaders/Sky.xdi
Original file line number Diff line number Diff line change
Expand Up @@ -885,9 +885,9 @@ $Distance = dist;
<comment/>
<position>
<first>396</first>
<second>713</second>
<second>711</second>
</position>
<name>Clouds</name>
<name>Clouds1</name>
</item>
<item type="traktor.render.Uniform" version="3,traktor.render.Node:1">
<id>{4DA8342F-E6B2-D54D-884D-BA1D1171C134}</id>
Expand Down Expand Up @@ -961,7 +961,6 @@ $Distance = dist;
<![CDATA[
vec2 texCoord = DirectionToTexCoord($Direction.xyz);
$Output = vec4(texCoord, 0.0f, 0.0f);
]]>
</script>
</item>
Expand All @@ -982,6 +981,60 @@ $Output = vec4(texCoord, 0.0f, 0.0f);
<second>1073</second>
</position>
</item>
<item type="traktor.render.Variable" version="2,traktor.render.Node:1">
<id>{A406F0AD-2458-F342-A94B-E5523021E997}</id>
<comment/>
<position>
<first>698</first>
<second>986</second>
</position>
<name>Clouds</name>
</item>
<item type="traktor.render.Vector" version="traktor.render.Node:1">
<id>{E7530B7B-E7A2-3C4B-8072-C3B73EE99101}</id>
<comment/>
<position>
<first>-263</first>
<second>892</second>
</position>
<value>0, 0, 0, 0</value>
</item>
<item type="traktor.render.Variable" version="2,traktor.render.Node:1">
<id>{B3D755AB-48B1-184B-9565-D5CFB8023987}</id>
<comment/>
<position>
<first>655</first>
<second>1115</second>
</position>
<name>Clouds2</name>
</item>
<item type="traktor.render.Variable" version="2,traktor.render.Node:1">
<id>{4C5FFF90-EE98-8F4A-BA9A-B485930C7F27}</id>
<comment/>
<position>
<first>822</first>
<second>782</second>
</position>
<name>Clouds</name>
</item>
<item type="traktor.render.Variable" version="2,traktor.render.Node:1">
<id>{945F78CE-C5DA-DC44-9FC1-C82A8626C5C5}</id>
<comment/>
<position>
<first>656</first>
<second>844</second>
</position>
<name>Clouds2</name>
</item>
<item type="traktor.render.Variable" version="2,traktor.render.Node:1">
<id>{142F3F34-6742-3F4F-ABDC-2925A753D8E2}</id>
<comment/>
<position>
<first>656</first>
<second>722</second>
</position>
<name>Clouds1</name>
</item>
</nodes>
<edges>
<item type="traktor.render.Edge" version="1">
Expand Down Expand Up @@ -1464,16 +1517,6 @@ $Output = vec4(texCoord, 0.0f, 0.0f);
<id>{567A2DC4-F113-4DE2-917A-791917DA5DA5}</id>
</destination>
</item>
<item type="traktor.render.Edge" version="1">
<source>
<node ref="/object/nodes/item[46]"/>
<id>{1E6639B6-8B58-4694-99E7-C058E3583522}</id>
</source>
<destination>
<node ref="/object/nodes/item[33]"/>
<id>{70605746-81B0-A64B-8596-3F4762DB8477}</id>
</destination>
</item>
<item type="traktor.render.Edge" version="1">
<source>
<node ref="/object/nodes/item[47]"/>
Expand Down Expand Up @@ -1606,8 +1649,38 @@ $Output = vec4(texCoord, 0.0f, 0.0f);
</item>
<item type="traktor.render.Edge" version="1">
<source>
<node ref="/object/nodes/item[61]"/>
<id>{84BF3C26-64A7-4032-B775-1D369052B243}</id>
</source>
<destination>
<node ref="/object/nodes/item[62]"/>
<id>{FE413452-19EB-4DC9-B724-2984FA17CC20}</id>
</destination>
</item>
<item type="traktor.render.Edge" version="1">
<source>
<node ref="/object/nodes/item[62]"/>
<id>{8591EE56-8A3E-41CF-8E98-8F8DB26AABDC}</id>
</source>
<destination>
<node ref="/object/nodes/item[60]"/>
<id>{A24A7B3B-5327-EE42-94B3-1DEDDE2A1975}</id>
</destination>
</item>
<item type="traktor.render.Edge" version="1">
<source>
<node ref="/object/nodes/item[60]"/>
<id>{A4DD34C4-30F8-8C48-A530-71D4E13D5F33}</id>
</source>
<destination>
<node ref="/object/nodes/item[48]"/>
<id>{AF6C971B-D67A-42EE-A12B-97D36927C89F}</id>
<id>{6D5C5EFE-A35C-4748-B81E-B8EBACE433BC}</id>
</destination>
</item>
<item type="traktor.render.Edge" version="1">
<source>
<node ref="/object/nodes/item[63]"/>
<id>{84BF3C26-64A7-4032-B775-1D369052B243}</id>
</source>
<destination>
<node ref="/object/nodes/item[37]"/>
Expand All @@ -1616,8 +1689,8 @@ $Output = vec4(texCoord, 0.0f, 0.0f);
</item>
<item type="traktor.render.Edge" version="1">
<source>
<node ref="/object/nodes/item[48]"/>
<id>{AF6C971B-D67A-42EE-A12B-97D36927C89F}</id>
<node ref="/object/nodes/item[63]"/>
<id>{84BF3C26-64A7-4032-B775-1D369052B243}</id>
</source>
<destination>
<node ref="/object/nodes/item[38]"/>
Expand All @@ -1626,32 +1699,32 @@ $Output = vec4(texCoord, 0.0f, 0.0f);
</item>
<item type="traktor.render.Edge" version="1">
<source>
<node ref="/object/nodes/item[61]"/>
<id>{84BF3C26-64A7-4032-B775-1D369052B243}</id>
<node ref="/object/nodes/item[64]"/>
<id>{D51E6077-37E9-4B1C-86D2-92DA544DC613}</id>
</source>
<destination>
<node ref="/object/nodes/item[62]"/>
<id>{FE413452-19EB-4DC9-B724-2984FA17CC20}</id>
<node ref="/object/nodes/item[33]"/>
<id>{70605746-81B0-A64B-8596-3F4762DB8477}</id>
</destination>
</item>
<item type="traktor.render.Edge" version="1">
<source>
<node ref="/object/nodes/item[62]"/>
<id>{8591EE56-8A3E-41CF-8E98-8F8DB26AABDC}</id>
<node ref="/object/nodes/item[48]"/>
<id>{AF6C971B-D67A-42EE-A12B-97D36927C89F}</id>
</source>
<destination>
<node ref="/object/nodes/item[60]"/>
<id>{A24A7B3B-5327-EE42-94B3-1DEDDE2A1975}</id>
<node ref="/object/nodes/item[65]"/>
<id>{11585EBC-914D-4E6D-A10D-D01694FF9840}</id>
</destination>
</item>
<item type="traktor.render.Edge" version="1">
<source>
<node ref="/object/nodes/item[60]"/>
<id>{A4DD34C4-30F8-8C48-A530-71D4E13D5F33}</id>
<node ref="/object/nodes/item[67]"/>
<id>{84BF3C26-64A7-4032-B775-1D369052B243}</id>
</source>
<destination>
<node ref="/object/nodes/item[48]"/>
<id>{6D5C5EFE-A35C-4748-B81E-B8EBACE433BC}</id>
<node ref="/object/nodes/item[66]"/>
<id>{11585EBC-914D-4E6D-A10D-D01694FF9840}</id>
</destination>
</item>
</edges>
Expand Down
2 changes: 1 addition & 1 deletion data/Source/System/Weather/Sky/Sky.xdi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<object type="traktor.world.IrradianceGridAsset" version="3">
<fileName></fileName>
<intensity>1.5</intensity>
<intensity>1</intensity>
<saturation>0.25</saturation>
<cancelSun>false</cancelSun>
</object>

0 comments on commit 0af30e6

Please sign in to comment.