Thursday, September 2. 2010
Today I have continued to get the textures fixed. The length of the segment now is used to calculate the texture coordinate, but there a problem has appeared. The straight segments are so long, that they cover more than one complete texture instance. As I don't yet add new vertices, I can't handle that case correctly, currently all the texture coordinates end up with the same value. So next week I have to start adding additional geometry to correctly texture the track. But at least I seem to be getting closer to a working solution.
Thursday, August 19. 2010
As I got the basic problems fixed last week, I could finally start to add all the little details. Today I first changed the code so it would create continuous geometry. That also closed most of the remaining holes (where small rounding errors occurred). Then I started to think about how I get the texture working correctly.
The texture coordinates have to be aligned to the geometry, so that the length of the track segment defines, how far I have progressed in the texture. When I reach the end of the texture, I have to close a quad and start a new one. I currently don't want to add points where the exact boundary between the v-coordinates 1.0 and 0.0 would be, I will just treat the point where the v-coordinate had the last value before rolling over to 0.0 again as that boundary. When that works, I will try to add the geometry to get that into a fully working state.
Thursday, August 12. 2010
Nearly a month has passed since I did something at least a bit productive for the game. Today I finally seem to have found a solution for the problem. As often it turned out to be rather simple, but I really didn't think of it. I needed to find the intersection line between two track segments and I think I found a very nice way. I have the normals at the connection point of the track segments before and after that point. I calculate the average normal (just summing the two vectors) and use that and the point to define a plane. Into this plane I project the track segment directions and calculate the line which is exactly between the two segments.
The motivation for this is quite simple, I expect the tracks to be smooth, so I basically smooth out the tracks by taking the average normal. I think it makes sense to also use this normal for the geometry, but currently that isn't done. So I needed several weeks to find that simple solution.
Thursday, July 15. 2010
I have decided to scrap the function calculating the intersection between the track segments and start from another point. I think I finally have the correct idea. The track segments have to connect smoothly so I can be sure, that the normals of the two segments are identical where the two segments meet. Currently that is not the case, I will check where I made an error.
Then I project the direction of the tracks into the plane defined by the normal and calculate the half vector between the two directions. That results in a line, where the two segments meet. I think, that this will lead to correct segments and is much easier to understand. Also I have explicit conditions I can check to find bugs.
I hope, that that way I can fix this thing and finally get on with it. I would like to work on something else, this thing is really, really boring and so I am not very motivated to work on it, what makes its progress even slower.
Thursday, July 8. 2010
Another day without progress. I slowly get the impression, that deep down I have done something stupid and not thought through something. The problem with the segments not intersecting properly points into that direction. What I saw seems to indicate, that the segments can't be connected that way at all. I am considering to go back and think about the problem again and then change the code. The question is, how do the directions of the track segment have to be aligned to make sense.
Thursday, July 1. 2010
I have made no progress today at all. I have added some code to check, if the inclination of the track is non continuous over segment boundaries, but it doesn't seem big enough to matter. So I guess the problem I found last week means, that it wasn't caused by a bug, but I just have to cope with it. I am really surprised, as I had not expected a bug in that area, as it is very similar to the old, working code.
Thursday, June 24. 2010
I think, I finally understand what is wrong with the track. At least with the straight segments. There I have a problem with the calculation of the intersection line between two segments. In theory there should be no intersection possible, as the start of one segment has to be planar to the end of the previous segment to form a smooth track.
But that is not what happens, instead the two planes created from the up vectors intersect along the middle line. That results in completely wrong geometry, as I place the side points of the track on the middle line. So I will look into the code to find out, if I have done an error in the specification of the track or if something is not calculated correctly. If the first is what happens (I fear that), I will see, how I can change the functions so they detect and fix that problem.
Thursday, June 17. 2010
I have found the track again. It was just a stupid collection of bugs. I haven't found all of them yet, but I can at least see the track in some parts. The geometry seems to be wrong somewhere, I have to do more debugging to find those bugs, but the bug shows itself identically in every segment. But at least the track textures are starting to work. When this first, primitive step works, I can finally start to get some real new features into the program.
First I need to collect multiple track segments and turn them into one geometry patche. Currently each segment is completely separate. With that I will also be able to control the uv-mapping so the texture has the same length on the axis for all parts of the track. And then I will play with a more complex texture, currently the track texture I use for testing is very primitive.
Thursday, June 10. 2010
Today I found the bug which I had hit last week. It was a small oversight, but not easy to find. So now the new track geometry is created by the new code, there is just one little issue, it isn't visible. So I will continue with debugging next week.
Thursday, June 3. 2010
I think I have finally made all the changes so that the track textures should work. It wasn't much which was missing. But now the code throws an exception, I haven't found out yet where it comes from. I will look for it next week, and I hope the next things after that are more interesting.
Thursday, May 27. 2010
After two lazy Thursdays I at least did a bit to get the track texture working. I have added the code which should be able to create the geometry. It currently uses the wrong texture and the uv-coordinates are not correct. Also the created geometry will be very inefficient, as it creates a separate geometry object for each slice and each segment. And because of that last issue the textures will not be continuous over segments.
That is one of the reasons, that progress has been so slow, I was thinking about how to get all those things fixed. But I think, it makes more sense to first get something working and then think about how to fix it. So I hope, that next week the code will again work and I can use the new code and see something. Then I will probably start to fix the issues, the biggest is to make the textures continuous over segment boundaries.
Thursday, April 29. 2010
I was very lazy today, only wrote some accessors and now should have the two lines where the segment hits the previous and the next one. On that lines I need to find the points I have already calculated and then it should be possible to create the geometry. The last part is to actually use the new class. And I will be very happy, when it works.
Thursday, April 22. 2010
The track textures which have been read from the file are now passed on to the track. It currently doesn't yet call the function creating the geometry, as it isn't finished yet. That function now should be able to find positions for the texture parts based on the widths. I have also moved a function from the track to the track texture so it can find the intersection of two segment planes. What is still missing now is to calculate the second intersection line and then to calculate the points on that line matching the positions of the track parts. And finally the points have to be connected. As a lot of the code has never run, I expect some time to get it all working, though.
Thursday, April 15. 2010
The preprocessing function is finally done. I even managed to execute the code again and fixed some stupid bugs. So next week I can finally start to create the geometry, if I have done everything correct it shouldn't be hard, at least not for the simple track texture I currently use. If that one works, I will create a little bit more complex variant and then I will see what happens.
Thursday, April 8. 2010
I wanted to work a bit on the game on the last weekend. But I was so lazy, I didn't do a lot at all and also didn't look at the game. At least I got quite a bit of the distribution algorithm implemented today. I currently only have to add the handling for the fixed slices and then it should work. And then I can finally create the geometry and map the textures and it is ready to be tested. I am still following the rough outline I made some weeks ago, it seems my idea was good, up to now I haven't hit a problem in the approach. So hopefully I will have this thing done soon.
|