Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaks in three@0.157.0 #177

Open
ajmeese7 opened this issue Oct 26, 2023 · 2 comments
Open

Breaks in three@0.157.0 #177

ajmeese7 opened this issue Oct 26, 2023 · 2 comments

Comments

@ajmeese7
Copy link

Whenever I use 0.152.2 of three.js, my project works exactly as expected. But if I try upgrading my project to the latest version of three, Vanta just renders a blank screen. This is my code segment, unchanged between when I used each version of three:

/**
 * Allows us to defer the loading of Three.js until it's needed,
 * preventing page blocking upon initial load.
 * @link https://dev.to/marcinwosinek/lazy-load-library-in-application-build-with-webpack-5757
 */
import(/* webpackChunkName: "three-js" */ "three").then(THREE => {
	import(/* webpackChunkName: "vanta-waves" */ "vanta/dist/vanta.waves.min").then(library => {
		const WAVES = library.default;
		effect = WAVES({
			el: background,
			THREE: THREE,
			minHeight: 200.00,
			minWidth: 200.00,
			scale: 1.0,
			scaleMobile: 1.0,
			gyroControls: false,
			mouseControls: false,
			mouseEase: false,
			touchControls: false,
			camera: {
				far: 400,
				fov: 30,
				near: 0.1,
			},
			color: "hsl(225, 40%, 20%)",
			colorCycleSpeed: 10,
			forceAnimate: true,
			hh: 50,
			hue: 225,
			lightness: 20,
			material: {
				options: {
					fog: false,
					wireframe: false,
				},
			},
			saturation: 40,
			shininess: 35,
			waveHeight: 20,
			waveSpeed: 0.25,
			ww: 50,
			...settings,
		});

	...

Do you have any idea why this might be, or how I can resolve it? I would like to update to the latest version of three, but I'm stuck at the previous version until this issue is resolved.

@RaunoT
Copy link

RaunoT commented Jan 7, 2024

Running into the same issue. For me the animation seems to render properly, but is very dark. Pretty sure it has something to do with the color logic changes in r151 -> r152 of three.js.

https://github.com/mrdoob/three.js/wiki/Migration-Guide#151--152
https://github.com/mrdoob/three.js/releases/tag/r152

This is my implementation FWIW

import * as THREE from 'three'
import FOG from 'vanta/dist/vanta.fog.min'

export default function AppProvider() {
  const [background, setBackground] = useState<VantaEffect>(null)
  const backgroundRef = useRef(null)

  useEffect(() => {
    if (!background) {
      setBackground(
        FOG({
          el: backgroundRef.current,
          THREE: THREE, // seems to not work properly > 0.151.3
          highlightColor: 0xb5336,
          midtoneColor: 0x211e1d,
          lowlightColor: 0x16166f,
          baseColor: 0x0,
          speed: 1,
        }),
      )
    }

    return () => {
      if (background) {
        background.destroy()
      }
    }
  }, [background])

  return (
    <main ref={backgroundRef}>
       {children}
    </main>
  )
}

@meowthing
Copy link

Thank you for this thread - I thought I was doing something wrong when trying to implement Waves into my React project!

I have nothing more to contribute other than to confirm that using the latest version of Three JS (0.164.0) continues to break some VantaJS effects.

Out of the effects I've tried, Waves renders a blank screen, Rings has some sort of muted grey layer on top, and only Globe seems to render properly. Had to downgrade to 0.151.0 of Three to get Waves working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants