OnscreenImage problem[ solved ]

Hi, I have been using OnscreenImage for some time( adjusting only position and path of the image ) and noticed my images scale arent show correctly, becoming bigger than they are and disproportional, becoming very ugly. I repeat I havent messed with OnscreenImage scale, just image path and position, and my image is a power of 2 already( 512 x 1024 )

Do OnscreenImage really works? Are there better methods for displaying images on screen?

Thanks in advance

Did you parent your OnscreenImage to aspect2d, or render2d?

Aspect2d automatically scales attached nodes dependent upon the width/height aspect ratio of the window, versus render2d, which just treats the window’s coordinates as absolute. (So you’ll get a distortion if you do not account for this in your OnscreenImage’s scale.)

May I ask how would I go about parenting the image to aspect2d? I have tried

image.reparentTo(Aspect2d)

, but thats not quite right >_<

it’s “aspect2d”, not “Aspect2d”.

Well…I wasnt parenting the OnscreenImage, but since you said so, I tried both render2d and aspect2d. In both, without messing with scale the result is ugly.

Setting scale to 0.5 reduces the image, but its still incorrect, and using scale = 0.5, 1, 1 I get the best result, which is still quite blurry…

What should I do?

Thanks in advance

You need to set the card to the same size as the texture. You can use egg-texture-cards to do this most easily, then load the card model and use it in place of the texture.

Use the parameter -p y,y on egg-texture-cards, where y is 1/2 your window height in pixels, e.g. -p 300,300 if your window is 800x600.

David

sorry for the delay, have been busy with cg and testing onscreen image.

I used a blender python script to pixel perfect convert the texture to a 3d model, i then loaded the model at OnscreenImage and adjusted the scale with scale = ( 0.066 ). The result is a lot better, but is it the same as using panda3d texture to egg convert stuff?

I will continue to experiment here, thanks in advance

Sure, that’s the same thing.

David

Just a note:

You can alternatively do this to have a simple onscreen image:

the blender stuff I said before is because the latest blender release have a script on uv window>image>2D cutout image importer, which creates a pixel perfect texture model based on the image path you provided. You then export this to egg with chicken exporter.

well, I must say which the egg-texture-cards terminal command is easier for me, now I use Linux ubuntu. I also discovered which my textures were blurry also because of them not being a power of 2(2,4,816,32,64,128,256,512,1025…).

My code for each image is as following now:

self.graphicname = loader.loadModel('/path')
		self.graphicname.setPos = ( x, 0, z )
		self.graphicname.setTransparency(TransparencyAttrib.MAlpha)
		self.graphicname.reparentTo(aspect2d)