Java Cool Dude
New member
Since I'm still a n00b when it comes to coding 3D stuff, I thought I might stop by here and ask for your honest opinion about my real time shadows program.
Here's a first snap
And here comes the second
Sorry for the lousy JPG quality*swears at paint*, but you get the idea.
I make the shadows by computing the x/z coordinates of a vertix corresponding to a y coordinate = 0f, such that x belongs to the line of slope (light.y -vertex.y)/(light.x-vertex.x) and a constant B = (light.y - xYslope*light.x);
same applies for z;
ver.x = tempx + loca.x;
ver.y = tempy + loca.y;
ver.z = tempz + loca.z;
xYslope = (light.y - ver.y)/(light.x - ver.x);
b = (light.y - xYslope*light.x);
zYslope = (light.y - ver.y)/(light.z - ver.z);
c = (light.y - zYslope*light.z);
xIntersect = -(b)/xYslope ;
zIntersect = -(c)/zYslope;
objectGeom.setColor(i,objColor);
objectGeom.setCoordinate(i, new Point3f(ver.x,ver.y,ver.z));
shadowGeom.setCoordinate(i, new Point3f(xIntersect, .005f ,zIntersect));
shadowGeom.setColor(i,new Color3f(.0f,.0f,.0f));
Here's a first snap
And here comes the second
Sorry for the lousy JPG quality*swears at paint*, but you get the idea.
I make the shadows by computing the x/z coordinates of a vertix corresponding to a y coordinate = 0f, such that x belongs to the line of slope (light.y -vertex.y)/(light.x-vertex.x) and a constant B = (light.y - xYslope*light.x);
same applies for z;
ver.x = tempx + loca.x;
ver.y = tempy + loca.y;
ver.z = tempz + loca.z;
xYslope = (light.y - ver.y)/(light.x - ver.x);
b = (light.y - xYslope*light.x);
zYslope = (light.y - ver.y)/(light.z - ver.z);
c = (light.y - zYslope*light.z);
xIntersect = -(b)/xYslope ;
zIntersect = -(c)/zYslope;
objectGeom.setColor(i,objColor);
objectGeom.setCoordinate(i, new Point3f(ver.x,ver.y,ver.z));
shadowGeom.setCoordinate(i, new Point3f(xIntersect, .005f ,zIntersect));
shadowGeom.setColor(i,new Color3f(.0f,.0f,.0f));