michaelbrusegard / WebGL-Fluid-Enhanced

WebGL Fluid Simulation for modern webpages (works even on mobile).
https://michaelbrusegard.github.io/WebGL-Fluid-Enhanced/
MIT License
40 stars 7 forks source link

Unable to set COLORFUL to false #13

Open shaun-visser opened 2 months ago

shaun-visser commented 2 months ago

setting COLORFUL false seems to stop everything from being rendered out e.g. useEffect(() => { webGLFluidEnhanced.simulation(canvasRef.current!, { SIM_RESOLUTION: 128, // Resolution of the simulation grid DYE_RESOLUTION: 1024, // Resolution of the dye grid CAPTURE_RESOLUTION: 512, // Resolution of captured frames DENSITY_DISSIPATION: 1, // Rate at which density dissipates VELOCITY_DISSIPATION: 0.2, // Rate at which velocity dissipates PRESSURE: 0.8, // Pressure value used in the simulation PRESSURE_ITERATIONS: 20, // Number of pressure iterations CURL: 10, // Curl value used in the simulation INITIAL: false, // Enables splats on initial load SPLAT_AMOUNT: 5, // Number of initial splats (Random number between n and n * 5) SPLAT_RADIUS: 0.25, // Radius of the splats SPLAT_FORCE: 6000, // Force applied by the splats SPLAT_KEY: '', // Keyboard key to spawn new splats (empty to disable) SHADING: false, // Enables shading in the visualization COLORFUL: false, // Enables rapid changing of colors COLOR_UPDATE_SPEED: 10, // Speed of color update COLOR_PALETTE: ['#ffff00', '#ffff00', '#ffff00', '#ffff00', '#ffff00'], // Custom color palette (empty by default, uses hex colors) HOVER: true, // Enables interaction on hover BACK_COLOR: '#ffffff', // Background color of the canvas TRANSPARENT: false, // Makes the canvas transparent if true BRIGHTNESS: 1, // Color brightness (Recommend lower than 1.0 if BLOOM is true) BLOOM: false, // Enables bloom effect BLOOM_ITERATIONS: 8, // Number of bloom effect iterations BLOOM_RESOLUTION: 256, // Resolution of the bloom effect BLOOM_INTENSITY: 0.8, // Intensity of the bloom effect BLOOM_THRESHOLD: 0.6, // Threshold for the bloom effect BLOOM_SOFT_KNEE: 0.7, // Soft knee value for the bloom effect SUNRAYS: false, // Enables sunrays effect SUNRAYS_RESOLUTION: 196, // Resolution of the sunrays effect SUNRAYS_WEIGHT: 1.0, // Weight of the sunrays effect }); }, []);

michaelbrusegard commented 1 week ago

You are right, it seems to be broken. I will try to implement a fix when I can

michaelbrusegard commented 1 week ago

@shaun-visser So I did some experimenting and figured out that disabling colorful only works when you disable hover. This is because the color is supposed to only change when you reclick the canvas when you are not hovering, I can probably fix this but I am unsure on how the implementation would be best when you have hover enabled