OCESS / orbitx

Rewrite of OrbitV, maintained by Patrick, Gavin, and contributors
MIT License
10 stars 18 forks source link

Graphics: Add rings to gas giants #90

Open StefanDeYoung opened 4 years ago

StefanDeYoung commented 4 years ago

Add ring structures to the solar system gas giants. Spectacle! Realism!

StefanDeYoung commented 4 years ago

You would think that the vpython.ring() object would be perfect. Unfortunately, vpython.ring() is a torus rather than a flat ring. So far, my best guess is a circular extrusion with a circular cutout:

PLANET

saturn = sphere(pos=vector(0,0,0), texture='saturnmap.jpg', radius=1)

RINGS

outer_circ = shapes.circle(radius=1.116saturn.radius) inner_circ = shapes.circle(radius=2.327saturn.radius) ring_thickness = 8.29e-6 expath = [vec(0,0,-ring_thickness/2), vec(0,0,ring_thickness/2)]

ex = extrusion(path=expath,shape=[outer_circ,inner_circ],texture='saturn_circle.png')

StefanDeYoung commented 4 years ago

I opened a question in the vpython group. Bruce Sherwood provided the following response: https://groups.google.com/d/msgid/vpython-users/af60d67a-e448-49ae-b646-67f292fe92d9o%40googlegroups.com?utm_medium=email&utm_source=footer

I generated some rings like this:

scene.width = scene.height = 1000 for r in arange(0.1, 5, 0.1): c = color.hsv_to_rgb(vec(random(),1,1)) ring(radius=r, thickness=0.02, axis=vec(0,0,1), color=c) scene.pause() scene.capture('rings')

It looks like this:

Then moved rings.png from Downloads to my program folder and executed this:

extrusion(path=[vec(0,0,0), vec(0,0,1)], shape=[shapes.circle(radius=10), shapes.circle(radius=5)], texture='rings.png')

It looks like this:

What I don't know is how to take an arbitrary image and manipulate its formatting. But my experience suggests that if you can find some way to display the image you want, in some app or other, you could capture that image and use it in the extrusion.

Bruce

StefanDeYoung commented 4 years ago

I downloaded the saturn map and saturn ring color from: http://planetpixelemporium.com/saturn.html saturnmap saturnringcolor

I used the tiled clones feature in inkscape to revolve the saturn ring colour image saturn_circle

Based on Bruce's response, I think I can make a texture in inkscape by revolving the saturn ring color image, but I need to leave a circular hole in the middle that is the same size as the circular cutout.

pmelanson commented 4 years ago

bless bruce, he's a great guy