forked from gwaldron/osgearth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoise.earth
78 lines (61 loc) · 3.48 KB
/
noise.earth
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!--
osgEarth Sample
-->
<map version="2">
<options>
<terrain normal_maps="true"/>
</options>
<elevation name="readymap_elevation" driver="tms">
<url>http://readymap.org/readymap/tiles/1.0.0/116/</url>
</elevation>
<extensions>
<noise size="1024" num_channels="1"/>
<contour_map/>
<sky hours="20.0"/>
<terrainshader>
<code><![CDATA[
#version 330
#pragma vp_entryPoint "makeSomeNoise"
#pragma vp_location "fragment_coloring"
// Try modifying these for fun.
uniform float baseLOD = 1;
uniform sampler2D oe_noise_tex;
uniform vec4 oe_tile_key;
in vec4 oe_layer_tilec;
vec2 getNoiseCoords(in float lod)
{
float dL = oe_tile_key.z - lod;
float factor = exp2(dL);
float invFactor = 1.0/factor;
vec2 result = oe_layer_tilec.st * vec2(invFactor);
// For upsampling we need to calculate an offset as well
if ( factor >= 1.0 )
{
vec2 a = floor(oe_tile_key.xy * invFactor);
vec2 b = a * factor;
vec2 c = (a+1.0) * factor;
vec2 offset = (oe_tile_key.xy-b)/(c-b);
result += offset;
}
return result;
}
void makeSomeNoise(inout vec4 color)
{
vec2 coords = getNoiseCoords( floor(baseLOD) );
float n = 1.5 * texture( oe_noise_tex, coords ).r;
color.rgb *= n;
}
]]></code>
</terrainshader>
<viewpoints>
<viewpoint name="Wash St. 430K" heading="-1.002577141807595" height="3694.875054217875" lat="46.85393268075167" long="-121.7764141794478" pitch="-89.85464953482169" range="426454.3850159062"/>
<viewpoint name="Mt R. Nadir 30K" heading="0.5013023037097585" height="4101.627114404924" lat="46.85909894548915" long="-121.7598368518208" pitch="-89.43249895879129" range="29029.34246828893"/>
<viewpoint name="Mt R. Oblique 30K" heading="17.33521725357022" height="2462.60273069609" lat="46.82181702111031" long="-121.7814936386096" pitch="-21.29241356548601" range="23926.75258864516"/>
<viewpoint name="Mt R. Closeup" heading="-109.6842970297122" height="3843.486737414263" lat="46.85528453766688" long="-121.7455004166102" pitch="-4.617466338845979" range="951.4780720092711"/>
<viewpoint name="Mt R. Trees" heading="-98.36122712710565" height="1639.304918398149" lat="46.78673277044066" long="-121.743286318636" pitch="-10.85365380742088" range="257.5853045645545"/>
<viewpoint name="Nepal" heading="-72.70835146844568" height="6334.845537136309" lat="27.94213038800919" long="86.9936567556778" pitch="-18.63803872963365" range="13611.24948464565"/>
<viewpoint name="Nepal NF" heading="-49.14546953546358" height="6334.332569343038" lat="27.9421778947837" long="86.9935949004298" pitch="-3.643325527310435" range="13302.81192964212"/>
<viewpoint name="Matterhorn" heading="-1.429462844200832" height="2282.858508689329" lat="45.95106319557" long="7.642741711675961" pitch="-25.12269405854052" range="26690.10606054494"/>
</viewpoints>
</extensions>
</map>