zzzzzz
gfgfdew vdfs w gbrgb erbfefg nen f efeg e
kjh j hjjbjhbjh
hjbjhhj
hb j
jnnnnnnn nnnn n nnnn nnn
WEBDESIGN & CREATIVE CODING
Computer Graphic - Machine Learning - XR
ing. Fausto Baroncini
mat. Eva Grechi
eng. Fausto Baroncini
math. Eva Grechi
ABOUT
About
8822code.org is the online studio of Fausto Baroncini
a web-oriented creative coder, data analist, freelancer and teacher, based in Firenze, Italy _
Focus
Machine Learning
Web Tech
HTML5
UNITY & C#
Computer graphics
Generative/Procedural
VR/AR/XR/3D graphics
Volumetric Filmaking Processing
Fast Convolutive Neural Network
Arduino/Rapberry Setting-up and Coding
Algorithm Designer
Nonlinear/Noise/Chaotic/Fractal Modeling Real Time Data Assimilation and Kalman Filtering ModelingFat Tails and Long Memories Modeling
Bio
I’m a 45y, italian freelance professional since 11 years, I have collected respectively 5 years of experience as a researcher, 7 as teacher and 14 as a developer mainly (but not only) web oriented. In the last jobs as developer I have dealt with Machine Learning, as a "data analyst" consultant at
MONOGRID . In jobs prior to 2000 I always combined my research skills with those of computer science in works mainly oriented to computer graphics, Web documentaries and AI (artificial intelligence).
Education
Bachelor’s degree in engineering at University of Florence in 2004 with final thesis about Remote Data Assimilation for the retrival of Land Surface Temperature Maps. Thesis became an article on ‘International Journal Of Remote Sensing’.
Phd in ‘ complex dynamics and non-linear systems ’ at the IT Departement University of Engineering,Florence.
Research
During this period I acquire knowledge both in computer science and physics. In particular, I delve into disciplines such as data assimilation, control theory and kalman filters on non-linear applications, statistical physics, deterministic chaos, fractal dimensions, self-criticality models, automated cellular etc.
The aim of the research in the hydrological field was to study the extreme events of flooding on a regional scale.
Web Developer
After 5 years of career as a researcher suffering from the lack of a close-knit work team and facing the prospect of making the "brain on the run" abroad I decided to change profession drastically and I was hired as web-oriented developer by Virtualcom, an influential software company in Italy in the field of digital platforms for online publishing.
Freelance
From 2012 I became a freelance, thanks to the pre-official impulse and the enthusiasm of 5puj47980xk , since then my inseparable partner. During this new profession as a programmer I create sites and webapp modules in the most varied sectors of fashion, education, research, exhibitions, tourism, etc.
Creative Coding
From 2015 with the meeting of Roberto Malfagia and Emanuele Nappini founders of the storytelling company La Jetee, I begin to approach my experience as a modeling researcher with that of computer scientist.
I make the first web documentaries: as well as working as a developer / technology consultant, a more creative and experimental role is required in team work:
I take my first steps as Alghoritm Designer and User Experience Designer.
From 2016 I realize 2 - 3 web documentaries every year with different brands: La Jetee, Manifatture Digitali, Internet Festival, Fondazione Sistema Toscana, Indire, MACMA.
In 2018 the collaboration with the sound designer Giampaolo Capobianco began, together with which I made two Virtual Reality works applied to the web and I realized the first physical installation at the spaces of the Internet Festival of Pisa 2018. This installation (MIR) consists of a study on artificial intelligence based on the real-time coupling of three neural networks (Fast Convolutive Neural Networks) appropriately trained in identifying human faces, their emotional mapping and graphic manipulation.
In 2021 a fruitful collaboration with MONOGRID on Machine Learning was born where I implemented and personally trained the first neural networks (AI) oriented towards Speech Rekognition, Body Tracking and Positioning and Face Rekognition (see section Porfolio),
The collaboration with MONOGRID in the last 2 years has been oriented both to engagements for third party customers projects (Mobile Apps and WebApps) and to periods of Research and Development within the MONOGRID company.
Teaching
Since 2017 I started a new work experience parallel to that of coding: teaching.
I started teaching Experience Design in artistic residency of multimedia artists (See Portfolio: Production - Setteponti/Walkabout).
After a further teaching experience as a Creative Coder at the FORMODENA training center, I focused on teach in public middle & high school.
In 2020 I designed, created and coordinated a team of multimedia seniors for the realization of the VR puzzle game "Villa Ambra, the UNESCO heritage"(Production : Lanterne Magiche, Fondazione Sistema Toscana). "Villa Ambra" is a webapp for educational purposes in Virtual Reality. In the video game both the 3D graphic contents and the script composed of creative and historical writing were created through workshops made during laboratory lessons with high school pupils of the public school .
From 2019 to 2023 I also worked in public school as a teacher (in middle and high school, teaching subject: "science", "technology" , "physics", with both part-time and full-time yearly assignments.
Honors & Awards
Two achievements of the 2018 “ Walkabout Setteponti ” and “ the invention of space - Medici Villas and Gardens in Tuscany ” (UNESCO) were presented at the Festival dei Popoli 59 edition in the section called Doc Explorer and dedicated to the production of Web documentary and Virtual Reality.
About
8822code.org è lo studio online di Fausto Baroncini _
Creative Coder, Data Analist, libero professionista e docente residente a Firenze_
Focus
Machine Learning
Web Tech
HTML5
UNITY & C#
Computer graphics
Generative/Procedural
VR/AR/XR/3D graphics
Volumetric Filmaking Processing
Fast Convolutive Neural Network
Arduino/Rapberry Setting-up and Coding
Algorithm Designer
Nonlinear/Noise/Chaotic/Fractal Modeling Real Time Data Assimilation and Kalman Filtering ModelingFat Tails and Long Memories Modeling
Bio
Ho 45 anni compiuti, sono libero professionista da 11. A oggi ho collezionato rispettivamente 5 anni di esperienza come ricercatore, 7 anni come insegnante e 14 come sviluppatore principalmente per il web (ma non solo). Negli ultimi lavori come sviluppatore mi sono occupato di Machine Learning, come consulente "data analist" per conto di
MONOGRID . Nei lavori precedenti ai 2000 ho coniugato le mie conoscenze di ricercatore con quelle di informatico in lavori orientati principalmente alla computer grafica, al documentario Web e all'intelligenza artificiale.
Educazione
Laureato in Ingegneria presso l'Università di Firenze nel 2004 con una Tesi sulla Data Assimilation per la stima delle temperature al suolo da satellite. Tale tesi è stata pubblicata sull' ‘International Journal Of Remote Sensing’.
Inizio la carriera come ricercatore conseguendo un dottorato interdisciplinare in ‘dinamiche complesse e sistemi non lineare’ presso il Dipartimento di Informatica dell Università d'Ingegneria di Firenze.
Ricerca
Durante tale periodo acquisisco conoscenza sia in ambito informatico che fisico. In particolare approfondisco discipline quali la data assimilation, la teoria del controllo e filtri di kalman su applicazioni non lineari, la fisica statistica, il chaos deterministico, le dimensioni frattali,i modelli di self-criticality, le cellular automata etc.
Obbiettivo della ricerca in ambito idrologico era uno studio degli eventi estremi di piena di fiumi su scala regionale.
Web Developer
Dopo 5 anni di carriera come ricercatore soffrendo la mancanza di un team affiatato di lavoro e di fronte alla prospettiva di fare il “cervello in fuga” all’estero decido di cambiare drasticamente professione e vengo assunto come sviluppatore orientato al web da Virtualcom, una software house Fiorentina influente a livello nazionale nel campo delle piattaforme digitali per l’editoria online .
Freelance
Dal 2012 divento freelance, grazie alla spinta prefessionale e all'entusiasmo di 5puj47980xk da allora inseparabile socio. Nel corso di questa nuova professione come programmatore realizzo siti e moduli per Web-app nei più svariati settori della moda, educazione, ricerca, eventi fieristici, turismo, etc.
Creative Coding
Dal 2015 con l’incontro di Roberto Malfagia e Emanuele Nappini fondatori della società di story telling La Jetee, comincio ad avvicinare la mia esperienza di ricercatore modellista con quella di informatico.
Realizzo i primi documentari web : oltre a operare come sviluppatore / consulente tecnologico, nel lavoro di team è richiesto un ruolo piu creativo e sperimentale:
Muovo i primi passi come Alghoritm Designer e User Experience Designer.
Dal 2016 realizzo 2 - 3 documentari web l’anno con differenti produzioni: La Jetèe, Manifatture Digitali, Internet Festival, Fondazione Sistema Toscana, Indire, MACMA .
Nel 2018 comincia la collaborazione col sound designer Giampaolo Capobianco, insieme al quale confeziono due lavori di Virtual Reality applicata al web e realizzo la mia prima installazione fisica presso gli spazi dell’Internet Festival di Pisa 2018. Tale installazione (M.I.R.) consiste in uno studio sull’intelligenza artificiale basato sull’accoppiamento in tempo reale di tre reti neurali (Fast Convolutive Neural Networks) opportunamente ‘allenate’ all’identificazione di volti umani, alla loro mappatura emotiva e manipolazione grafica .
Nel 2021 nasce una proficua collaborazione con MONOGRID sul Machine Learning dove abbiamo implementato e personalmente allenato le prime reti neurali (AI) orientate allo Speech Rekognition, al Body Tracking and Positioning e al Face Rekognition (vedi sezione Porfolio),
La collaborazione con MONOGRID di questi ultimi 2 anni è stata orientata sia ad ingaggi per progetti di clienti terzi (E.g. Mobile Apps and WebApps) che a dei periodi di Ricerca e Sviluppo interni alla azienda MONOGRID.
Insegnamento
Dal 2017 ad oggi ho cominciato una nuova esperienza lavorativa parallela a quella del coding : l'insegnamento.
Ho cominciato insegnando Experience Design a residenze di artisti multimediali (Vedi Porfolio: Produzione - Setteponti/Walkabout)
Dopo una ulteriore esperienza di insegnamento come Creative Coder presso il centro di formazione FORMODENA mi sono orientato all'insegnamento giovanile.
Nel 2020 ho progettato, realizzato e coordinato una squadra di professionisti del multimedile per la produzione del puzzle game VR "Villa Ambra" (Lanterne Magiche, Fondazione Sistema Toscana). "Villa Ambra" è una webapp a scopo educativo in Realta Virtuale. Nel video-gioco sia i contenuti grafici che la sceneggiatura composta di scrittura creativa e storica sono stati creati attraverso laboratori fatti con alunni delle scuole superiori della scuola pbblica durante ore di laboratorio.
Dal 2019 al 2023 ho inoltre lavorato nella scuola pubblica come insegnante (alle scuole medie e superiori) con classe di insegnamento di scienze, tecnologia e fisica, con incarichi sia part-time che full-time annuali.
Honors & Awards
Due realizzazioni del 2018 “Setteponti Walkabout” e “L’invenzione dello spazio - Ville e Giardini medicei in Toscana” (UNESCO) sono state presentate al Festival dei Popoli 59 edizione nella sezione denominata Doc Explorer e dedicata alle produzioni di Web documentary e Virtual Reality.
hguuhb
gfgfdew vdfs w gbrgb erbfefg nen f efeg e
kjh j hjjbjhbjh
hjbjhhj
hb j
jnnnnnnn nnnn n nnnn nnn
hguuhb
gfgfdew vdfs w gbrgb erbfefg nen f efeg e
kjh j hjjbjhbjh
hjbjhhj
hb j
jnnnnnnn nnnn n nnnn nnn
HOME
//SKY SCELTA - FRAGMENT
uniform float time;
uniform float dissolve;
uniform int modesky;
varying vec2 vUv;
uniform float amount;
#define S(a, b, t) smoothstep(a, b, t)
float random( vec2 p )
{
vec2 K1 = vec2(
23.14069263277926, // e^pi (Gelfond’s constant)
2.665144142690225 // 2^sqrt(2) (Gelfond–Schneider constant)
);
return fract( cos( dot(p,K1) ) * 12345.6789 );
}
float N21(vec2 p) {
return fract(sin(p.x*123.+p.y*3456.)*3524.);
}
vec2 N22(vec2 p) {
return vec2(N21(p), N21(p+324.));
}
float L(vec2 p, vec2 a, vec2 b) {
vec2 pa = p-a;
vec2 ba = b-a;
// float t = clamp(dot(pa, ba)/dot(ba, ba), 0., 1.);
float t = 0.;
float d = length(pa - ba*t);
float m = S(.12, .0, d);
d = length(a-b);
float f = S(1., .8, d);
m *= f;
m += m*S(.05, .06, abs(d - .75))*2.;
return m;
}
vec2 GetPos(vec2 p, vec2 o) {
p += o;
vec2 n = N22(p)*time;
p = sin(n)*.4;
return o+p;
}
float G(vec2 uv) {
vec2 id = floor(uv);
uv = fract(uv)-.5;
vec2 g = GetPos(id, vec2(0));
float m = 0.;
for(float y=-1.; y<=1.; y++) {
for(float x=0.; x<=1.; x++) {
vec2 offs = vec2(x, y);
vec2 p = GetPos(id, offs);
m+=L(uv, g, p);//METTE LE LINEE
vec2 a = p-uv;
//float flash = .003/dot(a, a);
//flash *= pow( sin(N21(id+offs)*6.2831+10.*time)*.4+.6, 10.);//METTE LE STELLINE PULSANTI
//flash *= pow( sin(time)*.5+.5, 3.);
//m += flash;
}
}
//m += L(uv, GetPos(id, vec2(-1, 0)), GetPos(id, vec2(0, -1)));//METTE LE LINEE
//m += L(uv, GetPos(id, vec2(0, -1)), GetPos(id, vec2(1, 0)));//METTE LE LINEE
//m += L(uv, GetPos(id, vec2(1, 0)), GetPos(id, vec2(0, 1)));//METTE LE LINEE
//m += L(uv, GetPos(id, vec2(0, 1)), GetPos(id, vec2(-1, 0)));//METTE LE LINEE
//float d = length(g-uv);//LEVA LE LINEE E METTE CERCHIETTI
//m = S(.1, .08, d);
return m;
}
void main( void ) {
vec2 uv = (0.1*vUv.xy) / 1.;
// vec2 uv = ( gl_FragCoord.xy-.5*varying vec2 vUv.xy*0.001) / 1.*0.001*position.y;
float d = step(uv.y, 0.);
//if(uv.y<0.)
// uv.y = abs(uv.y);
float m = 0.;
m = 0.;
float t = time*.2;
float i=0.;
//for(float i=0.; i<1.; i+=.4) {//da il numero di stelle
float z = fract(i-t);//la t da il movimento e il verso
float s = mix(10., .5, z);//i primi due danno la focale/profondita/zoom
float f = S(0., .4, z)*S(1., .8, z);//regolano la dissolvenza delle linee
m += G(uv*s+10.*i)*f;
//}
t *= 10.;
vec3 base = vec3(0.06 ,0.12 ,0.49);//.5+sin(vec3(1., .56, .76)*t)*.5;//CAMBIA COLORE
vec3 col = base;
col *= m;
col -= uv.y*base;
col *= dissolve*(1.-dot(uv, uv));
//col *= mix(1., .5, d);
//if(col.r<0.1){
vec2 uvRandom = uv;
uvRandom.y *= random(vec2(uvRandom.y,1.));
col += random(uvRandom)*0.15*amount;
gl_FragColor = vec4( col, 1.0 );
//}
}
//SKY SCELTA - VERTEX
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
uniform float dissolve;
uniform int modesky;
varying vec2 vUv;
void main() {
vUv = uv;
vUv = vec2( position.x , position.y );
gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0);
}
//BUTTON ECHO - FRAGMENT
uniform float mousex;
uniform float mousey;
uniform float time;
uniform float dime;
uniform float dimex;
uniform float alph;
uniform sampler2D texture0;
uniform float resolutionx;
uniform float offx;
uniform float offy;
uniform float ratio;
varying vec3 vUv;
void main() {
vec2 vUUv=vUv.xy;//vec2(resolutionx*ratio*(vUv.x)-offx, ratio*(vUv.y)-offy);
//float ratio=float(resolutionx)/float(resolutiony)-ratio;
float t = abs(sin(3.*(time+length(vUUv)*sin(time)*sin(time))));
float t2 = abs(sin(3.*(time+length(vUUv)*sin(time+0.7)*sin(time+0.7))));
float t3 = abs(sin(3.*(time+length(vUUv)*sin(time+1.55)*sin(time+1.55))));
float m0=dime;
float m0x=dimex;
float a1=9.;
float a2=6.;
float a3=3.;
float alfa=2.;
float faktor=0.3;
float prosp_y=mousey;
float prosp_x=mousex;
vec3 texColor = vec3(texture2D(texture0,m0*vec2( m0x*(vUUv.x), (vUUv.y) )+0.5).rgb);//**************
vec3 texColor2 = pow(1.-t,alfa)*vec3(texture2D(texture0, m0*vec2(m0x*vUUv.x*(1.+faktor*t)-prosp_x*t + 1./(a1*4.)*sin(t*10.)*sin(t*10./3.), vUUv.y*(1.+faktor*t)-prosp_y*t+1./(a1*4.)*sin(t*10./5.)*sin(t*10./3.) ) + 0.5 ).rgb);//**************
vec3 texColor3 = pow(1.-t2,alfa)*vec3(texture2D(texture0, m0*vec2(m0x*vUUv.x*(1.+faktor*t2)-prosp_x*t2 + 1./(a2*4.)*sin(t2*10.)*sin(t2*10./3.) , vUUv.y*(1.+faktor*t2) -prosp_y*t2+1./(a2*4.)*sin(t2*10.)*sin(t2*10./3.) ) + 0.5 ).rgb);//**************
vec3 texColor4 = pow(1.-t3,alfa)*vec3(texture2D(texture0, m0*vec2(m0x*vUUv.x*(1.+faktor*t3)-prosp_x*t3 + 1./(a3*4.)*sin(t3*10.)*sin(t3*10./3.) , vUUv.y*(1.+faktor*t3) -prosp_y*t3+1./(a3*4.)*sin(t3*10.)*sin(t3*10./3.) ) + 0.5 ).rgb);//**************
texColor=0.5*(dime-1.4)/(3.4-1.4)*texColor+texColor2+texColor3+texColor4+vec3(0.,0.,0.3);//texColor+
gl_FragColor = vec4(texColor,alph-0.2) ;
}
//BUTTON ECHO - VERTEX
uniform float time;
varying vec3 vUv;
void main() {
vUv=position;
vec3 pos = position;
vec4 mvPosition = modelViewMatrix * vec4( pos, 1.0 );
gl_Position = projectionMatrix * mvPosition;
}
uniform int iFrame;
//uniform sampler2D iChannelB;
//uniform sampler2D iChannelC;
//uniform sampler2D iChannel1;
uniform sampler2D iChannel2;
uniform sampler2D iChannelBRAIN;
const float sizeGlob = 256.;
const int PNUM = 200;
struct Particle // user defined structure.
{
vec2 pos;
vec2 pos2;
int idx;
};
#define N(v) (v.yx*vec2(1,-1))
int modI(int a,int b) {
float m=float(a)-floor((float(a)+0.5)/float(b))*float(b);
return int(floor(m+0.5));
}
ivec2 textureSize(sampler2D s,int lod){
return ivec2(256,256);
}
vec4 texelFetch(sampler2D tex, ivec2 size, ivec2 coord)
{
return texture2D(tex, vec2((float(coord.x)-0.5) / float(size.x), (float(coord.y)-0.5) / float(size.y)));
}
int particleIdx(vec2 coord, sampler2D s)
{
ivec2 ires=textureSize(s,0);
return int(coord.x)+int(coord.y)*ires.x;
}
vec2 particleCoord(int idx, sampler2D s)
{
ivec2 ires=textureSize(s,0);
return vec2(modI((idx),(ires.x)),idx/ires.x)+.5;
}
vec4 getPixel(vec2 coord, sampler2D s)
{
return texelFetch(s,textureSize(s,0),ivec2(coord));
}
float rand(vec2 co){
return fract(sin(dot(co.xy, vec2(12.8273, 67.245))) * 53726.17623);
}
Particle readParticle(Particle p, vec2 coord, vec2 size, sampler2D s)
{
vec4 pix=texture2D(s, vec2(((coord.x)) / (size.x), ((coord.y)) / (size.y)));
p.pos=pix.xy;
p.pos2=pix.zw;
p.idx=particleIdx(coord,s);
return p;
}
vec4 getRand(vec2 pos, sampler2D s)//velocity
{
//vec2 rres=vec2(textureSize(s,0));
vec2 rres=vec2(512.,512.);
//return textureLod(s,pos/rres,0.);
return texture2D(s,pos/rres);
}
vec4 getRand(int idx, sampler2D s)//position
{
// ivec2 rres=textureSize(s,0);
ivec2 rres=ivec2(512,512);
idx=int(modI((idx) , (rres.x*rres.y) ) );
return texelFetch(s,rres,ivec2(int(modI((idx),(rres.x))),int(idx/rres.x)));
//return texelFetch(s,textureSize(s,0),ivec2(coord));
}
vec4 getCol(vec2 pos, sampler2D s, vec2 res)
{
// return textureLod(s,pos/res.xy,0.);
return texture2D(s,pos/res.xy);
}
float getVal(vec2 pos, sampler2D s, vec2 res)
{
return dot(getCol(pos,s,res).xyz,vec3(1.)/3.);
}
vec2 getGrad(vec2 pos, float eps, sampler2D s, vec2 res)
{
vec2 d=vec2(eps,0);
return vec2(
getVal(pos+d.xy,s,res)-getVal(pos-d.xy,s,res),
getVal(pos+d.yx,s,res)-getVal(pos-d.yx,s,res)
)/eps/2.;
}
void main(){
vec2 uvy = gl_FragCoord.xy / resolution.xy;
vec2 uv = gl_FragCoord.xy ;
//float velocity=0.01;
Particle p;
//int idx = particleIdx(uv,iChannelB);
//p=readParticle(p,uv,resolution.xy,iChannelB);
vec4 zzz = texture2D(iChannelB, uvy*1.);
//vec3 test = texture2D(iChannelBRAIN, uvy*1.).xyz;
vec3 begin = texture2D(iChannelBRAIN, vec2( zzz.z, zzz.w ) ).xyz;
vec3 end = texture2D(iChannelBRAIN, vec2( zzz.x , zzz.y ) ).xyz;
vec3 www = texture2D(iChannelC,uvy).xyz;
float tx= www.x;
vec3 next = (1.-tx)*begin + tx*end;
gl_FragColor = vec4(next,www.z);
//gl_FragColor = vec4(test,1.);
//gl_FragColor =zzz;
//gl_FragColor = vec4(zzz.xy,0.,1.);
//
//vec4 test = texture2D(iChannel1,gl_FragCoord.xy);
//vec4 test = vec4(1.0, 0.0, 0.0, 1.);
//vec4 test = vec4(1.0,0.0,0.0,1.);
//gl_FragColor = vec4(zzz,1.);
}
uniform int iFrame;
uniform sampler2D iChannelB;
uniform sampler2D iChannelC;
//uniform sampler2D iChannel1;
uniform sampler2D iChannel2;
uniform sampler2D iChannelBRAIN;
uniform vec2 resolution;
varying vec2 vUv;
const float sizeGlob = 256.;
const int PNUM = 200;
struct Particle // user defined structure.
{
vec2 pos;
vec2 pos2;
int idx;
};
#define N(v) (v.yx*vec2(1,-1))
int modI(int a,int b) {
float m=float(a)-floor((float(a)+0.5)/float(b))*float(b);
return int(floor(m+0.5));
}
ivec2 textureSize(sampler2D s,int lod){
return ivec2(256,256);
}
vec4 texelFetch(sampler2D tex, ivec2 size, ivec2 coord)
{
return texture2D(tex, vec2((float(coord.x)-0.5) / float(size.x), (float(coord.y)-0.5) / float(size.y)));
}
int particleIdx(vec2 coord, sampler2D s)
{
ivec2 ires=textureSize(s,0);
return int(coord.x)+int(coord.y)*ires.x;
}
vec2 particleCoord(int idx, sampler2D s)
{
ivec2 ires=textureSize(s,0);
return vec2(modI((idx),(ires.x)),idx/ires.x)+.5;
}
vec4 getPixel(vec2 coord, sampler2D s)
{
return texelFetch(s,textureSize(s,0),ivec2(coord));
}
float rand(vec2 co){
return fract(sin(dot(co.xy, vec2(12.8273, 67.245))) * 53726.17623);
}
Particle readParticle(Particle p, vec2 coord, vec2 size, sampler2D s)
{
vec4 pix=texture2D(s, vec2(((coord.x)) / (size.x), ((coord.y)) / (size.y)));
p.pos=pix.xy;
p.pos2=pix.zw;
p.idx=particleIdx(coord,s);
return p;
}
vec4 getRand(vec2 pos, sampler2D s)//velocity
{
//vec2 rres=vec2(textureSize(s,0));
vec2 rres=vec2(512.,512.);
//return textureLod(s,pos/rres,0.);
return texture2D(s,pos/rres);
}
vec4 getRand(int idx, sampler2D s)//position
{
// ivec2 rres=textureSize(s,0);
ivec2 rres=ivec2(512,512);
idx=int(modI((idx) , (rres.x*rres.y) ) );
return texelFetch(s,rres,ivec2(int(modI((idx),(rres.x))),int(idx/rres.x)));
//return texelFetch(s,textureSize(s,0),ivec2(coord));
}
vec4 getCol(vec2 pos, sampler2D s, vec2 res)
{
// return textureLod(s,pos/res.xy,0.);
return texture2D(s,pos/res.xy);
}
float getVal(vec2 pos, sampler2D s, vec2 res)
{
return dot(getCol(pos,s,res).xyz,vec3(1.)/3.);
}
vec2 getGrad(vec2 pos, float eps, sampler2D s, vec2 res)
{
vec2 d=vec2(eps,0);
return vec2(
getVal(pos+d.xy,s,res)-getVal(pos-d.xy,s,res),
getVal(pos+d.yx,s,res)-getVal(pos-d.yx,s,res)
)/eps/2.;
}
void main(){
vec2 uvy = gl_FragCoord.xy/resolution.xy;
vec2 uv = gl_FragCoord.xy ;
//float velocity=0.01;
Particle p;
//int idx = particleIdx(uv,iChannelB);
//p=readParticle(p,uv,resolution.xy,iChannelB);
vec4 zzz = texture2D(iChannelB, uvy*1.);
//vec3 test = texture2D(iChannelBRAIN, uvy*1.).xyz;
vec3 begin = texture2D(iChannelBRAIN, vec2( zzz.z, zzz.w ) ).xyz;
vec3 end = texture2D(iChannelBRAIN, vec2( zzz.x , zzz.y ) ).xyz;
vec3 www = texture2D(iChannelC,uvy).xyz;
float tx= www.x;
vec3 next = (1.-tx)*begin + tx*end;
gl_FragColor = vec4(next,www.z);
//gl_FragColor = vec4(test,1.);
//gl_FragColor =zzz;
//gl_FragColor = vec4(zzz.xy,0.,1.);
//
//vec4 test = texture2D(iChannelB , gl_FragCoord.xy/resolution.xy);
//vec4 test = vec4(1.0, 0.0, 0.0, 1.);
//vec4 test = vec4(1.0,0.0,0.0,1.);
//gl_FragColor = vec4(test.xyz,1.);
}
uniform int iFrame;
//uniform sampler2D iChannelB;
//uniform sampler2D iChannelA;
//uniform sampler2D iChannelC;
//uniform sampler2D iChannel1;
uniform sampler2D iChannel2;
uniform sampler2D iChannelBRAIN;
uniform sampler2D iChannelVICINI;
uniform sampler2D iChannelVICINI_B;
uniform sampler2D iChannelVICINI_C;
uniform sampler2D iChannelVICINI_D;
const int PNUM = 200;
const float sizeGlob = 256.;
struct Particle // user defined structure.
{
vec2 pos;
vec2 pos2;
int idx;
};
#define N(v) (v.yx*vec2(1,-1))
int modI(int a,int b) {
float m=float(a)-floor((float(a)+0.5)/float(b))*float(b);
return int(floor(m+0.5));
}
ivec2 textureSize(sampler2D s,int lod){
return ivec2(256,256);
}
vec4 texelFetch(sampler2D tex, ivec2 size, ivec2 coord)
{
return texture2D(tex, vec2((float(coord.x)-0.5) / float(size.x), (float(coord.y)-0.5) / float(size.y)));
}
int particleIdx(vec2 coord, sampler2D s)
{
ivec2 ires=textureSize(s,0);
return int(coord.x)+int(coord.y)*ires.x;
}
vec2 particleCoord(int idx, sampler2D s)
{
ivec2 ires=textureSize(s,0);
return vec2(modI(idx,ires.x),idx/ires.x)+.5;
}
vec4 getPixel(vec2 coord, sampler2D s)
{
return texelFetch(s,textureSize(s,0),ivec2(coord));
}
float rand(vec2 co){
return fract(sin(dot(co.xy, vec2(12.8273, 67.245))) * 53726.17623);
}
Particle readParticle(Particle p, vec2 coord, vec2 size, sampler2D s)
{
vec4 pix=texture2D(s, vec2(((coord.x)) / (size.x), ((coord.y)) / (size.y)));
p.pos=pix.xy;
p.pos2=pix.zw;
p.idx=particleIdx(coord,s);
return p;
}
Particle initParticle(Particle p, vec2 coord, vec2 size, sampler2D s)
{
vec4 pix=texture2D(s, vec2(((coord.x)) / (size.x), ((coord.y)) / (size.y)));
p.pos=vec2(0.,0.);
p.pos2=vec2(155./256., 206./256.);
p.idx=particleIdx(coord,s);
return p;
}
Particle updatePos(Particle p, vec2 coord, vec2 size, sampler2D s,vec2 coord2)
{
vec4 pix=texture2D(s, vec2(((coord2.x)) / (size.x), ((coord2.y)) / (size.y)));
vec2 fp=pix.zw;
p.pos=fp;
p.pos2=coord/(size);
return p;
}
vec4 writeParticle(Particle p, vec2 coord)
{
vec4 col=vec4(0.);
//if ( modI( (particleIdx(coord)), (PNUM) ) == p.idx )
col=vec4(p.pos,p.pos2);
return col;
}
vec4 getRand(vec2 pos, sampler2D s)//velocity
{
//vec2 rres=vec2(textureSize(s,0));
vec2 rres=vec2(512.,512.);
//return textureLod(s,pos/rres,0.);
return texture2D(s,pos/rres);
}
vec4 getRand(int idx, sampler2D s)//position
{
// ivec2 rres=textureSize(s,0);
ivec2 rres=ivec2(512,512);
idx=int(modI((idx) , (rres.x*rres.y) ) );
return texelFetch(s,rres,ivec2(int(modI((idx),(rres.x))),int(idx/rres.x)));
//return texelFetch(s,textureSize(s,0),ivec2(coord));
}
void main(){
vec2 uvy = gl_FragCoord.xy / resolution.xy;
vec2 uv = gl_FragCoord.xy ;
float velocity=0.01;
//int idx = particleIdx(uv,iChannelB);
//p=readParticle(p,uv,resolution,iChannelB);
//vec3 test=vec3(0.);
vec4 CC = texture2D(iChannelC, uvy*1.).xyzw;
float Tlife=CC.x;
vec4 pos2x = texture2D(iChannelB,uvy);
vec2 origin=vec2(120./255.,70./255.);
if (iFrame < 2) pos2x=texture2D(iChannelB,origin);//vec4(pos2x.z*0.8+1./255.,pos2x.w*0.8+1./255.,pos2x.z*0.+1./255.,pos2x.w*0.+1./255.);
//vec4 vicini = texture2D(iChannelVICINI, uvy );
//vec4 vicini_B = texture2D(iChannelVICINI_B, uvy );
//float vx=1.*CC.w;
//float vx2=0.2*CC.w;
float nofp=0.5;
float va=rand(pos2x.xy*0.8+7.13*float(iFrame));
float va2=rand(pos2x.xy*0.2+3.13*float(iFrame));
vec2 zz= step(vec2(1.,1.)*nofp,vec2(va,va2) );
float vx=1.*rand(zz+256.*CC.w);
float vx2=0.2*rand(zz+133.*CC.w);
//float vx2=1.*rand(zz+133.*CC.w);
if(Tlife>=1.) {
Particle p;
vec4 vicini = texture2D(iChannelVICINI, vec2( pos2x.x , pos2x.y ) );
vec4 vicini_B = texture2D(iChannelVICINI_B, vec2( pos2x.x , pos2x.y ) );
vec4 vicini_C = texture2D(iChannelVICINI_C, vec2( pos2x.x , pos2x.y ) );
vec4 vicini_D = texture2D(iChannelVICINI_D, vec2( pos2x.x , pos2x.y ) );
vec2 INDnb=pos2x.xy;
int numofneig=0;
int where=0;
float v1=rand(uv*0.8+7.13*float(iFrame));
float v2=rand(uv*0.7+0.2*float(iFrame));
float v3=rand(uv*0.6+0.3*float(iFrame));
float v4=rand(uv*0.5+0.4*float(iFrame));
float v5=rand(uv*0.4+0.5*float(iFrame));
float v6=rand(uv*0.3+0.6*float(iFrame));
float v7=rand(uv*0.2+0.7*float(iFrame));
float v8=rand(uv*0.1+0.8*float(iFrame));
vec4 dir0 = texture2D(iChannelBRAIN, vec2(vx,vx2));
vec4 dirX = texture2D(iChannelBRAIN, uvy);
vec4 dirA = texture2D(iChannelBRAIN, vicini.xy/255. );
vec4 dirA2 = texture2D(iChannelBRAIN, vicini.zw/255.);
vec4 dirB = texture2D(iChannelBRAIN, vicini_B.xy/255. );
vec4 dirB2 = texture2D(iChannelBRAIN, vicini_B.zw/255. );
vec4 dirC = texture2D(iChannelBRAIN, vicini_C.xy/255. );
vec4 dirC2 = texture2D(iChannelBRAIN, vicini_C.zw/255. );
vec4 dirD = texture2D(iChannelBRAIN, vicini_D.xy/255.);
vec4 dirD2 = texture2D(iChannelBRAIN, vicini_D.zw/255. );
if(CC.z > 0.15 )
dir0=dirX;
//if(CC.z > 0.40 && CC.z < 0.90)
if(false)
dir0.z=dir0.z-300.;
float rfact=0.6;
if(true){
//if(CC.z > 0.15 && CC.z < 0.40 ){
rfact=0.3;
float la= ((1.-rfact)+rfact*rand(dirA.xy+0.43*float(iFrame)) )*length(dirA-dir0);
float la2= ((1.-rfact)+rfact*rand(dirA2.xy+0.43*float(iFrame)) )*length(dirA2-dir0);
float lb=((1.-rfact)+rfact*rand(dirB.xy+0.43*float(iFrame)) )* length(dirB-dir0);
float lb2=((1.-rfact)+rfact*rand(dirB2.xy+0.43*float(iFrame)) )* length(dirB2-dir0);
float lc=((1.-rfact)+rfact*rand(dirC.xy+0.43*float(iFrame)) )* length(dirC-dir0);
float lc2=((1.-rfact)+rfact*rand(dirC2.xy+0.43*float(iFrame)) )* length(dirC2-dir0);
float ld=((1.-rfact)+rfact*rand(dirD.xy+0.43*float(iFrame)) )* length(dirD-dir0);
float ld2=((1.-rfact)+rfact*rand(dirD2.xy+0.43*float(iFrame)) )* length(dirD2-dir0);
//if(CC.z > 0.20 && CC.z < 0.40) {
if(false) {
la= ((1.-rfact)+rfact*rand(dirA.xy+0.43*float(iFrame)) )*length(dirA-vec4(dirA.xyz/10.,1.));
la2= ((1.-rfact)+rfact*rand(dirA2.xy+0.43*float(iFrame)) )*length(dirA2-vec4(dirA2.xyz/10.,1.));
lb=((1.-rfact)+rfact*rand(dirB.xy+0.43*float(iFrame)) )* length(dirB-vec4(dirB.xyz/10.,1.));
lb2=((1.-rfact)+rfact*rand(dirB2.xy+0.43*float(iFrame)) )* length(dirB2-vec4(dirB2.xyz/10.,1.));
lc=((1.-rfact)+rfact*rand(dirC.xy+0.43*float(iFrame)) )* length(dirC-vec4(dirC.xyz/10.,1.));
lc2=((1.-rfact)+rfact*rand(dirC2.xy+0.43*float(iFrame)) )* length(dirC2-vec4(dirC2.xyz/10.,1.));
ld=((1.-rfact)+rfact*rand(dirD.xy+0.43*float(iFrame)) )* length(dirD-vec4(dirD.xyz/10.,1.));
ld2=((1.-rfact)+rfact*rand(dirD2.xy+0.43*float(iFrame)) )* length(dirD2-vec4(dirD2.xyz/10.,1.));
}
float mx = max( max( max(la,la2),max(lb,lb2) ), max( max(lc,lc2),max(ld,ld2) ) );
float minx = min( min( min(la,la2),min(lb,lb2) ), min( min(lc,lc2),min(ld,ld2) ) );
//if(CC.z > 0.15)
if(false)
mx=minx;
if( (mx-la) < 0.01 ){
INDnb=(vicini.xy/255.);
}else if( (mx-la2) < 0.01 ){
INDnb=(vicini.zw/255.);
}else if( (mx-lb) < 0.01 ){
INDnb=(vicini_B.xy/255.);
}else if( (mx-lb2) < 0.01 ){
INDnb=(vicini_B.zw/255.);
}else if( (mx-lc) < 0.01 ){
INDnb=(vicini_C.xy/255.);
}else if( (mx-lc2) < 0.01 ){
INDnb=(vicini_C.zw/255.);
}else if( (mx-ld) < 0.01 ){
INDnb=(vicini_D.xy/255.);
}else if( (mx-ld2) < 0.01 ){
INDnb=(vicini_D.zw/255.);
}
}
// 0 + 10 + 15 + 20 + 40 + 50
//COMPLX + DIVERGE + EXTERNAL + LINE + CONVERGE + DIVERGE
//if(CC.z < 0.1 || ((CC.z > 0.15 && CC.z < 0.40 ) && v1 < 0.5) || ((CC.z > 0.40 && CC.z < 0.90 ) && v1 < 0.5) ){
if(false){
if( (length(vicini.xy-pos2x.zw*255.)> 1.)
&& (length(vicini.xy-pos2x.xy*255.)> 1. )
&& v1 < 0.2
){
numofneig=numofneig+1;
where+=1;
INDnb=(vicini.xy/255.);
}
if( (length(vicini.zw-pos2x.zw*255.)> 1.)
&& (length(vicini.zw-pos2x.xy*255.)> 1.)
&& v2 < 0.3
){
numofneig=numofneig+1;
where+=2;
INDnb=(vicini.zw/255.);
}
if( (length(vicini_B.xy-pos2x.zw*255.) > 1.)
&& (length(vicini_B.xy-pos2x.xy*255.) > 1.)
&& v3 < 0.4
){
numofneig=numofneig+1;
where+=5;
INDnb=(vicini_B.xy/255.);
}
if( (length(vicini_B.zw-pos2x.zw*255.) > 1.)
&& (length(vicini_B.zw-pos2x.xy*255.) > 1.)
&& v4 < 0.5
){
numofneig=numofneig+1;
where+=10;
INDnb=(vicini_B.zw/255.);
}
if( (length(vicini_C.xy-pos2x.zw*255.)> 1.)
&& (length(vicini_C.xy-pos2x.xy*255.)> 1.)
&& v5 < 0.5
){
numofneig=numofneig+1;
where+=20;
INDnb=(vicini_C.xy/255.);
}
if( (length(vicini_C.zw-pos2x.zw*255.)> 1.01)
&& (length(vicini_C.zw-pos2x.xy*255.)> 1.01)
&& v6 < 0.5
){
numofneig=numofneig+1;
where+=50;
INDnb=(vicini_C.zw/255.);
}
if( (length(vicini_D.xy-pos2x.zw*255.)> 1.01)
&& (length(vicini_D.xy-pos2x.xy*255.)> 1.01)
&& v7 < 0.6
){
numofneig=numofneig+1;
where+=100;
INDnb=(vicini_D.xy/255.);
}
if( (length(vicini_D.zw-pos2x.zw*255.)>1.01)
&& (length(vicini_D.zw-pos2x.xy*255.)>1.01)
&& v8 < 0.6
){
numofneig=numofneig+1;
where+=200;
INDnb=(vicini_D.zw/255.);
}
}
if(CC.z<=0.0001){
INDnb=vec2(vx,vx2);
}
p.pos=pos2x.xy;
p.pos2=INDnb;
gl_FragColor=vec4( p.pos2.x , p.pos2.y , p.pos.x , p.pos.y);
}else{
if(CC.z<=0.0001){
pos2x.xy=vec2(vx,vx2);
}
//gl_FragColor=vec4( pos2x.x , pos2x.y , float(ind_prev)/7. , pos2x.w);
gl_FragColor=pos2x;
}
//gl_FragColor=vec4(uvy.x,uvy.y,0.,1.);
//gl_FragColor=vec4(vicini.x/255.,vicini.y/255.,0.,1.);
//vec3 zzz = texture2D(iChannelBRAIN, uv*1.).xyz;
//gl_FragColor=writeParticle(p,uvy);
//gl_FragColor = vec4(vicini);
}
uniform int iFrame;
//uniform sampler2D iChannelB;
//uniform sampler2D iChannelA;
//uniform sampler2D iChannelC;
//uniform sampler2D iChannel1;
uniform sampler2D iChannel2;
uniform sampler2D iChannelBRAIN;
uniform sampler2D iChannelVICINI;
uniform sampler2D iChannelVICINI_B;
uniform sampler2D iChannelVICINI_C;
uniform sampler2D iChannelVICINI_D;
const int PNUM = 200;
const float sizeGlob = 256.;
struct Particle // user defined structure.
{
vec2 pos;
vec2 pos2;
int idx;
};
#define N(v) (v.yx*vec2(1,-1))
int modI(int a,int b) {
float m=float(a)-floor((float(a)+0.5)/float(b))*float(b);
return int(floor(m+0.5));
}
ivec2 textureSize(sampler2D s,int lod){
return ivec2(256,256);
}
vec4 texelFetch(sampler2D tex, ivec2 size, ivec2 coord)
{
return texture2D(tex, vec2((float(coord.x)-0.5) / float(size.x), (float(coord.y)-0.5) / float(size.y)));
}
int particleIdx(vec2 coord, sampler2D s)
{
ivec2 ires=textureSize(s,0);
return int(coord.x)+int(coord.y)*ires.x;
}
vec2 particleCoord(int idx, sampler2D s)
{
ivec2 ires=textureSize(s,0);
return vec2(modI(idx,ires.x),idx/ires.x)+.5;
}
vec4 getPixel(vec2 coord, sampler2D s)
{
return texelFetch(s,textureSize(s,0),ivec2(coord));
}
float rand(vec2 co){
return fract(sin(dot(co.xy, vec2(12.8273, 67.245))) * 53726.17623);
}
Particle readParticle(Particle p, vec2 coord, vec2 size, sampler2D s)
{
vec4 pix=texture2D(s, vec2(((coord.x)) / (size.x), ((coord.y)) / (size.y)));
p.pos=pix.xy;
p.pos2=pix.zw;
p.idx=particleIdx(coord,s);
return p;
}
Particle initParticle(Particle p, vec2 coord, vec2 size, sampler2D s)
{
vec4 pix=texture2D(s, vec2(((coord.x)) / (size.x), ((coord.y)) / (size.y)));
p.pos=vec2(0.,0.);
p.pos2=vec2(155./256., 206./256.);
p.idx=particleIdx(coord,s);
return p;
}
Particle updatePos(Particle p, vec2 coord, vec2 size, sampler2D s,vec2 coord2)
{
vec4 pix=texture2D(s, vec2(((coord2.x)) / (size.x), ((coord2.y)) / (size.y)));
vec2 fp=pix.zw;
p.pos=fp;
p.pos2=coord/(size);
return p;
}
vec4 writeParticle(Particle p, vec2 coord)
{
vec4 col=vec4(0.);
//if ( modI( (particleIdx(coord)), (PNUM) ) == p.idx )
col=vec4(p.pos,p.pos2);
return col;
}
void main(){
vec2 uvy = gl_FragCoord.xy / resolution.xy;
vec2 uv = gl_FragCoord.xy ;
float velocity=0.01;
//int idx = particleIdx(uv,iChannelB);
//p=readParticle(p,uv,resolution,iChannelB);
//vec3 test=vec3(0.);
vec4 CC = texture2D(iChannelC, uvy*1.).xyzw;
float Tlife=CC.x;
vec4 pos2x = texture2D(iChannelB,uvy);
vec2 origin=vec2(120./255.,70./255.);
if (iFrame < 2) pos2x=texture2D(iChannelB,origin);//vec4(pos2x.z*0.8+1./255.,pos2x.w*0.8+1./255.,pos2x.z*0.+1./255.,pos2x.w*0.+1./255.);
//vec4 vicini = texture2D(iChannelVICINI, uvy );
//vec4 vicini_B = texture2D(iChannelVICINI_B, uvy );
//float vx=1.*CC.w;
//float vx2=0.2*CC.w;
float nofp=0.5;
float va=rand(pos2x.xy*0.8+7.13*float(iFrame));
float va2=rand(pos2x.xy*0.2+3.13*float(iFrame));
vec2 zz= step(vec2(1.,1.)*nofp,vec2(va,va2) );
float vx=1.*rand(zz+256.*CC.w);
float vx2=0.2*rand(zz+133.*CC.w);
//float vx2=1.*rand(zz+133.*CC.w);
if(Tlife>=1.) {
Particle p;
vec4 vicini = texture2D(iChannelVICINI, vec2( pos2x.x , pos2x.y ) );
vec4 vicini_B = texture2D(iChannelVICINI_B, vec2( pos2x.x , pos2x.y ) );
//vec4 vicini_C = texture2D(iChannelVICINI_C, vec2( pos2x.x , pos2x.y ) );
//vec4 vicini_D = texture2D(iChannelVICINI_D, vec2( pos2x.x , pos2x.y ) );
vec2 INDnb=pos2x.xy;
int numofneig=0;
int where=0;
vec4 dir0 = texture2D(iChannelBRAIN, vec2(vx,vx2));
vec4 dirX = texture2D(iChannelBRAIN, uvy);
vec4 dirA = texture2D(iChannelBRAIN, vicini.xy/255. );
vec4 dirA2 = texture2D(iChannelBRAIN, vicini.zw/255.);
vec4 dirB = texture2D(iChannelBRAIN, vicini_B.xy/255. );
vec4 dirB2 = texture2D(iChannelBRAIN, vicini_B.zw/255. );
//vec4 dirC = texture2D(iChannelBRAIN, vicini_C.xy/255. );
//vec4 dirC2 = texture2D(iChannelBRAIN, vicini_C.zw/255. );
//vec4 dirD = texture2D(iChannelBRAIN, vicini_D.xy/255.);
//vec4 dirD2 = texture2D(iChannelBRAIN, vicini_D.zw/255. );
if(CC.z > 0.15 )
dir0=dirX;
float rfact=0.6;
if(true){
rfact=0.3;
float la= ((1.-rfact)+rfact*rand(dirA.xy+0.43*float(iFrame)) )*length(dirA-dir0);
float la2= ((1.-rfact)+rfact*rand(dirA2.xy+0.43*float(iFrame)) )*length(dirA2-dir0);
float lb=((1.-rfact)+rfact*rand(dirB.xy+0.43*float(iFrame)) )* length(dirB-dir0);
float lb2=((1.-rfact)+rfact*rand(dirB2.xy+0.43*float(iFrame)) )* length(dirB2-dir0);
float mx = max( max(la,la2),max(lb,lb2) ) ;
if( (mx-la) < 0.01 ){
INDnb=(vicini.xy/255.);
}else if( (mx-la2) < 0.01 ){
INDnb=(vicini.zw/255.);
}else if( (mx-lb) < 0.01 ){
INDnb=(vicini_B.xy/255.);
}else if( (mx-lb2) < 0.01 ){
INDnb=(vicini_B.zw/255.);
}
}
if(CC.z<=0.0001){
INDnb=vec2(vx,vx2);
}
p.pos=pos2x.xy;
p.pos2=INDnb;
gl_FragColor=vec4( p.pos2.x , p.pos2.y , p.pos.x , p.pos.y);
}else{
if(CC.z<=0.0001){
pos2x.xy=vec2(vx,vx2);
}
//gl_FragColor=vec4( pos2x.x , pos2x.y , float(ind_prev)/7. , pos2x.w);
gl_FragColor=pos2x;
}
//gl_FragColor=vec4(uvy.x,uvy.y,0.,1.);
//gl_FragColor=vec4(vicini.x/255.,vicini.y/255.,0.,1.);
//vec3 zzz = texture2D(iChannelBRAIN, uv*1.).xyz;
//gl_FragColor=writeParticle(p,uvy);
//gl_FragColor = vec4(vicini);
}
uniform int iFrame;
uniform sampler2D iChannelB;
uniform sampler2D iChannelA;
uniform sampler2D iChannelC;
//uniform sampler2D iChannel1;
uniform sampler2D iChannel2;
uniform sampler2D iChannelBRAIN;
uniform sampler2D iChannelVICINI;
uniform sampler2D iChannelVICINI_B;
uniform sampler2D iChannelVICINI_C;
uniform sampler2D iChannelVICINI_D;
uniform vec2 resolution;
varying vec2 vUv;
const int PNUM = 200;
const float sizeGlob = 256.;
struct Particle // user defined structure.
{
vec2 pos;
vec2 pos2;
int idx;
};
#define N(v) (v.yx*vec2(1,-1))
int modI(int a,int b) {
float m=float(a)-floor((float(a)+0.5)/float(b))*float(b);
return int(floor(m+0.5));
}
ivec2 textureSize(sampler2D s,int lod){
return ivec2(256,256);
}
vec4 texelFetch(sampler2D tex, ivec2 size, ivec2 coord)
{
return texture2D(tex, vec2((float(coord.x)-0.5) / float(size.x), (float(coord.y)-0.5) / float(size.y)));
}
int particleIdx(vec2 coord, sampler2D s)
{
ivec2 ires=textureSize(s,0);
return int(coord.x)+int(coord.y)*ires.x;
}
vec2 particleCoord(int idx, sampler2D s)
{
ivec2 ires=textureSize(s,0);
return vec2(modI(idx,ires.x),idx/ires.x)+.5;
}
vec4 getPixel(vec2 coord, sampler2D s)
{
return texelFetch(s,textureSize(s,0),ivec2(coord));
}
float rand(vec2 co){
return fract(sin(dot(co.xy, vec2(12.8273, 67.245))) * 53726.17623);
}
Particle readParticle(Particle p, vec2 coord, vec2 size, sampler2D s)
{
vec4 pix=texture2D(s, vec2(((coord.x)) / (size.x), ((coord.y)) / (size.y)));
p.pos=pix.xy;
p.pos2=pix.zw;
p.idx=particleIdx(coord,s);
return p;
}
Particle initParticle(Particle p, vec2 coord, vec2 size, sampler2D s)
{
vec4 pix=texture2D(s, vec2(((coord.x)) / (size.x), ((coord.y)) / (size.y)));
p.pos=vec2(0.,0.);
p.pos2=vec2(155./256., 206./256.);
p.idx=particleIdx(coord,s);
return p;
}
Particle updatePos(Particle p, vec2 coord, vec2 size, sampler2D s,vec2 coord2)
{
vec4 pix=texture2D(s, vec2(((coord2.x)) / (size.x), ((coord2.y)) / (size.y)));
vec2 fp=pix.zw;
p.pos=fp;
p.pos2=coord/(size);
return p;
}
vec4 writeParticle(Particle p, vec2 coord)
{
vec4 col=vec4(0.);
//if ( modI( (particleIdx(coord)), (PNUM) ) == p.idx )
col=vec4(p.pos,p.pos2);
return col;
}
vec4 getRand(vec2 pos, sampler2D s)//velocity
{
//vec2 rres=vec2(textureSize(s,0));
vec2 rres=vec2(512.,512.);
//return textureLod(s,pos/rres,0.);
return texture2D(s,pos/rres);
}
vec4 getRand(int idx, sampler2D s)//position
{
// ivec2 rres=textureSize(s,0);
ivec2 rres=ivec2(512,512);
idx=int(modI((idx) , (rres.x*rres.y) ) );
return texelFetch(s,rres,ivec2(int(modI((idx),(rres.x))),int(idx/rres.x)));
//return texelFetch(s,textureSize(s,0),ivec2(coord));
}
void main(){
vec2 uvy = gl_FragCoord.xy/resolution.xy;
vec2 uv = gl_FragCoord.xy ;
float velocity=0.01;
//int idx = particleIdx(uv,iChannelB);
//p=readParticle(p,uv,resolution,iChannelB);
//vec3 test=vec3(0.);
vec4 CC = texture2D(iChannelC, uvy*1.).xyzw;
float Tlife=CC.x;
vec4 pos2x = texture2D(iChannelB,uvy);
vec2 origin=vec2(120./255.,70./255.);
if (iFrame < 2) pos2x=texture2D(iChannelB,origin);//vec4(pos2x.z*0.8+1./255.,pos2x.w*0.8+1./255.,pos2x.z*0.+1./255.,pos2x.w*0.+1./255.);
//vec4 vicini = texture2D(iChannelVICINI, uvy );
//vec4 vicini_B = texture2D(iChannelVICINI_B, uvy );
//float vx=1.*CC.w;
//float vx2=0.2*CC.w;
float nofp=0.5;
float va=rand(uv*pos2x.xy*0.8+7.13*float(iFrame));
float va2=rand(uv*pos2x.xy*0.2+3.13*float(iFrame));
vec2 zz= step(vec2(1.,1.)*nofp,vec2(va,va2) );
float vx=1.*rand(uv*zz+256.*va*CC.w);
float vx2=0.2*rand(uv*zz+133.*va2*CC.w);
//float vx2=1.*rand(zz+133.*CC.w);
if(Tlife>=1.) {
Particle p;
vec4 vicini = texture2D(iChannelVICINI, vec2( pos2x.x , pos2x.y ) );
vec4 vicini_B = texture2D(iChannelVICINI_B, vec2( pos2x.x , pos2x.y ) );
vec4 vicini_C = texture2D(iChannelVICINI_C, vec2( pos2x.x , pos2x.y ) );
vec4 vicini_D = texture2D(iChannelVICINI_D, vec2( pos2x.x , pos2x.y ) );
vec2 INDnb=pos2x.xy;
int numofneig=0;
int where=0;
float v1=rand(uv*0.8*7.13*float(iFrame));
float v2=rand(uv*0.7*0.2*float(iFrame));
float v3=rand(uv*0.6*0.3*float(iFrame));
float v4=rand(uv*0.5*0.4*float(iFrame));
float v5=rand(uv*0.4*0.5*float(iFrame));
float v6=rand(uv*0.3*0.6*float(iFrame));
float v7=rand(uv*0.2*0.7*float(iFrame));
float v8=rand(uv*0.1*0.8*float(iFrame));
vec4 dir0 = texture2D(iChannelBRAIN, vec2(vx,vx2));
vec4 dirX = texture2D(iChannelBRAIN, uvy);
vec4 dirA = texture2D(iChannelBRAIN, vicini.xy/255. );
vec4 dirA2 = texture2D(iChannelBRAIN, vicini.zw/255.);
vec4 dirB = texture2D(iChannelBRAIN, vicini_B.xy/255. );
vec4 dirB2 = texture2D(iChannelBRAIN, vicini_B.zw/255. );
vec4 dirC = texture2D(iChannelBRAIN, vicini_C.xy/255. );
vec4 dirC2 = texture2D(iChannelBRAIN, vicini_C.zw/255. );
vec4 dirD = texture2D(iChannelBRAIN, vicini_D.xy/255.);
vec4 dirD2 = texture2D(iChannelBRAIN, vicini_D.zw/255. );
if(CC.z > 0.15 )
dir0=dirX;
//if(CC.z > 0.40 && CC.z < 0.90)
if(false)
dir0.z=dir0.z-300.;
float rfact=0.6;
if(true){
//if(CC.z > 0.15 && CC.z < 0.40 ){
rfact=0.3;
float la= ((1.-rfact)+rfact*rand(dirA.xy+0.43*float(iFrame)) )*length(dirA-dir0);
float la2= ((1.-rfact)+rfact*rand(uv*dirA2.xy+0.43*float(iFrame)) )*length(dirA2-dir0);
float lb=((1.-rfact)+rfact*rand(dirB.xy+0.43*float(iFrame)) )* length(dirB-dir0);
float lb2=((1.-rfact)+rfact*rand(uv*dirB2.xy+0.43*float(iFrame)) )* length(dirB2-dir0);
float lc=((1.-rfact)+rfact*rand(dirC.xy+0.43*float(iFrame)) )* length(dirC-dir0);
float lc2=((1.-rfact)+rfact*rand(uv*dirC2.xy+0.43*float(iFrame)) )* length(dirC2-dir0);
float ld=((1.-rfact)+rfact*rand(dirD.xy+0.43*float(iFrame)) )* length(dirD-dir0);
float ld2=((1.-rfact)+rfact*rand(dirD2.xy+0.43*float(iFrame)) )* length(dirD2-dir0);
//if(CC.z > 0.20 && CC.z < 0.40) {
if(false) {
la= ((1.-rfact)+rfact*rand(dirA.xy+0.43*float(iFrame)) )*length(dirA-vec4(dirA.xyz/10.,1.));
la2= ((1.-rfact)+rfact*rand(uv*dirA2.xy+0.43*float(iFrame)) )*length(dirA2-vec4(dirA2.xyz/10.,1.));
lb=((1.-rfact)+rfact*rand(dirB.xy+0.43*float(iFrame)) )* length(dirB-vec4(dirB.xyz/10.,1.));
lb2=((1.-rfact)+rfact*rand(uv*dirB2.xy+0.43*float(iFrame)) )* length(dirB2-vec4(dirB2.xyz/10.,1.));
lc=((1.-rfact)+rfact*rand(dirC.xy+0.43*float(iFrame)) )* length(dirC-vec4(dirC.xyz/10.,1.));
lc2=((1.-rfact)+rfact*rand(uv*dirC2.xy+0.43*float(iFrame)) )* length(dirC2-vec4(dirC2.xyz/10.,1.));
ld=((1.-rfact)+rfact*rand(dirD.xy+0.43*float(iFrame)) )* length(dirD-vec4(dirD.xyz/10.,1.));
ld2=((1.-rfact)+rfact*rand(dirD2.xy+0.43*float(iFrame)) )* length(dirD2-vec4(dirD2.xyz/10.,1.));
}
float mx = max( max( max(la,la2),max(lb,lb2) ), max( max(lc,lc2),max(ld,ld2) ) );
float minx = min( min( min(la,la2),min(lb,lb2) ), min( min(lc,lc2),min(ld,ld2) ) );
//if(CC.z > 0.15)
if(false)
mx=minx;
if( (mx-la) < 0.01 ){
INDnb=(vicini.xy/255.);
}else if( (mx-la2) < 0.01 ){
INDnb=(vicini.zw/255.);
}else if( (mx-lb) < 0.01 ){
INDnb=(vicini_B.xy/255.);
}else if( (mx-lb2) < 0.01 ){
INDnb=(vicini_B.zw/255.);
}else if( (mx-lc) < 0.01 ){
INDnb=(vicini_C.xy/255.);
}else if( (mx-lc2) < 0.01 ){
INDnb=(vicini_C.zw/255.);
}else if( (mx-ld) < 0.01 ){
INDnb=(vicini_D.xy/255.);
}else if( (mx-ld2) < 0.01 ){
INDnb=(vicini_D.zw/255.);
}
}
// 0 + 10 + 15 + 20 + 40 + 50
//COMPLX + DIVERGE + EXTERNAL + LINE + CONVERGE + DIVERGE
//if(CC.z < 0.1 || ((CC.z > 0.15 && CC.z < 0.40 ) && v1 < 0.5) || ((CC.z > 0.40 && CC.z < 0.90 ) && v1 < 0.5) ){
if(false){
if( (length(vicini.xy-pos2x.zw*255.)> 1.)
&& (length(vicini.xy-pos2x.xy*255.)> 1. )
&& v1 < 0.2
){
numofneig=numofneig+1;
where+=1;
INDnb=(vicini.xy/255.);
}
if( (length(vicini.zw-pos2x.zw*255.)> 1.)
&& (length(vicini.zw-pos2x.xy*255.)> 1.)
&& v2 < 0.3
){
numofneig=numofneig+1;
where+=2;
INDnb=(vicini.zw/255.);
}
if( (length(vicini_B.xy-pos2x.zw*255.) > 1.)
&& (length(vicini_B.xy-pos2x.xy*255.) > 1.)
&& v3 < 0.4
){
numofneig=numofneig+1;
where+=5;
INDnb=(vicini_B.xy/255.);
}
if( (length(vicini_B.zw-pos2x.zw*255.) > 1.)
&& (length(vicini_B.zw-pos2x.xy*255.) > 1.)
&& v4 < 0.5
){
numofneig=numofneig+1;
where+=10;
INDnb=(vicini_B.zw/255.);
}
if( (length(vicini_C.xy-pos2x.zw*255.)> 1.)
&& (length(vicini_C.xy-pos2x.xy*255.)> 1.)
&& v5 < 0.5
){
numofneig=numofneig+1;
where+=20;
INDnb=(vicini_C.xy/255.);
}
if( (length(vicini_C.zw-pos2x.zw*255.)> 1.01)
&& (length(vicini_C.zw-pos2x.xy*255.)> 1.01)
&& v6 < 0.5
){
numofneig=numofneig+1;
where+=50;
INDnb=(vicini_C.zw/255.);
}
if( (length(vicini_D.xy-pos2x.zw*255.)> 1.01)
&& (length(vicini_D.xy-pos2x.xy*255.)> 1.01)
&& v7 < 0.6
){
numofneig=numofneig+1;
where+=100;
INDnb=(vicini_D.xy/255.);
}
if( (length(vicini_D.zw-pos2x.zw*255.)>1.01)
&& (length(vicini_D.zw-pos2x.xy*255.)>1.01)
&& v8 < 0.6
){
numofneig=numofneig+1;
where+=200;
INDnb=(vicini_D.zw/255.);
}
}
if(CC.z<=0.001){
INDnb=vec2(vx,vx2);
}
p.pos=pos2x.xy;
p.pos2=INDnb;
gl_FragColor=vec4( p.pos2.x , p.pos2.y , p.pos.x , p.pos.y);
}else{
if(CC.z<=0.001){
pos2x.xy=vec2(vx,vx2);
}
//gl_FragColor=vec4( pos2x.x , pos2x.y , float(ind_prev)/7. , pos2x.w);
gl_FragColor=pos2x;
}
//gl_FragColor=vec4(uvy.x,uvy.y,0.,1.);
//gl_FragColor=vec4(vicini.x/255.,vicini.y/255.,0.,1.);
//vec3 zzz = texture2D(iChannelBRAIN, uvy*1.).xyz;
//gl_FragColor=writeParticle(p,uvy);
//gl_FragColor = vec4(zzz,1.);
}
uniform int iFrame;
//uniform sampler2D iChannelB;
//uniform sampler2D iChannelC;
//uniform sampler2D iChannel1;
uniform sampler2D iChannel2;
uniform sampler2D iChannelBRAIN;
const int PNUM = 200;
const float sizeGlob = 256.;
#define N(v) (v.yx*vec2(1,-1))
float rand(vec2 co){
return fract(sin(dot(co.xy, vec2(12.8273, 67.245))) * 53726.17623);
}
vec4 getRand(vec2 pos, sampler2D s)//velocity
{
//vec2 rres=vec2(textureSize(s,0));
vec2 rres=vec2(512.,512.);
//return textureLod(s,pos/rres,0.);
return texture2D(s,pos/rres);
}
void main(){
vec2 uvy = gl_FragCoord.xy / resolution.xy;
vec2 uv = gl_FragCoord.xy ;
vec4 col = texture2D(iChannelC, uvy*1.).xyzw;
float vx=col.w;
if (iFrame < 2) {
col.y =7.*(0.01);
vx=0.01;
}
col.z=col.z+0.6/254.;
if(col.z>0.999){
col.z=0.;
}
if (col.z < 0.0001 ) {
vx=col.w+0.01;
if(vx>=1.) vx=0.;
}
if(col.x>=1.){
vec2 colB = texture2D(iChannelB, uvy*1.).xy;
col.x=0.;
float v=rand(colB+7.13*float(iFrame));
col.y = 3.*(0.01+0.007*v);
}
col.x=col.x+col.y;
gl_FragColor= vec4( col.xyz, vx );
}
uniform int iFrame;
uniform sampler2D iChannelB;
uniform sampler2D iChannelC;
//uniform sampler2D iChannel1;
uniform sampler2D iChannel2;
uniform sampler2D iChannelBRAIN;
uniform vec2 resolution;
varying vec2 vUv;
const int PNUM = 200;
const float sizeGlob = 256.;
#define N(v) (v.yx*vec2(1,-1))
float rand(vec2 co){
return fract(sin(dot(co.xy, vec2(12.8273, 67.245))) * 53726.17623);
}
vec4 getRand(vec2 pos, sampler2D s)//velocity
{
//vec2 rres=vec2(textureSize(s,0));
vec2 rres=vec2(512.,512.);
//return textureLod(s,pos/rres,0.);
return texture2D(s,pos/rres);
}
void main(){
vec2 uvy = gl_FragCoord.xy/resolution.xy;
vec2 uv = gl_FragCoord.xy ;
vec4 col = texture2D(iChannelC, uvy*1.).xyzw;
float vx=col.w;
if (iFrame < 2) {
col.y =7.*(0.01);
vx=0.01;
}
col.z=col.z+4./254.;
if(col.z>0.999){
col.z=0.;
}
if (col.z < 0.0001 ) {
vx=col.w+0.01;
if(vx>=1.) vx=0.;
}
if(col.x>=1.){
vec2 colB = texture2D(iChannelB, uvy*1.).xy;
col.x=0.;
float v=rand(uvy*colB*7.13*float(iFrame));
col.y = 3.*(0.01+0.04*v);
}
col.x=col.x+col.y;
gl_FragColor= vec4( col.xyz, vx );
}
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1);
}
const float sizeGlob = 256.;
varying vec2 uvx;
uniform sampler2D map;
uniform sampler2D iChannelA;
uniform sampler2D iChannelC;
uniform sampler2D iChannelBRAIN;
uniform float opacity;
//uniform sampler2D iChannel1;
uniform float flatu;
uniform int mode;
ivec2 textureSize(sampler2D s,int lod){
return ivec2(256,256);
}
void main() {
vec2 uv = gl_FragCoord.xy /256.;
vec3 color = texture2D(iChannelA, uvx).xyz;
vec3 colorC = texture2D(iChannelA, uvx).xyz;
//vec4 test = vec4(1.,0.2+colorC.z,0.+colorC.z,0.065);
vec4 test = vec4(0.96,0.0,0.505,0.065);
// vec4 test = vec4(0.96*0.3,0.0,0.505*0.3,0.95);
if(mode==0)
test = vec4(0.96,0.0,0.505,0.65);
vec4 pngimg=texture2D( map, gl_PointCoord );
if(pngimg.z > 0.5){
gl_FragColor=test;
gl_FragColor = gl_FragColor * pngimg*flatu;;
}
}
uniform sampler2D iChannelA;
uniform sampler2D iChannelC;
attribute vec2 uvu;
uniform sampler2D iChannelBRAIN;
//uniform sampler2D iChannel1;
varying vec2 uvx;
const float sizeGlob = 256.;
uniform float size;
uniform int mode;
uniform int isfloat;
uniform float flatu;
void main() {
uvx=0.5*position.xy-10.;
//vec3 position = texture2D(iChannelA, uvu).xyz*0.4-0.2;
vec3 position = texture2D(iChannelA, uvu).xyz*0.4-0.2;
float xc=1.;
if(isfloat==0){
position = texture2D(iChannelA, uvu).xyz*0.4-0.2;
}else{
if(mode==1){
position = texture2D(iChannelA, uvu).xyz*39.3*0.4-0.2*39.3;
}else{
xc=1.;
position = texture2D(iChannelA, uvu).xyz*199.3*0.4-0.2*199.3;
}
}
// float scalaz;
vec4 mvPosition = modelViewMatrix * vec4(position.x,position.y,position.z,1.);
// if(-mvPosition.z>2.*fade){
if(length(position)>0.01){
gl_PointSize = xc*size/ length( mvPosition.xyz) ;
gl_Position = projectionMatrix * mvPosition;
}
}
const float sizeGlob = 256.;
uniform float flatu;
uniform float size;
uniform int isfloat;
varying vec2 uvx;
uniform sampler2D map;
uniform sampler2D iChannelA;
uniform sampler2D iChannelC;
uniform sampler2D iChannelBRAIN;
uniform float opacity;
//uniform sampler2D iChannel1;
uniform int mode;
ivec2 textureSize(sampler2D s,int lod){
return ivec2(256,256);
}
void main() {
vec2 uv = gl_FragCoord.xy /256.;
vec3 color = texture2D(iChannelA, uvx).xyz;
vec3 color2 = texture2D(iChannelC, uvx).xyz;
vec4 test = vec4(0.96,0.0,0.505,0.02);
if(mode==1)
test = vec4(1.,0.2,0.,0.04);
vec4 pngimg=texture2D( map, gl_PointCoord );
if(pngimg.w > 0.){
gl_FragColor=test;
gl_FragColor = gl_FragColor * pngimg*flatu;;
}
}
uniform sampler2D iChannelA;
uniform sampler2D iChannelC;
attribute vec2 uvu;
uniform sampler2D iChannelBRAIN;
//uniform sampler2D iChannel1;
varying vec2 uvx;
const float sizeGlob = 256.;
uniform float size;
uniform int mode;
uniform int isfloat;
uniform float flatu;
void main() {
uvx=0.5*position.xy-10.;
vec3 position = texture2D(iChannelA, uvu).xyz*0.4-0.2;
float xc=250.;
if(isfloat==0){
position = texture2D(iChannelA, uvu).xyz*0.4-0.2;
if(mode==1)
xc=5.;
}else{
xc=10.;
if(mode==1){
position = texture2D(iChannelA, uvu).xyz*39.3*0.4-0.2*39.3;
}else{
xc=1.;
position = texture2D(iChannelA, uvu).xyz*199.3*0.4-0.2*199.3;
}
}
float scalaz;
vec3 color2 = texture2D(iChannelC, uvx).xyz;
vec4 mvPosition = modelViewMatrix * vec4(position.x,position.y,position.z,1.);
if(length(uvu) < 0.06 ){
gl_PointSize = xc*size/ length( mvPosition.xyz) ;
gl_Position = projectionMatrix * mvPosition;
}
}
uniform sampler2D iChannelA;
uniform sampler2D iChannelC;
attribute vec2 uvu;
uniform sampler2D iChannelBRAIN;
//uniform sampler2D iChannel1;
varying vec2 uvx;
const float sizeGlob = 256.;
uniform float size;
uniform int mode;
uniform int isfloat;
uniform float flatu;
void main() {
uvx=0.5*position.xy-10.;
vec3 position = texture2D(iChannelA, uvu).xyz*0.4-0.2;
float xc=250.;
if(isfloat==0){
position = texture2D(iChannelA, uvu).xyz*0.4-0.2;
if(mode==1)
xc=5.;
}else{
xc=10.;
if(mode==1){
position = texture2D(iChannelA, uvu).xyz*39.3*0.4-0.2*39.3;
}else{
xc=1.;
position = texture2D(iChannelA, uvu).xyz*199.3*0.4-0.2*199.3;
}
}
float scalaz;
vec3 color2 = texture2D(iChannelC, uvx).xyz;
vec4 mvPosition = modelViewMatrix * vec4(position.x,position.y,position.z,1.);
if(length(uvu) < 0.01 ){
gl_PointSize = xc*size/ length( mvPosition.xyz) ;
gl_Position = projectionMatrix * mvPosition;
}
}
const float sizeGlob = 256.;
uniform float flatu;
uniform float time;
varying vec2 uvx;
uniform sampler2D map;
uniform int resolutionx;
uniform int resolutiony;
uniform float ratio;
void main() {
vec2 uv = gl_FragCoord.xy /256.;
vec4 test = vec4(1.0,1.0,1.,0.9);
vec4 test2 = vec4(0.96,0.0,0.505,0.7);
// vec4 test = texture2D(iChannelA, uv.xy);
vec4 pngimg=texture2D( map, gl_PointCoord );
if(pngimg.w > 0.2){
gl_FragColor=test;
if(length(uvx-3.5*(time/100.)) > 2.8){
gl_FragColor=test2;
}
gl_FragColor = gl_FragColor * pngimg * flatu;
}
}
attribute vec2 reference;
attribute vec2 uvu;
uniform int mode;
uniform float time;
uniform float fade;
uniform float flatu;
varying vec2 uvx;
const float sizeGlob = 256.;
void main() {
uvx=position.xy/100.;
float scalaz;
vec3 pos=position;
// if(mode==1){
pos=position*(1.+0.1*time/100.);
// }
vec4 mvPosition = modelViewMatrix * vec4(2.*pos,1.);
// if(-mvPosition.z>2.*fade){
gl_PointSize = 30./ length( mvPosition.xyz) ;
gl_Position = projectionMatrix * mvPosition;
// }
}
const float sizeGlob = 256.;
uniform float flatu;
varying vec2 uvx;
uniform sampler2D map;
uniform sampler2D iChannelA;
uniform sampler2D iChannelBRAIN;
//uniform sampler2D iChannel1;
uniform int resolutionx;
uniform int resolutiony;
uniform float ratio;
void main() {
vec2 uv = gl_FragCoord.xy /256.;
vec4 test = vec4(0.28,0.28,0.85,0.3);
// vec4 test = texture2D(iChannelA, uv.xy);
vec4 pngimg=texture2D( map, gl_PointCoord );
if(pngimg.z > 0.5){
gl_FragColor=test;
gl_FragColor = 0.5*gl_FragColor * pngimg * flatu;
}
}
attribute vec2 reference;
attribute vec2 uvu;
uniform sampler2D iChannelBRAIN;
//uniform sampler2D iChannel1;
uniform int mode;
uniform float fade;
uniform float size ;
uniform int isfloat;
uniform float flatu;
varying vec2 uvx;
const float sizeGlob = 256.;
void main() {
uvx=0.5*position.xy-10.;
vec3 position;
float xc=70.;
if(isfloat==0){
position = texture2D(iChannelBRAIN, uvu).xyz*0.4-0.2;
}else{
if(mode==1){
xc=70.;
position = texture2D(iChannelBRAIN, uvu).xyz*39.3*0.4-0.2*39.3;
}else{
xc=10.;
position = texture2D(iChannelBRAIN, uvu).xyz*199.3*0.4-0.2*199.3;
}
}
//
//
float scalaz;
//float p=length(0.5-position);
// vec4 mvPosition = modelViewMatrix * vec4(position.x+(1.-flatu)*p,position.y+(1.-flatu)*p,position.z+(1.-flatu)*p,1.);
vec4 mvPosition = modelViewMatrix * vec4(position.x,position.y,position.z,1.);
// if(-mvPosition.z>2.*fade){
gl_PointSize =size* xc/ length( mvPosition.xyz) ;
gl_Position = projectionMatrix * mvPosition;
// }
}
varying vec3 vUv;
uniform sampler2D noise;
uniform float flatu;
void main() {
vec4 pngimg=texture2D( noise,vUv.xy );
float grad=1./(1.+8.*vUv.z);
vec4 test = flatu*vec4(pngimg.x*grad*0.18,pngimg.x*grad*0.18,pngimg.x*grad*0.55,grad);
//vec4 test = vec4(0.28,0.28,0.85,1.);
gl_FragColor=test;
}
varying vec3 vUv;
void main() {
vec3 pos=vec3(position.x,position.y,(0.3*(length(position.y-0.5)*length(position.y-0.5))+0.3*(length(position.x-0.5)*length(position.x-0.5))));
vUv = pos;
gl_Position = projectionMatrix * modelViewMatrix * vec4(pos,1);
}