I’m trying to make a house from cards (procedurally). A card with texture represents a wall, and I want to cut out a window.
cm = CardMaker('card')
cm.setUvRange( Point2( 0, 0 ), Point2( 1, 1 ) )
cm.setFrame( Point3(-60,-60,0), Point3(-60,60,0), Point3(-60,60,40), Point3(-60,-60,40) )
card = render.attachNewNode(cm.generate())
tex = loader.loadTexture('brick.jpg')
Question: is there a an easy way to cut a hole in a CardMaker card? If only I could somehow see what exactly Egg content this code generates,… Is there a way to see it?
I wonder if you could use a texture with alpha channel and then change those pixels where you want your window to be totally transparent…
It worked. However, the corners are blurred… It’s better than nothing, but it would be nice to have a real rectangular hole. So, some questions:
Is there a way to combine several CardMaker cards into a mesh, just like in the case procedurally of triangles (GeomTriangles)?
Is there a way to manipulate the vertices created by CardMaker manually?
Try setting the transparency mode to MBinary instead of MAlpha.
Thank you both. That really worked well!
So far, I was generating ‘image.jpg’ from tiles on my own, and then combining it with transparency mapping like this:
cm.setUvRange( Point2( 0, 0 ), Point2( 1, 1) )
tex = loader.loadTexture('image.jpg', 'map.jpg')
However, I would like to utilize the card’s property .setUvRange to tile an image, e.g.,
cm.setUvRange( Point2( 0, 0 ), Point2( 5, 5) )
with transparency map defined on Point2( 0, 0 ), Point2( 1, 1) .
Is this possible?
You can also use:
np.setTexOffset(self.ts, self.offsetU, self.offsetV)
np.setTexScale(self.ts, sizeCELLS, sizeRAWS)
self.ts = TextureStage(‘ts’)
self.ts.setMode(TextureStage.MAdd)# or whatever
so set the scale and then use offsetU,V to set the corner.