PNG
PNG
Hey
I noticed on the feature list and the planned features that the PNG format isn't included, is it supported? I've heard of a licence needs to be purchased for JPEG ( PNG is SO much better at compression and quality anyway )
Also, any plans to support the .MAX model format? I know that you can't store animations in .3DS and I don't really want to buy Milkshape as well as 3DSM. Any other format I can use ( or is planned ) apart from ms3de and the Q2 format?
I noticed on the feature list and the planned features that the PNG format isn't included, is it supported? I've heard of a licence needs to be purchased for JPEG ( PNG is SO much better at compression and quality anyway )
Also, any plans to support the .MAX model format? I know that you can't store animations in .3DS and I don't really want to buy Milkshape as well as 3DSM. Any other format I can use ( or is planned ) apart from ms3de and the Q2 format?
From what I remember, PNG was suggested and Niko acknowledge working on it in the Feature Request thread in the Open Discussion forum. I really like PNG.
Anim8or support is in the works and is free. I've seen some talk about Max. But not many people can afford the $795.00 for it, so I can't see many people using it... more people can afford the $25 for milkShape or the $0 pricetag of Anim8or
Anim8or support is in the works and is free. I've seen some talk about Max. But not many people can afford the $795.00 for it, so I can't see many people using it... more people can afford the $25 for milkShape or the $0 pricetag of Anim8or
Crud, how do I do this again?
-
- Posts: 69
- Joined: Sun Oct 12, 2003 3:42 pm
- Location: Germany
There is a free library on http://www.libpng.org/ including source code and tutorials. Why re-invent the wheel ?
And why does niko have to do all this ? Anybody could write a wrapper class for PNG files ( independent from using libpng or not )
Just my 2 cents ...
And why does niko have to do all this ? Anybody could write a wrapper class for PNG files ( independent from using libpng or not )
Just my 2 cents ...
has there been any more thought about getting a png loader into the engine? it is such a great format
i coded a CImageLoaderPNG class and it works ok with 24-bpp, but in 32-bpp the alpha doesn't show up right .. and also it required libpng.dll which i don't think niko wants.
this is what it looks like when a 32-bpp (with alpha) .png is loaded and then displayed with useAlphaChannelOfTexture=false
and this is what is looks with the same image but useAlphaChannelOfTexture = true
the problem is that the center part of the scope (the white part from the first image) is actually transparent (0x00FFFFFF). it's almost like the alpha is backwards? and the color of the numbers is changed too ..
can anyone help out?
[edit]: i set ETCF_OPTIMIZED_FOR_QUALITY = true and now the .png image is displayed perfectly! ... but only with the directx driver when i switch to opengl it suddenly becomes 1-bit alpha instead of 8 bit. this is also a problem for 32-bit .tga files.. they only display correctly in directx mode.
i coded a CImageLoaderPNG class and it works ok with 24-bpp, but in 32-bpp the alpha doesn't show up right .. and also it required libpng.dll which i don't think niko wants.
this is what it looks like when a 32-bpp (with alpha) .png is loaded and then displayed with useAlphaChannelOfTexture=false
and this is what is looks with the same image but useAlphaChannelOfTexture = true
the problem is that the center part of the scope (the white part from the first image) is actually transparent (0x00FFFFFF). it's almost like the alpha is backwards? and the color of the numbers is changed too ..
can anyone help out?
[edit]: i set ETCF_OPTIMIZED_FOR_QUALITY = true and now the .png image is displayed perfectly! ... but only with the directx driver when i switch to opengl it suddenly becomes 1-bit alpha instead of 8 bit. this is also a problem for 32-bit .tga files.. they only display correctly in directx mode.
png loader source code (0.4.2)
---->here<---- is the source for the CImageLoaderPng class (why png?).
there are at least 2 things you won't like about it:
1 - it requires you to hack CReadFile() so that it can get access the "FILE* File" variable.
2 - it requires libpng.dll (included) to be distributed with your exe (this of course could be solved by adding all the png source code to the project but who's got time for that!)
10 easy steps to adding the CImageLoaderPng class to irrlicht:
1 - unzip files to your irrlicht source code folder and in vc++ add CImageLoaderPng.h and .cpp to 'video impl' -> 'null'
2 - open CVideoNull.cpp and add 'createImageLoaderPNG()' in two places .. see if you can figure out where
3 - hack CReadFile.h so that "FILE* File" is public (terrible.. simply terrible!)
4 - build irrlicht!
5 - copy libpng.dll to the same folder as your exe
6 - there is no step 6
7 - create a 64x64 .png image either with alpha (32bpp) or without (24bpp)
8 - add this line before loading any textures
9 - load a texture like so
10 - render it like so
good luck i hope it works for you but i make no guarantee that it will or that there is not a huge memory leak which will blow up your system. i'm open to any suggestions or improvments so if you think you can improve the code please do.
[edit]: oh yeah, the 32bpp alpha only works properly when directx is the video driver at the moment. but before it will work you need to goto CVideoDirectX8::setRenderStates2DMode and look for the "if (alphaChannel)" block, now change SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE) to SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA)
here is a very ugly screen shot of the png alpha greatness in action:
there are at least 2 things you won't like about it:
1 - it requires you to hack CReadFile() so that it can get access the "FILE* File" variable.
2 - it requires libpng.dll (included) to be distributed with your exe (this of course could be solved by adding all the png source code to the project but who's got time for that!)
10 easy steps to adding the CImageLoaderPng class to irrlicht:
1 - unzip files to your irrlicht source code folder and in vc++ add CImageLoaderPng.h and .cpp to 'video impl' -> 'null'
2 - open CVideoNull.cpp and add 'createImageLoaderPNG()' in two places .. see if you can figure out where
3 - hack CReadFile.h so that "FILE* File" is public (terrible.. simply terrible!)
4 - build irrlicht!
5 - copy libpng.dll to the same folder as your exe
6 - there is no step 6
7 - create a 64x64 .png image either with alpha (32bpp) or without (24bpp)
8 - add this line before loading any textures
Code: Select all
driver->setTextureCreationFlag(irr::video::ETCF_OPTIMIZED_FOR_QUALITY,true);
Code: Select all
irr::video::ITexture* my_png_image = driver->getTexture("cool_image.png");
Code: Select all
device->getVideoDriver()->draw2DImage(my_png_image,irr::core::position2d<irr::s32>(0,0),irr::core::rect<irr::s32>(0,0,63,63),NULL,irr::video::SColor(255,255,255,255),true);
[edit]: oh yeah, the 32bpp alpha only works properly when directx is the video driver at the moment. but before it will work you need to goto CVideoDirectX8::setRenderStates2DMode and look for the "if (alphaChannel)" block, now change SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE) to SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA)
here is a very ugly screen shot of the png alpha greatness in action:
Last edited by rt on Sat Jan 22, 2005 4:08 am, edited 1 time in total.
opened up opengl
after some poking around i found out how to make 32-bit .png's and .tga's show up properly in opengl mode.
open up CVideoOpenGL.cpp and locate CVideoOpenGL::setRenderStates2DMode().
change thisto this
now the alpha transparency shows up perfect ... but of course the .png file is 10 times smaller than the .tga!
open up CVideoOpenGL.cpp and locate CVideoOpenGL::setRenderStates2DMode().
change this
Code: Select all
if (alphaChannel)
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glDisable(GL_BLEND);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0);
}
Code: Select all
if (alphaChannel)
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glDisable(GL_ALPHA_TEST);
}
the P is not for Popular
i guess no one likes png format in this forum
RT,
This would be a perfect TPIM. Mind if I put it into storage?
http://irrlicht.sourceforge.net/phpBB2/ ... =9076#9076
This would be a perfect TPIM. Mind if I put it into storage?
http://irrlicht.sourceforge.net/phpBB2/ ... =9076#9076
Crud, how do I do this again?
sure, however my code bends the rules you set out... i.e. "TPIMs should be clean". as stated, the code requires a slight hack to CReadFile().. but if you (or someone else) can find a workaround i'd be happy to have it added to TPIMsaigumi wrote:RT,
This would be a perfect TPIM. Mind if I put it into storage?
http://irrlicht.sourceforge.net/phpBB2/ ... =9076#9076
Why does it need libpng.dll? You can of course link it statically, can't you!?rt wrote: .. and also it required libpng.dll which i don't think niko wants.
I like PNG the only correct format for games.. jpeg not good for textures, tga and others bad compression. That's why PNG-loader should be included in the Engine! I'v been using libjpeg, libz and libpng in my engine and just noticed that I need libz.dll, but libjpeg and libpng are statically there.. so as well as you have linjpeg in your engine, you could also have libpng there. (Except if there are licensing restrictions).
Re: Glazer & the Buccaneers
i'd have to disagree. i found them to be useful, helpful and informative.duko wrote:Topics containing links to people's sites are unneeded and contribute nothing as a whole, much like topics containing content like this one. You could have PMed a moderator and asked this same question and received the same Black Jack response. Please do so in the future.