Jump to content

Opacity texture with texture TGA and texture PNG


Dad72
 Share

Recommended Posts

I do not know if it's a bug or something else, but I'm using opacity textures on tree foliage and it works very well with a TGA texture, but with the same PNG textures, it does not work anymore.

Finally, if it works only if the background of the texture is black. In my case the foliage background is green, but with TGA textures no problem.

Does anyone know why? This is a problem because the TGA textures are a huge weight and a big impact on the loading of the scene. Then I find that the PNG texture makes the same image quality and is of much lower weight. (3 Mb tga, 50 Ko png)  I even have images of 16 Mb in tga against 500 Ko if in PNG.

Here are the texture:

elmleaves_DF.png.0c65c7b40952a0d63844a96a1218355f.png

Thanks

Link to comment
Share on other sites

@Dad72

It sounds as though your PNG file doesn't have an alpha channel. I would first load into Photoshop and take a look. The reason for a black background transparency is the babylon is using a spice BlendMode to try and calculate transparency for your texture. This sounds like the same issue I've had in the past with the particle BlendMode. 

DB

Link to comment
Share on other sites

Logically when we add the opacity (in 3ds max) the background becomes an alpha channel regardless of its color.

With the same texture in TGA it works, but if I convert the texture to PNG it does not work anymore. Logically it should.
Alor may be that I do not convert the image correctly to png. I compress it using the 8 bit to reduce the weight of the image. I will try to convert to 24 bit to see what this gives.

Link to comment
Share on other sites

@Dad72

1 hour ago, Dad72 said:

I compress it using the 8 bit to reduce the weight of the image. I will try to convert to 24 bit to see what this gives.

That makes sense... an 8 bit PNG file doesn't hold the alpha channel as we might expect, and will convert the alpha channel to a black and white mask. Saving a 24 bit PNG will provide you with a true alpha channel. The best method to save this is to use Photoshop and when saving select "save for web"  and saving as a PNG24. This will maintain the alpha channel as well as provide the lowest file size for memory.

DB

Link to comment
Share on other sites

No it did not work. I even try to reduce the size of the image to 512 by saving it from tga to tga in 24 bit, but even like that, the alpha no longer exists. 

I use FastStone as software. I would try with photoshop to see what this gives.

Thank you DB for the reflexion tracks

 

Link to comment
Share on other sites

@dbawel

I try with Photoshop. I realized that my image TGA on was recorded in 32 bit. If I change the size (512*512) and save in 32 bit TGA, it works, but if I save in PNG, I do not have a 32 bit recording and if I save in 24 bit, I lose the alpha of the 32 bit.

Any ideas of how I can recreate the alpha on the PNG 24 bit ?

I'm not good with pictures and photoshop, if anyone can explain to me how to record a PNG from a 32 bit TGA or possibly convert me images that I would send him by PM.

[edit] I try several things, but as soon as I save in PNG I lose the alpha. I do not know how the tga images that I have been recorded (it comes from a model to buy, so it's not me who made them and it is too heavy, from where I would like to convert them in PNG)

I also try to save my TGA image in 24 bit instead of 32, but the same, I lose the alpha if I record in 24 bit.

Thank you in advance

Link to comment
Share on other sites

@Dad72

Sorry I wasn't clear enough... images always require 8 bits per channel. So for RGBA, it requires 32 bits to save all channels. In Photoshop, I used "save for web" and PNG24, as the 24 stands for the RGB component, and Photoshop used to be smart enough to see the Alpha channel and not throw it away. If you're not using Photoshop, then yes - any alpha channel requires 32 bits to save all four channels. 

Also, I don't know if you are concerned about memory on your project... however I thought I'd pass along that memory is far more efficient as well as drawing the texture at run time using power of 2 texture. But I'm guessing you already know this. We expect WebGL2 to be better at managing textures and draws, so I'm really looking forward to WebGL2. There's so many advancements already.?

Cheers,

DB

Link to comment
Share on other sites

Thanks Nasimi but the format tiff me create a file even bigger than tga and impossible to choose another format than tiff with this method.

I wanted to create a PNG release from the TGA. How can I do ?

Link to comment
Share on other sites

Ok, thanks, I suddenly looking at your method, find to do it faster:

  1. select the alpha channel then right click => retrieve the selection
  2.  Create a mask fusion and it's over.
  3. apply the fusion mask
  4.  'save as' in .png format (no need to export)

It's going a little faster.

Merci V!nc3r ?

Link to comment
Share on other sites

Hey @Dad72

Sorry I missed your posts... just didn't get notified. I'm glad @NasimiAsl saw this as I would not have guessed you were working in a 24 bit workspace/mode (image> mode). This is critical to understand, and will often lead to problems exporting; or even working on channels in Photoshop. I'm glad you got an answer, as I know how frustrating this can be. Too much to understand ... which is why nuts like us are disagreeing with most of the rest of the world and breaking new frontiers.

Onward!

DB

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...