public SdfSmoothUnion(ISdfObject a, ISdfObject b, double blend, Color color) { A = a; B = b; Blend = blend; this.color = color; }
public SdfBlend(ISdfObject a, ISdfObject b, double blend) { A = a; B = b; Blend = blend; color = Color.White; }
public SdfSmoothUnion(ISdfObject a, ISdfObject b, double blend) { A = a; B = b; Blend = blend; color = a.ObjectColor; }
private Color PointToColorFakeShadows(Point3d hitPoint) { ISdfObject sdfObject = ClosestObject(hitPoint); Point3d normal = new Point3d( (hitPoint + new Point3d(0.001, 0, 0)).DistanceFromSdfObject(sdfObject) - (hitPoint - new Point3d(0.001, 0, 0)).DistanceFromSdfObject(sdfObject), (hitPoint + new Point3d(0, 0.001, 0)).DistanceFromSdfObject(sdfObject) - (hitPoint - new Point3d(0, 0.001, 0)).DistanceFromSdfObject(sdfObject), (hitPoint + new Point3d(0, 0, 0.001)).DistanceFromSdfObject(sdfObject) - (hitPoint - new Point3d(0, 0, 0.001)).DistanceFromSdfObject(sdfObject) ).VectorNormalize(); double NdotL = LambertNdotL(normal, GlobalLight); NdotL = NdotL > GlobalIllumination ? NdotL : GlobalIllumination; return(Color.FromArgb((int)(sdfObject.ObjectColor.R * NdotL), (int)(sdfObject.ObjectColor.G * NdotL), (int)(sdfObject.ObjectColor.B * NdotL))); }
private Color PointToColorRayShadows(Point3d hitPoint) { ISdfObject sdfObject = ClosestObject(hitPoint); Point3d normal = new Point3d( (hitPoint + new Point3d(0.001, 0, 0)).DistanceFromSdfObject(sdfObject) - (hitPoint - new Point3d(0.001, 0, 0)).DistanceFromSdfObject(sdfObject), (hitPoint + new Point3d(0, 0.001, 0)).DistanceFromSdfObject(sdfObject) - (hitPoint - new Point3d(0, 0.001, 0)).DistanceFromSdfObject(sdfObject), (hitPoint + new Point3d(0, 0, 0.001)).DistanceFromSdfObject(sdfObject) - (hitPoint - new Point3d(0, 0, 0.001)).DistanceFromSdfObject(sdfObject) ).VectorNormalize(); Point3d lightPoint = hitPoint + (GlobalLight) * renderDistance; (double distance, int steps, Point3d lightHitPoint) = RayMarch(lightPoint, hitPoint, renderDistance * 2); double light = (hitPoint - lightHitPoint).VectorLength(); light = (1 - Math.Min(light, 1.0)) / 1; light = light > GlobalIllumination ? light : GlobalIllumination; return(Color.FromArgb((int)(sdfObject.ObjectColor.R * light), (int)(sdfObject.ObjectColor.G * light), (int)(sdfObject.ObjectColor.B * light))); }
private ISdfObject ClosestObject(Point3d point) { if (objects.Count == 0) { return(null); } ISdfObject closest = objects[0]; double min = point.DistanceFromSdfObject(objects[0]); for (int i = 1; i < objects.Count; i++) { double dist = point.DistanceFromSdfObject(objects[i]); if (min > dist) { min = dist; closest = objects[i]; } } return(closest); }
public SdfRepetition(ISdfObject primitive, double repetitionDistance) { Primitive = primitive; RepetitionDistance = new Point3d(repetitionDistance, repetitionDistance, repetitionDistance); }
public SdfRotation(ISdfObject primitive, Point3d rotation) { Primitive = primitive; Rotation = rotation; }
public SdfOnion(ISdfObject primitive, double thickness) { Primitive = primitive; Thickness = thickness; }
public SdfUnion(ISdfObject a, ISdfObject b) { A = a; B = b; color = a.ObjectColor; }
public SdfSliceXZ(ISdfObject primitive) { Primitive = primitive; }
public SdfSmoothSubtraction(ISdfObject a, ISdfObject b, double blend) { A = a; B = b; Blend = blend; }
public SdfIntersection(ISdfObject a, ISdfObject b, Color color) { A = a; B = b; this.color = color; }
public SdfIntersection(ISdfObject a, ISdfObject b) { A = a; B = b; color = a.ObjectColor; }
public SdfRepetition(ISdfObject primitive, Point3d repetitionDistance) { Primitive = primitive; RepetitionDistance = repetitionDistance; }
public SdfTranslation(ISdfObject primitive, Point3d translation) { Primitive = primitive; Translation = translation; }
public double DistanceFromSdfObject(ISdfObject sdfObject) { return(sdfObject.DistanceFromPoint(this)); }
public SdfElongation(ISdfObject primitive, Point3d elongation) { Primitive = primitive; Elongation = elongation; }
public SdfUnion(ISdfObject a, ISdfObject b, Color color) { A = a; B = b; this.color = color; }
public SdfSubtraction(ISdfObject a, ISdfObject b) { A = a; B = b; }