GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — surrender_scenarios/script_09_ceres_landing.py at master · SurRenderSoftware/surrender_scenarios Expand file tree/ Copy pathscript_09_ceres_landing.pyMore file actions 117 lines (99 loc) · 3.13 KB / Copy pathscript_09_ceres_landing.pyFile metadata and controls117 lines (99 loc) · 3.13 KB 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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 #! python3 # -*- coding: utf-8 -*- """ SurRender script Script : SCR_09 Landing on Ceres (C) 2019 Airbus copyright all rights reserved """ from surrender.surrender_client import surrender_client from surrender.geometry import vec3, vec4, quat, normalize, QuatToMat, MatToQuat, gaussian import numpy as np import matplotlib.pyplot as plot import cv2 from PIL import Image # Constants: sun_radius = 696342000 ua2km = 149597870.700 ua = ua2km * 1000 Rceres = 4.7e5 pi = np.pi pos_sun = normalize(vec3(-4e11,-4e11,-8e11)) * 8e11 pos_target = vec3(0,0,0) # Image setup: fov=5; raytracing=True; N = [512,512]; rays = 16; # set PSF surech_PSF=10; sigma = 1; wPSF = 5; PSF = gaussian(wPSF * surech_PSF, sigma * surech_PSF); ## Initializing SurRender s = surrender_client(); s.setVerbosityLevel(2); s.connectToServer('127.0.0.1'); s.setCompressionLevel(0); s.closeViewer(); s.setTimeOut(86400); s.setShadowMapSize(512); s.setCubeMapSize(512); s.enableMultilateralFiltering(False); s.enablePreviewMode(True); s.enableDoublePrecisionMode(False); s.enableRaytracing(True); s.setConventions(s.SCALAR_XYZ_CONVENTION,s.Z_FRONTWARD); s.setPSF(PSF,wPSF,wPSF); if raytracing: s.enableFastPSFMode(False); s.enableRaytracing(True); s.enableIrradianceMode(False); s.setNbSamplesPerPixel(rays); # Raytracing s.enableRegularPSFSampling(True); s.enablePathTracing(False); else: s.enableFastPSFMode(True); s.enableRaytracing(False); s.enableIrradianceMode(False); s.enablePathTracing(False); s.createBRDF('sun', 'sun.brdf', {}) s.createShape('sun', 'sphere.shp', { 'radius' : sun_radius }) s.createBody('sun', 'sun', 'sun', []); s.createBRDF('hapke', 'hapke.brdf', {}) s.createSphericalDEM('asteroid', 'Ceres_Dawn.dem', 'hapke', 'Ceres_texture.big') s.setObjectElementBRDF('asteroid', 'asteroid', 'hapke') s.setCameraFOVDeg(fov, np.arctan(np.tan(fov/360*pi)*N[1]/N[0])*360/pi); s.setImageSize(N[0],N[1]); s.setSunPower(10*ua*ua*pi*5.2*5.2*vec4(1,1,1,1)); ## Trajectory def gen_image(alpha, dist): Rcam = np.eye(3); s.setObjectPosition('camera', vec3(0,0,-dist)); s.setObjectAttitude('camera', MatToQuat(Rcam)); s.setObjectPosition('sun', pos_sun); s.setObjectPosition('asteroid', pos_target); R_ast = np.eye(3); R_ast = QuatToMat(quat(vec3(0,0,1), pi/2)) @ R_ast; R_ast = QuatToMat(quat(vec3(1,0,0), (90-11)/180*pi)) @ R_ast; R_ast = QuatToMat(quat(vec3(0,1,0), -alpha-pi/3)) @ R_ast; s.setObjectAttitude('asteroid', MatToQuat(R_ast)); s.render(); im = s.getImageGray32F(); ## Color imageRGBA = s.getImageRGBA8() # discards the alpha channel: r,g,b,a = Image.fromarray(imageRGBA).split() imageRGB = Image.merge("RGB", (r, g, b)) im = imageRGB; im.save('images/' + 'ceres' + '_' + str(it).zfill(4) +'.png') # plot.ioff() plot.imshow(im, aspect='equal', interpolation='none', cmap='gray'); plot.draw() plot.pause(0.01) for it in range(0,359,1): angle = it / 360 * pi; # 1 degr steps dist = Rceres*(40-it/360*39); gen_image(angle, dist) print(str(round(it/360*100))+'%: '+ ' #'+str(it)+' -> '+str(round(dist/1000))+' km') print(' End of simulation') |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |