Skip to main content
<CodeWithBhurtel/>
HomeLearnProjectsChallengesBlogAboutContactLogin
<CodeWithBhurtel/>

Learn through structured lessons, real projects, and live challenges. Free tutorials for HTML, CSS, JavaScript, and more.

Pages

  • Home
  • Learn
  • Blog
  • Projects
  • Challenges
  • About
  • Contact

Lessons

  • HTML
  • CSS
  • JavaScript

© 2026 CodeWithBhurtel. All rights reserved.

Privacy PolicyTerms & Conditions
Projects

Neural Colored Simulation

AdvancedHTML

The hardest part is understanding that the signal animation has no moving parts. It is purely the fragment shader reading a uniform value and deciding which parts of the neuron to light up on each frame which feels counterintuitive when you first expect to see geometry actually moving.

Neural Colored Simulation – project preview
Share this project
Follow me on social media

About this project

This project builds an interactive 3D neuron inside the browser using Three.js. Clicking anywhere triggers a firing sequence where a signal travels from an input branch into the central soma and then spreads outward as an action potential across the full neuron structure.

The neuron is procedurally generated using CatmullRomCurve3 to define smooth wandering paths and TubeGeometry to give those paths physical volume. There is no pre-made model loaded from a file. Everything is built in code at runtime. The glow effect comes from UnrealBloomPass which runs after the main scene renders and bleeds light outward from bright areas in the frame.

The signal animation does not move any geometry. It runs entirely inside the GLSL fragment shader using two uniforms. uPulseProgress lights up the input branch progressively as the signal travels toward the soma. Once it arrives uActivation takes over and spreads a colorful wave outward across the full neuron. The animation is purely the shader reading a number and deciding what to light up on each frame.

The UI panel uses glassmorphism styling and displays live telemetry values like membrane voltage and propagation status that update on every frame based on the current simulation state. The numbers track the animation and make the interface feel like a real scientific instrument.

What you will learn

You will learn how to procedurally generate 3D geometry using Three.js curves. Defining points in space, connecting them with CatmullRomCurve3 and wrapping them with TubeGeometry is a workflow you can apply to any project that needs organic or branching shapes built at runtime without a modeling tool.

You will understand how UnrealBloomPass works as a post-processing effect. It does not add glow at the geometry level. It scans the rendered frame for bright pixels and mathematically bleeds light outward from them. That is why it produces results that CSS filters cannot replicate. You will learn how to animate through shader uniforms instead of moving geometry. Passing a float into a fragment shader and using it to control which parts of a mesh light up is more efficient and more flexible than transforming vertices on every frame.

You will also learn how to build a simple state machine to manage sequential animation phases and how to keep a UI panel synchronized with a live running system by updating it inside the animation loop on every frame.

Understand with AI

Get an AI-generated overview or a file-by-file code breakdown. Ask questions about the project below the overview.

AI Overview: Neural Colored Simulation

This project, "Neural Synapse Simulation," creates an interactive 3D visualization of a neuron firing, presented with a retro-futuristic, glowing aesthetic. Its primary purpose is to visually represent the propagation of a neural signal and an action potential within a stylized neuron structure. Users can click anywhere on the screen to trigger the firing sequence, observing dynamic changes in the neuron's appearance and an accompanying telemetry display.

The visual experience is built using Three.js, a JavaScript 3D library, combined with custom GLSL shaders for advanced rendering effects. The core neuron structure, including a central soma and numerous dendrite-like branches, is procedurally generated using TubeGeometry and CatmullRomCurve3 to create organic, wandering paths. An UnrealBloomPass is applied in post-processing to give the entire scene a vibrant, ethereal glow, enhancing the sci-fi feel.

const vertexShader = `
    attribute float aIsInput;
    // ... other attributes and varyings
    void main() {
        vIsInput = aIsInput; // Pass a custom attribute to the fragment shader
        // ... calculate position
    }
`;

const fragmentShader = `
    uniform float uTime;
    uniform float uPulseProgress; // Controls the incoming signal animation
    uniform float uActivation;    // Controls the firing animation
    // ... other uniforms and varyings

    void main() {
        // ... base color calculation
        vec3 pulseColor = vec3(0.0);
        if (vIsInput > 0.5 && uPulseProgress > -5.0) {
            // Logic for the incoming signal glow
        }
        vec3 actColor = vec3(0.0);
        if (uActivation > 0.0) {
            // Logic for the action potential (firing) wave
        }
        gl_FragColor = vec4(baseColor + pulseColor + actColor, 1.0);
    }
`;

These custom shaders are crucial for the project's visual effects. The vertexShader prepares data like aIsInput (to identify the signal input branch), while the fragmentShader uses uPulseProgress and uActivation uniforms to dynamically color and animate the neuron's glow, simulating the signal propagation and action potential.

The user interface, styled with CSS, features a "glassmorphism" panel displaying real-time "telemetry" data such as "Membrane V" and "Propagation" status. This panel, along with a custom animated cursor and subtle scanline/vignette overlays, reinforces the futuristic, holographic aesthetic. The JavaScript code continuously updates these UI elements based on the simulation's state, providing visual feedback on the neuron's activity.

.glass-inner {
    position: relative;
    z-index: 1;
    background: rgba(2, 5, 18, 0.75);
    backdrop-filter: blur(16px) saturate(160%); /* Creates the frosted glass effect */
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border-radius: 3px;
    padding: 14px 16px;
    border: 1px solid rgba(0, 180, 255, 0.08);
}

This CSS snippet demonstrates the "glassmorphism" effect applied to the UI panel, using backdrop-filter to blur content behind it, giving it a translucent, frosted appearance.

The simulation progresses through distinct states: idle, signal propagation, and firing. A click event transitions the simulation from idle to propagation, where the uPulseProgress uniform decreases, visually moving a "signal" along the input branch. Once the signal reaches the soma, the state changes to firing, and the uActivation uniform increases, creating a colorful, outward-spreading "action potential" wave across the entire neuron.

window.addEventListener('click', () => {
    if (state !== 0) return; // Only allow re-triggering when idle
    state = 1; // Transition to propagation state
    pulseProg = INPUT_LENGTH;
    actProg   = 0.0;
    material.uniforms.uActivation.value = 0.0;
    elPanel.style.opacity = '0'; // Hide UI temporarily
    document.body.classList.add('active'); // Trigger cursor animation
    setTimeout(() => document.body.classList.remove('active'), 300);
    mvTarget = 40.0; // Update membrane voltage target
});

This JavaScript snippet shows how a click event initiates the simulation. It sets the state to 1 (propagating), resets animation progress variables, updates shader uniforms, and triggers temporary UI changes and cursor animations. The animate loop then continuously updates the scene and UI based on this state and the progress of pulseProg and actProg.

Ask about this project

Have a question about how this project works? Ask below and get an answer based on the project code.

Code Breakdown

Structured technical breakdown for beginners. Anyone can generate or regenerate; your version is saved in this browser (local storage).

No breakdown yet. Generate one to see a file-by-file explanation. Your version is saved in this browser.

Comments

No comments yet. Sign in to leave a comment.

Sign in to leave a comment.