Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8015

Java • Aliasing(?) in three.js

$
0
0
I am using a Raspberry Pi 4 Model B Rev 1.4, and I am making a game in three.js. Previously, I experienced a visual glich in which whenever i turned the camera to the left, a green rectangle would appear from the corner of the room, on the plane of the left wall, and if you turned the camera to the right a purple rectangle would appear the same way, just on the plane of the right wall.
When I tried to screenshot it, it would not appear, UNLESS, I flipped through the screenshots. Then i could see it for a frame and it would dissappear (I took a video of it so it's not my eyes).
Now, on all of the walls whenever I turn my camera there is some visual glitch. https://youtu.be/q0L5zOAljmA
Any help or tips would be greatly appreciated. Thank you all! :D
I have also posted this on the graphics forum, but here is my code for anti aliasing, lighting and texture loading:

Code:

// anti aliasingconst composer = new EffectComposer(renderer);composer.addPass(new RenderPass(scene, camera));const smaaPass = new SMAAPass(    window.innerWidth * renderer.getPixelRatio(),    window.innerHeight * renderer.getPixelRatio());composer.addPass(smaaPass);//  lightscene.add(new THREE.AmbientLight(0xffffff, 0.008));//  texture loadingconst textureLoader = new THREE.TextureLoader();const maxAnisotropy = renderer.capabilities.getMaxAnisotropy();const setupTexture = (tex, repeatX, repeatY) => {    tex.wrapS = tex.wrapT = THREE.RepeatWrapping;    tex.repeat.set(repeatX, repeatY);    tex.anisotropy = Math.min(maxAnisotropy, 8); };const woodGrain = textureLoader.load('https://raw.githubusercontent.com/mrdoob/three.js/master/examples/textures/hardwood2_diffuse.jpg', (tex) => {    setupTexture(tex, 4, 4);});const plasterNormal = textureLoader.load('https://threejs.org/examples/textures/water/Water_1_M_Normal.jpg', (tex) => {    setupTexture(tex, 2, 1);});

Statistics: Posted by Ziggyzaggy300 — Thu Jan 15, 2026 6:44 pm



Viewing all articles
Browse latest Browse all 8015

Trending Articles