Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
edge-of-space
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dario Seyb
edge-of-space
Commits
0933cb57
Commit
0933cb57
authored
Feb 23, 2016
by
Dario Seyb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added mars
parent
f524c5e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
61 deletions
+29
-61
data/config/settings.json
data/config/settings.json
+1
-1
data/shader/planets/mars/mars_texture.glsl
data/shader/planets/mars/mars_texture.glsl
+28
-60
No files found.
data/config/settings.json
View file @
0933cb57
...
...
@@ -11,5 +11,5 @@
"jupiter"
],
"scene"
:
"AtmosphereTest"
,
"default_planet_type"
:
"
earth
"
"default_planet_type"
:
"
mars
"
}
\ No newline at end of file
data/shader/planets/mars/mars_texture.glsl
View file @
0933cb57
...
...
@@ -2,75 +2,40 @@ const float SC = 250.0;
// value noise, and its analytical derivatives
/*
vec3 noised( in vec3 xIn )
{
//return vec3(1, 1, 1);
float omega = acos(xIn.z);
float phi = atan(xIn.y/xIn.x);
vec3 x = xIn;
vec2 p = floor(x);
vec2 f = fract(x);
vec2 u = f*f*(3.0-2.0*f);
float a = texture(uTexture,(p+vec2(0.5,0.5))/256.0,-100.0).x;
float b = texture(uTexture,(p+vec2(1.5,0.5))/256.0,-100.0).x;
float c = texture(uTexture,(p+vec2(0.5,1.5))/256.0,-100.0).x;
float d = texture(uTexture,(p+vec2(1.5,1.5))/256.0,-100.0).x;
return vec3(a+(b-a)*u.x+(c-a)*u.y+(a-b-c+d)*u.x*u.y,
float terrainH( in vec2 x )
{
vec2 p = x*0.003/SC;
float a = 0.0;
float b = 1.0;
vec2 d = vec2(0.0);
for( int i=0; i<15; i++ )
{
vec3 n = noised(p);
d += n.yz;
a += b*n.x/(1.0+dot(d,d));
b *= 0.5;
p = m2*p*2.0;
}
return SC*100.0*a;
}*/
float
fbm
(
vec3
coords
,
int
numberOfOcts
,
float
freq
){
float
fValue
=
0
.
0
;
float
weight
=
.
5
;
for
(
int
i
=
0
;
i
<
numberOfOcts
;
i
++
){
fValue
+=
hash_noise
(
freq
*
coords
)
*
weight
;
weight
*=
0
.
5
;
freq
*=
2
.
0
;
}
return
fValue
;
}
const
mat2
m2
=
mat2
(
0
.
8
,
-
0
.
6
,
0
.
6
,
0
.
8
);
float
getContinentHeightNoise
(
vec3
normalizedPosInModelspace
)
{
return
2
*
(
fbm
(
normalizedPosInModelspace
,
2
,
1
.
25
));
return
2
*
(
fbm
_3d
(
normalizedPosInModelspace
,
5
,
1
.
25
));
}
float
getRidgedHeightNoise
(
vec3
normalizedPosInModelspace
)
{
return
(.
75
-
abs
(
fbm
(
normalizedPosInModelspace
,
2
,
40
.)))
/
2
.;
return
(.
75
-
abs
(
fbm
_3d
(
normalizedPosInModelspace
,
2
,
40
.)))
/
2
.;
}
float
getDetailHeightNoise
(
vec3
normalizedPosInModelspace
)
{
return
fbm
(
normalizedPosInModelspace
,
2
,
160
.)
/
8
.;
return
fbm
_3d
(
normalizedPosInModelspace
,
2
,
160
.)
/
8
.;
}
float
getRidgedDetailsHeightNoise
(
vec3
normalizedPosInModelspace
)
{
return
(.
75
-
abs
(
fbm
(
normalizedPosInModelspace
,
4
,
8
*
640
.)))
/
256
.;
return
(.
75
-
abs
(
fbm
_3d
(
normalizedPosInModelspace
,
6
,
640
.)))
/
256
.;
//return 0.;
}
float
getLevel
(
vec3
normalizedPosInModelspace
,
float
count
,
float
power
)
{
float
levelSample
=
abs
(
fbm_3d
(
normalizedPosInModelspace
*
4
+
vec3
(
0
.
4
,
5
,
1
)
,
2
,
3
.
0
)
+
1
.
6
)
*
count
;
float
level
=
floor
(
levelSample
)
+
pow
(
fract
(
levelSample
),
power
);
level
*=
1
.
0
/
count
;
return
level
;
}
float
getHeightNoise
(
vec3
normalizedPosInModelspace
)
{
return
(
getContinentHeightNoise
(
normalizedPosInModelspace
)
+
getRidgedHeightNoise
(
normalizedPosInModelspace
)
+
getDetailHeightNoise
(
normalizedPosInModelspace
)
+
getRidgedDetailsHeightNoise
(
normalizedPosInModelspace
))
*
1
.
25
-
1
.
0
;
float
continent
=
smoothstep
(
0
.
0
,
1
.
0
,
getContinentHeightNoise
(
normalizedPosInModelspace
));
float
level
=
getLevel
(
normalizedPosInModelspace
,
4
,
2
)
*
1
;
float
result
=
(
floor
(
continent
)
+
pow
(
fract
(
continent
),
5
))
*
3
+
getDetailHeightNoise
(
normalizedPosInModelspace
)
*
0
.
6
+
level
;
result
+=
getRidgedDetailsHeightNoise
(
normalizedPosInModelspace
)
*
0
.
3
+
getDetailHeightNoise
(
normalizedPosInModelspace
*
4
)
*
0
.
1
;
return
result
;
}
...
...
@@ -109,18 +74,21 @@ vec4 texture_getColor(vec3 texCoord3d, vec3 upVectorNormalized, vec3 normalNorma
float
phiPertubation
=
1
.
/
2
.
*
noiseOct4
+
1
.
/
4
.
*
noiseOct5
;
float
phiPert
=
.
9
*
phiNormalized
+
.
1
*
phiPertubation
;
color
=
mix
(
vec4
(
1
.,
0
.
05
,
0
.
02
,
1
.),
vec4
(.
9
,
.
1
,
.
1
,
1
.),
height
);
color
+=
vec4
(
0
.
1
,
0
.
04
,
0
.
05
,
0
)
*
fbm_3d
(
texCoord3d
,
4
,
5
);
if
(
height
>
SNOW_LEVEL
&&
phiPert
<=
ROCK_SLOPE
)
{
color
=
vec4
(
1
.,
1
.,
1
.,
1
.)
;
/*
if (height> SNOW_LEVEL && phiPert <= ROCK_SLOPE) {
color = ;
} else if (height> ROCK_LEVEL || phiPert > ROCK_SLOPE) {
color
=
vec4
(.
1
,
.
1
,
.
1
,
1
.);
color = vec4(.
9, .3, .4, 2
.);
} else if (height> PLANT_LEVEL) {
color = vec4(.2, .5,.15, 1.);
}else { //"sand""
color = vec4(1., .8, .55, 1.);
}
}
*/
return
color
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment