Saturday, March 5, 2011
Diary During Summer Vacation 7
This week mainly what I did is to add some animation functionality to our program prototype. The program can now play an animation showing how a knot is created step by step. The animation can be played automatically from the first point to last point, or played manually by a user. The second one is actually also a functionality of unlimited operational history of un-do and re-do.
Diary During Summer Vacation 6
This week, pretty much what I did was exploring 2 sample codes of merging Windows form and XNA game engine. The samples are very basic tutorial downloaded from XNA game develop club. Although it's basic idea of how XNA framework can be drawed in window form as a customised Control, it is still a very complex process to merging them. 16 hours have been spent on this stuff that is the important part of our project. Finally, this is the result: I now can draw a simple colored and animated triangle, using XNA Framework, onto our Window form Knot A Problem prototype.
Diary During Summer Vacation 5
A very good progress has been made after a hardworking week: our Knot A Problem program has now got four views including Perspective view, Top view, Right view and Front view. This makes the program much more professional and makes operations on creating knots much eaiser. Each view has its own matrices that allow the view to zoom in, zoom out and pan move of camera. A mouse clike on a view makes the view activated and hence the allow keys etc. can only affect this activated view. Press Key 1 & 4 is to switch the display from one view to 4 view.
Diary During Summer Vacation 4
This week I went to help a friend with building a new house. This friend is very good at 3D programming. During the work we discussed our project, especially the problem with lighting. I used the PositionTexture user difined Class to define and draw the string. This has leaded to a problem that the primitives have no information of the normal of each point so that it's looking like half lit and half dark. I used this PositionTexture class simply because I have not come out the method to calculate the normals for each point. My friend pointed out that I can actually use the central point on the curve to get it done, that is curent_point_on_circle - (minus) central_point is a vector which can be normalised to be exactly the normal of that point. This idea is so good, simple and it works. Now I've used the PositionNormalTexture Class and set up each point to have information about its postion, information of its texture coordinate, and the info of its normal. This change has given us a very nice looking string. It looks so real. I love it. The attached photos show the current effect of a string with different color in a scene.
Diary During Summer Vacation 3
I was working on solving two technical problems: how to get right rotation so that the string will not be stretched; and how to convert a 2D position on the screen to a 3D position in the scene so that the new points added by the user can be as right as what the user expects. Having tried many methods, however the fisrt problem remain unsolved. Regarding the second problem, we already have WorldMatrix, ProjectionMatrix and ViewMatrix. Given only a 2D position, with these there difined matrics there is obviously a whole set of possible 3D positions that I can use. By uising the Unproject() method, passing these matrics as parameters, I now can get exactly the right 3D position. The program is now much more elegant: it is now easy to really add points to form a knot. The first problem is unsolved yet. I would like to go seek help from Casey, the coordinator of CSCI356. I think he would give me some help with matrix calculation in XNA.
Diary During Summer Vacation 2
This week I was working on lighting the scene. It was pretty much just a lot of try and test, not a very technological stuff in XNA. By providing 3 lights: 45 degree front-right main light, 45 degree front-left auxiliary light and 90 degree back auxiliary light (this is the classical lighting method in photography), the strings look stereoscopic and beautiful. Four hours work on it.
Diary During Vacation 1
On Thursday night, I worked on adding Knot A Problem the ability to load and changed textures. I worked based on the demo code that had not yet been lit and textured. This functionality is one of the essetial features of Knot A Problem and is not supposed to be hard to implement. However, because of wrong definition of VertexDeclaration, I could not get it work for 2.5 hours, and had no mean to find where the problem was. In Friday morning, I realised that I could have a check through all the code to see if all user difined primitives match with each other. Then the problem was found in vertexDeclaration: it should be of type VertexPositionTexture. Changing into this, the string was then textured with any texture I provided. Then I also created 4 texture images and loaded them manually. With texture, the string looks very exciting. Now it's ready to add more test code to allow user to change the texture by pressing a pop-out button.
Subscribe to:
Posts (Atom)














