Development > Artwork
Tools to generate textures
krilain:
Don't worry, in fact the problems come from the fact that I'm using the computer to test some modeling so that it was not a very good news to get this cygwin bug.
Anyway I think I've found the reason of this. Here for information : as far as I remember, I aborted a big part of a Tex package in download. When I asked cygwin after that to install all the packages I'd finally downloaded, cygwin possibly has met this uncomplete Tex package and unfortunately was unable to handle it. So it created a lot of directories named in Tex format which is properly undeletable with Windows - but , good point, removable in the cygwin console with rm. For my 4 Go, it is that I'd downloaded too much packages, moreover unuseful because I had most of them (like Perl) in spare parts somewhere else.
Ok, for the textures, what I would need it is quite simple. I'm looking for landscapes tiles that could in any maneer imitate (when melted properly) a top view over the earth.
Unless you're interested on training on this concrete case, I wouldn't ask you to make a sample because I still want to try another approach to compile your C file with the help of visual studio and the GSL library. I want this to work
krilain:
I just post a feedback here. Don't worry about the previous post, it's outdated.
So I've finally compiled the c++ part with gsl inside. Let me tell you that I've again encountered some strange problems. I tried first with QT4, which has a so nice editor, but linking was impossible (using visual C in fact). Then jumped to Visual studio directly, and again encountered some weird issue. The good new, is that, I have been following the first steps provided in the UFOAI wiki for compiling the game and downloaded the great Code Block. This one compiled the file almost immediatly. It uses directly some gcc, that apparently helps.
Ok, I have now to run it with your python script even if I wonder what new surprises are pending ;)
I would like to add some information here about the UFOAI wiki pages dealing with textures. I've read some part, some days ago, so I'm not sure about the links but this one is an example : Wiki..
I discovered there, that there could be a "pick effect" when tiling a texture, just like in tiling sounds. That requires to remove the low frequencies from there, and a gimp plugin helps for that. Anyway if you are fluent in gsl as you seem to be, you may remove those frequencies by advance in your tool when you get the time for that.
ps : compiled version of GSL here : Geldreich compiled gsl
fhstoica:
Hi,
I'm glad that you managed to compile the code, after a bit of digging I found that Python supports 2-dimensional FFTs directly via the numpy package:
http://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.fft2.html
http://sourceforge.net/projects/numpy/files/NumPy/1.6.2/
I may be able to put everything inside a single Python script that you can run from the Command Prompt in Windows.
Anyway, I tested the executable you posted, and it works perfectly.
The roughness you are mentioning can be controlled via the last parameter, the "power". The higher the value, (2 to 5) the smoother the image. A value between 1 and 2 will result in a rough image.
I have to read a bit more about the "pick effect" you mentioned, but the low frequencies can be removed by choosing a central_freq different than zero (for example 10, to 20).
Please let me know if you encounter any problems running the Python script, it should work with Python 2.7.
krilain:
--- Quote from: fhstoica on February 04, 2013, 04:37:50 pm ---I may be able to put everything inside a single Python script that you can run from the Command Prompt in Windows.
--- End quote ---
That's would be easier indeed. But why don't you use some more dedicated engine, like Scilab (powerful matlab clone) dedicated to matrix and including all FFT you could dream of :)
--- Quote from: fhstoica on February 04, 2013, 04:37:50 pm ---I have to read a bit more about the "pick effect" you mentioned, but the low frequencies can be removed by choosing a central_freq different than zero (for example 10, to 20).
--- End quote ---
Sorry that's more a "peak" effect. I'm not an english first language guy ;)
As far as I've understood, it is the same effect that you meet when you melt 2 or more identical sounds, the low frequencies make blank sound...
Edit : I've finally obtained my first texture generated by your process, attached below. I removed the part with sys.argv entry at start.py, and I'm entering them manually. I removed also the "make" part, and I let start.py use the exe directly. I don't use povray inside the .py, I just let it generate the surface.pov and open the povray editor. That's fine ;)
fhstoica:
Well, done! You got it working now. The two diagrams you posted explain the flow of the texture generation process very well. You basically wrote the documentation for it.
Time to go a bit more into the details:
First, in the povray.ini file the line:
+W1024 +H1024
controls the width and height of the rendered image, in pixels. As it stands it is set to 1024x1024.
You will notice in the Generate_Texture.py script in line 128:
outstring += 'object{surfface scale<1.33, 1, 1>}\n'
This scales the surface horizontally (the x-z plane is the horizontal, y is the vertical) so that the final texture has the same numbers of pixels horizontally and vertically. I found the 1.33 value by trial and error.
Feel free to modify the parameters in this line if you want to get a different shape, but it is a good idea to keep the value for the y-direction to 1:
scale<x_scale, 1, z_scale>
At the moment the surface is shifted and scaled vertically so that it takes values between 0 and 1 along the y-direction. This way it appears flat when seen from a narrow-angle camera located high above the surface (line 88 in Generate_Texture.py). Changing the y_scale can make perspective effects visible, so it is better to leave that value unchanged.
As for the color_map, at the moment it is defined as:
self.color_map = \
"""[0.0 color Green]
[0.125 color Blue]
[0.25 color Red]
[0.375 color Orange]
[0.5 color Sienna]
[0.625 color SteelBlue]
[0.75 color Cyan]
[0.875 color Yellow]
[1.0 color Magenta]"""
It specifies at each contour level (between 0 and 1) which color to use. POV-RAY will interpolate the RGB values between these levels. The predefined colors are specified in the colors.inc file of the POV-RAY installation. They can also be found here:
http://www.buckosoft.com/~dick/pov/colors.php
You can specify the colors in rgb format, for example "color rgb<1, 0, 0>" or rgbf format, for example:
color_map {
[0.00, 0.33 color rgb <0, 0, 1>
color rgb <0, 0, 1>]
[0.33, 0.66 color rgbf <1, 1, 1, 1>
color rgbf <1, 1, 1, 1>]
[0.66, 1.00 color rgb <0, 0, 1>
color rgb <0, 0, 1>]
Again, very good documentation (for pigments, in general) can be found here:
http://www.povray.org/documentation/view/3.6.1/77/
I still have to rewrite Generate_Texture.py to include the FFT as well.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version