png Textures cause visibility errors

Posted By: RedPhoenix

png Textures cause visibility errors - 08/25/09 23:21

Hi conitec,

I registrated a strange behaviour when using .png Textures for model skins: The faces to which the .png skin is attached are appearing invisible when moving with the camera at certain positions in a scene. I tested this behaviour with some models that had two skins attached to different parts of the model. One skin was a bitmap, the other one a png file. Only the faces which had the png texture attached vanished in the scene when moving the camera around. I replaced the png file with a bmp file and the problem didn't appear any more.

Greetings
Redphoenix
Posted By: Cowabanga

Re: png Textures cause visibility errors - 08/25/09 23:27

Use .tga instead.
Posted By: RedPhoenix

Re: png Textures cause visibility errors - 08/25/09 23:50

Well I could have come to that myself...

Don't you think I have some reason for using .png. ...?

Besides it's supported by med and therefore should work properly anyway.

To make it finally clear. This post isn't about asking how to solve the problem I got, but about reporting a possible engine bug, that should be fixed whether there exists a workaround or not.
Posted By: XD1v0

Re: png Textures cause visibility errors - 08/26/09 07:51

RedPhoenix i think it would be understandable if post a screenshoot. I guess you .png image have alpha channel, so you see the alpha blending errors, this is not engine bug its feature of hardware.
Anyway, the manual says:
Quote:
PNG images behave like TGA images, but are not recommended because they are loaded not by the engine, but by the DirectX library, and are not guaranteed to be automatically restored when the video device gets lost. This means that they can lose their content f.i. when a fullscreen application is minimized.

Posted By: jcl

Re: png Textures cause visibility errors - 08/26/09 08:09

Thanks for reporting the problem. I don't think that a 3D engine renders textures any differently when their file names ended with .PNG.

Thus, your problem is not the .PNG format, but that the image itself is wrong. The most frequent mistake is accidentally using a 32 bit image with alpha channel. That's why the manual says to use TGA, PCX, BMP, and DDS. Just because the least mistakes can be made with them.
Posted By: RedPhoenix

Re: png Textures cause visibility errors - 08/26/09 09:12

Ok I now got the problem right:

XD1v0 is correct about the alpha blending error, that's what I saw as visibility problem. However there is one thing left.
I used several .png images and none of them contained an alpha channel!

It is possible for both the .png and the .tga format to have an image saved with or without alpha channel applied. This can be controled using the channel dock in e.g. gimp.
When loading a .tga file without alpha channel into med, the skin is proceeded in the right way and created as 24bit without alpha. However when loading a .png file into med, it seems that automatically a pure white alpha channel is created.
The texture format is set to 32bit with alpha, althoughh there is no alpha channel in the image.

Of course it's not that great problem to deactivate the alpha channel for each .png texture, but it would still be good, if you could change that behaviour, if possible.
Posted By: jcl

Re: png Textures cause visibility errors - 08/26/09 09:18

I can not see how we could change this behavior as we didn't make PNG and DirectX. But we'll place a note in the manual about that. PNG images might always contain an alpha channel even if you haven't created one in your paint program.

Posted By: Damocles_

Re: png Textures cause visibility errors - 08/26/09 12:45

How about making an intergrated png loader for the engine then?
So that a png without Alphachannel gets loaded as such.
Posted By: Hummel

Re: png Textures cause visibility errors - 08/26/09 17:42

would be great-I love this format laugh
© 2024 lite-C Forums