PDA

View Full Version : Vizard automatically scaling image to an aspect ratio of 1:1


Frank Verberne
01-02-2014, 03:01 AM
I want to present pictures with an aspect ratio different from 1:1 (meaning a square picture) as textures in Vizard. When I apply a texture to a surface with the same aspect ratio as the picture, Vizard still scales the image to a 1:1 aspect ratio. Because I'm working with a lot of pictures, the scaling of all the images takes time that I want to decrease. Is there any way to apply pictures without Vizard scaling them to an aspect ratio of 1:1?

Frank Verberne
01-02-2014, 04:06 AM
And here some code showing the 'problem':
import viz

viz.go()
viz.eyeheight(0)

box = viz.add('box.wrl')
box.setScale(1.5,1,0.001)
box.setPosition(0,0,1.5)
box.color(1,1,1)
tex = viz.addTexture('worldviz-logo-white.jpg')
box.texture(tex)
So my question is whether & how I can prevent Vizard from scaling the image worldvizlogo-white.jpg from (1280, 1024) to (1024, 1024).

Erikvdb
01-02-2014, 07:42 AM
OpenGL limits the texture resolution to always be a power of two (i.e. 16, 32, 64, 128, etc.). However this is not restricted to aspect ratio, so you can have 512x256 rectangular textures as well.

Actually I read that in newer versions of OpenGL, non power of two (NPOT) textures are supported, but I know too little about that to come up with a possible solution for you.

My solution would be to find a Photoshop script that automatically places and fits every image in a 1024x1024 texture, and then edit the texture coordinates in Vizard to get the result you want.

Frank Verberne
01-13-2014, 07:48 AM
Hi Erikvdb,

Thanks for your suggestion! I did not manage to get Vizard working with non power of two textures, and I did not find/create a photoshop script to solve the issue like that. Ultimately, I just let Vizard load the program for 10 seconds. No big deal at the moment. If someone has a simple solution, then I'm all eyes/ears!