L15 POV-Ray - Part 1

Similar documents
Ray Tracer Due date: April 27, 2011

A Quick Introduction to POV-Ray

L16 Povray - Part 2. Our previous examples showed us how to make objects solid colors. To remind us, let s draw a sphere and make it red:

L18 POV-Ray - Part 4

Topics and things to know about them:

COS 116 The Computational Universe Laboratory 10: Computer Graphics

More on POV-Ray Surface Shading Surface color

Assignment 6: Ray Tracing

CPSC / Texture Mapping

COS 116 The Computational Universe Laboratory 10: Computer Graphics

Beyond Gnuplot: An introduction to POV-Ray

Assignment 2 Ray Tracing

diffuse diffuse reflection refraction diffuse mapping diffuse reflection reflection filter mapping mapping reflection

Caustics - Mental Ray

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007

A Short Introduction to POV-Ray

Ray Tracer I: Ray Casting Due date: 12:00pm December 3, 2001

lecture 18 - ray tracing - environment mapping - refraction

Autodesk Fusion 360: Render. Overview

Textures and normals in ray tracing

CMSC427 Final Practice v2 Fall 2017

Introduction to 3D Concepts

CS 4620 Midterm, March 21, 2017

4) Finish the spline here. To complete the spline, double click the last point or select the spline tool again.

Lecture Outlines Chapter 26

The feature set you are required to implement in your ray tracer is as follows (by order from easy to hard):

Homework #2. Shading, Ray Tracing, and Texture Mapping

COMP environment mapping Mar. 12, r = 2n(n v) v

Texture Mapping. Images from 3D Creative Magazine

Chapter 4- Blender Render Engines

Practical 2: Ray Tracing

Chapter 10. Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

critical theory Computer Science

Interactive Real-Time Raycasting

POVRAY: a tool for scientific visualisation Paul Bourke WASP, UWA

Lighting. To do. Course Outline. This Lecture. Continue to work on ray programming assignment Start thinking about final project

SIMPLE PHOTOREALISM USING PERSISTENCE OF VISION

RAYTRACING. Christopher Peters INTRODUCTION TO COMPUTER GRAPHICS AND INTERACTION. HPCViz, KTH Royal Institute of Technology, Sweden

Computer Graphics. Illumination Models and Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

Raytracing CS148 AS3. Due :59pm PDT

Photorealism: Ray Tracing

Simple Photorealism using Persistence of Vision. A tutorial on making 3-D images for people who can t draw to save their life.

Chapter 9- Ray-Tracing

Ray-Tracing. Misha Kazhdan

Graphics for VEs. Ruth Aylett

2. Drag and drop the cloud image onto your desktop to be used later in the tutorial.

COMP 175 COMPUTER GRAPHICS. Lecture 11: Recursive Ray Tracer. COMP 175: Computer Graphics April 9, Erik Anderson 11 Recursive Ray Tracer

Ray Tracing. CSCI 420 Computer Graphics Lecture 15. Ray Casting Shadow Rays Reflection and Transmission [Ch ]

Rendering Engines - Specific tools may depend on "Rendering Engine"

Consider a partially transparent object that is illuminated with two lights, one visible from each side of the object. Start with a ray from the eye

A more realistic model of heart structure

Draw Guide. Chapter 7 Working with 3D Objects

Shading, Advanced Rendering. Week 7, Wed Feb 28

MITOCW MIT6_172_F10_lec18_300k-mp4

03 RENDERING PART TWO

So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources.

Homework #2. Shading, Projections, Texture Mapping, Ray Tracing, and Bezier Curves

CS451Real-time Rendering Pipeline

COMPUTER GRAPHICS AND INTERACTION

Programming projects. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer

Chapter 5- Materials & Textures

CS 184: Assignment 4 Simple Raytracer

Turn your movie file into the homework folder on the server called Lights, Camera, Action.

CS 325 Computer Graphics

Chapter 4- Materials and Textures

The University of Calgary

Chapter 17: The Truth about Normals

Texture. Texture Mapping. Texture Mapping. CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Ray Tracing. Kjetil Babington

1 of 8 11/25/ :42 PM

When light strikes an object there are different ways it can be affected. Light can be

UDK Basics Textures and Material Setup

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Chapter 26 Geometrical Optics

Fog and Cloud Effects. Karl Smeltzer Alice Cao John Comstock

Lesson 03: We will add water and will set the placing conditions for the material. WorldBuilder 3.5. for. About Digital Element Tutorials:

1.54 Law of Reflection

Complex Features on a Surface. CITS4241 Visualisation Lectures 22 & 23. Texture mapping techniques. Texture mapping techniques

Raytracing. COSC 4328/5327 Scott A. King

Ray tracing. Methods of Programming DV2. Introduction to ray tracing and XML. Forward ray tracing. The image plane. Backward ray tracing

Glass Gambit: Chess set and shader presets for DAZ Studio

Movie: For The Birds. Announcements. Ray Tracing 1. Programming 2 Recap. Programming 3 Info Test data for part 1 (Lines) is available

COMP371 COMPUTER GRAPHICS

Lecture Outline Chapter 26. Physics, 4 th Edition James S. Walker. Copyright 2010 Pearson Education, Inc.

Introduction Ray tracing basics Advanced topics (shading) Advanced topics (geometry) Graphics 2010/2011, 4th quarter. Lecture 11: Ray tracing

Computer Graphics. Lecture 14 Bump-mapping, Global Illumination (1)

Computer Graphics. Lecture 9 Environment mapping, Mirroring

Section 2 Flat Mirrors. Distinguish between specular and diffuse reflection of light. Apply the law of reflection for flat mirrors.

move object resize object create a sphere create light source camera left view camera view animation tracks

Lecture 8 Ray tracing Part 1: Basic concept Yong-Jin Liu.

An Introduction to Maya. Maya. Used in industrial design, CAD, computer games and motion picture effects. The ambition is what get

Computer Graphics. Lecture 13. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura

Graphics Hardware and Display Devices

CS5620 Intro to Computer Graphics

Lecture 18: Primer on Ray Tracing Techniques

Ray Tracing. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows

Working with the BCC Bump Map Generator

Transcription:

Geophysical Computing L15-1 L15 POV-Ray - Part 1 1. What is POV-Ray? POV-Ray stands for the Persistance of Vision Raytracer. POV-Ray belongs to a class of programs called ray tracers. For you seismologists this concept should be quite familiar. This has nothing to do with ray tracing seismic ray paths, but is essentially the same thing. Here we are creating an image by ray tracing light paths from an object to an observer or camera. You can generate some really incredible images using this tool. The cover art for Peter Shearer s new seismology text was designed using POV-Ray by Gunnar Jahnke (of LMU, Munich). For some really nice examples of what you can do check out the POV-Ray Hall of Fame: http://hof.povray.org In this class we will use POV-Ray on the Windows side of the computers. However, POV-Ray can be run on almost any system. The reason is that POV-Ray is a very basic program that doesn t include any graphics. It can produce images, but relies on other software available on any computer system to view these images. In this sense POV-Ray is similar to the Generic Mapping Tools (GMT). To create an image in POV-Ray we create a text file in the POV scene description language and then we render this image in POV-Ray. Just as in GMT we will be writing out our scenes in a text file which tells POV-Ray where the camera, lights, and objects are. 2. Getting Started To launch POV-Ray: Start > Programs > POV-Ray for Windows Now let s create a new text file to describe our scene: File > New File Here is a simple example you can type in: // This is a simple sphere // first, the camera position camera { location <0,8,-15> look_at <1,0,5> // now add some light light_source { <5,10,-15> color rgb <1,1,1>

