Skip to content

Commit

Permalink
implicit surface
Browse files Browse the repository at this point in the history
  • Loading branch information
ssloy committed Jan 27, 2019
1 parent 2c9e70f commit ec1ed71
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
Binary file modified out.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions tinykaboom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ const float sphere_radius = 1.5;
const float noise_amplitude = 0.2;

float signed_distance(const Vec3f &p) {
Vec3f s = Vec3f(p).normalize(sphere_radius);
float displacement = sin(16*s.x)*sin(16*s.y)*sin(16*s.z)*noise_amplitude;
float displacement = sin(16*p.x)*sin(16*p.y)*sin(16*p.z)*noise_amplitude;
return p.norm() - (sphere_radius + displacement);
}

Expand Down

0 comments on commit ec1ed71

Please # to comment.