Pseudo Light and Shadows

I’m trying to create pseudo light and shadows around a mesh by using a plane with a png gradient fill texture, but i’m getting a single pixel line on the edge of the Plane. Is it a known issue or am I doing something wrong ?

var dshadow = new BABYLON.StandardMaterial("dshadow");
dshadow.diffuseTexture = new BABYLON.Texture("textures/dlight.png", scene);
dshadow.diffuseTexture.hasAlpha = true;
dshadow.useAlphaFromDiffuseTexture = true;
dshadow.backGroundCulling = true;

Are you sure your texture has no dead pixel line? It happens a lot with photoshop

Confused !! How can a texture have a dead pixel line ?
I’ll try changing the RGB Format of the PNG to see if it makes a difference.

Have you tried making just a small offset on your texture? Have you tried cropping your texture just 1px (to remove that dead pixel if there is). Is your PNG a PNG-24? Does your plane receive or cast shadows?
And then, what is ‘backGroundCulling’? Does this exist, I’m not sure. I know ‘backFaceCulling’ but I never heard about backGroundCulling.

I tried sampling just a section of the texture, but the line remained. I also tried other things, but in the end I just stretched and hid the end of the mesh/texture under another mesh :wink: … swept it under the carpet !

sounds like a weird solution. Are you saying, you are overlapping your plane end with another mesh to remove line? Nah, 'wouldn’t do that.
I’m using this technique of using planes as a soft overlay and never had issues.
Another thing I do is use an opacity gradient or texture.
Let me see if I can quickly set something in the PG.
May be meanwhile you can work some other parts… Right now I have to see to dinner;)

Oh, and I forgot to ask. Why do you use pseudo shadows by any means. Is it for performance? What about a light/shadow map?

Ok, here a quick and dirty PG with the assets from BJS, just to demonstrate. You can see that there is no line appearing on the PNG textured plane. Something must be wrong with your asset.

Something must be wrong with your asset

Exactly. This is the point I’m trying to make. You have the line in your file (maybe a line with pixels with alpha !== 0)

It must be something that Photoshop is doing when I convert the PSD image to png. I’ll have to try making the png in some other image editor.

I thought you worked your pictures with PSD? If not, what did you use?
Else, really, it cannot be from PSD (Any version since 15y+). And for whatever is going on with your export, you can also simply crop the png 1px. That should solve the problem.