How to make the trees in this scene render correctly?

How to make the trees in this scene render correctly?
I speeak about this code and imgs:

three.min.js (589.3 KB)

stats.js (3.7 KB)

perlin.js (10.2 KB)

index.html (7.3 KB)

And its generating this:

Why? May the threejs render can render this points correctly?

if it’s a transparent png (as it looks like it is) you’ll need to use a material with transparency and transparent: true, three should take care of the alpha quite well by default but if you need you can also refine the alpha with alphaTest

I tried alpha test but doesnt work… :thinking:

This is my code:

puntosTextura=new THREE.TextureLoader().load(“tree.jpg”)
const puntosMaterial = new THREE.PointsMaterial({
map: puntosTextura,
size: 40,
transparent: true,
});

ah i just looked at your code snippet…

puntosTextura=new THREE.TextureLoader().load(“tree.jpg”)
const puntosMaterial = new THREE.PointsMaterial(
{
map: puntosTextura,
size: 2.0 ,
transparent: true,
}
);

you’re loading a jpg which won’t have an alpha channel, png has an alpha channel, if you require only jpg’s then you’d have to include an alphaMap jpg too whereby white is opaque and black would be transparent, otherwise try loading a png with the alpha channel intact…


Its shows at that form.

is that with a png? if not try this…

.load(“tree.png”)

// 2. Para los Puntos (Single Points Object)
const puntosGeometria = new THREE.BufferGeometry();
puntosTextura=new THREE.TextureLoader().load(“tree.jpg”)
const puntosMaterial = new THREE.PointsMaterial(
{
map: puntosTextura,
size: 2.0 ,
transparent: true,
}
);

.load(“tree.jpg”)


.png


This is the code:

puntosTextura=new THREE.TextureLoader().load(“tree.png”)
const puntosMaterial = new THREE.PointsMaterial({
map: puntosTextura,
size: 5, // tamaño pequeño y realista
transparent: true,
});

I changed the image to three.png:

yes this looks like transparency is working, however, you’re now faced with a general lower level transparency rendering conundrum, try playing with these material parameters to suit your needs…

material.depthTest = true | false

material.depthWrite = true | false

material.blending = NoBlending | NormalBlending | AdditiveBlending | SubtractiveBlending | MultiplyBlending | CustomBlending

the material depths doesnt work, and the blending doesnt too much… :thinking:

have you tried true or false combinations on the depth parameters and tried with individual blending types?

Yes, doesnt work any blend… :thinking:

If found the solution to make a infinite terrain:

Thanks anyway!!!

.alphaTest: .5 on the material.

I get a virus alert when I click on that that screen.