WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   how to tile a texture (https://forum.worldviz.com/showthread.php?t=1702)

vDeonne 11-05-2008 04:09 PM

how to tile a texture
 
I tried to tile the 'ground' by texturing using the code below. Rather than tile, however, the texture image is enlarged to texture the ground -- with no repeat. What code can I use to ensure that the texture image tiles rather than stretches?

ground = viz.add('tut_ground.wrl')
ground.setPosition(0,0,0)
ground.collidePlane()
leaves = viz.add('fall-leaves.jpg')
leaves.wrap(viz.WRAP_S,viz.REPEAT)
leaves.wrap(viz.WRAP_T,viz.REPEAT)
ground.texture(leaves)

farshizzo 11-05-2008 05:35 PM

You need to apply a texture matrix to the ground model to scale the texture coordinates up. Here is some sample code:
Code:

#Number of times to repeat texture horizontally/vertically
NUMBER_OF_REPEATS = 10

leaves = viz.add('fall-leaves.jpg',wrap=viz.REPEAT)

ground = viz.add('tut_ground.wrl')
ground.setPosition(0,0,0)
ground.collidePlane()
ground.texture(leaves)

#Apply a texture matrix that scales to number of repeats
ground.texmat( viz.Matrix.scale(NUMBER_OF_REPEATS,NUMBER_OF_REPEATS,1) )



All times are GMT -7. The time now is 07:36 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC