There are four new features highlighted above. The first is specular highlights. The second is reflections. The checker board pattern is the third, and the plane it is applied to is the fourth. The plane is not a proper plane; it's normal is always along the Y axis (except as noted below), making it good for creating a ground object to place objects on and around, but it isn't useful for much else. You'll also notice some aliasing around the checkerboard pattern. I believe this is caused by rounding errors, but I'll need to investigate to determine for sure. This image also uses ambient light, which was not present in the first few images that contained diffuse lighting. In addition, shadows appear to be functioning normally.
This next image was actually created before the above image, but highlights a few other features that were not used in the above image. This image is very high-res (2000x2000), so be sure to view the full size image.
Figure 2. It's a good thing solid black compresses well.
This image introduces two features not seen above. The blue-green and red sphere on the upper left and the blue and white sphere on the upper right use the concept of noise to create a cloud-like texture and a marble-like texture, respectively (although, admittedly in this picture, the texture I consider marble looks more like clouds due to the particular color scheme chosen).
Noise, for those who aren't familiar, is n-dimensional, interpolated semi-random data. What that means in English is that noise is used to create things like marble, that have a pattern that varies widely overall, but is not random as close inspection reveals that there is a continuousness to it. For more information, google "Perlin noise".
If you look closely at the blue marble texture, you'll see that the reflection coefficient varies with the color. It was also rendered with a low specular exponent, so the highlight is much larger than on the other objects.
The second feature introduced is bump-mapping, which is used on the red sphere. Bump-mapping is related to textures, but tweaks the way the ray tracer works internally to give the illusion of a non-smooth surface. This works by making small changes to the surface normal of the object, without the need to mathematically model the actual shape of the surface. In this example, sine and cosine are utilized to give a lumpy feel to the object. Notice around the edges of the sphere, however, that the silhouette of the sphere is still completely round. For small to medium alterations of the surface normal, the illusion stands pretty well.
Next steps? New features, such as refraction or oversampling, aren't planned to show up for a while. Priority is to clean up the code and get the performance up, add more primitives, and solve most of the little issues. My dirty little secret is that these images carefully hide known issues with the current code. Well, o.k., that's not my only secret...
Finally, I'll leave you with an image that contains all the new features, followed by a little more source code. Again, don't forget to view the full size image.
Noise, for those who aren't familiar, is n-dimensional, interpolated semi-random data. What that means in English is that noise is used to create things like marble, that have a pattern that varies widely overall, but is not random as close inspection reveals that there is a continuousness to it. For more information, google "Perlin noise".
If you look closely at the blue marble texture, you'll see that the reflection coefficient varies with the color. It was also rendered with a low specular exponent, so the highlight is much larger than on the other objects.
The second feature introduced is bump-mapping, which is used on the red sphere. Bump-mapping is related to textures, but tweaks the way the ray tracer works internally to give the illusion of a non-smooth surface. This works by making small changes to the surface normal of the object, without the need to mathematically model the actual shape of the surface. In this example, sine and cosine are utilized to give a lumpy feel to the object. Notice around the edges of the sphere, however, that the silhouette of the sphere is still completely round. For small to medium alterations of the surface normal, the illusion stands pretty well.
Next steps? New features, such as refraction or oversampling, aren't planned to show up for a while. Priority is to clean up the code and get the performance up, add more primitives, and solve most of the little issues. My dirty little secret is that these images carefully hide known issues with the current code. Well, o.k., that's not my only secret...
Finally, I'll leave you with an image that contains all the new features, followed by a little more source code. Again, don't forget to view the full size image.
# All code on blog is (c) 2007 Brandon Inman. Please contact
# me directly for licensing information. I am intending to
# make this OSS but I'm not there yet :)
class MarbleTexture
def initialize(args = {})
@material = Material.new
@material.specular = args[:specular] || 0.0
@material.refraction = args[:refraction] || 0.0
@stretch = args[:stretch] || 1000.0
end
def get_at(point)
i = Noise.noise(point[0] / @stretch , point[1] *2, point[2]*2)
@material.color = [i,i,1]
@material.reflection = i ** 2
return @material
end
end
No comments:
Post a Comment