modelado procedural mediante programación visual
TRANSCRIPT
1
11
ModeladoModelado procedural procedural mediantemediante programaciprogramacióónn visualvisual
Gustavo Gustavo PatowPatowGeometryGeometry andand Graphics Group (GGG) Graphics Group (GGG)
UniversitatUniversitat de Girona (de Girona (UdGUdG))
Jornadas sobre estrategias de generación de entornos colaborativos virtuales
22
What is/is not procedural?What is/is not procedural? This is a course about:This is a course about:
–– Procedural modelingProcedural modeling–– Procedural texturingProcedural texturing–– Procedural animationProcedural animation
““A ProcedureA Procedure”” –– a a ““blackblack--boxbox””, with well defined , with well defined input input and output, and output, for achieving a certain (small) targetfor achieving a certain (small) target..
““Procedural approachProcedural approach”” –– making things by using making things by using different different procedures procedures that follow in a clearly definite that follow in a clearly definite orderorder..
““Procedural AnimationProcedural Animation”” –– the color, sound, geometry and the color, sound, geometry and movement are manipulated procedurallymovement are manipulated procedurally
2
33
NonNon--procedural modelingprocedural modelingPick a vertex and drag it.Pick another vertex and drag it. Pick another vertex and drag it. Pick another vertex and drag it. Pick another vertex and drag it. Pick another vertex and drag it. Pick another vertex and drag it. …
44
Procedural modeling First, I need a ¼ torus. Copy and paste, and then rotate it 180
degrees, I got another side. Merge them together I got the basic shape. The basic shape is then copied to every
point on a 16x16 grid, each rotate either 0 or 90 degrees, decided randomly.
……
3
55
Non-procedural approach
Need craftsmanship skill. Not much planning. Animator sits in front of the computer,
fine-tune here and there, until s/he feels satisfy.
Usually cannot reproduce the same result if you ask him/her to do it again.
66
Procedural approach
Describes the shape/motion algorithmically. You plan a lot before you really start. Define the “procedures”, input and output you
need.– Express shape/animation as a function of parameters.
You can write down the steps clearly, reproduce it anytime, or even ask others to reproduce the result.
Need logical mind, careful planning, sometimes a little bit mathematics
4
77
Procedural approach (cont.) Easy to change any “input parameters” to achieve
different effects.– Can easily fine-tune the results in front of your client or boss.– Can create results in a short time (because computer does much
faster than human being). Easy to add, delete, or modify the operations at any
stage.– Because every steps are recorded down by the procedures.– Compare to Maya’s “construction history”?
Suitable for:– Large amount of geometry, each has its own variation of shape
or motion (e.g. a flock of birds)– Complicated shape that cannot be created by hand, but
welldefined by algorithm/mathematics (e.g. plants and trees).– Motions that follow physics (e.g. dynamics).– Motions that follow real-world data (e.g. motion capture).
88
Effort/Timeline for both approach
Non-procedural
Plan Build Modify / fine-tune
Procedural
Plan Build Modify / fine-tune
5
99
Both are good…
I am not saying that procedural is better than non-procedural.– Procedural approach can produce something that
non-procedural approach cannot easily create, and vice verse.
They are complement of each other. A good animation may contain both elements. A good animator should know both approach,
and know when to use procedural approach, and when to use non-procedural approach.
1010
The tools we’ve chosen
To create procedural elements, of course, programming is the best tool.– However, most artists hate/afraid programming.
Among existing (3D) software, Houdini is one of the best to practice the “procedural” idea.– Houdini’s workflow is based on the procedural
paradigm.– Reduce the “programming effort” to minimal.– Quickly provide most common 3D elements, such as
basic shape, particles, basic rendering, etc.
6
1111
Kenneth A. Huffwww.kennethahuff.com
1212
Floyd Gilliswww.floydgillis.com
7
1313
William LathamEvolutionary Art and Computer
1414
Practical Introduction to Practical Introduction to visual procedural visual procedural
programingprograming
8
1515
The Houdini interface
Scene View
Parameters View
Node Network View
1616
WorkflowWorkflow Everything is created
and modified through a “network of operators (OPs)”– Each of them will take,
or generate, some “contents”.
– The contents will be processed
– Then passed to the next operator for further processing.
InitialShape
Comp
Subdiv_Facade
Insert_door
Repeat_Floors
Repeat_Windows
Insert_Window
Exception
plain_Window
9
1717
Ops CategoriesOps Categories Objects (OBJ) – networks of objects (geometry, light,
camera, etc). Geometry (SOP) – networks to construct a geometry’s
shape. Particle (POP) – networks for particle effect. Compositing (COP2) –networks for 2D compositing. Dynamic (DOP) – networks for dynamic effect. Channel (CHOP) – networks for channel’s operation.
“Channel” controls how a value changes over time. Shaders (SHOP) – networks for creating different
shaders. Output (ROP) –networks for specifying the rendering
settings. VEX Builder (VOP) – networks for the Houdini scripting
language called “VEX”.
1818
The Network View
we build our network of OPs here (i.e. procedures) to perform different tasks.
press TAB and choose one of the “OP” available– Need to remember the node
name…
Press ‘H’ to view all OPs
10
1919
Go “in” and “out” an OP
OBJ level
SOP level
Select anddouble-clickan OP to gointo it.
Press “u” to goback to the parentlevel.
2020
Information about an OP
Right-click an OP and choose “Help”. Middle-click an OP – shows the “contents”
of this OP.– Full Name: each OP has a unique name.– OP type: each OP has a type (i.e. what
procedure it does).– Points– Vertices– Primitives
11
2121
Points– most OP contains points– Points are the basic element of a 3D scene– Points contains a 3D position (x,y,z), and optionally points can
also contain color, normal, and other custom attribute (all called point attributes)
Vertices– vertices can share points, but vertices also contain their own
information– For example, if I have a cube with 6 different colored faces, then
each corner of the cube contains 3 vertices (each vertex has a different color), but these 3 vertices share the same 3D position (i.e. shared the same point)
Primitives– several points form a “primitive”– Points cannot be rendered, but primitive can– “Primitive” is a general term in Houdini, where it can be
polygons, curve surfaces (NURBS), meta-ball, etc.
Information about an OP
2222
The Scene View
The Scene View is a view of your scene
You can navigate this 3D view using your mouse
EDIT and VIEW mode in the Scene View: ENTER ESC
Use SPACE + key to do different viewing ops
12
2323
The Parameter View
When you select an operator in the Network View, the parameters of that operator will be shown in the Parameter View
You can modify any editable values there
2424
Our first Houdini model
Step 1) – Create a new Houdini file. In the OBJ level,
press TAB and create a GEOMETRY (geo)– Double-click the newly created geometry to
go into it– In the Network View, select and delete the
default FILE OP that was created for you.
13
2525
Step 2)– In the Network View, press TAB and create a
TORUS– Set the orientation of the torus to Z-axis
Display/render flag:• Turn it on to view the result in the Scene View• One and only one display flag can be turned on inside a SOP network.
Our first Houdini model
2626
Step 3)– Create a SPHERE OP– Increase its radius to 5– Also select “Polygon” as its “primitive type” We want the SPHERE to be made up by many
points (and those points will be passed to the next OP) A “primitive” sphere will only contain one “point” –
its center…
try middle-drag the parameter name “Radius”to see what happen
Our first Houdini model
14
2727
Step 4)– Create a COPY OP and connect the network– and see what happens!
Our first Houdini model
2828
Copy SOPCopy SOP
Copies the shape on the left input to every point on the right input
By default, the z-axis of the LHS shape will be oriented to match the normal of the points on the RHS– that’s why we set the orientation of the torus
to “z-axis” If available, uses the point “normal” to
orient the copies…
15
2929
Pre-view Render
Right-click and choose“View: Mantra”
3030
Create lights
Click the “Point Light” button on the Shelf In the OBJ level you should find a new
object (a Point Light) created
16
3131
Assigning materials To assign material to an object:
1. Create one “material” in the SHOP level.2. Assign a SHOP material to an object in the OBJ level.
Or drag it from the material palette!!
Left-drag to the model
3232
You can check the result by:– Go to the SHOP level: you should find a new
OP created You can fine-tune the color here.
– Go to the OBJ level, and select your model. In the Parameter Pane, select “Material” You should find the full name of the SHOP material
be put there.
Assigning materials
17
3333
A Simple Animation
Let’s setup a simple “procedural”animation
For example, let’s make the TORUS rotate according to a cyclic formula:
the sine() formula
3434
Select the TORUS. Right-click at its output pin, and then type TRANSFORM– A new TRANSFORM OP should be created and
connected between TORUS and COPY.
A Simple Animation
18
3535
In the Parameter Pane, type the following formula inside the Rotate-X attribute of the TRANSFORM OP:
sin($FF*5)*360
A Simple Animation
3636
Play the scene to see what happen You may also want to turn on the “real
time playback” to have an idea how fast the animation is in the final rendered
Real-time playback
Click this tochange the lengthof the animationif you want.
A Simple Animation
19
3737
Final Rendering
(1) Move the view
(2) Ctrl+leftclick the camera shelf button
(3) A new camera object will be created
3838
Final Rendering
(1) Choose a camera
(2) Lock camera (3) Navigate through the selected camera
20
3939
To render a sequence of images, you should also create an “Output driver” in the OUT level
Go to the OUT level, press TAB in the Network View and create a MANTRA OP
Tune the rendering settings in the Parameter Pane
Final Rendering
4040
Final RenderingChange this section if you want to render a sequence of images
Specify the image(s) name and file format. The $F4 in the file name will be replaced by the frame number, padded with 4 digits
Change this section if you want to render in a different resolution
Make sure that you are in the OUT level
Lastly, you can click the RENDER button on the upper-left corner of the Parameter Pane to start the final rendering