Geophysical Computing L15-2 plane { // the floor y, 0 // along the x-z plane (y is the normal vector) texture { color <0,0,1> // checkered pattern normal { ripples 20 <1,3,-5>, 3 marble turbulence 1 color_map { [0.0 color <1,0,0>] [0.25 color <0,0,1>] [1.0 color <0,1,0>] scale 3 reflection 0.2 refraction 0.8 ior 1.5 phong 1 First we need to save the file: File > Save As Let s just save the file name as sphere.pov. And now we can render the image by hitting the Run button: The following image should be rendered. Note that POV-Ray will save the image as sphere.bmp in the same location as you saved the sphere.pov file.

Geophysical Computing L15-3 Note that we can change the size of the rendered image by going to Render > Edit Settings/Render and selecting a different size (e.g., 1024 768). Initialization files (.INI files) contain information such as the resolution of the rendered image. If you need a resolution that is not included in the QUICKRES.INI file you can change them by going to: Tools > Edit resolution INI file. 3. Camera Angle The example in the previous section shows a few key points about what is necessary in a POV- Ray file: (1) camera location, (2) lighting location, and (3) some objects to display (in this case a plane and a sphere). To understand where to place the camera we need to first understand the POV-Ray coordinate system. POV-Ray uses a simple Cartesian coordinate system that looks like this: The two easiest attributes to use of the camera object is as shown in the first example. Namely the location and look_at attributes. In our above example we used: camera { location <0,8,-15> look_at <1,0,5> Where the location just gives us the x-, y-, and z- coordinates of where the camera is located (x = 0, y = 8, z = -15), and we stated we wanted it to look at the position x = 1, y = 0, and z = 5. We could make a change and say we want to look directly at the origin by changing the look_at attribute: look_at <0,0,0> It s more fun now to change the location attribute. Try a few changes, for example: location <0,10,-50> location <0,5,-10>

Geophysical Computing L15-4 4. Lighting Adding lighting to our scene is very similar to that of how we describe the camera position. The simplest light source is just a point light source. light_source { <5,10,-15> color rgb <1,1,1> Here we first specify that we want the light placed at position x = 5, y = 10, and z = -15. We next state we want to use a white light. We use a RGB vector to describe the color of the light, but note that in GMT our RGB colors ranged from 0 to 255, in POV-Ray our colors range from 0 to 1. So, the vector <1,1,1> would be the same as 255/255/255 in GMT. In general it s best to use a white light source, but you are not restricted to it. To change our light source so that it is looking directly down on our object try a position: <0,15,0> You can also add additional light sources. E.g., just add another line group: light_source { <-20,0,0> color rgb <0.5,1,1> 5. Simple POV-Ray Objects Defining a camera position and light source are great, but they serve no purpose unless you have something to look at. The simplest thing one can do as a new comer to POV-Ray is learn how to manipulate some of the basic POV-Ray shapes. In general primitive POV-Ray objects are described as: Object_Name { Object_Parameters Some_Simple_Attribute Some_Complicated_Attribute { Some_Attribute 5.1 Sphere We already saw an example of a sphere above. The basic form of drawing a sphere is as follows: <center>, radius But, we should add some color to it with the pigment attribute. An example is:

Geophysical Computing L15-5 color rgb <0, 0, 1> To make sure we understand how these objects work let s create a simple pov-ray file that we can play with: // Make Some Simple Objects camera { location <0,10,-10> look_at <0,0,0> light_source { <5,10,-15> color rgb <1,1,1> // Simple Sphere color rgb <0, 0, 1> There are several classes of basic objects we can use in POV-Ray. The next table shows the basic syntax for some of the most important. Object Syntax Example Box box { <corner-1>, <corner-2> box { <0,0,0>, <3,3,3> Cone cone { <center-1>, radius-1 <center-2>, radius-2 cone { <0,4,0>, 0

Geophysical Computing L15-6 Object Syntax Example Cylinder cylinder { <center-1>, <center-2>, radius cylinder { <0,0,0>, <0,4,0>, 3 Disc disc { <center>, <normal>, radius [, hole radius] disc { <0,0,0>, <1,1,0>, 3, 2 Plane plane { <normal>, offset Sphere <center>, radius plane { <0,1,0>, 1 Just a plane surface! Torus torus { major radius, minor radius torus { 3, 0.5 Triangle triangle { <corner-1>, <corner-2>, <corner-3> triangle { <0,0,0>, <1,0,0>, <0.5,1,0>

Geophysical Computing L15-7 6. Finish An objects finish describes how the objects interact with light. For example, how much light they reflect. To play with the finish attribute let s look at our simple sphere example again. We can make our object shine a bit by having our light source hit the sphere and giving it the phong finish: camera { location <0,10,-10> look_at <0,0,0> light_source { <5,5,-15> color rgb <1,1,1> // create a checker board surface plane { <0,1,0>, -5 checker color <1,0,0> color <1,1,1> // Simple Sphere color rgb <0, 0, 1> phong 0.8 The next table describes the primary ways we can apply finish to our objects. Finish Description Example ambient How much of the lighting comes from ambient light (i.e., light that bounces off other objects). ambient 1.0 Range {0.0 to 1.0 0.0 means that objects that are not directly lit will be black. Higher values will make an object appear to glow.

Geophysical Computing L15-8 brilliance crand How much of the lighting from direct light sources will bounce off of the object. Range {0.0 to?? Large numbers can make an object more metallic looking. Numbers less than 1.0 make the object look softer. Used to make an object appear to have a rough surface. Range: {0.0 to 1.0 The larger the number the rougher the surface. brilliance 0.5 crand 0.5 diffuse Similar to the ambient keyword, but how much of the lighting will come from diffuse (direct) light sources. Range: {0.0 to 1.0 diffuse 1.0 phong Create a highlight on the object. Range: {0.0 to 1.0. The larger the number the brighter the highlight. phong 1.0 phong_size Describes size of phong highlight. Range: {1.0 to 250.0 The larger the number the smaller (tighter) the highlight phong 1.0 phong_size 1

Geophysical Computing L15-9 metallic Only works in conjuction with phong and specular finishes. Highlight on object takes on color associated with object and not just on the light color. phong 1.0 metallic reflection specular roughness Using reflection will give the surface a mirrored finish. Range: {0.0 to 1.0. A value of 0.0 turns reflection totally off. The larger the number the more reflective the surface is. This is similar to phong, in that it is used to create a highlight on the object. This is purportedly more realistic than phong. Range: {0.0 to 1.0. The larger the number the brighter the highlight. This controls the size of the highlight used in the specular command. Range: {0.0005 to 1.0 The smaller the number the smoother the object is. reflection 1.0 specular 1.0 specular 1.0 roughness 1.0 refraction Refraction only works if your objects are partly transparent. This can be changed in the pigment statement. For example: color rgbf <0,0,1,0.8> Will partially transparent objects light can now refract through them. refraction 1

Geophysical Computing L15-10 Refraction = 0 means to turn off refraction. Refraction = 1 means to turn on refraction. ior Stands for index of refraction. By default the ior = 1.0 which means no refraction (speed of light is the same inside and outside of the object). This allows us to change lights index of refraction for an object refraction 1 ior 1.5 Now that we know all about finish, just for fun try out the following: // Simple Sphere color rgbf <1, 1, 1, 0.8> reflection 0.1 refraction 1.0 ior 1.5 phong 0.8 For even more fun start adding in texture statements: // Simple Sphere texture { color rgbf <1, 1, 1, 0.8> normal { bumps 1/2 scale 1/6 reflection 0.1 refraction 1.0 ior 1.5 phong 0.8

Geophysical Computing L15-11 7. Image Overlays In our next lecture we will go over the different uses of the pigment command in detail. But, for now let s look at one of the most useful keywords: image_map. On the course web page the material for this lecture contains a file called: Earth Surface, Clouds & Ocean. Download this file into the directory where you are keeping your.pov files. Unzip these files and note that these are just.png images of the Earth. Now, see how simple it is to overlay this on a sphere in POV- Ray using the pigment command: // Earth Sphere image_map {png "./Earth/03_Earth_Land.png" map_type 1 interpolate 2 Of course, we don t necessarily need to restrict ourselves to a spherical Earth box { <-3,-3,-3>, <3,3,3> image_map {png "./Earth/03_Earth_Land.png" map_type 1 interpolate 2 The most important modifier is map_type: map_type = 0: This is a planar mapping. We will describe it more below. map_type = 1: This is the spherical mapping. The image is wrapped around the origin. map_type = 2: This is a cylindrical mapping. The image is wrapped around the y-axis. map_type = 5: This is a toroidal mapping. Fantastic if you ever find the need to wrap an image on a donut. For plotting maps onto spheres we will typically want to use the map_type 1 modifier. But it is often useful to paste planar images onto surface. For example the following image of a nebula is taken from the Hubble telescope:

Geophysical Computing L15-12 This image is of size 1024 831 pixels. It might make a really nice background image. So, let s create a plane surface in the x-y plane and image_map this onto it: plane { <0,0,1>, 50 image_map {png "./Hubble/04_Hubble.png" map_type 0 interpolate 2 What you get is the next image. It s not too useful. The problem is that the normal image map takes any image no matter what it s size and maps it onto the interval from 0-1 (for both axes). So, not only does the image turn out small it is also now stretched. It also repeats the image over and over. The key is to start scaling the image. Since the image wider than it is tall we can use different scales for the different axes. For example, camera { location <0,0,-40> look_at <20,18,-5> light_source { <5,5,-15> color rgb <1,1,1> plane { <0,0,1>, 50 image_map {png "./Hubble/04_Hubble.png" map_type 0 interpolate 2 once scale <123,100,0> Using the once key word will turn off wrapping the image. The image below shows that we can build up perspective views of our image maps for nice effects.

Geophysical Computing L15-13 8. Translation and Rotation If you play around with image mapping onto spherical objects POV-Ray only seems to behave well if you place the sphere at the plot origin. That isn t very useful if you want multiple objects. Luckily, we have the translate function. Translate basically just tells us by how much in the x-, y-, and z- directions to move our object by. E.g., for our example of the Earth we can move it over in the positive x-direction by: camera { location <0,0,-10> look_at <0,0,0> light_source { <5,5,-15> color rgb <1,1,1> image_map {png "./Earth/03_Earth_Land.png" map_type 1 interpolate 2 translate <5,0,0> Rotate is really useful for our image maps mapped to spheres. We could change our look_at parameter for our camera. But, it would be easier just to rotate the sphere. The rotate command looks like: rotate <x angle, y angle, z angle> Which tells us how many degrees to rotate our object around one of the principal axes. For example, change our earth plot to:

Geophysical Computing L15-14 image_map {png "./Earth/03_Earth_Land.png" map_type 1 interpolate 2 rotate <30,180,0> 9. Homework 1) On the course web page there is a large tar file called Solar System Objects. This file contains surface maps of many of the bodies in our solar system. This is my collection of image maps, and is not complete, but about as complete and as current as you will find anywhere I think. Use these images to do something creative in POV-Ray that utilizes at least 2 objects. Print out a copy of your image and bring to the next class. We will vote on the best image with the winner taking home a prize! Here is an example image I created in about 15 minutes. Now, good luck and have fun!