Weird Image distortion in different rendering modes.

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Phant0m51
Posts: 106
Joined: Mon Jan 15, 2007 6:07 am

Weird Image distortion in different rendering modes.

Post 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
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post 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.
Phant0m51
Posts: 106
Joined: Mon Jan 15, 2007 6:07 am

Post 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.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

The software driver would work fine because it doesn't use hardware for rendering textures.

Travis
Phant0m51
Posts: 106
Joined: Mon Jan 15, 2007 6:07 am

Post by Phant0m51 »

Thanks for your quick replies Vitek.
eric
Posts: 17
Joined: Thu Mar 08, 2007 7:26 am
Location: Berlin, GY

Post 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
Robert Y.
Posts: 212
Joined: Sun Jan 28, 2007 11:23 pm

Post by Robert Y. »

Could you post the code that produces this effect, in combination with the used images (and maybe some screenshots) ?
eric
Posts: 17
Joined: Thu Mar 08, 2007 7:26 am
Location: Berlin, GY

Post 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
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post 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?
eric
Posts: 17
Joined: Thu Mar 08, 2007 7:26 am
Location: Berlin, GY

Post 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 ?
Post Reply