othmanskn
Apr 11, 2006, 06:25 PM
Configuring Collision Objects for Clearview 4.35 without AC3D
This is to document the steps that are required to edit Clearview 4.35 control.ac files where the 3D objects in AC3D format is stored.
References are:
http://clearviewrc.com/docs/CVCollision.html
http://www.ac3d.org/ac3d/man/ac3dfileformat.html
http://www.euclideanspace.com/maths/algebra/matrix/orthogonal/rotation/index.htm
Based on the above documents, I was able to insert and edit objects by using a text editor to edit the conrols.ac file without any need to use AC3D or any 3D graphic programs. I was not able to understand all the functions of the ac3d file format in order to place these control objects.
Step 1: Enabling loading of Control objects and freeflight mode
Follow the instructions in CVCollision.html in order to activate the freeflight mode. Very useful for learning how to navigate in an RC enviroment without the pains of failures and crashes.
The document is not easy to understand for the beginner. The important points are to edit the model and landscape paramter files.
The easiest and fastest for a beginner is to use a text editor to edit but I used the advanced model editing mode but had to look for the “specialmode” parameter.
D:\Program Files\SVKSystems\ClearView\models\Raptor60Easy\par ams.txt
specialMode 1.0
D:\Program Files\SVKSystems\ClearView\landscapes\tg_aru\lands cape-params.txt
loadCtlObjects 1.0
Step 2: Get copies of sample text files for objects
D:\Program Files\SVKSystems\ClearView\landscapes\Farm field\data\controls.ac
Copy this file to your landscape directory\data directory first. Create a new directory data if it does not exist. It makes all the objects there available for your scenery and you can view it by pressing idle-up buttons.
Make sure you can see these control objects first. You must reload your scenery when there is a crash, or when there is a possibly of any syntax error.
Step 3: Understand the relevant parameters
This sample file shall be used as a demonstration:
OBJECT poly
name "rwall"
loc -5.2 0 2.95
rot 0.85 0 0.53 0 1 0 -0.53 0 0.85
crease 45.000000
numvert 4
0 -0.2 -20
0 -0.2 13
0 10.73 13
0 10.73 -20
numsurf 1
SURF 0x20
mat 4
refs 4
3 0 0
2 1 0
1 1 1
0 0 1
kids 0
Make sure that the kids parameter for the OBJECT “world”, is equal to the number of your objects. I used wordpad “find” command to count by searching for “name”, instead of “OBJECT” because sometimes I didn't copy this header. See below.
AC3Db
MATERIAL "ac3dmat1" rgb 1 1 1 amb 0.2 0.2 0.2 emis 0 0 0 spec 0 0 0 shi 10 trans 0
MATERIAL "ac3dmat3" rgb 1 0 0 amb 0.2 0.2 0.2 emis 0 0 0 spec 0 0 0 shi 10 trans 0
MATERIAL "ac3dmat8" rgb 0.627451 0.752941 0.878431 amb 0.2 0.2 0.2 emis 0 0 0 spec 0 0 0 shi 10 trans 0
MATERIAL "ac3dmat11" rgb 0.933333 0.501961 0.933333 amb 0.2 0.2 0.2 emis 0 0 0 spec 0 0 0 shi 10 trans 0
MATERIAL "ac3dmat8" rgb 0.627 0.753 0.878 amb 0.2 0.2 0.2 emis 0 0 0 spec 0 0 0 shi 10 trans 0.522
OBJECT world
kids 19
If your objects exceed this number, Clearview will still load objects but it will not load the other objects more than the number of “kids” specified.
The above samples uses the optional “loc” location parameter which is just an offset to the coordinates of the vertices, and “rot” the rotation in 3x3 matrix format.
numvert
The most important are the coordinates of the vertices which come after numvert paramter.
Enter coordinates as you read them from Clearview freeflight mode by pressing throttle-off buttons. Make sure you switch off the coordinate display when trying to access other PC functions.
The coordinates are in X , Y, Z format where:
X is the left direction of a panoramic picture.
Y is the up and down direction.
Z is the forward direction.
numvert 4
There are 4 vertices which means it can only have one surface so is used as walls.
numvert 8
This is for a rectangular object. It can have 4, 5 or 6 surfaces.
numsurf
Number of surfaces.
numsurf 4
Walls and fences.
numsurf 5
Hollow rectangular culverts.
numsurf 6
Pipes and tree trunks.
numsurf 5
Used for objects on the ground, such as cars and tables.
numsurf 6
For floating objects. I used them for leaves and hanging model aeroplanes.
Choose samples of objects that have the correct number of surfaces and edit the coordinates of the vertices. Much easier this way.
Step 4: Apply the basics
You can start editing by using the basics first. Get the feel and operations of Clearview in interpreting the paramters that we input.
There is a bug in Clearview. It interprets AC3D files by adding 0.2 m to the height(Y coordinate) of all points. So all ground points must be given values of -0.2 and all heights deducted by 0.2 m.
Step 5: Learn alternate ways of placing objects.
loc
Instead of entering coordinates for all vertices, we can have a model of an object and just place them anywhere we like, by modifying only one coordiante. The -0.2m offset for height can be done at the “loc” parameter only.
The coordinates in loc are added to all coordinates in the numvert vertices.
So when using “loc”, the coordinates for the vertices is best set about the centre of horizontal plane of the object.
An example of a set of coordinates where their origin is at the centre of its horizontal plane.
numvert 8
1.57 -0.2 1.75
1.57 -0.2 -1.75
-1.57 -0.2 -1.75
-1.57 -0.2 1.75
-1.57 1.4 1.75
-1.57 1.4 -1.75
1.57 1.4 -1.75
1.571.4 1.75
rot
rot 0.85 0 0.53 0 1 0 -0.53 0 0.85
The formula for a rotation about the Y axis, which is what is normally required is:
cos(a) 0 sin(a) 0 1 0 -sin(a) 0 cos(a)
Where a is the angle of rotation.
Step 6: Doing more graphic editing.
mat
Material choice command. The material properties are predefined at the beginning of the file. Although you can edit the materials because they appear to be just colour combinations, it is not necessary for drawing control objects.
However special note for material 4, i.e. the last material defined at the beginning. It has a transparency parameter(trans) set to 0.522. I changed all mat commands to only give mat 4, so that all control objects are transparent.
This is the power of text editing.
refs
mat 4
refs 4
3 0 0
2 1 0
1 1 1
0 0 1
The left most number is the index to the vertices. 0 is the first line of the coordinate of the vertex.
By looking at the vertex indices, we can tell the surface that the “mat” parameter applies its material to.
I did it to highlight the top surfaces. The top surface is identified by identifying the vertices that have all 4 “height” coordinates, instead of ground coordinates.
numvert 8
0:1.57 -0.2 1.75
1:1.57 -0.2 -1.75
2:-1.57 -0.2 -1.75
3:-1.57 -0.2 1.75
4:-1.57 1.4 1.75
5:-1.57 1.4 -1.75
6:1.57 1.4 -1.75
7: 1.57 1.4 1.75
The top surface is made up of vertices 4, 5, 6, 7
SURF 0x20
mat 4
refs 4
7 0 0
4 1 0
5 1 1
6 0 1
There is no need to edit these refs entries. Just understand them so that we can apply the correct texture to its surface.
LIMITATIONS OF PANORAMIC PICTURES
1. Panoramic pictures don't give distances of objects on its pictures. We must measure them ourselves and place correctly at the distance reported by Clearview.
Just by taking coordinates by placing helicopters near the picture of an object will not be accurate.
It is only accurate if it is a ground object, such as grasses.
2.There is a scale distortion if the panoramic pictures are not taken at the height of 1.8m. The error is proportional to the diffrence. If your camera height is 0.46m, the error is 1.8/0.46,i.e. 4. Distances in Clearview is reported 4 times of the real distance.
3.You must use clearview corrected distances in order to determine the correct location on the panoramic picture.
DISCLAIMER:
Try at your own risk. No warranty whatsover is provided.
Othman Ahmad
This is to document the steps that are required to edit Clearview 4.35 control.ac files where the 3D objects in AC3D format is stored.
References are:
http://clearviewrc.com/docs/CVCollision.html
http://www.ac3d.org/ac3d/man/ac3dfileformat.html
http://www.euclideanspace.com/maths/algebra/matrix/orthogonal/rotation/index.htm
Based on the above documents, I was able to insert and edit objects by using a text editor to edit the conrols.ac file without any need to use AC3D or any 3D graphic programs. I was not able to understand all the functions of the ac3d file format in order to place these control objects.
Step 1: Enabling loading of Control objects and freeflight mode
Follow the instructions in CVCollision.html in order to activate the freeflight mode. Very useful for learning how to navigate in an RC enviroment without the pains of failures and crashes.
The document is not easy to understand for the beginner. The important points are to edit the model and landscape paramter files.
The easiest and fastest for a beginner is to use a text editor to edit but I used the advanced model editing mode but had to look for the “specialmode” parameter.
D:\Program Files\SVKSystems\ClearView\models\Raptor60Easy\par ams.txt
specialMode 1.0
D:\Program Files\SVKSystems\ClearView\landscapes\tg_aru\lands cape-params.txt
loadCtlObjects 1.0
Step 2: Get copies of sample text files for objects
D:\Program Files\SVKSystems\ClearView\landscapes\Farm field\data\controls.ac
Copy this file to your landscape directory\data directory first. Create a new directory data if it does not exist. It makes all the objects there available for your scenery and you can view it by pressing idle-up buttons.
Make sure you can see these control objects first. You must reload your scenery when there is a crash, or when there is a possibly of any syntax error.
Step 3: Understand the relevant parameters
This sample file shall be used as a demonstration:
OBJECT poly
name "rwall"
loc -5.2 0 2.95
rot 0.85 0 0.53 0 1 0 -0.53 0 0.85
crease 45.000000
numvert 4
0 -0.2 -20
0 -0.2 13
0 10.73 13
0 10.73 -20
numsurf 1
SURF 0x20
mat 4
refs 4
3 0 0
2 1 0
1 1 1
0 0 1
kids 0
Make sure that the kids parameter for the OBJECT “world”, is equal to the number of your objects. I used wordpad “find” command to count by searching for “name”, instead of “OBJECT” because sometimes I didn't copy this header. See below.
AC3Db
MATERIAL "ac3dmat1" rgb 1 1 1 amb 0.2 0.2 0.2 emis 0 0 0 spec 0 0 0 shi 10 trans 0
MATERIAL "ac3dmat3" rgb 1 0 0 amb 0.2 0.2 0.2 emis 0 0 0 spec 0 0 0 shi 10 trans 0
MATERIAL "ac3dmat8" rgb 0.627451 0.752941 0.878431 amb 0.2 0.2 0.2 emis 0 0 0 spec 0 0 0 shi 10 trans 0
MATERIAL "ac3dmat11" rgb 0.933333 0.501961 0.933333 amb 0.2 0.2 0.2 emis 0 0 0 spec 0 0 0 shi 10 trans 0
MATERIAL "ac3dmat8" rgb 0.627 0.753 0.878 amb 0.2 0.2 0.2 emis 0 0 0 spec 0 0 0 shi 10 trans 0.522
OBJECT world
kids 19
If your objects exceed this number, Clearview will still load objects but it will not load the other objects more than the number of “kids” specified.
The above samples uses the optional “loc” location parameter which is just an offset to the coordinates of the vertices, and “rot” the rotation in 3x3 matrix format.
numvert
The most important are the coordinates of the vertices which come after numvert paramter.
Enter coordinates as you read them from Clearview freeflight mode by pressing throttle-off buttons. Make sure you switch off the coordinate display when trying to access other PC functions.
The coordinates are in X , Y, Z format where:
X is the left direction of a panoramic picture.
Y is the up and down direction.
Z is the forward direction.
numvert 4
There are 4 vertices which means it can only have one surface so is used as walls.
numvert 8
This is for a rectangular object. It can have 4, 5 or 6 surfaces.
numsurf
Number of surfaces.
numsurf 4
Walls and fences.
numsurf 5
Hollow rectangular culverts.
numsurf 6
Pipes and tree trunks.
numsurf 5
Used for objects on the ground, such as cars and tables.
numsurf 6
For floating objects. I used them for leaves and hanging model aeroplanes.
Choose samples of objects that have the correct number of surfaces and edit the coordinates of the vertices. Much easier this way.
Step 4: Apply the basics
You can start editing by using the basics first. Get the feel and operations of Clearview in interpreting the paramters that we input.
There is a bug in Clearview. It interprets AC3D files by adding 0.2 m to the height(Y coordinate) of all points. So all ground points must be given values of -0.2 and all heights deducted by 0.2 m.
Step 5: Learn alternate ways of placing objects.
loc
Instead of entering coordinates for all vertices, we can have a model of an object and just place them anywhere we like, by modifying only one coordiante. The -0.2m offset for height can be done at the “loc” parameter only.
The coordinates in loc are added to all coordinates in the numvert vertices.
So when using “loc”, the coordinates for the vertices is best set about the centre of horizontal plane of the object.
An example of a set of coordinates where their origin is at the centre of its horizontal plane.
numvert 8
1.57 -0.2 1.75
1.57 -0.2 -1.75
-1.57 -0.2 -1.75
-1.57 -0.2 1.75
-1.57 1.4 1.75
-1.57 1.4 -1.75
1.57 1.4 -1.75
1.571.4 1.75
rot
rot 0.85 0 0.53 0 1 0 -0.53 0 0.85
The formula for a rotation about the Y axis, which is what is normally required is:
cos(a) 0 sin(a) 0 1 0 -sin(a) 0 cos(a)
Where a is the angle of rotation.
Step 6: Doing more graphic editing.
mat
Material choice command. The material properties are predefined at the beginning of the file. Although you can edit the materials because they appear to be just colour combinations, it is not necessary for drawing control objects.
However special note for material 4, i.e. the last material defined at the beginning. It has a transparency parameter(trans) set to 0.522. I changed all mat commands to only give mat 4, so that all control objects are transparent.
This is the power of text editing.
refs
mat 4
refs 4
3 0 0
2 1 0
1 1 1
0 0 1
The left most number is the index to the vertices. 0 is the first line of the coordinate of the vertex.
By looking at the vertex indices, we can tell the surface that the “mat” parameter applies its material to.
I did it to highlight the top surfaces. The top surface is identified by identifying the vertices that have all 4 “height” coordinates, instead of ground coordinates.
numvert 8
0:1.57 -0.2 1.75
1:1.57 -0.2 -1.75
2:-1.57 -0.2 -1.75
3:-1.57 -0.2 1.75
4:-1.57 1.4 1.75
5:-1.57 1.4 -1.75
6:1.57 1.4 -1.75
7: 1.57 1.4 1.75
The top surface is made up of vertices 4, 5, 6, 7
SURF 0x20
mat 4
refs 4
7 0 0
4 1 0
5 1 1
6 0 1
There is no need to edit these refs entries. Just understand them so that we can apply the correct texture to its surface.
LIMITATIONS OF PANORAMIC PICTURES
1. Panoramic pictures don't give distances of objects on its pictures. We must measure them ourselves and place correctly at the distance reported by Clearview.
Just by taking coordinates by placing helicopters near the picture of an object will not be accurate.
It is only accurate if it is a ground object, such as grasses.
2.There is a scale distortion if the panoramic pictures are not taken at the height of 1.8m. The error is proportional to the diffrence. If your camera height is 0.46m, the error is 1.8/0.46,i.e. 4. Distances in Clearview is reported 4 times of the real distance.
3.You must use clearview corrected distances in order to determine the correct location on the panoramic picture.
DISCLAIMER:
Try at your own risk. No warranty whatsover is provided.
Othman Ahmad