PDA

View Full Version : How to apply texture on an on-the-fly 3d object


Zhi
10-10-2013, 01:51 PM
This question may be naive. But I could not find the answer in the forum or from the vizard help file.

I used vizshape.addCylinder() to create an on-the-fly cylinder. Then, I used <3d_node>.texture to add a texture on it. But, the texture does not appear on the top and the bottom circular faces of the cylinder. What shall I do? :confused:

Here is my code:
tex = viz.addTexture('wood.jpg')
tex.wrap(viz.WRAP_R,viz.REPEAT)
tex.wrap(viz.WRAP_T,viz.REPEAT)
tex.wrap(viz.WRAP_S,viz.REPEAT)

circle = vizshape.addCylinder(height=0.15, radius=0.5)
circle.texture(tex)

Zhi
10-11-2013, 10:40 AM
I think the problem is probably related to the texture wrapping. Because I can see texture on the side surface of the cylinder, but there is no texture on the top and bottom surfaces of the cylinder. However, the color of the top and bottom surfaces changed to the closest color to that of the texture I applied.

Notch
09-01-2014, 01:15 PM
Did you ever find a solution to this? I'm trying to color an on-the-fly cylinder but am unable to get the color to appear on the top and bottom of the cylinder.

Notch
09-09-2014, 04:42 AM
I think this might have been a lighting issue; without a specific light source, Vizard can make objects appear very dark in some situations. It's possible that the object was coloured, but I couldn't see the colour.