Dad72 Posted June 30, 2018 Share Posted June 30, 2018 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: Thanks Quote Link to comment Share on other sites More sharing options...
dbawel Posted July 1, 2018 Share Posted July 1, 2018 @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 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 2, 2018 Author Share Posted July 2, 2018 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. Quote Link to comment Share on other sites More sharing options...
dbawel Posted July 2, 2018 Share Posted July 2, 2018 @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 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 2, 2018 Author Share Posted July 2, 2018 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 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 2, 2018 Author Share Posted July 2, 2018 @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 Quote Link to comment Share on other sites More sharing options...
dbawel Posted July 2, 2018 Share Posted July 2, 2018 @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 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 2, 2018 Author Share Posted July 2, 2018 WebGL2 is already available. I'm running with WebGL2 now. Can you explain to me the steps to follow with photoshop by step, because I'm not sure to understand how to save png in 32 bit Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted July 3, 2018 Share Posted July 3, 2018 1 change mode in photoshop menu > image > mode > 32 bits / channel 2. select .Tiff extension in save and choose 32 bits again Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 3, 2018 Author Share Posted July 3, 2018 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 ? Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted July 3, 2018 Share Posted July 3, 2018 In my side when I convert tga to png I don't even check the 24 or 32b, check my video attached. When done, as dbawel says, just use the File > Export with transparency enabled, and it's done. tga-to-png.mp4 Dad72 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 3, 2018 Author Share Posted July 3, 2018 Ok, thanks, I suddenly looking at your method, find to do it faster: select the alpha channel then right click => retrieve the selection Create a mask fusion and it's over. apply the fusion mask 'save as' in .png format (no need to export) It's going a little faster. Merci V!nc3r ? V!nc3r and NasimiAsl 2 Quote Link to comment Share on other sites More sharing options...
dbawel Posted July 4, 2018 Share Posted July 4, 2018 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 NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.