PDA

View Full Version : how to apply two textures to one 3D object?


sqwiggily
11-11-2011, 02:45 AM
Hello,

How can I attach two different textures (that is, two different JPGs) to one 3D object, i.e. a box model (box.wrl), such that each texture can only be seen from one side?

I´m trying to create walls in a maze (box objects which have been stretched), on one side of the box I want to apply a JPG texture so the wall looks as if it has a photo hanging on it. I would like to have the photo on one side of the wall and only a wall texture on the other side.

Thanks a lot!
Kelsey

Jeff
11-16-2011, 04:30 PM
Each side of the wall will have to be a separate object so they can be textured independently.

4711
11-21-2011, 01:05 AM
Using the "splitFaces" parameter from <vizshape>.addBox allows you to create a box with six subnodes, one for each side of the box, each of which can be handled independently. That way you can easily apply a different texture to each side of the box.

See the example code for <vizshape>.addBox from the Vizard 3.0 documentation:
import viz
import vizshape
viz.go()

#Create box with each face split into separate sub-node
box = vizshape.addBox(splitFaces=True)
box.setPosition(0,1.8,4)

box.addAction(vizact.spin(0,1,0,45))

#Create textures
t1 = viz.add('image1.jpg')
t2 = viz.add('image2.jpg')

#Apply first texture to front/back face
box.texture(t1,node='front')
box.texture(t1,node='back')

#Apply second texture to left/right face
box.texture(t2,node='left')
box.texture(t2,node='right')

Darkmax
03-15-2012, 07:39 PM
i don't understand the question, very well but i think you can use baking texture or prepare one texture with the two faces that you want to show, like Jeff said it can't be done, you have to combine the two jpg in one.

4711 I didn't know that maybe that could be the right solution but you have to create the box in vizard, and maybe sqwiggily want to do it in a program like 3ds max or maya