The Research Team:
Dr.
Alexei Sourin
Mr.
Shahzad Rasool (PhD project: 2010 - currently)
Mr. Cui Jian (PhD project: 2013-currently)
Contributed researchers:
Ms.
Lai Danbo (PhD project: 2009 - 2013)
Dr. Lei Wei (PhD project: 2006 - 2011)
Dr.
Qi Liu (PhD project: 2004 -
2007)
Dr.
Konstantin Levinski (MSc/PhD project: 2001-2007)
Mr.
Lai
Feng Min (MEng project, 2000-2002)
Last time updated 28 January, 2019
Function-based extension of VRML and X3D (FVRML/FX3D) allows for extending VRML and its successor X3D with practically any type of object’s geometry and sophisticated graphics appearances by defining the object’s geometry, appearance (color and 3D texture) and transformations with analytical formulas which are implicit, explicit and parametric representations used concurrently. Static and time-dependent shapes and operations can be defined. In contrast to the polygon-based models of VRML/X3D, function-based nodes greatly reduce the size of the models and provide an unlimited level of detail. Also, these nodes allow for using set-theoretic as well as any analytically-defined geometric operations which can be introduced by the user. FVRML/FX3D allows for its extending with any proprietary function-based models. The extension is developed for collaborative shape modeling as well as for building shared virtual worlds.
The following plug-ins work with MS Internet Explorer and Mozilla Firefox.
1. Install BS Contact VRML/X3D (32bit version).
2. Click to install the FVRML/FX3D plug-in ( Version 5.3, 11 November 2013, memory bug fixed).
Please report bugs to assourin@ntu.edu.sg
Function-based extension of VRML—FVRML—allows for extending VRML with practically any type of object’s geometry, sophisticated graphics appearance and transformation by defining them analytically straight in the VRML code. In contrast to the polygon-based models of VRML, function-based nodes allow for a great reduction of the model sizes and provide an unlimited level of detail. Also, these nodes introduce to VRML set-theoretic as well as any other operations analytically-defined by the user.
For defining geometry, appearance and their transformations, three types of functions can be used concurrently. They are implicit, explicit and parametric functions.
Implicit functions are f(x,y,z,t)=0, where x, y, z are Cartesian coordinates and t is the time. The function equals to zero for the points located on the surface of a shape.
Explicit functions are g=f(x,y,z,t). The function value g evaluated at any point of the 3d space can be used either as an argument of other functions (e.g. for defining colors or parameters of transformations) or as an indicator of the sampled point location. Thus, explicit functions can be used for defining bounded solid objects. In this case, the function equals to zero for the points located on the surface of a shape. Positive values indicate points inside the shape and negative values are for the points outside the shape.
Parametric functions define surfaces and solid objects as:
x= f_{1}(u,v,w,t); y= f_{2}(u,v,w,t); z= f_{3}(u,v,w,t) where x, y, z are Cartesian coordinates of the points, while u, v and w are parametric coordinates, and t is the time. Parametric functions can also define r, g, b values of color or parameters of transformations.
Geometry, 3D texture, and color can be defined by implicit, explicit or parametric functions in their own domains and then merged together into one shape by the predefined mapping functions. When modeling shape, first a geometric texture is mapped onto the original shape’s geometry, and then the color is mapped to the textured shape to form the final shape. This process repeats as many times as needed.
Defining complex shapes, appearances and operations usually assumes using multiple formulas and temporary variables. This requires a script-like mathematical language. To be consistent with VRML, which has a JavaScript (VRMLScript) as a standard feature, and to ease the learning curve, FVRML emulates a subset of JavaScipt. In this JavaScript emulation, all variables, arrays and constants have only one type float. The following mathematical functions are implemented: abs(x), sqrt(x), exp(x), log(x), sin(x), cos(x), tan(x), acos(x), asin(x), atan(x), ceil(x), floor(x), round(x), max(x,y), min(x,y), atan2(y,x), mod(x,y), cosh(x), sinh(x), tanh(x), log10(x). There are also three operators ‘&’, ‘|’ and ‘^’, which denote set-theoretic ‘intersection’, ‘union’, and ‘power’ operations, respectively. Custom functions can be defined in the same way as defining a function in JavaScript. Recursions are allowed. There are also the following flow control operators: for-loops, while-loops, do-while-loops, break, continue, and if-else.
When writing function scripts, implicit and explicit functions have to be named ‘frep’. Parametric functions for shapes and geometric textures have to be named ‘parametric_x’, ‘parametric_y’, and ‘parametric_z’, and for colors—‘parametric_r’, ‘parametric_g’, and ‘parametric_b’. If all these functions exist concurrently, frep function will have priority.
FVRML offers six additional nodes, which are FShape, FGeometry, FAppearance, FMaterial, FTexture3D and FTransform. These nodes can be used together as well as with the standard VRML nodes. The nodes' prototypes are here.
FShape node is a container similar to the VRML’s Shape node. It contains FGeometry or any standard geometry node, and FAppearance or the standard Appearance node. These nodes define the geometry and the appearance of the shape, respectively. FShape may be called from FTransform node of from the standard Transform node.
FGeometry node is designed to define a geometry using implicit, explicit or parametric functions. It contains either one string, or a script defining a function representing the geometry, or a URL to the function definition.
FAppearance node may contain FMaterial or the standard Material, the standard Texture node, and FTexture3D node. FTexture3D defines geometric textures while the standard Texture node is used for image texture mapping.
FMaterial node defines diffuse, specular, and emissive colors, as well as transparency, ambient intensity, and shininess with parametric and explicit functions. Parametric functions directly define color values r, g, b. When the color is defined with an explicit function, its values are linearly mapped to the r, g, b values of the actual color with a user-defined color interpolation map. The color can be defined at every point of the 3D modeling space and then will be sampled by the geometry of the shape.
FTexture3D node defines 3D geometric textures using explicit and parametric functions. These functions define displacements of the original shape’s geometry defined in FGeometry or in any standard geometry node. The functions are defined either in one string, or in a function script, or via a URL to the function definition.
If the standard Geometry node is used in place of FGeometry node, the standard shapes of VRML will be assigned an appearance defined in FAppearance node. This ability of using the function-based nodes with the standard geometry and appearance nodes of VRML adds many new features to VRML, some of which are illustrated in this chapter.
FTransform node contains function-defined operations. It may contain FShape and other FTransform nodes as its children. FTransform contains either one string, or a script defining a function representing the operation, or a URL to the function definition as well as other fields to preserve the consistency with the standard Transform node. Both, set-theoretic and affine transformations can be defined as functions of time in FTransform node.
In the following examples, different ways of using
implicit, explicit and parametric functions for defining the shape's geometry
and appearance are used.
For better performance switch the VRML viewer to OpenGL (software) mode.
Click at the images to see the VRML scene. Right click
to save the .wrl file.
Parametric Metamorphoses:
Parametric solids (beta):
Parameters of the FVRML fields:
definition “f(x,y,z,t)“ or definition" frep(x,y,z,t){ function script; return frep(x,y,z,t);}” or definition” x= x(u,v,w,t); y= y(u,v,w,t); z= z(u,v,w,t);” or
definition” function script; return x(u,v,w,t);} function parametric_y(u,v,w,t){ function script; return y(u,v,w,t);} function parametric_z(u,v,w,t){ function script; return z(u,v,w,t);}” |
In this field analytical
definition of the shape's geometry
or geometric texture has to be defined.
It can be given either as individual implicit or parametric formulas or as a
function script. The names of Cartesian
coordinates are |
parameters [p_{1} p_{2} p_{3} p_{4} p_{5} p_{6}]
Default: parameters [-1 1 -1 -1 1] |
It defines parameters' range for u, v, w and
continuity of the predefined set-theoretic operations. Default values
for u, v, w are -1 1, and the continuity is 0. If the
continuity equals to 0, the set-theoretic operations are implemented with
min/max functions (as in Chapter 3). If the continuity is greater than
0, they are implemented with the so-called |
bboxCenter x y z Default: bboxCenter 0 0 0 |
It defines the origin of the coordinate system of the implicitly/explicitly defined surface. |
bboxSize x y z Default: bboxSize 10 10 10 |
It defines the size of the bounding box, and thus the range of variables x, y, z for the implicitly/explicitly defined shape. |
resolution [x y z] Default: resolution [50 50 50] |
It defines the rendering resolution. There must be 3 values for solid shapes, 2 values for parametric surfaces, and 1 value for parametric curves. |
diffuseColor ”frep(x,y,z,t)” or diffuseColor ” frep(x,y,z,t){ function script; return frep(x,y,z,t);}” or diffuseColor ” r=r(u,v,w,t); g=g(u,v,w,t); b=b(u,v,w,t);” or diffuseColor ” function parametric_r(u,v,w,t){ function script; return r(u,v,w,t);} function parametric_g(u,v,w,t){ function script; return g(u,v,w,t);} function parametric_b(u,v,w,t){ function script; return b(u,v,w,t);}” |
In this field the function definition of the shape's diffuse color is to be given. It can be typed either as individual explicit or parametric formulas or as a function script. Cartesian coordinates are x, y, z, while the names of parametric coordinates are u, v, w. Ranges of the variables can be defined in parameters, bboxCenter, and bboxSize fields. Parameter t is the time. The formulae can be also called by a URL. In case if the color is defined by an explicit function, color interpolation will be done using the values defined in fields patternKey and patternColor. |
emissiveColor ”frep(t)” or emissiveColor ” frep(t){ function script; return frep(t);}” or emissiveColor ” r=r(t); g=g(t); b=b(t);” or emissiveColor ” function parametric_r(t){ function script; return r(t);} function parametric_g(t){ function script; return g(t);} function parametric_b(t){ function script; return b(t);}” |
It defines a time-dependent emissive color by an explicit function or script. In case of color definition by one explicit function, color interpolation will be done by the current pattern. Parameter t is the time. The formulae can be also called by a URL. The emissive color is assigned to the whole shape and cannot vary across it. In case if the color is defined by an explicit function, color interpolation will be done using the values defined in fields patternKey and patternColor. |
specularColor ”frep(t)” or specularColor ” frep(t){ function script; return frep(t);}” or specularColor ” r=r(t); g=g(t); b=b(t);” or specularColor ” function parametric_r(t){ function script; return r(t);} function parametric_g(t){ function script; return g(t);} function parametric_b(t){ function script; return b(t);}” |
It defines a time-dependent specular color by an explicit function or script. In case of color definition by one explicit function, color interpolation will be done by the current pattern. Parameter t is the time. The formulae can be also called by a URL. The specular color is assigned to the whole shape and cannot vary across it. In case if the color is defined by an explicit function, color interpolation will be done using the values defined in fields patternKey and patternColor. |
ambientIntensity “frep(t)” |
It defines a time-dependent ambient intensity by an explicit function or script. The ambient intensity is assigned to the whole shape and cannot vary across it. |
shininess “frep(t)” |
It defines a time-dependent shininess by an explicit function or script. The shininess is assigned to the whole shape and cannot vary across it. |
transparency “frep(t)” |
It defines a time-dependent transparency by an explicit function or script. The transparency is assigned to the whole shape and cannot vary across it. |
patternKey [a_{1} a_{2} a_{3} … a_{n}] |
It defines the values of the explicit diffuseColor, emissiveColor or specularColor function or script which will be used for mapping to patternColor. |
patternColor [r_{1 }g_{1 }b_{1 }r_{2 }g_{2 }b_{2 }… r_{n }g_{n }b_{n}] |
It defines the colors which will be used for interpolating the color defined by an explicit diffuseColor, emissiveColor or specularColor function or script based on the current patternKey. Linear interpolation of colors will be done. |
g=...; patternValue(g); |
The function is used in scripts to generate colors defined by patternKey and patternColor. |
translation “x=x(t); y=y(t); z=z(t);” |
It defines translation parameters by explicit functions or scripts. |
scale “x=x(t); y=y(t); z=z(t);” |
It defines scaling parameters by explicit functions or scripts. |
rotation “x=x(t); y=y(t); z=z(t); a=a(t);” |
It defines rotation parameters by explicit functions or scripts. |
center “x=x(t); y=y(t); z=z(t);” |
It specifies a function-defined translation offset from the origin of the local coordinate system (0, 0, 0). |
scaleOrientation “x=x(t); y=y(t); z=z(t); a=a(t);” |
It specifies a function-defined rotation of the coordinate system before the scale (to specify scales in arbitrary orientations). |
operation “union | intersection | difference” or operation “ frep(f,g,t){ function script; return frep(f,g,t);}”
Default: operation “union” parameters [0] |
In this field either a name of the predefined set-theoretic operation or an individual formula or script defining a set-theoretic operation on shapes defined by functions f(x,y,z,t) and g(x,y,z,t) have to be typed. The respective FShapes are to be defined as children of FTransform node. Set-theoretic operations do not apply to parametrically defined shapes. |
timeSpan t_{1} t_{2} _{ } _{ } Default: timeSpan 0 1 |
It defines a time interval of variable t when defining a time-dependent process (shape's geometry, color, texture or transformation). Variables t_{1} and t_{2} can take any real values including negative. |
startTime t Default: startTime 0 |
It defines the values of time to start a time-dependent process. |
stopTime t Default: stopTime 0 |
It defines the values of time to stop a time-dependent process. |
cycleInterval t Default: cycleInterval 1 |
It defines the duration of the time-dependent process cycle in sec. |
frames n Default: frames 0 |
It defines the number of frames to be cached. If 0 is defined, rendering time-dependent processes will be performed on the fly. |
loop TRUE|FALSE Default: loop FALSE |
It enables or disables looping of time-dependent processes. |
enabled TRUE|FALSE Default: enabled TRUE |
It enables or disables time-dependent processes. |
trilinear(x,y,z,size_x,size_y,size_z,’filename’) | This function is provided to support 8-bit raw CT/MRI data. Parameter x, y, and z represents the coordinates of the point to be evaluated. Parameter size_x, size_y and size_z indicates the dimension of the CT/MRI data. Parameter filename is a string, representing the volume data file. When the filename is a relative file name, it is a file relative to the C:/Program Files/FuncNodes/Processor directory of the plug-in. When the filename is an absolute file name, it reads the absolute file directly. When the filename is an URL of http, https or ftp, the function reads the file from the network according to the URL. |
nurbs |
Besides function scripts and analytical formulae, NURBS surface can also be defined in FVRML. When defining NURBS surface, the ‘type’ field in FGeometry should be set as ‘nurbs’. In the ‘definition’ field, write the definition of the NURBS surface. The definition of the NURBS surface is formatted as the follows: ‘uOrder <uOrder> vOrder <vOrder> uDimension <n> vDimension <m> uKnots [<uKnot1> <uKnot2> .. <uKnot n>] vKnots [<vKnot1> <vKnot2> .. <vKnot m>] controlPoint [<Point1_x> <Point1_y> <Point1_z> <Point2_x> <Point2_y> <Point2_z> .. <Point m*n_x> <Point m*n_y> <Point m*n_z>] weight [<Weight1> <Weight2> .. <Weight m*n>]’ uDimension and vDimension define the number of control points in the u and v dimensions. uOrder and vOrder define the order of surface. uKnots and vKnots define the knot vectors. controlPoint defines a set of control points of dimension uDimension * vDimension. This set of points defines a mesh similar to the grid of a ElevationGrid whereas the points do not have a uniform spacing. Depending on the weight-values and the order this hull is approximated by the resulting surface. #uDimension points define a polyline in u-direction followed by further u-polylines with the v-parameter in ascending order. The number of control points must be equal or greater than the order. A closed NURBS surface can be specified by repeating the limiting control points. The control vertex corresponding to the control point P[i, j] on the control grid is : P[i,j].x = controlPoints[i + ( j × uDimension)].x P[i,j].y = controlPoints[i + ( j × uDimension)].y P[i,j].z = controlPoints[i + ( j × uDimension)].z P[i,j].w = weight[ i + (j × uDimension)] where 0 <= i < uDimension and 0 <= j < vDimension. |
Preserving backward compatibility with FVRML, in function-based extension of X3D there are six concrete node types FShape, FGeometry, FAppearance, FMaterial, FTexture3D, and FTransform and one abstract node type X3DFunctionChildNode. The existing models designed using FVRML can be upgraded to FX3D with minimum efforts.
FShape node is designed to associate a function-defined geometry and a function-defined appearance, which is quite similar to Shape node. FShape may be used as a child of a function-defined operation, which results in the implementation of X3DFunctionChildNode.
FGeometry node is designed to define a geometry using any type of functions—implicit, explicit or parametric.
FAppearance node represents function-defined material, function-defined 3D geometric texture, and other regular appearance components (2D/3D image texture, texture transformation, etc.).
FMaterial node contains color information of a shape, including the function definitions used to describe the diffuse color.
FTexture3D stores function definitions of a 3D geometric texture, such as vertex displacements.
FTransform defines affine transformations (i.e. translation, rotation, and scaling) as well as set-theoretic operations on function-defined shapes.
The detailed definitions of the function-based node types can be seen in FX3D.x3d.
If BS Contact VRML/X3D is used, make sure to deselect "resolve external XML resources" in Settings/Preferences/General.
For users of Xj3D, download fx3d.jar and copy it to the Xj3D root directory.
This application requires BS Contact VRML/X3D to be installed. It works only with MS Internet Explorer and Mozilla Firefox. Make sure you have installed the most recent version of the FVRML plug-in.
Release notes:
1. Geometry and appearance are defined in their own coordinate systems and can
be mutually interactively relocated to form a final shape.
2. Geometry and appearance can be changed in editing windows which can be
displayed by clicking at Edit operation in Geometry and
Appearance modes.
Mathematical operations and functions which can be used in formulas:
+, - , *, /, ^, &, |
acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, tan,
tanh, sqrt, ceil, floor, range, min, max
^ Power. E.g. x^3
stands for x*x*x
& Set-theoretic
"AND". The continuity of this function can be defined in parameters.
| Set-theoretic
"OR". The continuity of this function can be defined in parameters.
range When a>b
and a<c, range(a,b,c)=1,
otherwise, range(a,b,c)=0. This function is only provided for
FRep shapes.
3. In the editing windows, the basic shape and tools definition functions and
scripts are kept separated from the coordinate transformations and other
parameters.
4. Any part constituting the shape can be edited by selecting it in Show
Handle mode.
5. The models can be saved/loaded as well as exported to VRML.
Email problems to: Alexei Sourin
Selected Publications:
Lai D, Sourin A, Interactive Visualization of Mathematics in 3D Web, In Proc 2012 Int Conf on Cyberworlds, Darmstadt, 25-27 Sept, 2012, IEEE Press, pp.122-129.
Wei L, Sourin A. Function-based approach to mixed haptic effects rendering. The Visual Computer, DOI: 10.1007/s00371-011-0548-0, 27(321-332), 2011.
Wei L, Sourin A, Stocker H. A Framework for Visual and Haptic Collaboration in Shared Virtual Spaces, 6^{th} International Symposium on Visual Computing (ISVC 2010), Las Vegas, 27 Nov – 1 Dec, 2010.
Wei L, Sourin A. Haptic Rendering of Mixed Haptic Effects. In Proc. 2010 Int. Conf. on Cyberworlds, Singapore, 20-22 Oct, 2001, pp. 38-45.
Sourin A, Wei L. Visual Immersive Haptic Mathematics, Virtual Reality, Springer, 13(4):221-234, 2009.
Sourin A, Sourina O, Wei L, Gagnon P. Visual Immersive Haptic Mathematics in Shared Virtual Spaces. Transactions on Computational Science III, LNCS5300, Springer, LNCS Volume 5300/2009, pp 1-19, 2009
Weil L, Sourin A, Stocker H. Collaboration in 3D Shared Spaces using X3D and VRML. In Proc. 2009 Int. Conf. on Cyberworlds, Bradford, 7-11 Sept, 2009. pp. 36-42, 2009.
Ugail H, Castro GG, Sourin A, Sourina O. Towards a Definition of Virtual Objects with Partial Differential Equations. In Proc. 2009 Int. Conf. on Cyberworlds, Bradford, 7-11 Sept, 2009. pp. 138-145, 2009.
Wei L, Sourin A, Stocker H. Function-based haptic collaboration in X3D. Web3D 2009, 16-17 June, Darmstadt, Germany, 2009. pp. 15-23
Sourin A, Weil L. Visual Immersive Haptic Rendering on the Web. 7th ACM SIGGRAPH International Conference on Virtual-Reality Continuum and its Applications in Industry, VRCAI 2008, 8-9 December 2008
Sourin A, Sourina O, Wei L, Gagnon P. Visual Immersive Haptic Mathematics in Shared Virtual Spaces. Transactions on Computational Science III, LNCS5300, Springer, LNCS Volume 5300/2009, pp 1-19, 2009
Wei L, Sourin A, Sourina O. Function-based Visualization and Haptic Rendering in Shared Virtual Spaces, The Visual Computer, Springer, 24(10):871-880, 2008.
Wei L, Sourin A, Sourina O. Function-based Haptic Interaction in Cyberworlds. Proc. 2007 International Conference on Cyberworlds, 24-27 October, Hannover, IEEE CS, pp.225-232, 2007.
Qi Liu and Alexei Sourin, Function-defined Shape Metamorphoses in Visual Cyberworlds. The Visual Computer, Springer, 2006;22(12):977-990.
Qi Liu and Alexei Sourin, Function-based Shape Modeling and Visualization in X3D, Proc ACM Web3D 2006, pp. 131-141, 2006.
Qi Liu and Alexei Sourin, Function-based Shape Modelling Extension of the Virtual Reality Modelling Language, Elsevier Computers & Graphics, 2006, 30:4, 629-645.
Qi Liu and Alexei Sourin, Function-defined Shape Metamorphoses in VRML, ACM Graphite'05, 29 November-2 December 2005, Dunedin, New Zealand, ACM, 339-346.
Qi Liu and Alexei Sourin, Function-based Time-dependent Shape Modeling on the Web, 2005 International Conference on Cyberworlds, 23-25 November, Singapore, IEEE CS, 35-42.
Alexei Sourin, Computer Graphics. From a Small Formula to Cyberworlds, Prentice Hall, Singapore, ISBN 9810675518, 362 pages, 2005.
Qi Liu and Alexei Sourin, Function-based Representation of Complex Geometry and Appearance, Proc ACM Web3d 2005, 123-134.
Alexei Sourin, Computer Graphics. From a Small Formula to Virtual Worlds, Prentice Hall, Singapore, ISBN 981-244-743-1, 280 pages, 2004.
A.Sourin, K.Levinski, Qi Liu, Virtual Campus--It is Fun and Educational, Proceedings of MAAP 2004, Singapore, 27-28 October, 2004.
Qi Liu, Alexei Sourin, Analytically-defined Collaborative Shape Modeling in VRML, 2004 International Conference on Cyberworlds, Tokyo, 18-20 November, 2004, 70-77.
Alexei Sourin, Lai Feng Min, Konstantin Levinski, Web Visualization of Function-Defined Shapes, Lecture Notes in Computer Science, LNCS, Springer-Verlag Heidelberg, ISSN: 0302-9743, Volume 2669/2003, 428-437, 2003.
Lai Feng Min, Alexei Sourin, Konstantin Levinski, "Function-based 3D web visualization", 2002 International Symposium Cyber Worlds: Theory and Practice 2002, Tokyo, Japan 6-8 November, 2002, 428-435.
Lai Feng Min, Alexei Sourin, "Function-defined shape node for VRML", Eurographics 2002, Short Presentations, ISSN 1017-4565, 207-215, 2002.
Copyright
2001-2006 Lai F.M, Lei. W., Levinski K., Liu Q., Sourin A.
This material may not be published, modified or otherwise
redistributed in whole or part without prior approval.