This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

source: ps/trunk/binaries/data/mods/public/maps/random/rmgen/environment.js

Last change on this file was 26934, checked in by wraitii, 3 years ago

Improve shadow artifact problems without shadow filtering in some A25 biomes/maps

Without shadow filtering, artifacts may appear at some angle (shadow bias issue). This change ssome settings so that these are less common.

Reported by: langbart

Accepted by: marder

Refs #6552

Differential Revision: https://code.wildfiregames.com/D4681

  • Property svn:eol-style set to native
File size: 3.7 KB
RevLine 
[20400]1/**
2 * @file The environment settings govern the appearance of the Sky, Fog, Water and Post-Processing effects.
3 */
4
[18862]5var g_Environment = {
6 "SkySet": "default", // textures for the skybox, subdirectory name of art/textures/skies
[25562]7 "SunColor": { "r": 1.03162, "g": 0.99521, "b": 0.865752, "a": 0 }, // all rgb from 0 to 1
[26934]8 "SunElevation": 0.7, // 0 to 2pi
9 "SunRotation": -0.909, // 0 to 2pi
[25562]10 "AmbientColor": { "r": 0.364706, "g": 0.376471, "b": 0.419608, "a": 0 },
[18862]11 "Water": {
12 "WaterBody": {
13 "Type": "ocean", // Subdirectory name of art/textures/animated/water
14 "Color": { "r": 0.3, "g": 0.35, "b": 0.7, "a": 0 },
15 "Tint": { "r": 0.28, "g": 0.3, "b": 0.59, "a": 0 },
[20932]16 "Height": undefined, // TODO: default shouldn't be set in ExportMap
[18862]17 "Waviness": 8, // typically from 0 to 10
18 "Murkiness": 0.45, // 0 to 1, amount of tint to blend in with the refracted color
19 "WindAngle": 0.0 // 0 to 2pi, direction of waves
20 }
21 },
22 "Fog": {
23 "FogFactor": 0.0,
24 "FogThickness": 0.5,
25 "FogColor": { "r": 0.8, "g": 0.8, "b": 0.8, "a": 0 }
26 },
27 "Postproc": {
28 "Brightness": 0.0,
29 "Contrast": 1.0,
30 "Saturation": 1.0,
31 "Bloom": 0.2,
32 "PostprocEffect": "default" // "default", "hdr" or "DOF"
33 }
34};
[9099]35
[20932]36/**
37 * Camera location in case there are no player entities.
38 */
39var g_Camera = {
40 "Position": { "x": 256, "y": 150, "z": 256 },
41 "Rotation": 0,
42 "Declination": 0.523599
43};
44
[9099]45////////////////////////////////////////////////////////////////////////////
[18862]46// Sun, Sky and Terrain
[9271]47////////////////////////////////////////////////////////////////////////////
[9099]48
49function setSkySet(set)
50{
51 g_Environment.SkySet = set;
52}
53
[16438]54function setSunColor(r, g, b)
[9099]55{
[18862]56 g_Environment.SunColor = { "r" : r, "g" : g, "b" : b, "a" : 0 };
[9099]57}
58
59function setSunElevation(e)
60{
61 g_Environment.SunElevation = e;
62}
63
64function setSunRotation(r)
65{
66 g_Environment.SunRotation = r;
67}
68
[24661]69function setAmbientColor(r, g, b)
[9099]70{
[24661]71 g_Environment.AmbientColor = { "r" : r, "g" : g, "b" : b, "a" : 0 };
[9099]72}
73
74////////////////////////////////////////////////////////////////////////////
[18862]75// Water
[9271]76////////////////////////////////////////////////////////////////////////////
[18840]77
[16438]78function setWaterColor(r, g, b)
[9099]79{
[18862]80 g_Environment.Water.WaterBody.Color = { "r" : r, "g" : g, "b" : b, "a" : 0 };
[9099]81}
82
[15486]83function setWaterTint(r, g, b)
84{
[18862]85 g_Environment.Water.WaterBody.Tint = { "r" : r, "g" : g, "b" : b, "a" : 0 };
[15486]86}
87
[9099]88function setWaterHeight(h)
89{
90 g_Environment.Water.WaterBody.Height = h;
91}
92
93function setWaterWaviness(w)
94{
95 g_Environment.Water.WaterBody.Waviness = w;
96}
97
98function setWaterMurkiness(m)
99{
100 g_Environment.Water.WaterBody.Murkiness = m;
101}
102
[15486]103function setWaterType(m)
[9099]104{
[15486]105 g_Environment.Water.WaterBody.Type = m;
[9099]106}
107
[15486]108function setWindAngle(m)
[9099]109{
[15486]110 g_Environment.Water.WaterBody.WindAngle = m;
[9099]111}
112
[18862]113////////////////////////////////////////////////////////////////////////////
114// Fog (numerical arguments between 0 and 1)
115////////////////////////////////////////////////////////////////////////////
116
[14170]117function setFogFactor(s)
118{
119 g_Environment.Fog.FogFactor = s / 100.0;
120}
121
[18862]122function setFogThickness(thickness)
[14170]123{
[18862]124 g_Environment.Fog.FogThickness = thickness;
[14170]125}
126
127function setFogColor(r, g, b)
128{
[18862]129 g_Environment.Fog.FogColor = { "r" : r, "g" : g, "b" : b, "a" : 0 };
[14170]130}
131
[18862]132////////////////////////////////////////////////////////////////////////////
133// Post Processing (numerical arguments between 0 and 1)
134////////////////////////////////////////////////////////////////////////////
135
[14170]136function setPPBrightness(s)
137{
138 g_Environment.Postproc.Brightness = s - 0.5;
139}
140
141function setPPContrast(s)
142{
143 g_Environment.Postproc.Contrast = s + 0.5;
144}
145
146function setPPSaturation(s)
147{
148 g_Environment.Postproc.Saturation = s * 2;
149}
150
151function setPPBloom(s)
152{
153 g_Environment.Postproc.Bloom = (1 - s) * 0.2;
154}
155
156function setPPEffect(s)
157{
158 g_Environment.Postproc.PostprocEffect = s;
[18862]159}
Note: See TracBrowser for help on using the repository browser.