SYNAPSES: Fat lines + Selective Bloom

Hi community!

Picture:

Demo + source code: https://codepen.io/prisoner849/full/RwjQaeO

The brain in the scene consists of seveal components:

  • Fat lines. Based on CatmullRomCurve3. Instead of changing parts of LineMaterial with .replace(), I took the source code of material shaders awhole and changed the parts I needed. Magenta flows.
  • Icosahedron. That blue-ish mesh of wireframe.
  • Lines. Yellow signals.

First version of the brain was ugly, as I just used ImprovedNoise on a sphere with some scaling on axes.
So, I had to rewrite the function of deforming to make something, that looks more or less like a human brain.
If you’re intersted in function of deform, it’s here: JSFiddle (costed me a couple of morning hours :slight_smile: )

Brain deform
function deform(p){
	let mainR = 4;

	v3.copy(p).normalize();
  let len = p.length();
  
  let ns = perlin.noise(v3.x * 3, v3.y * 3, v3.z * 3);
  ns = Math.pow(Math.abs(ns), 0.5) * 0.5;
  
  let r = smoothstep(0.375, 0,Math.abs(v3.x)) - ns;
  p.setLength(mainR - r*0.5);
  p.y *= 1 - 0.5 * smoothstep(0, -mainR, p.y);
  p.y *= 0.75;
  p.x *= 0.75;
  p.y *= 1 - 0.125 * smoothstep(mainR * 0.25, -mainR, p.z);
  p.x *= 1 - 0.125 * smoothstep(mainR * 0.25, -mainR, p.z);
}

//https://github.com/gre/smoothstep/blob/aa5b60a10fd7c1c6e3a62d5efad4b086369f4232/index.js
function smoothstep (min, max, value) {
  var x = Math.max(0, Math.min(1, (value-min)/(max-min)));
  return x*x*(3 - 2*x);
};

Any component, in its base, is a set of points in a sphere with radius of 1. So vertices of each somponent are deformed with the same function, to match them one to each other.

12 Likes

Looks magical, well done! :rainbow:

Looks awesome!

@Usnul @XAR Thanks, guys :beers:

1 Like

Very pretty! I wish I could zoom in far enough to see how it looks from inside the brain

1 Like

@DolphinIQ Surprisingly, I haven’t thought about it :slight_smile: Reduced .minDistance to 1 to allow camera to get inside. Looks nice for me :slight_smile:

1 Like