Page 1 of 1

BitmapFromFile

Posted: Mon Jun 09, 2008 2:16 pm
by Kjell
Hej Ville,

If it ain't too much of a hassle, I'd like to see one of the current limitations of the BitmapFromFile Component ( as mentioned in the Component Reference ) being lifted, namely the fact that Alpha channel information is not imported.

Thanks in advance,
Kjell

Posted: Mon Jun 09, 2008 3:09 pm
by VilleK
It should not be so hard. Do you have a good texture-bitmap with transparency that you can post here or PM? That would help me test this.

Posted: Thu Apr 23, 2009 9:12 pm
by y offs et
I'd like to bump this thread, not because of the previous topic, but because it refers to the component.
.
"...Importing bitmaps will increase your exe-file size very quickly..."
.
I'm wondering if this component can have a checkbox option of the usual way of importing textures from a tag-along "Data" file. Besides helping the .exe size, this adds user modding.
.
I'm looking at the FPS demo, and that, along with map .txt file, makes for an attractive user participation option.
.
I suppose this train of thought would lead to sound effects, etc. also.

Posted: Thu Apr 23, 2009 9:28 pm
by Kjell
Hello,

Correct me if I'm wrong ( Ville ), but I believe one of the reasons ZGE builds such small exe's is that it doesn't include importers for file formats such as bmp, 3ds and wav. Instead, files are converted into the "native" engine formats when they are imported by the Editor.

Now this doesn't mean that external data resources wouldn't be possible, on the contrary .. but it wouldn't really be useful for opening up games to customization in that way as Photoshop / Softimage / etc. wouldn't be able to open up the data.

Personally I'd take the "Little Big Planet" route when possible, where all customization is done within the Game itself rather then relying on external software and file formats.

Don't get me wrong though, I'd welcome the ability to load external sound / image files on the fly as well :)

*And a new / separate thread for this feature request might have been a little more appropriate.

K

Posted: Fri Apr 24, 2009 12:41 pm
by VilleK
One of the early design decisions about the ZGE-engine was to minimize the number of files needed to redistribute the games. There are several reasons:

- No external dependencies to other files in runtime. If you have the exe then it will work. My opinion is that single file distributions are elegant.
- No external dependencies to other files also in designer. The whole project is in the zgeproj-file.
- Whole program including data can be compressed with exe-compressors
- And as Kjell mentions, no file format parsers are needed in runtime. When you import 3ds, bitmaps and audio into ZGE it is converted to a simple internal format. Having 3ds/jpg/bmp/tga/mp3 parsers built into the runtime would significantly increase runtime size and complexity.

Having said the above, I would imagine that when we start expanding the scripting-functions with functionality it would be very useful to add some kind of "loadTexture('setse.tga');" function. So I won't rule it out totally but it won't happen in short-term.

Posted: Fri Apr 24, 2009 2:24 pm
by kattle87
Some stuff has a quite-simple structure so we might come up with a ZLibrary for importing some "simple" bitmaps/models. Actually, if this is the case it will probably be with the advancing of the scripting language. However I can try to get a TGA importer in a ZExpression/file component :P although I don't know anything about TARGA files! xD

Jockes apart... if we were to offer the final user a little bit customization... I would prefere them to be able to define some "producer-code" created with the editor itself... EG: you tell them a list of stuff they can overwrite (like the mesh used by a model) and they do create that object in their own ZGE "data" file using our editor. That data will be read when the Exe will be executed and the content would "overwrite" (better, overload) the mesh/bitmaps you defined. This will not be that easy, but could be an elegant solution since ZGE runtime is not "compiled", but only "interpreted".

Posted: Fri Apr 24, 2009 4:00 pm
by jph_wacheski
I can see all the sides of this one; on the one hand, yes moding could be done easily with external files, as well as many other things,. (a cool little app that could say, generate a fancy random 3d media show on a folder of image files you run it from) on the other hand it is a sweet deal to have a nice single compressed file with the whole game and no file structure to install, etc. Kjell is right in pointing out that by using the current file writing component in game map/character/ect. editing can be created and saved. In fact I am planing to develop such a system soon for an idea i have,. so user maps will be generated in the game (in an edit mode) and can then be shared easily,. .

Posted: Sat Oct 24, 2009 5:28 am
by y offs et
transparency - definable color

There is a boatload of great liberated textures from "do you remember when?" that used other than black for transparency, and used black as part of the design.
I guess the bitmap-animation is done with a large texture containing all animation frames and then modifying texture coordinates?
I made a marching soldier this way by cobbling together some sprite textures, but it involved a lot of work to change the colors. This feature would make it dead easy.

Posted: Mon May 24, 2010 2:51 pm
by y offs et
I was wondering why it took a few seconds for my game to compile and run, as opposed to the usual almost instantly. Irfanview has an information feature and I noticed my newest bitmap had entries in dpi boxes for printing it out. Blanking these boxes restored ZGE's quick compile.

Posted: Wed May 26, 2010 2:16 pm
by Kjell
8)

Attached is a example on how to use any color you want as Alpha Mask.

K

Posted: Wed May 26, 2010 3:30 pm
by Valerious
Without function:

Code: Select all

float rr,gg,bb;
rr=this.Pixel.R;  gg=this.Pixel.G;  bb=this.Pixel.B;
this.Pixel.A = 1-(rr==0 && gg==1 && bb==1); // 0,1,1 RGB(0,255,255)

Posted: Wed May 26, 2010 3:46 pm
by y offs et
That's a good trick. It's really tough touching up the bordering near black parts when you're using the black as transparent.

I might as well post my work around for converting bitmaps with black as part of their palette. I use Gimp to save them in .xpm format, read it in text editor. The index is easy to change 000000 to 000001, and observing the rest, it's easy to figure which symbol to change to 000000. Then reloaded into gimp and save as 24bit .btm ( watch the advanced options! )

Posted: Wed Apr 29, 2015 12:40 am
by rrTea
Kjell wrote:8)

Attached is a example on how to use any color you want as Alpha Mask.

K
Valerious wrote:Without function:

Code: Select all

float rr,gg,bb;
rr=this.Pixel.R;  gg=this.Pixel.G;  bb=this.Pixel.B;
this.Pixel.A = 1-(rr==0 && gg==1 && bb==1); // 0,1,1 RGB(0,255,255)
Such useful tricks (without it, dealing with transparencies in 8 bit pngs is really too impractical!) should really be added to the "tips and tricks" part of the forum, who will ever find them burried in this thread :)