pretty nbody simulation

60 views
Skip to first unread message

jimbo007

unread,
Feb 2, 2016, 4:31:33 AM2/2/16
to VPython-users
Hi all,
I have been working on doing an nbody simulation in vpython.  It does almost everything I want it to including multi core processing, rotating and zooming however I would like to make it prettier.  Just wondering if vpython is capable of producing something exactly like the images below (fog/smoke/glowing effects).  If it is capable how would I go about creating it?
<blockquote class="imgur-embed-pub" lang="en" data-id="ly63Z"><a href="//imgur.com/ly63Z">nbody</a></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script>

If not could someone point me to the tools required to go about creating this?

Thanks in advance!

jimbo007

unread,
Feb 2, 2016, 4:33:04 AM2/2/16
to VPython-users
Looks like I dont know how to embed images, here is a link instead for attempt #2
http://imgur.com/a/ly63Z

Eric Zárate

unread,
Feb 2, 2016, 7:12:03 AM2/2/16
to vpytho...@googlegroups.com
One option that I did for have a background, it was to create a big sphere as Bruce suggested once, and use the library "Image", so with this it's possible to load your texture on the image, and it looks very nice.

This is an example of code:

tex = materials.texture(data=materials.loadTGA('wallpaper.tga'), mapping='spherical')
	sphere(radius=200, material=tex,axis=(0,0,1)) 

The only detail, is that you have to convert the image to "tga" format. I hope this help.

Greetings!


2016-02-02 6:33 GMT-03:00 jimbo007 <jimb...@gmail.com>:
Looks like I dont know how to embed images, here is a link instead for attempt #2
http://imgur.com/a/ly63Z

--
You received this message because you are subscribed to the Google Groups "VPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vpython-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bruce Sherwood

unread,
Feb 2, 2016, 10:23:54 AM2/2/16
to VPython-users
None of the various VPythons currently supports fog or smoke, but as for glowing effects the GlowScript and Jupyter versions do have this object attribute:

emissive If True, local and distant lights are ignored, and the brightness is governed by the object's own color. An example of its use is to put an emissive sphere at the location of a local_light, which looks like a glowing lamp. The default for emissive is False.


jimbo007

unread,
Feb 2, 2016, 8:06:21 PM2/2/16
to VPython-users
Thanks Eric and Bruce
Message has been deleted

Fatah Ari Kusuma Wardana

unread,
Jun 11, 2024, 8:44:55 AMJun 11
to VPython-users
hi Eric,
recently I've been trying a new project and I wanted to try reading tga files as textures like your example,
def material(name): 
 name = join(join(getcwd(), "textures"), name) # textures folder
 material = textures(data=textures.loadTGA(name), mapping="spherical")
 return material

However, I am having difficulty processing textures with the pattern above because 'materials' can no longer be used in Python 7. Would you like to help me? sorry I'm still a beginner

Bruce Sherwood

unread,
Jun 11, 2024, 6:25:43 PMJun 11
to VPython-users
Here is the page of the VPython documentation dealing with textures:


Here are a number of examples of programs that use textures:


Bruce




Reply all
Reply to author
Forward
0 new messages