Toribash
Prev Previous Post   Next Post Next
Original Post
toribash .inc and POV-ray Tutorial
[EDIT] There is a shop up in the Market place for custom .inc files for toribash[/edit]

Here is the first part of my POV-ray tutorial
The .inc files on toribash will be next

So this will start from scratch for people who have never used POV-ray before.

Everything in this language everything is case sensitive.

the object codes are always lowercase
EX: box, sphere, torus, cylinder, cone, etc.

The first letter in any word in your color are uppercase
EX: Blue, Red, Yellow, Green, BrightGold, etc.

attributes are lowercase
EX: pigment, finish, etc.

another thing i should note should be that words with spaces inbetween will not use spaces they will use underscore
EX: look_at, light_source, etc.

The First thing to do in any .pov file is add the include tag
---the include tag is the tag that tells the program to look for the attributes in the .inc files
#include "filname.inc"

so for this file we will be including the .inc file "colors"

so our code should look like this so far
#include "colors.inc"

The second thing you need to do for any .pov file you will be creating is create a camera
---the camera tag tells where it is located and what is looking at and at what angle.( angle does not have to be included)

camera {
location <x, y, z>
look_at <x, y, z>
}

so the one we will use for our picture will look like this

camera {
location <5, 5, -0.5>
look_at 0
angle 45
}

NOTE: realize that this should go right under the #include tag

The Next essential is the lighting of our scene. it does not have to be included but it adds a nice touch
---the light_source tag says the location of the light and the color of the light

light_source {
<x, y, z>
color Colorname
}

So by now you are wondering where are my shapes and objects?
and if i have my objects what are they going to sit on?

Well if there is nothing our objects can sit on, they will just float in mid air.

so i will introduce the plane
---the plane tag deals with the axis that it will infinitely extend upon. and the axis opposite it, the plane will lay on

since this is a fairly simple tag i will show you how to use it instead of giving the base code

we will make our plane extend infinitly on the y axis and lay on the point -1 on the z axis
we will also add a pigment to the plane.

NOTE: you can use the word "color" or "colour" depending on which you are familiar with

plane {y, -1
pigment{
checker color White color Red
}
}

so if we press Alt+G we can render the image and you will see a checkered plan stretching horizontally

In this part i will teach about objects including...

box
cone
sphere
cylinder
torus

we will only be using two of these in our image but i will teach about the other 3 later on.
NOTE: there are many more but i will not cover those

--the box tag asks for one corner and another corner and it will stretch one to the other

box {
<x, y, z>
<x, y, z>
}

--the sphere tag asks for the center and then the radius of your sphere

sphere {
<x, y, z>, r
}

Now before we draw our Object i must cover the #declare tag and the difference tag

--the #declare tag tells the computer that when we add an "object" tag into our document with the name provided from
--the declare tag to put in the objects within the declare tag

#declare Nameofobject =

after the equals we put our shape tags

--the difference tag says that if one object within this tag overlaps another within this tag to take the object overlapping--
--and take it away from the overlapped object making the inside transparent

Since i use these two tags together i will show you how to use these in our tutorial saving you precious time so you can
copy and paste these in.

#declare Bun = difference {
sphere {
<0, 0, 0>, 1
}
box {
<-1, -0.5, -1>
<1, 0.5, 1>
}
pigment { Gold }
}

#declare Burger = sphere {
<0, 0, 0>, 1
scale <1, .5, 1>
pigment { Brown }
}

so now we have just said that upon entering the object tags these objects will be displayed

so here is the object tag

object { Bun }
object { Burger }

here is the finished code.

#include "colors.inc"

camera {
location <5, 5, -0.5>
look_at 0
angle 45
}
light_source {
<1, 2, 1>
color White
}
plane {y, -1
pigment{
checker color White color Red
}
}

#declare Bun = difference {
sphere {
<0, 0, 0>,1
}
box {
<-1, -0.5, -1>
<1, 0.5, 1>
}
pigment { Gold }
}
#declare Burger = sphere {
<0, 0, 0>,1
scale <1, .5, 1>
pigment { Brown }
}

object { Bun }
object { Burger }

feel free to add in Note tags where ever you like by this "// this is a note" but without the
quotation marks around it

this is just a quick image i did for the sake of this tutorial...

the image of this is at the bottom
Attached Images
new.jpg (38.8 KB, 84 views)
Attached Files
new.jpg_thumb (21.1 KB, 20 views)