how to render object as .png image with no background

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

how to render object as .png image with no background // Archive: Tech Forum

1  |  

Post by sharamun // Jan 3, 2007, 11:52am

sharamun
Total Posts: 8
I'm using trueSpace 6.6 and after creating an object, I want to render it to a .png file without the background, or at least with a completely transparent (0% alpha) background.


Is there a way to do this in trueSpace 6.6 or do I have to use a third party image editor to eliminate the background?


I want to do this so I can use the .png image in a Macromedia Flash Professional 8 document and I can't have the background obscuring the other layers.


Any pointers are greatly appreciated!

Post by Bobbins // Jan 3, 2007, 12:01pm

Bobbins
Total Posts: 506
Render to 32 bit TGA which will give you an 8 bit alpha channel then convert to PNG afterwards. That's by far the best and easiest way to get the end result you want.

Post by sharamun // Jan 3, 2007, 12:20pm

sharamun
Total Posts: 8
PNG already supports an alpha channel so I see no reason to use the intermediary TGA format.


Are you suggesting to do this because there is some limitation in rendering to PNG in trueSpace 6.6 (e.g. no PNG alpha channel support)?

Post by Morgan // Jan 3, 2007, 12:55pm

Morgan
Total Posts: 138
pic
Strange, I'd rendered to PNG in ts4.3 a few times and got precisely the result you're looking for, without changing any settings. (And I wouldn't think the functionality would get removed...) I'll give things a look in the next day or two and see if I can cause it to render with and without background, and if so, I'll report back on what settings affect it.

Post by SteveBe // Jan 3, 2007, 1:12pm

SteveBe
Total Posts: 282
pic
Hi sharamun,

trueSpace 6.6 supports a 32 bit PNG render as well.

Post by jamesmc // Jan 3, 2007, 1:18pm

jamesmc
Total Posts: 2566
Yep yep tS66 does save to 24 and 32 bit png. Under the render button, render to file...

Post by Bobbins // Jan 3, 2007, 11:29pm

Bobbins
Total Posts: 506
Ha, and there was me thinking sharamun had tried 32 bit PNG and had problems, hence the suggestion to use 32 bit TGA.


It didn't occur to me that he hadn't even bothered trying it himself before posting for help.

Post by Tiles // Jan 4, 2007, 12:51am

Tiles
Total Posts: 1037
pic
Lack of knowledge, definitely. And so no shame to ask. That's why this forum is here. You may know that PNG and TGA has alpha channel. But that doesn't guarantee that you know that you have to render in 32 Bit and to pure background to render a working Alpha Channel ;)

Post by sharamun // Jan 4, 2007, 2:52am

sharamun
Total Posts: 8
Sure, I can render as 32 bit PNG with no background but I have to edit it in a third party image editor in order to make the grey background transparent.


Isn't there a way to do this in trueSpace 6.6 without the third party image editor? That's the main question I am asking.


Thanks to everyone for taking the time to post your advice and suggestions.

Post by Tiles // Jan 4, 2007, 3:59am

Tiles
Total Posts: 1037
pic
Err, just to be sure: you render with 32 bit against pure background, and the alpha channel doesn't work? That`s not how trueSpace should act. For me it works perfect without the need of post editing the image. Rendered with trueSpace 6.6:

http://reinerstileset.4players.de/ext/png32bit.png

As you can see the transparent area is transparent (in this case white) and not grey. So the answer that is still given here, and prooved now: yes, you can do that with TS.

Where do you import it to? For what do you need the PNG? My guess is more that your destination where you put in your PNG is a bit in trouble with PNG.

Note: Transparency like in a GIF is something completely different than Alpha Channel. Alpha channel is an 8 bit greyscale mask that provides you with 255 greyscale steps of transparency. Transparent colour is ONE colour in the colour index of the picture itself. that is reserved to set this specific colour to be 100% transparent. And has nothing to do with the greyscale Alpha Channel ...

Post by sharamun // Jan 4, 2007, 4:12am

sharamun
Total Posts: 8
Tiles: thanks for the clarification. I was looking at the .png file via a web browser before trying to use it in Macromedia Flash Professional 8 and saw the grey background, hence my question. It's possible I didn't render it correctly to start with so I'll experiment with it some more, import it into Flash and see how it works. It seems I'm doing it the correct way as you posted but maybe different web browsers handle the alpha channel differently.


I'll play around with it some and post my results later. Thanks again for the help!

Post by jamesmc // Jan 4, 2007, 4:46am

