Hello, I am following a Three.js tutorial for beginners by Red Stapler, specifically the Thanos portal but I am having issue with displaying the smoke in the viewport. I am at the point where it’s suppose to load the image using TextureLoader and set the mesh. Supposedly, the smoke should be statically displayed in the viewport but I don’t see mine.
In the tutorial, his looks like this.
I’m trying it out using glitch if you want to see, otherwise the code is like this:
function particleSetup() {
let loader = new THREE.TextureLoader()
let result = loader.load("https://cdn.glitch.global/0be44fce-7f68-4bcc-92aa-1de6f40962e8/cloud.png?v=1689044367190", function(texture){
// THREE.PlaneGeometry(width, height)
portalGeometry = new THREE.PlaneGeometry(350, 350)
portalMaterial = new THREE.MeshStandardMaterial({
map: texture,
transparent: true
})
let particle = new THREE.Mesh(portalGeometry, portalMaterial)
particle.position.set(2,2,2)
scene.add(particle)
renderer.render(scene, camera)
})
}
initScene()
i tried using loadAsync
but i could be using it incorrectly
async function particleSetup() {
let loader = new THREE.TextureLoader()
const [ texture ] = await Promise.all( [loader.loadAsync( 'https://cdn.glitch.global/0be44fce-7f68-4bcc-92aa-1de6f40962e8/cloud.png?v=1689044367190' )] );
portalGeometry = new THREE.PlaneGeometry(350, 350)
portalMaterial = new THREE.MeshStandardMaterial({
map: texture,
transparent: true
})
let particle = new THREE.Mesh(portalGeometry, portalMaterial)
particle.position.set(2,2,2)
scene.add(particle)
renderer.render(scene, camera)
}