So to give some idea about heightmap, here is an example which I have written using Python in Pysoy. It basically generates pseudo random texel values over the required texture. I have created a four vertex mesh and applied the textured material while mapping the texture over it using the uv coordinates. Here I am just coloring texels with eight bit greyscale values.
By changing the smooth attribute we can toggle between the abrupt pixelation to smoothly varying interpolated colour values which is just like a blurred image.
So this is what a heightmap would look like, although after implementation this would create the most unrealistic and terrific looking terrain. As we can see that light colour values will create hills and other elevated areas and darker values will create valleys. This was just a test and the final implementation would be much better.
For now, PySoy has an API call for getting heightmap data from PNG or JPG format images and it passes it over as eight bit grey-scale values. My task for the rest of the week is to implement my small test code in LibSoy where all the processing happens. For this I need to implement another method in Heigtmap class which can take some numerical values like dimensions of heightmap and couple of other variables as parameters.
By changing the smooth attribute we can toggle between the abrupt pixelation to smoothly varying interpolated colour values which is just like a blurred image.
So this is what a heightmap would look like, although after implementation this would create the most unrealistic and terrific looking terrain. As we can see that light colour values will create hills and other elevated areas and darker values will create valleys. This was just a test and the final implementation would be much better.
For now, PySoy has an API call for getting heightmap data from PNG or JPG format images and it passes it over as eight bit grey-scale values. My task for the rest of the week is to implement my small test code in LibSoy where all the processing happens. For this I need to implement another method in Heigtmap class which can take some numerical values like dimensions of heightmap and couple of other variables as parameters.
A code snippet from LibSoy (Language : Genie) |
As you can see that there is a noise function which is being called inside the heightFieldData method. This is where the pseudo random texel values are assigned. The above method need to have corresponding C bindings in PySoy so that it can be called from there. Another step was to add the required bindings for this.
Writing binding was bit tricky but not as tough as I anticipated. Actually I just added a few lines of code to the present bindings for Heightmap API. The most important part of it was to parse the parameters and pass the function as a g object, the rest is taken care by the LibSoy libraries.
With this done, I am almost in the beginning of week two and already pushed this much of work. By the way, I am also getting a hang of Mercurial, which is a version control system written in Python. It is similar to Git and easy to use. With the completion of week one, I have a clearer view of things lying ahead. Next step would be to implement the different noise functions.
So stay tuned to know more about the upcoming week.
No comments:
Post a Comment