POVRay Tutorial 2' - PowerPoint PPT Presentation

1 / 48
About This Presentation
Title:

POVRay Tutorial 2'

Description:

... texture patterns e.g. granite, agate, marble etc.. Are available in POVRay ... The agate texture with the colour maps shown on the previous . color_map ... – PowerPoint PPT presentation

Number of Views:141
Avg rating:3.0/5.0
Slides: 49
Provided by: Joh6198
Category:
Tags: agate | povray | tutorial

less

Transcript and Presenter's Notes

Title: POVRay Tutorial 2'


1
POVRay Tutorial 2.
  • A brief re-cap Some new details on Textures,
    Bump-maps

2
Optional Libraries
  • A number of pre-defined high-level functions are
    provided in the optional libraries.
  • These are included as required using the include
    directive
  • e.g.
  • include colors.inc
  • include shapes.inc
  • include textures.inc

3
Vectors
  • Colours, Positions and Directions are represented
    using vectors e.g.
  • rgb lt1, 1, 1gt //Red, Green, Blue
  • rgbf lt0, 0, 1, 0.5gt //Red, Green, Blue,
    (transparency)
  • translate lt0, 1, 1gt //x, y, z (or left, up,
    forward)
  • colors.inc includes some named colors e.g.
    Blue, White, Red. If you want to use this in your
    model, insert the following at the start of the
    file
  • include colors.inc

4
Comments
  • Comments can be included in a similar way to java
    script e.g.
  • texture
  • pigment //this is a single line comment
  • color Blue
  • / this is a multi-line comment
  • Still a comment
  • Last line of comment /

5
Camera Positioning
  • The following is a simple set-up you can use for
    now
  • camera
  • Perspective
  • location lt0, 0, -10gt
  • lookAt lt0, 0, 0gt

6
Light Source
  • For any object to be rendered visible, we require
    at least one light source or emissive object
  • light_source
  • lt5, 5, 5gt // position
  • rgb lt1, 1, 1gt //colour

7
declare
  • If you re-use large definitions quite often you
    might want to assign a name to them e.g.

Then the code to draw 3 such spheres at different
positions is simply object
check_sphere translate -0.5
object check_sphere
translate -3.5
object check_sphere
translate 2.5
declare check_sphere sphere lt0,
0, 0gt, .5 pigment checker
rgbf lt1,0,0,.8gt rgbf lt1, 1, 1,.3gt
finish phong 1 phong_size
200 reflection .1
interior ior 2
normal bump_map gif
"bumpmap_2.gif" bump_size 3
translate lt-.5, -.5, 0gt rotate
90x scale 4
8
Simple Objects
  • provided in the shapes.inc library
  • sphere lt0, 0, 0gt, 2
  • Material properties and transformations can also
    be included within the object description e.g.
  • sphere
  • lt0, 0, 0gt, 2
  • pigment rgb lt1, 0, 0gt
  • rotate lt4, 0, 0gt

r
c
9
Simple Objects Planes
  • Infinite planes are defined by a normal direction
    and a distance from the origin e.g.
  • plane
  • lt1, 1, 0gt, 2
  • pigment Blue

n
d
10
Simple Objects Cuboids
  • Boxes are defined by a the positions of two
    opposite corners e.g.
  • box
  • lt-1,-1,-1gt, lt1, 1, 1gt
  • rotate 30lt0, 1, 0gt
  • pigment White

11
Cone and Cylinder
  • cone
  • lt0, 1, 0gt, 0.3 // Center and radius of one end
  • lt1, 2, 3gt, 1.0 // Center and radius of other end
  • cylinder
  • lt0, 1, 0gt, // Center of one end
  • lt1, 2, 3gt, // Center of other end
  • 0.5 // Radius
  • open // Remove end caps

12
Torus
  • torus
  • 2, //major radius
  • .2 //minor radius

For more shapes, see the helpfiles or shapes.inc
13
Object Properties
  • Object
  • Parameters (depends on object type)
  • pigment colour OR patter
  • finish material shininess etc.
  • normal bump map or normal map
  • interior refraction index, caustics
  • transformations

