Th3813 08 geometri (grid & extrusion)

5
1 TH3813 Realiti Maya Geometri 2 Membina grid dongakan (elevation grid) TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd Noah [email protected] 3 Latarbelakang Membina terain (lerengan) adalah lazim dalam animasi 3D: bukit, lembah, gunung Boleh bina terain dengan menggunakan nod IndexedFaceSet Boleh bina terain dengan lebih berkesan menggunakan nod ElevationGrid TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd Noah [email protected] 4 Contoh [16x16:mount16.wrl] [32x32:mount32.wrl] [128x128:mount128.wrl] TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd Noah [email protected] 5 Sintaks: ElevationGrid Nod geometri ElevationGrid hasilkan terain xDimension dan zDimension - saiz grid xSpacing dan zSpacing - jarak antara baris dan lajur Shape { appearance Appearance { . . . } geometry ElevationGrid { xDimension 3 zDimension 2 xSpacing 1.0 zSpacing 1.0 . . . } } TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd Noah [email protected] 6 Sintaks: ElevationGrid Nod geometri ElevationGrid hasilkan terain height - dongakan pada titik grid Shape { appearance Appearance { . . . } geometry ElevationGrid { . . . height [ 0.0, -0.5, 0.0, 0.2, 4.0, 0.0 ] } }

Transcript of Th3813 08 geometri (grid & extrusion)

Page 1: Th3813 08 geometri (grid & extrusion)

1

1

TH3813 Realiti MayaGeometri

2

Membina grid dongakan(elevation grid)

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 3

LatarbelakangMembina terain (lerengan) adalah lazim dalamanimasi 3D:

bukit, lembah, gunungBoleh bina terain dengan menggunakan nod IndexedFaceSetBoleh bina terain dengan lebih berkesanmenggunakan nod ElevationGrid

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 4

Contoh

[16x16:mount16.wrl] [32x32:mount32.wrl]

[128x128:mount128.wrl]

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 5

Sintaks: ElevationGridNod geometri ElevationGrid hasilkan terain

xDimension dan zDimension - saiz gridxSpacing dan zSpacing - jarak antara baris danlajur

Shape {appearance Appearance { . . . }geometry ElevationGrid {

xDimension 3zDimension 2xSpacing 1.0zSpacing 1.0. . .

}}

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 6

Sintaks: ElevationGridNod geometri ElevationGrid hasilkan terain

height - dongakan pada titik gridShape {

appearance Appearance { . . . }geometry ElevationGrid {

. . .height [

0.0, -0.5, 0.0,0.2, 4.0, 0.0

]}

}

Page 2: Th3813 08 geometri (grid & extrusion)

2

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 7

Sintaks: ElevationGridNod geometri ElevationGrid hasilkan terain

solid - bentuk paduccw - permukaan adalah lawan jam

Shape {appearance Appearance { . . . }geometry ElevationGrid {

. . .solid TRUEccw TRUE

}}

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 8

Sintaks:ElevationGridElevationGrid {

xDimension 0 #field SFInt32xSpacing 0.0 #field SFFloatzDimension 0 #field SFInt32zSpacing 0.0 #field SFFloatheight [ ] #field MFFloatcolor NULL #exposedField SFNodecolorPerVertex TRUE #field SFBoolnormal NULL #exposedField SFNodenormalPerVertex TRUE #field SFBooltexCoord NULL #exposedField SFNodeccw TRUE #field SFBoolsolid TRUE #field SFBoolcreaseAngle 0.0 #field SFFloatset_height #eventIn MFFloat

}

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 9

Contoh penggunaan grid dongakanShape {

appearance Appearance {material Material { }

}geometry ElevationGrid {

xDimension 9zDimension 9xSpacing 1.0zSpacing 1.0solid FALSEcreaseAngle 0.785height [

0.0, 0.0, 0.5, 1.0, 0.5, 0.0, 0.0, 0.0, 0.0,0.0, 0.0, 0.0, 0.0, 2.5, 0.5, 0.0, 0.0, 0.0,0.0, 0.0, 0.5, 0.5, 3.0, 1.0, 0.5, 0.0, 1.0,0.0, 0.0, 0.5, 2.0, 4.5, 2.5, 1.0, 1.5, 0.5,1.0, 2.5, 3.0, 4.5, 5.5, 3.5, 3.0, 1.0, 0.0,0.5, 2.0, 2.0, 2.5, 3.5, 4.0, 2.0, 0.5, 0.0,0.0, 0.0, 0.5, 1.5, 1.0, 2.0, 3.0, 1.5, 0.0,0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.0, 1.5, 0.5,0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0,

]}

}TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd Noah