jamesmc
Total Posts: 2566
Another thing to remember about PNG and web publishing is that Internet Explorer browsers older than 6, do not support PNG Alpha; Mozilla and a few others do. Hope your viewers use IE 7 or another browser in order to see the transparent background (wishful thinking.)


You can make GIF's transparent, but GIF's always come with with a matte background, so on a contrasting background, you see the jagged edges of the background or a matte unicolor itself. The trick here is to get a sample color of the background and use that for the background of the GIF image. As you would guess, you are out of luck with gradients or patterned backgrounds unless that is the initial background you make.


ALPHA channel uses the channel bit information to make it all 1's (white) or all 0's (black) so that a mask or transparency can be applied or a combination of bits depending on what application you use. Photoshop appears to be the most versatile on masks and transparencies. An application like Paint Shop Pro is less sophisticated in that regard and will cause you to struggle with the alpha channel manipulation.


PNG is a preferred graphic format to be used along with the much older Targa as they both can handle 32 bit graphics. 24 bit is called True Color and 32 bit is called true color + ALPHA.


Anyways, that's my interpretation with 0.81 percent accuracy because of substantial pork influx into my brain. :D

Post by Tiles // Jan 4, 2007, 4:52am

Tiles
Total Posts: 1037
pic
Ah, indeed, i completely forgot about this PNG versus IE thingie. It may happen that you can still see the grey colour. As JamesMC said, some older browsers are in trouble with Alphachanneled PNG's. I use Firefox here.


In the end, as told above, not the fault of TS ... ;)


Good luck with your experiments :)

Post by sharamun // Jan 4, 2007, 5:15am

sharamun
Total Posts: 8
jamesmc, Tiles: you guys are really great, thanks for the expert information, it really helps and was what I was looking for.


I believe I was viewing the PNG on IE 5.5 where I saw the grey background, but it didn't show up on Firefox (you know, preliminary platform testing before using it in development). I'll verify it but I believe that is what is happening, IE 5.5 does not properly support (if at all) the PNG alpha channel.


You also mention that Photoshop appears to be the most versatile on masks and transparencies (I'm assuming you mean Photoshop CS2). How does GIMP compare with it in this regard? Considering GIMP is free, if it has comparitively good versatility on mask and transparency manipulation, I'll stick with it since Photoshop CS2 is pretty pricey ($625.00 from http://www.viosoftware.com/Photoshop/ ), or would you recommend an image editor better than GIMP but less pricey than Photoshop CS2?

Post by jamesmc // Jan 4, 2007, 5:24am

jamesmc
Total Posts: 2566
I'm unsure about GIMP, barely have used it. Although it is supposed to be a PhotoShop clone, I am unsure just how much of a clone it is.


Perhaps somebody else who has experience with GIMP can chime in.

Post by Morgan // Jan 4, 2007, 6:15am

Morgan
Total Posts: 138
pic
jamesmc, Tiles: you guys are really great, thanks for the expert information, it really helps and was what I was looking for.


I believe I was viewing the PNG on IE 5.5 where I saw the grey background, but it didn't show up on Firefox (you know, preliminary platform testing before using it in development). I'll verify it but I believe that is what is happening, IE 5.5 does not properly support (if at all) the PNG alpha channel.

This is indeed the case; before version 7, Internet Explorer didn't support transparency in PNGs except through a very kludgy and irritating workaround. With IE 7, it's supported; Firefox has supported it all along (in fact, it was supported in Mozilla-based browsers since before the split from Netscape, with Netscape 6.0.)


You also mention that Photoshop appears to be the most versatile on masks and transparencies (I'm assuming you mean Photoshop CS2). How does GIMP compare with it in this regard? Considering GIMP is free, if it has comparitively good versatility on mask and transparency manipulation, I'll stick with it since Photoshop CS2 is pretty pricey ($625.00 from http://www.viosoftware.com/Photoshop/ ), or would you recommend an image editor better than GIMP but less pricey than Photoshop CS2?

I can't speak to the success of other programs on masking, but I've not had any problems using Paint Shop Pro.

Post by Tiles // Jan 4, 2007, 7:57am

Tiles
Total Posts: 1037
pic
The Gimp also supports layers, transparencies and stuff. Featuresided it is somehow equal. There is even a plugin that can load PS filters. And so it is somehow comparable with the big packages like PS.


Normal layer stuff is no problem. Applying a greyscale mask to make it Alpha channeled is also very easy.


Manipulating greyscale masks of loaded alphachanneled pictures in The Gimp is a pain though. I gave up after a long thread in a Gimp Forum. Made too much trouble. I nevertheless love The Gimp :)
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2021. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn