You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried that shader in shaderfrog here. Some thing looks wired about it. I also tried to use it in processing. here is what it looks like . black cube is the light position.
one thing that seems wrong is when cube goes behind the sphere the red blob does not go back. I think its because in code mvpMatrix of cam is passed to shader but I am not getting it how to access mvpMatrix of camera in processing. it must be that problem that is causing the anomaily. Hey robert please don't mind I am just trying to understand the shader. :) your work always amaze me and I love it just trying to understand how you create those visuals. I know its hard for you to explain the code but I would appreciate if some one might do that. Just learning shaders.
PShader lantern;
voidsetup() {
size(700 , 600, P3D);
noStroke();
fill(204);
lantern = loadShader("frag.glsl", "vert.glsl");
float z =(height/2.0) /tan(PI*30.0/180.0); //default camera pos for processing//println(z);
lantern.set("eyePos",width/2.0, height/2.0, z); //default camera pos for processing
lantern.set("roomDim",7000.0,7000.0,7000.0);
lantern.set("mainPower",05.99);
}
float t=0;float r=173;// ticker and radius of spherevoiddraw() {
float dirY =0;
float dirX = r*sin(t*2*PI);
float dirZ = r*cos(t*2*PI);
lantern.set("lightPos",-dirX,-dirY,dirZ,0); //setting light pos for the shader
shader(lantern);
background(0);
t+=0.01;
translate(width/2, height/2,0); //moiving to center of screen//fill(255);//directionalLight(20, 204, 204, -dirX, -dirY, dirZ); // setting directional ,not need for this shaderfor(int i=0;i<1;i++){ //for if you wanted to create multiple spheresfill(120,100,80);
pushMatrix();
translate(0, 0, 0); // translate multiple spheres to different positions : set the random values or some calculated locations(x= rad*sin(theta), y= rad*cos(theta))sphere(170); //main sphere with shader//box(900,900,0);popMatrix();
}
resetShader();
pushMatrix();
translate(-dirX, -dirY, dirZ);
fill(255,0,0);
box(10,10,10); //virtual light box , just to see where the light is.popMatrix();
}````
The text was updated successfully, but these errors were encountered:
I tried that shader in shaderfrog here. Some thing looks wired about it. I also tried to use it in processing. here is what it looks like .
black cube is the light position.
one thing that seems wrong is when cube goes behind the sphere the red blob does not go back. I think its because in code mvpMatrix of cam is passed to shader but I am not getting it how to access mvpMatrix of camera in processing. it must be that problem that is causing the anomaily.
Hey robert please don't mind I am just trying to understand the shader. :) your work always amaze me and I love it just trying to understand how you create those visuals. I know its hard for you to explain the code but I would appreciate if some one might do that. Just learning shaders.
The text was updated successfully, but these errors were encountered: