Sunday, May 31. 2009
I have finished adjusting the third group of functions. I haven't tested the code, as I don't think it makes any sense without the fourth group. I have started with that fourth group, the headers are changed and now I only have to implement them. So I haven't finished this week (or month), but at least an end to this feature seems near.
The stored views now work quite nicely with scenes. I have implemented all of the parts, the list even gets purged when hitting the button to create a new scene (I had forgotten that one at first). I also started to add the feature for the objects. There I am not finished yet, but have most of the code done. There is one big difference, the list will change much more often, as I have to react to a change in selection. That and the code which actually switches the camera and I should be done. Then I will add one more small feature. I can already switch to the view of a camera, but it is a bit tedious. I think I will just add the cameras into the menu, that way they act quite a bit like the stored views. The main difference being, that a camera has more parameters (e.g. you can change the focus length) , can be animated and can be used for rendering.
Saturday, May 30. 2009
I added the dialog box to add a new predefined view. For the scene it is even storing the data to the right object. But that object is not yet storing that information and there is no way to use the information stored. That I will (hopefully) add tomorrow. Then I have to add something similar for objects and this thing should be finished.
Friday, May 29. 2009
I have also added the five other views. It was very easy. The next addition will be harder, I will add a command to store the current view under a name with the scene or an object. The difference is, that a view stored with the scene will be the same whenever used, while a view on the object will be aligned to the currently selected object pointer. That means, that when an object is inserted several times in the scene, I can store a relative camera view. So I need a command to store the current view and the views have to be added to the menu. I also need a way to delete a view. Also I have to store and load them, so need to extend the object holding the scene and the base of all objects. I think that should not be very hard and should be done soon.
Thursday, May 28. 2009
I have reconsidered again and I start even simpler, not with two triangles, but with a plane containing the line defining the track segment and with an inclination in the middle between the inclination at the start and end of the segment. I think it is worth it to at least implement it and try it. If it works, great. If not I have at least written some additional functions for the geometry objects and those will be of use in the future. I already have the planes created and now have to add the intersection function. That should give me the intersection point of the ray straight down from the center of the car with the track segments. I will then calculate the distance to the line defining the segment and should be able to determine, if the intersection point is on the track.
Wednesday, May 27. 2009
I continued with the layered materials today. I am in the process to change the first of the two remaining function groups. I think from this group I have the worst implementations done, the remaining ones are hopefully rather easy to do now. I started with the generic material which has to handle that case sufficiently well. Some of the other materials are much simpler in that regard, they either don't handle that case at all (because I don't see a reason I will ever need it) or have simplified implementations.
Tuesday, May 26. 2009
The code I wrote yesterday did indeed work. I can now align the camera so, that I look at the front of a selected object. I have also refactored the code so adding the other five directions should be simple. Then I will add a facility to store the current view into a list of views. The list will be made up of two parts, absolute views and view associated with an object. That should cover all cases, I hope.
Monday, May 25. 2009
Today I have a new excuse why I was lazy: it was so hot. I did a bit of work on the predefined views and I think the first one should work now (didn't test it, I will tomorrow). The rest should be fairly easy.
Sunday, May 24. 2009
I have also started to implement a menu to switch to a predefined view. I thought about a good way to add it to my normal UI, but haven't found one yet. So for now I added a new menu and add the commands there. That might even be the best option. The implementation isn't hard, but I already found (and fixed) a stupid bug in another part of the program (extents of polyhedra were wrong in some cases). The next issue I need to solve is to find out, how far to move away from the object so it is fully visible in the view. I thought I already had a solution, but it doesn't seem to work. The other five directions should be rather simple then.
I checked the thing I saw yesterday and it turned out to be correct. So I am rather sure that the program is back in a working state. This time hopefully the calculations are correct and the bugs don't just cancel out so the slightest change will result in a similar mess again. I will try to finally add the rest of the functions and finish the layered materials. I hope I can finally close this chapter this week.
Saturday, May 23. 2009
 I had written about posting pictures of the cat quite some days ago. Today I worked a bit on the cat and finally rendered some images. I think the results are not totally bad, although I am still missing some parts.  You probably can guess that there is no head and the forelegs are still missing. Currently I am still working on the hind legs. I think the basic form starts to look good, but there are still issues with it. I think that they are still a bit too thin from the side (or too thick from behind, probably the latter). In the second you can also see, that there are still problems around the hip.  But overall I am happy with the form. I think it resembles a cat quite well and with some additional tweaks it should be ok. I think I learned some things and I have fixed quite some bugs and added useful features to the program while working on this model. I hope I can soon finish the hind legs, I will tweak the form a bit and then start on the paw. I will then start with the forelegs.
I think I have the main problems with lighting. I found some more bugs and some of the fixes had the effect to make hidden bugs become visible ones. That is, what had happened yesterday and caused the results to be completely useless. For example I had at one place used the wrong normal to find out, if a light has an effect and so I filtered out all the effective lights, while the noneffective ones resulted in reduced light (a term became negative). Another one was, that the default filter in the layered material implementation was completely opaque instead of completely transparent. Now I have one more thing to check, I think the filtering function still doesn't work correctly with layered materials. The color I was seeing while debugging the code didn't seem correct to me. I will check and then finally start on the second half of the implementation for the layered materials.
Friday, May 22. 2009
The longer I try to fix the materials the worse the results seem to be. I have tried a lot of things and went through quite some of the code paths used by the lighting code. I have found a lot of small problems and I broke a lot of small features in the past. I have no longer any clue on how long it will take to fix this mess. The main problem is, that I have never defined how transparency is supposed to work. I originally had something like alpha blending in the program, but I actually don't like it. I define an opacity (= alpha) for colors and if a material is mostly opaque only a very small amount of light should shine through. So what I do now is to multiply the color components and damp the light by the inverse of the alpha value. That also means, that if the color is red then you will never see any blue or green pass the material, even if it is highly transparent. Alpha blending would blend the colors by multiplying the light components with the inverse alpha from the filtering color and add the filter color multiplied by alpha. As I calculate the reflective color separately it would mean to add the light damped by the alpha value. But it would also mean, that the resulting light would be the same if you used a red or a blue filter. And I think that is wrong.
Thursday, May 21. 2009
I continued with the implementation to constrain the car to the track. I still haven't started with the core of the algorithm, intersecting a ray with the track surface. A lot of infrastructure was necessary, but I hope I am mostly done with it. Now only two things need to be done (I hope), I have to store the track in a format I can use (the 3D representation is a bad fit, I fear) and to implement the function for the intersection of that object and the ray. The track representation will not be planar, as the track can and will be twisted when the inclination changes. I still haven't decided how to handle that, the easiest way would probably be to use two triangles to define the track surface. I guess I will start with that.
Today I added a new feature to the Free Edit Modifier to align the camera. I already had a feature which aligned the camera to a plane defined by the currently selected vertices. But when working with that feature it soon turned out to be flawed. E.g. you select an edge on a cube and want to look at it from the side to move it up and down. Then you cannot use the selection to align the camera (the camera defines what up and down is). So I added the feature, so that it is also possible to align to a second selection I call "Hot Selection". This selection is calculated whenever the mouse moves and shows, what would get selected when the left mouse button was pressed. So now I can show a face to align to without needing to have it selected. The main problem was, that I wanted inputting 'a' to cause the alignment to the selected objects and inputting 'A' to align to the hot selected items. It turned out, that I had only passed the character to the function, but not the state of the modifier keys. So I fixed that today. I have some more of these to add, though. First I would like to be able to just use the directions defined by the object. So I could just look at the object from the left or from behind. Additionally I think it would help to be able to define views so they can be recalled later. I have not decided how to handle that last case, but adding at least the default directions shouldn't be too complicated.
|