159
edits
No edit summary |
|||
(12 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
==== Twitter Bot ==== | |||
Description: | |||
The 3Dbot takes images as input and maps them into a cube. | |||
The script creates multiple variations of these cubes changing the position and rotation of them. After doing that, the image is rendered and posted back to twitter. | |||
The geometry is created using vapory and rendered using POVray. | |||
[[File:Botsn.jpg]] | |||
===== Tutorial on how to install vapory on unix ===== | |||
[http://www.uni-weimar.de/medien/wiki/images/Vapory-on-osx.txt Tutorial here] | |||
=====Full code on GITHUB===== | |||
Note that you will need to source your own keys and install the necessary libraries to make it work. | |||
[https://github.com/veli2305/botsnplots Code on GitHub] | |||
===== Screenshots ===== | |||
[[File:bnp_01.png |500px|]] | [[File:bnp_01.png |500px|]] | ||
< | [[File:bnp_02.png |500px|]] | ||
===== Source Code ===== | |||
<source lang="python"> | |||
###LOAD LIBRARIES ### | |||
from vapory import * | from vapory import * | ||
from math import pi, sqrt, sin, cos | from math import pi, sqrt, sin, cos | ||
from random import* | from random import* | ||
from PIL import Image | from PIL import Image | ||
###CREATE FUNCTION### | |||
def create_3D(): | def create_3D(): | ||
###DEFINE VARIABLES### | |||
#image.save("process.png") | #image.save("process.png") | ||
n_boxes=randint(25,34) | n_boxes=randint(25,34) | ||
Line 14: | Line 49: | ||
distances2 = [1*j for j in range(n_boxes)] | distances2 = [1*j for j in range(n_boxes)] | ||
###CREATE BOXES AT RANDOM LOCATIONS AND ASIGN IMAGE AS MAP### | |||
box= [Box([-0.5+y/4, -0.5+x/4, -0.5],[0.5+y/4,x/4+0.5,0.5],Texture('uv_mapping', | box= [Box([-0.5+y/4, -0.5+x/4, -0.5],[0.5+y/4,x/4+0.5,0.5],Texture('uv_mapping', | ||
Pigment( ImageMap('png', '"process.png"')), | Pigment( ImageMap('png', '"process.png"')), | ||
Line 22: | Line 57: | ||
for x in distances2 | for x in distances2 | ||
] | ] | ||
###SET UP SCENE FOR RENDERING AND SAVING THE FILE#### | |||
tt=[Background( "color", [0,0,0] )] | tt=[Background( "color", [0,0,0] )] | ||
Line 36: | Line 73: | ||
scene.render("chessboard.png", width=500, height=400, antialiasing=0.000001, quality=9) | scene.render("chessboard.png", width=500, height=400, antialiasing=0.000001, quality=9) | ||
###tHE SCRIPT IS LOADED AND THE FUNCTION ( def create_3D ) IS CALLED FROM WITHIN THE TWITTERBOT SCRIPT ### | |||
</source> | |||
[[User:Veli2305|Veli2305]] 15:52, 16 June 2015 (UTC) | |||
<br> | <br> | ||
===== Comments ===== | |||
Wow. Breaking the twitter wall :) Very good job.<br> | |||
You are really taking twitterbots to the next dimension! <br> | |||
[[User:Ms| — Martin Schneider]] 13:03, 17 June 2015 (UTC) | |||
---- | |||
==== '''Animated Processing Bot''' ==== | |||
[[Media:luisrobot.gif |animated bot]] | [[Media:luisrobot.gif |animated bot]] | ||
<br> | <br> | ||
---- | |||
==== '''Processing Bot''' ==== | |||
[[File:koala.png |200px|]] | |||
<source lang="python"> | |||
def setup(): | def setup(): | ||
Line 116: | Line 172: | ||
saveFrame("koala.png") | saveFrame("koala.png") | ||
</ | </source> |
edits