Title: DLP for Virtual Environments I
1DLP for Virtual Environments (I)
VRML EAI (External Authoring Interface)
2DLP Objects and Virtual Worlds
3VRML Scene Graph
VRML V2.0 utf8 Transform translation 0 0
0 rotation 0 1 0 0 children Shape appearance
Appearance
material Material
diffuseColor 1.0 1.0 0.0
geometry Cylinder
height 2.0 radius 1.0
4VRML Coordinate System
Y
-Z
X
-X
Z
-Y
5Rotations in VRML
Rotation lt1, 0, 0, 1.57gt
Angle in radians
The axis of rotation
1
Right-hand Rule
6VRML Nodes, Fields, and Types
VRML V2.0 utf8 Transform translation 0 0
0 rotation 0 1 0 0 children Shape appearance
Appearance
material Material
diffuseColor 1.0 1.0 0.0
geometry Cylinder
height 2.0 radius 1.0
translation SFVec3f 0 0 0 rotation
SFRotation 0 1 0 0 diffuseColor SFColor
1.0 1.0 0.0 height SFFloat 2.0
7Design 3D Objects for DLP Use
- Define object names on VRML nodes
- Manipulating values on the fields of defined
objects
VRML V2.0 utf8 DEF cylinder Transform
translation 0 0 0 rotation 0 1 0 0 children
Shape appearance Appearance
material DEF cylinderMaterial
Material
diffuseColor 1.0 1.0 0.0 geometry
Cylinder
height 2.0 radius 1.0
8DLP 3D Predicates (bcilib)
- getSFVec3f(ObjectName,Field, X,Y,Z)
- setSFVec3f(ObjectName,Field, X,Y,Z)
- getSFRotation(ObjectName,Field, X,Y,Z,R)
- setSFRotation(ObjectName,Field,X,Y,Z,R)
- getSFColor(ObjectName,Field, R, G, B)
- setSFColor(ObjectName,Field, R, G, B)
- .
9DLP 3D Predicates (bcilib)
- loadURL(URL)
- getPosition(ObjectName,X,Y,Z)
- getSFVec3f(ObjectName,translation,X,Y,Z)
- setPosition(ObjectName,X,Y,Z)
- setSFVec3f(ObjectName,translation,X,Y,Z)
- getRotation(ObjectName,X,Y,Z,R)
- getSFRotation(ObjectName, rotation,X,Y,Z,R)
- setRotation(ObjectName,X,Y,Z,R)
10Launch DLP Objects from Web Browsers
lthtmlgt ltbody bgcolorwhitegt ltembed
src"./../vrml/root.wrl" width"100"
height"100"gt ltapplet codebase"./classes"
archive"dlpsys.jar" code"dlpbrow.class"
width600 height300 MAYSCRIPTgt ltparam
name"mayscript" value"true"gt ltparam name"cols"
value"60"gt ltparam name"rows" value"10"gt ltparam
name"object" value"dlp-example1"gt lt/appletgt lt/b
odygt lt/htmlgt
11Example Moving Titles
12Design 3D Objects
VRML V2.0 utf8 DEF myViewpoint Viewpoint
position 0 3 60 orientation 0 1 0 0 Transform
translation 0 3 0 rotation 1 0 0 1.57 children
Transform translation 0 0 0 rotation 0 1 0
0 children Shape appearance Appearance
texture ImageTexture url "star1.jpg"
repeatS TRUE repeatT TRUE textureTransform
TextureTransform scale 30 10 material Material
diffuseColor 0.0 0.0 1.0 emissiveColor 1.0
1.0 1.0 geometry Cylinder height 2000 radius
2.5 top TRUE bottom FALSE
13Transform translation -2 3 50 scale 0.3 0.3
0.3 children Shape appearance Appearance
material Material diffuseColor 1 1
0 emissiveColor 1 0 0 Text string
"Intelligent Multimedia Technology"
Transform translation -2 3 30 scale 0.3 0.3
0.3 children Shape appearance Appearance
material Material diffuseColor 1
1 0 emissiveColor 1 0 0 Text
string "Distributed Logic Programming"
Sound minFront 1000 minBack 1000
intensity 20 source AudioClip loop TRUE url
"mozart38.wav"
14DLP Program Moving Title
-object titlemove0 bcilib. var count
3000. var increment 0.15. var
url'./title/title0.wrl'. note that the path is
relative to root.wrl in the html file. main -
text_area(Browser), set_output(Browser),
loadURL(url), sleep(3000),
move_title(count). move_title(0)-!. move_title(
N)- N1 is N-1, getSFVec3f(myViewpoint
,position, X,Y,Z), Znew is Z - increment,
setSFVec3f(myViewpoint,
position,X,Y,Znew), sleep(150),
move_title(N1). -end_object titlemove0.
15Example Moving Title (1)
- change the viewpoints position regularly
- the distance between the viewpoint and the title
is stable.
16...... DEF title Transform translation -2 3
50 scale 0.3 0.3 0.3 children Shape appearance
Appearance material Material
diffuseColor 1 1 0 emissiveColor 1 0 0
Text string Multimedia Authoring II Flying
Title" ......
17DLP Program Moving Title (1)
-object titlemove1 bcilib. var count
3000. var increment 0.15. var
url'./title/title0.wrl'. var distance
5.0. main - text_area(Browser),
set_output(Browser), loadURL(url),
sleep(3000), move_title(count). move_titl
e(0)-!. move_title(N)- N1 is N-1,
getSFVec3f(title, translation, Xt,Yt,_Zt),
getSFVec3f(myViewpoint,position, X,Y,Z),
Zt is Z - distance,
setSFVec3f(title, translation,Xt,Yt,Zt),
Znew is Z - increment,
setSFVec3f(myViewpoint,position,X,Y,Znew),
sleep(150), move_title(N1). -end_object
titlemove1.
18Example Moving Title (2)
- change the viewpoints position regularly
- change the titles position regularly
19DLP Program Moving Title (2)
-object titlemove2 bcilib. var count
5000. var distance 20.0. var increment
0.15. var url'./title/title1.wrl'. var
countv100. main - text_area(Browser),set_output
(Browser), loadURL(url), sleep(3000),
move_title(count). move_title(0)-!. move_title(N
)- N1 is N-1, getSFVec3f(title,
translation, Xt,Yt,_Zt),
getSFVec3f(myViewpoint,position, X,Y,Z), Zt is
Z - distance, setSFVec3f(title,
translation,Xt,Yt,Zt), move_viewpoint(myViewpoi
nt,position(X,Y,Z), countv),
move_title(N1). move_viewpoint(_V,_,0)-!. move_v
iewpoint(V,position(X,Y,Z),C)-C1 is C-1, Znew
is Z-increment, setSFVec3f(V,position,X,Y,Znew)
, sleep(100), move_viewpoint(V,position(
X,Y,Znew),C1). -end_object titlemove2.
20Example Moving Title (3)
- change the viewpoints position regularly
- change the titles position regularly
- change the text regularly
21DLP Program Moving Title (3)
-object titlemove3 bcilib. ...... move_title(0
)-!. move_title(N)- N1 is N-1, getSFVec3f(title
, translation, Xt,Yt,_Zt),
getSFVec3f(myViewpoint,position, X,Y,Z), Zt is
Z - distance, setSFVec3f(title,
translation,Xt,Yt,Zt), setTitleText(titletext,N),
move_viewpoint(myViewpoint,position(X,Y,Z),
countv), move_title(N1). ...... setTitleText(
O,N)- I is N mod 5, title_text(I,T), setMFS
tring(O, string, T). title_text(1,
'Multimedia Authoring II')-!. title_text(2,
'Flying Title Example')-!. title_text(3,
'Changing Title Strings')-!. title_text(4,
'VRMLJava Prolog')-!. title_text(0, 'Z. Huang
2002')-!. title_text(_, 'Thank You very
much!')-!. -end_object titlemove3.
22Exercises
1. Design a DLP program to implement a rolling
text, namely, the text can move along Y-dimension
from down to up. You can design your own vrml
file, or download it from the website http//wasp
.cs.vu.nl/mma2/examples/vrml/title/title7.wrl 2.
Based on the moving title example 3, design a DLP
program to implement moving titles in which the
texts and the colors of the titles are changed
regularly, using the following fact
format title_text(1, 'Multimedia Authoring II',
red)-!. title_text(2, 'Flying Title Example',
yellow)-!. title_text(3, 'Changing Title
Strings', green)-!. ...... The vrml file is
available at http//wasp.cs.vu.nl/mma2/examples/v
rml/title/title2.wrl
23Accessibility of your design
- After you have done your exercises, make them
accessible and executable from your project web
site. Add a brief description on them. - Send your DLP source code to your TA by email,
and let him know the link of your MMA2 webpage.
24A recommended file structure
bin
dlpsys.jar,.class, etc.
classes
examples
dlp
mma2
lib
ex1.pl, ex1.htm,etc
title
title2.wrl title7.wrl, etc.
lthome directorygt
vrml
...
root.wrl
dlpsys.jar,.class, etc.
classes
exercises
ex1.htm,etc
www
mma2
title
title2.wrl,etc.
vrml
...
root.wrl