Quote: "can any texture be used? It looks to me as if the texture needs to be specially constructed"
Not necesary, but if the image is seamlees the best. All 3D programs, has differents ways to add the mapping to the object...planar, cylindrical, box, spherical and even every face. All primitives has automatically mapping coords, but what about if we want our sphere to have planar or cylindrical mapping ?. As we all know, an image stars in the upper lefts and ends in lower rights....so how to add mapping coords to an object that has not mapping coords . In my lathe tool, I had to guess how to add the texture to every triangle correctly, in order to have a single texture in the whole object...I didn't know how many control points will decide the user to do to make its lathe, so I made a simple calculation in a ring of 18 triangles. Take a look to this piece of code.Use one of your textures.
autocam off
sync on
load image "tronco3.jpg",1
`making 36 control points to position triangles in
for i= 101 to 119
inc d
make object box i,1,1,1
yrotate object i,20*d
move object i,-25
clone object i+19,i
move object down i+19,100
next i
position camera 0,50,-150
point camera 50,0,0
for i= 1 to 18
x1=object position x(i+100)
y1=object position y(i+100)
z1=object position z(i+100)
x2=object position x(i+101)
y2=object position y(i+101)
z2=object position z(i+101)
x3=object position x(i+120)
y3=object position y(i+120)
z3=object position z(i+120)
x3b=object position x(i+119)
y3b=object position y(i+119)
z3b=object position z(i+119)
make object triangle i,x1,y1,z1,x2,y2,z2,x3,y3,z3 `upper triangles
make object triangle i+18,x3,y3,z3,x3b,y3b,z3b,x1,y1,z1 `lower triangles
texture object i,1
texture object i+18,1
`scaling correctly the texture for every triangle....we know that we have 18 triangle to complete
`the cirlce...so we have to divide 1/18=0.055
scale object texture i,0.055,1
scroll object texture i,0.055*i-0.055,0
scale object texture i+18,-0.055,-1
scroll object texture i+18,0.055*i,0
next i
do
control camera using arrowkeys 0,0.3,0.3
a#=wrapvalue(a#+mousemovex()/2)
cam#=wrapvalue(cam#+mousemovey()/2)
rotate camera cam#,a#,0
if leftkey() then move camera left 0.3
if rightkey() then move camera right 0.3
sync
loop
As we are creating a new object made up of triangle, we have to think first, how to texture just a simple triangle, and how to scale the texture as we add more triangles(limbs) to the main object. I hope it can help someone.
Cheers.
I'm not a grumpy grandpa