[email protected] 10

Contoh penggunaan grid dongakan

[mount.wrl]

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 11

IsuObjek sebelum ini kelihatan kasar.Bagaimanakah menghasilkan objek gunung yang lebih licin?Adakah boleh digabungkan beberapa grid dongakan untuk hasilkan pandangan terain baru?

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 12

Contoh-contoh lain

[ribbon.wrl]

Page 3: Th3813 08 geometri (grid & extrusion)

3

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 13

Contoh-contoh lain

[splash10.wrl] [splash40.wrl]

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 14

Contoh-contoh lain

[12ribbon.wrl]

15

Membina bentukextruded

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 16

LatarbelakangBentuk extruded adalah lazim digunakan

tiub, paip, palang, pasu, donut dllBoleh bina bentuk extruded menggunakan nod IndexedFaceSetBoleh bina bentuk extruded dengan lebih mudahmenggunakan nod Extrusion

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 17

Contoh

[slide.wrl] [donut.wrl]

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 18

Menghasilkan bentuk extrudedBentuk extruded dideskripsikan oleh:

keratan rentas 2Dspina 3D yang merentasi keratan rentas

Bentuk extruded adalah seperti

Page 4: Th3813 08 geometri (grid & extrusion)

4

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 19

Extruding garisan lurus

keratan rentassegiempat tepat

spina lurus

hasil daripadaextrusion

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 20

Extruding di sekitar bulatan

keratan rentasbulatan

spina bulatan

hasil daripadaextrusion

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 21

Extruding sepanjang heliks

keratan rentasseparuh bulatan spina heliks

hasil daripadaextrusion

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 22

Sintaks: ExtrusionNod geometri Extrusion hasilkan geometriextruded

cross-section - keratan rentas 2Dspine - laluan 3DendCap dan beginCap - hujung tukup (cap)

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 23

Shape {appearance Appearance { . . . }geometry Extrusion {

crossSection [ . . . ]spine [ . . . ]scale endCap TRUEbeginCap TRUE. . .

}}

Contoh

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 24

Sintaks: ExtrusionNod geometry Extrusion hasilkan geometry extruded

solid - bentuk paduccw - permukaan berlawanan jamconvex - permukaan cekung

Page 5: Th3813 08 geometri (grid & extrusion)

5

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 25

ContohShape {

appearance Appearance { . . . }geometry Extrusion {

. . .solid TRUEccw TRUEconvex TRUE

}}

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 26

Pemampatan dan pemusinganbentuk

Boleh skalakan keratan rentas di sepanjang spinapasu, alat muzikpermukaan-permukaan lain

Boleh putar keratan rentas di sepanjang spinareben

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 27

Sintaks: ExtrusionNod geometri Extrusion hasilkan geometrimenggunakan

scale - penskalaan keratan rentas untuk setiapbucu spinaorientation - putaran keratan rentas untuk setiapbucu spina

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 28

ContohShape {

appearance Appearance { . . . }geometry Extrusion {

. . . scale [ . . . ]orientation [ . . . ]

}}

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 29

Contoh

[horn.wrl] [bartwist.wrl]

TH3813 08 VRML 6 © Dr. Shahrul Azman Mohd [email protected] 30

Extrusion {crossSection [ ] #field MFVec2fspine [ ] #field MFVec3fscale 1.0 1.0 #field MFVec2forientation 0.0 0.0 1.0 0.0 #field MFRotationbeginCap TRUE #field SFBoolendCap TRUE #field SFBoolccw TRUE #field SFBoolsolid TRUE #field SFBoolconvex TRUE #field SFBoolcreaseAngle 0.0 #field SFFloatset_spine #eventIn MFVec3fset_crossSection #eventIn MFVec2fset_scale #eventIn MFVec2fset_orientation #eventIn MFRotation

}