File:Desert planet 8.png
Original file (1,024 × 768 pixels, file size: 351 KB, MIME type: image/png)
Captions
Summary
[edit]DescriptionDesert planet 8.png |
English: Image of Arrakis (Dune) like desert planet |
Date | |
Source | Own work |
Author | Merikanto |
Python 3 code to generate maps uses "noise"
- desert planet dem
- python3 source code
- 16.6.2023 0000.0000
import matplotlib.pyplot as plt
import numpy as np
import math
from time import perf_counter
from sys import getrefcount
from PIL import Image, ImageOps
import noise
import netCDF4 as nc
def save_netcdf_elev(fn, dataa1):
shp1=np.shape(dataa1)
dimx1=shp1[1]
dimy1=shp1[0]
ds = nc.Dataset(fn, 'w', format='NETCDF4')
latitude = ds.createDimension('latitude', dimy1)
longitude = ds.createDimension('longitude', dimx1)
lats = ds.createVariable('latitude', 'f4', ('latitude',))
lons = ds.createVariable('longitude', 'f4', ('longitude',))
data = ds.createVariable('z', 'f4', ('latitude', 'longitude',))
data.units = 'm'
lats[:] = np.arange(-90, 90, 180/dimy1)
lons[:] = np.arange(-180.0, 180, 360/dimx1)
data[:, :] = np.flipud(dataa1)
ds.close()
def normalize(arra):
mini=np.min(arra)
maxi=np.max(arra)
deltai=maxi-mini
return((arra-mini)/deltai)
dimx1=2000
dimy1=1000
outfilename1="desmo.png"
shape = (dimy1,dimx1)
scale = dimx1/2
octaves = 13
persistence = 0.5 ##0.5
lacunarity = 4.0 ## 2.0
- ar=0.5
ar=0.25
seed1=0
seed2=1
pi2=math.pi*2
pi=math.pi
t1 = perf_counter()
fiis=np.linspace(0,pi,dimy1)
phiis=np.linspace(0,pi2,dimx1)
leni=len(fiis)
lenj=len(phiis)
noise0 = np.zeros(shape)
for i in range(shape[0]):
for j in range(shape[1]):
theta=fiis[i]
phi=phiis[j]
x=ar * math.sin(theta) * math.cos(phi)
y=ar * math.sin(theta) * math.sin(phi)
z=ar * math.cos(theta)
noise0[i][j] = noise.pnoise3(x,y,z,octaves=octaves,persistence=persistence,lacunarity=lacunarity, repeatx=1024, repeaty=1024,repeatz=1024,base=seed1)
noise1 = np.zeros(shape)
ar=0.25
for i in range(shape[0]):
for j in range(shape[1]):
theta=fiis[i]
phi=phiis[j]
x=ar * math.sin(theta) * math.cos(phi)
y=ar * math.sin(theta) * math.sin(phi)
z=ar * math.cos(theta)
noise1[i][j] = noise.pnoise3(x,y,z,octaves=octaves,persistence=persistence,lacunarity=lacunarity, repeatx=1024, repeaty=1024,repeatz=1024,base=seed2)
noise2 = np.zeros(shape)
ar=4
for i in range(shape[0]):
for j in range(shape[1]):
theta=fiis[i]
phi=phiis[j]
x=ar * math.sin(theta) * math.cos(phi)
y=ar * math.sin(theta) * math.sin(phi)
z=ar * math.cos(theta)
noise2[i][j] = noise.pnoise3(x,y,z,octaves=octaves,persistence=persistence,lacunarity=lacunarity, repeatx=1024, repeaty=1024,repeatz=1024,base=seed2)
- qnoise0= 2 * (0.5 - np.abs(0.5 -noise0) )
- qnoise0b=np.power(qnoise0, 3)
- qnoise0c=np.abs(qnoise0b)
- qnoise0=np.power(noise0, 4)
qnoise0=np.copy(noise0)
qnoise1=np.where(qnoise0 < 0, np.power(qnoise0,2), np.power(qnoise0,0.5) )
qnoise2= 2 * (0.5 - np.abs(0.5 - qnoise1) )
qnoise3=np.power(qnoise2, 6)
qnoise4=np.exp(abs(qnoise3*noise1))
noisex=normalize(qnoise4)+normalize(np.exp(noise1))
- siny=np.copy(noisez)*0
siny=np.zeros(shape)
cosy=np.zeros(shape)
midi0=shape[0]/2
for i in range(shape[0]):
for j in range(shape[1]):
ii=i-midi0
ii2=float(ii)/float(midi0)
ii3=ii2*math.pi/2
cosy[i, j]=1-(math.cos(ii3)*math.cos(ii3))
siny[i, j]=math.sin(ii3)
siny2=np.copy(siny)
siny=np.where(siny>0,0,siny/2)
siny2=np.where(siny2>0.4,siny2,0.4)
- noisey=normalize(siny*noisex+noisex*0.2)
- siny2=1-normalize(siny*siny*siny*siny*siny*siny)
noisey0=normalize(siny2*cosy*noisex+noisex*0.2)
- noisey=siny
- noisey=noise2
noisey1=normalize(noise2+siny2-0.4)
- noisey=siny2
noisey3=normalize(noisey1-np.min(noisey1))/10
noisey=noisey0*(1-normalize(noisey3))
t2 = perf_counter()
t3=t2-t1
print("T3:", t3)
- I=noisex
- I=noisey
I=noisey
maxiima1=(256.0*256.0)-1.0
I16 = (((I - I.min()) / (I.max() - I.min())) * maxiima1).astype(np.uint16)
img = Image.fromarray(I16)
img.save(outfilename1)
- desert planet dem, hmax=7400
noisez=noisey*8700
- plt.imshow(noisey, cmap="terrain")
- plt.imshow(noisey, cmap="YlOrBr")
- plt.imshow(noisey, cmap="Oranges")
plt.imshow(np.flipud(noisey), cmap="copper_r")
shaded=1
if(shaded==1):
x, y = np.gradient(noisey)
slope = np.pi/2. - np.arctan(np.sqrt(x*x + y*y))
aspect = np.arctan2(-x, y)
altitude = np.pi / 4.
azimuth = np.pi / 2.
shaded = np.sin(altitude) * np.sin(slope)+ np.cos(altitude) * np.cos(slope)* np.cos((azimuth - np.pi/2.) - aspect)
plt.imshow(np.flipud(shaded), cmap='Greys', origin='lower', alpha=0.5)
plt.imsave('desmap.png', noisey, cmap="copper_r")
fig = plt.figure(frameon=False)
fig.savefig("desmap2.png")
plt.show()
save_netcdf_elev("desdem.nc", noisez)
- plt.show()
POV-Ray 3.7 scode to render image
// planet from surface imagemap, dem bumpmap
// 19.6.2022 v 0000.0002
- include "colors.inc"
- include "functions.inc"
global_settings {
assumed_gamma 1.5
noise_generator 1
}
light_source {
<10, 2, -10>*1000*1000*1000, rgb <1, 1, 1>
}
camera {
location <0,4, -3>
look_at <0,0,0>
angle 35
}
- declare planetex1= texture {
pigment {
image_map {
png "desmap.png"
//transmit all 0
map_type 1
interpolate 2
}
}
normal {
bump_map {
png "desmo.png"
bump_size 15
map_type 1
interpolate 2
}
//agate
}
finish { ambient 0}
//finish {diffuse 0.85 }
// rotate y*90
}
// clouds ...
- declare cloudiness1=0.5; //## suitable 0.5
- declare cloudturb1=1;
- declare cloudturb2=2;
- declare cloudpig1=pigment {
wrinkles
// granite
// agate
//scale 1/10
scale 3
warp { turbulence cloudturb1 }
scale 1/2
turbulence cloudturb2
//turbulence 1
pigment_map {
[0 color rgbt <1,1,1,1>*1]
[1-cloudiness1 color rgbt <1,1,1,1>]
[1 color rgbt <1,1,1,0>*4]
}
}
- declare cloudes1=texture {
pigment {
gradient y
scale 2
translate y*-1
// sine_wave
scale 3
warp {turbulence 0.7 }
//scale 1/3
scale 1/2
pigment_map {
[0.1 cloudpig1]
[0.2 rgbt 1]
// [0.5 cloudpig1]
[0.7 rgbt 1]
[0.75 cloudpig1]
}
}
finish {ambient 0}
}
// rayleigh based atm
- declare atm_thickness1 = 0.01;
//#declare atm_color1 = rgb <pow(460/650, 4), pow(460/555, 4), 1>;
#declare atm_color1 = rgb <1,0.5,0.3>*2;
- declare atm_amount1=1;
- declare atm_density1 = density
{
function
{
1*exp(-6.7*(sqrt(x*x+(y)*(y)+z*z)- 1 - 0.00001)/atm_thickness1)
// 1*exp(-6.7*(sqrt(x*x+(y)*(y)+z*z)-1- 0.00001)/atm_thickness1)
}
}
- declare atm_media1 = media
{
method 3
intervals 3
samples 3
scattering
{ 4
color atm_amount1*atm_color1/atm_thickness1
// extinction 1
}
density {atm_density1}
}
- declare atmos1 = difference
{
sphere {0, 1.00001 + atm_thickness1}
// sphere {0, 1.00001}
hollow
pigment {rgbt 1}
interior {media{atm_media1}}
}
- declare cloudlayer1= object {
sphere {0,1
texture { cloudes1 }
}
scale 1.003
}
#declare Polar1=
texture {
pigment {
color rgb <1,1,1>*5
}
normal {
granite
scale 0.05
// scale 5
octaves 15
turbulence 0.1
bump_size 0.1
}
finish { ambient 0}
}
- declare eis1=texture {
gradient y
scale 2
translate y*1
scale 10
warp {turbulence 0.2 }
scale 0.1
scale 100
warp {turbulence 0.2 }
scale 0.01
texture_map {
[0 Polar1]
[0.04 pigment {color rgbt 1}]
[0.97 pigment {color rgbt 1}]
[1 Polar1 ]
}
}
- declare icecaps1=object {
sphere {0,1
scale 1.001
}
texture {eis1}
}
- declare testplate1= object {
// plane {z,0 }
sphere {0,1
// texture {pigment { wrinkles color_map {[0 color rgb <0,0,1>]}} }
texture { planetex1
// scale 1 rotate z*90
// rotate x*-45
// rotate x*-90
}
// texture { cloudes1 }
}
// rotate x*-90
// rotate y*-90
}
union {
object {testplate1}
object {icecaps1}
object {atmos1}
object {cloudlayer1}
// rotate y*-150
// rotate y*-90
// rotate x*30
}
Licensing
[edit]- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 16:15, 19 June 2023 | 1,024 × 768 (351 KB) | Merikanto (talk | contribs) | Polar caps, some clouds | |
17:19, 16 June 2023 | 1,024 × 768 (346 KB) | Merikanto (talk | contribs) | Uploaded own work with UploadWizard |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
PNG file comment |
|
---|---|
File change date and time | 16:14, 19 June 2023 |
Software used |