I am trying to update a PNG in GIMP, for use on a sphere.
However, I can’t seem to get the png correct and was hoping for some help. sadly I can’t link to the file.
Hoping for some guidance.
What I have is a PNG of the world in black and white. I want to make the oceans (white) 50% opacity, of the color #010403
so what I did in GIMP, was I selected the white using the Select By Color tool.
i pressed delete to clear.
while still selected I picked the Bucket Fill tool, which was set to FG color of 010403, opacity 50.0. i filled it in.
exported to PNG with default options, which is:
Save background color
Save resolution
Save color values from transparent pixels.
“automatic pixelformat”
I’ve tried changing automatic pixelformat to 8bpc RGBA, this does not change anything.
the file i’m working with has htis in the image properties:
Color space: RGB color
Precision: 8-bit gamma integer
in BABYLON, when I apply the material to the sphere, using diffuseTexture does not show any opacity.
so I use the opacityTexture. This gets me opacity, however, it is like 0.1, not 50%.
Here’s my BABYLON code.
let tex = new BABYLON.Texture(“images/grid_8.png”, _scene, false, false);
tex.coordinatesMode = 1;
tex.uOffset = .4671;
tex.vOffset = .017;
tex.hasAlpha = true;
//tex.getAlphaFromRGB = true; // uncommenting this makes the skin like, bright white?
//tex.opacityFresnel = false; // doens’t seem to help
spheremat.opacityTexture = tex;
any pointers on how to get the alpha percentage recognized in babylon?
EDIT
I thought about this, and I wonder if babylon has something to help that is more flexible.
Ultimately I have 3 colors in the final png: white, black, and blue (0000FF). I’d like to programmatically assign those to different values in the texture, such as white for the alpha 010403, black to a soft green color, and maybe leave the blue, or change it from 0000FF to a different shade. It would be easier to do this without having to re-generate a PNG every time.
I know this can be done directly in a shader, but I have zero experience with those, and was wondering if there’s a babylon helper for this? the tutorial on materials mentioned Blending, but that seems specific to Alpha channels.
thanks