PDA

View Full Version : video texture mapping


andreionutz
08-19-2015, 03:49 AM
Hi,
I'm trying to map a video texture on a surface using texmat. it's a basic mapping that works when the texture is an image, but doesn't when it's a video. why? is this a limitation on purpose, or is it a bug? and is there a way to circumvent it?
Thanks,
Andrei

andreionutz
08-19-2015, 03:56 AM
here's a tiny test code based on some example. just replace the brick texture with a video one and you'll notce the difference.


import viz

# Make background wall
WALL_SCALE = [-1, -1, -1]
texture_scale = [1, 4, 1]

wall = viz.addTexQuad()
wall.setPosition( [0, 2, 3] )
wall.zoffset(1) #avoid zfighing, make wall appear behind pictures
wall.setScale( WALL_SCALE )
wall.setEuler(0, 0, 180)

# Apply nice repeating brick texture
matrix = vizmat.Transform()
matrix.setScale( texture_scale )
wall.texmat( matrix )

bricks = viz.addTexture('tile.png')
#bricks = viz.add('smallVideo.avi', viz.TEX_RECT)

bricks.wrap(viz.WRAP_T, viz.CLAMP_TO_BORDER)
bricks.wrap(viz.WRAP_S, viz.CLAMP_TO_BORDER) #viz.MIRROR)
wall.texture(bricks)

viz.go()

Jeff
08-19-2015, 12:37 PM
Do you get an error or does it look incorrect? Using an image or video included with Vizard its mapped the same:

#bricks = viz.addTexture('lake3.jpg')
bricks = viz.addVideo('mona.mpg')

andreionutz
08-20-2015, 02:53 AM
it works but looks incorrectly. the problem is appears when texmat is used. the moment i set this, the video is not displayed anymore. i mean something is displayed, but not the video as expected. even applying [1, 1, 1] breaks the display.

Jeff
08-21-2015, 10:10 AM
I'm not sure what the issue you're seeing is. Can you reproduce this and show the issue with two quads side by side using vizard's included resources (lake3.jpg and mona.mpg)?

andreionutz
08-24-2015, 07:53 AM
Hi Jeff,
the behavior is as expected when using mona.mpg and then it worked with other videos too. But with the video that I was using when I detected the problem, the strange behavior is still there: the video plays, but it's not mapped according to the ST coordinates. I don't know what's wrong with that video(loads and plays without errors), but I can use other videos instead.
Until further issues I would consider the issue solved/closed.
Thank you,
Andrei