14
finish
  • The finish command specifies the objects
    material properties such as shininess/gloss
    (more on this next week)
  • texture
  • pigment
  • Red
  • finish
  • reflection 0.5
  • phong 1 phong_size 250

15
pigment
  • Objects material properties are defined in the
    texture command which can be inserted into the
    object declaration
  • The first part of the texture specifies the
    object colour
  • texture
  • pigment
  • rgb lt1, 0, 0gt
  • POVRay allows you to take a shortcut and leave
    out the texture part if you wish to just
    declare a simple pigment
  • At the very least you need to specify a pigment
    for each object you declare

16
Textures
sphere lt0, 0, 0gt 1.5 pigment
agate //the texture name color_map
0.00 color rgb lt0.75, 0, 0gt 0.33
color rgb lt0.75, 0.75, 0gt 0.50 color rgb
lt0, 0.75, 0gt 0.66 color rgb lt0, 0,
0.75gt 1.00 color rgb lt0.75, 0, 0gt
  • Some built in procedural texture patterns e.g.
    granite, agate, marble etc.. Are available in
    POVRay we just specify the texture by name. And
    then provide a colour map (or pallette) that the
    function uses to generate patterns.
  • For more types, see the POVRAY Online tutorial
  • http//library.thinkquest.org/3285/language/pigmen
    t.html

17
Colour_Map
  • The colours in the colour map are used by povray
    to generate the actual texture
  • Specify a list of colours (as many as you want)
  • Attach them somewhere between a position of 0.0
    and 1.0
  • The intermediate values are interpolated

0
1
18
color_map 0.0 color rgb lt.8, .7, .5gt
0.3 color rgb lt.21, .21, .21gt 0.5
color rgb lt.51, .51, .51gt 0.6 color rgb
lt.41, .2, .0gt 0.8 color rgb lt1, 1, 1gt
1.0 color rgb lt.8, .7, .5gt
color_map 0.0 color rgb lt0, 0, 1gt
0.5 color rgb lt1, 1, 1gt 1.0 color rgb
lt.8, .7, .5gt
color_map 0.00 color rgb lt1, 1,
1gt 1.00 color rgb lt0, 0, 0gt
  • The agate texture with the colour maps shown on
    the previous slide.

19
Built in patterns
  • agate
  • bozo
  • wood
  • marble
  • brick
  • checker
  • hexagon
  • radial
  • mandel

20
Agate
Random marble like patterns
  • pigment
  • agate
  • color_map
  • 0.0 rgb lt1, 0, 0gt
  • 0.5 rgb lt0, 1, 0gt
  • 1.0 rgb lt0, 0, 1gt

Default colour_Map
21
Bozo
  • pigment
  • //rgbf lt1, 1, 1, 0gt
  • bozo
  • color_map
  • 0.0 rgb lt1, 0, 0gt
  • 0.5 rgb lt0, 1, 0gt
  • 1.0 rgb lt0, 0, 1gt

A smooth, random noise function traditionally
used with turbulence to create clouds.
22
Aside Sky_sphere
  • POVray has a built in tool for a sphereical sky
    map.
  • sky_sphere
  • pigment
  • agate
  • turbulence .3
  • color_map
  • 0.0 rgb lt0, 0, 1gt
  • 1.0 rgb lt.7, .6, 1gt

23
sky_sphere pigment
bozo turbulence 1 color_map
0.0 rgb lt.0, .0, .91gt
0.9 rgb lt.81, .81, 1gt 1.0 rgb lt1, 1,
1gt
scale lt.3, .21, .21gt
Code, color map and screenshot of bozo used to
generate a sky texture
24
Sky sphere textures
  • For some pre-built sky pigments
  • include skies.inc
  • sky_sphere
  • pigment
  • P_Cloud1

P_Cloud1
P_Cloud2
P_Cloud3
P_Cloud4
25
Wood
  • pigment
  • wood
  • color_map
  • 0.0 rgb lt1, 0, 0gt
  • 0.5 rgb lt0, 1, 0gt
  • 1.0 rgb lt0, 0, 1gt

Concentric circles modeling growth rings in wood
26
pigment wood
color_map 0.0 rgb lt1, .81,
.5gt 1.0 rgb lt.7, .51, .30gt

27
pigment wood turbulence 1
color_map 0.0 rgb lt1, .81,
.5gt 1.0 rgb lt.7, .51, .30gt

28
pigment wood turbulence 1
color_map 0.0 rgb lt1, .81,
.5gt 1.0 rgb lt.7, .51, .30gt
scale lt2, .2, .2gt

29
Marble
  • pigment
  • marble
  • color_map
  • 0.0 rgb lt1, 0, 0gt
  • 0.5 rgb lt0, 1, 0gt
  • 1.0 rgb lt0, 0, 1gt

A very simple repeating gradient pattern
30
color_map
  • pigment
  • marble
  • turbulence 1
  • color_map
  • 0.0 rgb lt.5, .4, .2gt
  • 0.5 rgb lt.7, .6, .4gt
  • 1.0 rgb lt.8, .8, .6gt
  • scale lt2, 2, 2gt

Turbulence
Scale
31
Image Texture
  • pigment
  • image_map
  • jpeg "texture.jpg"
  • Texture is just projected orthogonal on the x-y
    plane.
  • The texture is projected on to a square 1x1 in
    dimensions and repeats.
  • In order to avoid this, you have to scale and
    translate the texture

32
Checker
  • pigment
  • checker
  • Blue
  • White
  • pigment
  • checker
  • pigment agate
  • pigment Black

33
Brick
  • pigment
  • brick
  • White
  • Red
  • pigment
  • brick
  • pigment White
  • pigment marble
  • turbulence 1
  • scale lt2, .2, .2gt

34
Bump Mapping
A real bump distorts the directions of the
normals (this effects calculations of light
reflectance)
Fake bumps created by distorting the normals
although the geometry is still flat.
A bump-map texture applied to a flat polygon.
35
Normal Maps
  • We can add bumps, dents, wrinkles, ripples and
    waves to our objects.

box lt -4, -.25, -4 gt lt 4, .25, 4 gt
pigment White finish
reflection .4 normal
//add normal pattern here
Sample Scene (no normal maps)
36
Bumps
normal bumps 1
37
Dents
normal dents 1
38
Wrinkles
normal wrinkles 1
39
Ripples
normal ripples 1
40
Waves
normal waves 1
41
Bump Map
  • normal
  • bump_map
  • gif "bumpmap.gif"
  • rotate 90lt1, 0, 0gt
  • scale 8

42
(No Transcript)
43
Multiple Textures
44
Translucency
texture pigment
rgbf lt1, 1, 1, .8gt
Filter value of 0 is fully opaque, 1 is fully
transparent.
45
Refraction
  • texture
  • pigment
  • rgbf lt1, 1, 1, .8gt
  • interior
  • ior 3

46
Caustics
  • texture
  • pigment
  • rgbf lt1, 1, 1, .8gt
  • interior
  • ior 3
  • caustics 1

47
Constructive Solid Geometry
  • Some interesting shapes can be formed by simple
    operations on primitive shapes.
  • POVRay allows for union, difference and
    intersection

union sphere lt0, 0,
0gt 1.5 pigment rgb lt1, 0, 0gt
sphere lt0, .8,
-.3gt 1 pigment rgb lt1, 1, 1gt

Union of two spheres (the other variables are
simple the center, radius and color of the
spheres.
48
Other Operations
difference sphere
lt0, 0, 0gt 1.5 pigment rgb lt1,
0, 0gt sphere
lt0, .8, -.3gt 1 pigment
rgb lt1, 1, 1gt
intersection sphere
lt0, 0, 0gt 1.5 pigment rgb lt1,
0, 0gt sphere
lt0, .8, -.3gt 1 pigment
rgb lt1, 1, 1gt
Write a Comment
User Comments (0)
About PowerShow.com