Page 1 of 1

Weird Image distortion in different rendering modes.

Posted: Sun Feb 11, 2007 6:10 am
by Phant0m51
I have an image saved as a .PNG, it looks fine in my editor (GIMP).

When loaded in D3D it's blocky, like I've compressed the file too much. In OGL it's not nearly as distorted, but still looks a bit off. In BurningVideo it's getting stretched out and distorted (no longer a 480x320 picture). But in Software mode, it's drawn perfectly.

Any ideas as to why it's getting distorted in D3D, OGL, and Burning Video, but not in Software mode?

*Edit* Forgot to mention I'm loading it as a gui Image using this code:

gui::IGUIImage* theimg = env->addImage(driver->getTexture("C:/WoI480_320.PNG"),position2d<int>(0,0));

Using SVN Rev 448

Posted: Sun Feb 11, 2007 6:34 am
by vitek
Sounds like the non-pow-of-two issue. If your texture is not a power of 2 [1, 2, 4, 8, 16, 32, 64, ...] in each dimension, it may not look good when rendered.

Posted: Sun Feb 11, 2007 6:44 am
by Phant0m51
I'll change the image size to 512x512, but why would it not be distorted in Software mode if it's a non-power of 2 problem? Or does that only affect D3D and OGL?

And also, how do game makers deal with the power of 2 problem when making loading screens and menu's without everything getting distorted? I know that in Half Life, it used screen size images for their loading screens (640x480, 800x600, etc...), yet the images weren't distorted even though they weren't power of two's.

Posted: Sun Feb 11, 2007 7:06 am
by vitek
The software driver would work fine because it doesn't use hardware for rendering textures.

Travis

Posted: Sun Feb 11, 2007 7:23 am
by Phant0m51
Thanks for your quick replies Vitek.

Posted: Fri Mar 09, 2007 9:14 am
by eric
... trying to find a solution for my most recent problem on the 2D level, I stumbled across this topic. it is dealing with exactly my problem. Bringing up a 2D picture (same result for a psd, jpg, tga or whatsoever) into my terragen panoviewer project, I see jagged lines, noticeable pixelating. the image becomes blocky, just like Phant0m51 described it: "like I've compressed the file too much". This problem occurs only in DirectX (8,9). That does not affect the texturing of the skybox/skydome in the background, only the overlaid 2D pano which I use for VR-orientation purposes. Loading the app with the OPENGL driver, the pictures look like they were prepared in photoshop - nice and smooth. Is someone else encountering this problem ? Is it a bug or am I doing something wrong ? I checked my addImage-Syntax. From what I can tell, it seems correct. It is definitely not a non-pow-of-two issue. I stick to that - it doesn't change a thing. It has nothing to do with the graphics card drivers either, the blocky image effect is the same for ATI and NVIDIA. I do not remember that I had to deal with this problem in the past (using Irrlicht starting version 0.11.0). It seems to be a 1.2 problem ...

any hints would be appreciated. I find this pretty annoying, given the fact I just decided for the DirectX driver because of the skybox-visible-borders problem in OPENGL that I brought up a couple of days before.

regards eric, GY

Posted: Fri Mar 09, 2007 10:12 am
by Robert Y.
Could you post the code that produces this effect, in combination with the used images (and maybe some screenshots) ?

Posted: Fri Mar 09, 2007 11:11 am
by eric
the code: IGUIImage* vr_pano = device->getGUIEnvironment()->addImage(device->getVideoDriver()->getTexture(_MIN_SKY_1),
position2d<s32>(25,560));

the pictures:
opengl
Image

directx
Image

Posted: Fri Mar 09, 2007 12:06 pm
by hybrid
What are the actual dimensions of the image? And are you sure that HL did not change the textures internally to power-of-two?

Posted: Fri Mar 09, 2007 12:43 pm
by eric
Yes, you are right. I messed up cropping. It is 511 instead of 512x128. I missed it by one pixel unit. Stretching it to 512 eliminated the problem in DirectX. Still I'm wondering why the OPENGL driver did not do so. Does OPENGL care less about measurements ?