Osm2city.py textures: Difference between revisions

Jump to navigation Jump to search
m
fixed roof name, formatting
m (+cat)
m (fixed roof name, formatting)
Line 22: Line 22:
[[File:TexGUI added cut locations.jpg|thumb|texGUI: Added horizontal and vertical cut locations.]]
[[File:TexGUI added cut locations.jpg|thumb|texGUI: Added horizontal and vertical cut locations.]]


It is generally a good idea to use descriptive names, such as facade_industrial_old_white.png, but for this example we simply use facade.png.
It is generally a good idea to use descriptive names, such as "facade_industrial_old_white.png", but for this example we simply use "facade.png".


# Calibrate the image width/height. Find a feature in the image whose dimensions you know or can estimate. For example, simple windows are typically about 0.8 m wide. Here, we're using the aircon's width, estimated 0.82 m. Left drag to select that horizontal feature, then enter its length. Right drag for a vertical feature. You need only one of them. If both are given, both are used (e.g. if your image is stretched in one direction).
# Calibrate the image width/height. Find a feature in the image whose dimensions you know or can estimate. For example, simple windows are typically about 0.8 m wide. Here, we're using the aircon's width, estimated 0.82 m. Left drag to select that horizontal feature, then enter its length. Right drag for a vertical feature. You need only one of them. If both are given, both are used (e.g. if your image is stretched in one direction).
# mark locations at which osm2city.py may cut the texture. Use left and right mouse buttons. Shift+click removes the last marker.
# Mark locations at which osm2city.py may cut the texture. Use left and right mouse buttons. Shift+click removes the last marker.
# Once you're satisfied, click "dump and quit". This writes calibration/cut data to a file "facade_24x19m.py". Note that texGUI added "_24x19m" to the texture file name (the original file is still in place), since you're likely to have more than one texture for an industrial facade.
# Once you're satisfied, click "dump and quit". This writes calibration/cut data to a file "facade_24x19m.py". Note that texGUI added "_24x19m" to the texture file name (the original file is still in place), since you're likely to have more than one texture for an industrial facade.


Line 42: Line 42:


Usually you need to change very little here.
Usually you need to change very little here.
* you can set our texture to wrap around in at most one direction using h_can_repeat or v_can_repeat
* You can set the texture to wrap around in at most one direction using ''h_can_repeat'' or ''v_can_repeat''
* If v_align_bottom is True, osm2city.py will align the bottom part of the texture with the ground and cut away the top part if neccessary. Otherwise, it will align the top part with the roof and cut away the bottom.
* If ''v_align_bottom'' is True, osm2city.py will align the bottom part of the texture with the ground and cut away the top part if neccessary. Otherwise, it will align the top part with the roof and cut away the bottom.


For reference, we now descibe the format in a bit more detail. You might want to skip to the [[Osm2city.py_Textures#Texture_compatibility|next section]].
For reference, we now descibe the format in a bit more detail. You might want to skip to the [[Osm2city.py_Textures#Texture_compatibility|next section]].
Line 72: Line 72:


A lightmap is required for every texture, having the same file name with a postfix "_LM".  So for our example this would be
A lightmap is required for every texture, having the same file name with a postfix "_LM".  So for our example this would be
facade_24x19m_LM.png
"facade_24x19m_LM.png"


Osm2city uses
Osm2city uses
* red channel for window lights
* red channel for window lights
* green channel for ambient street lights shining onto facade.
* green channel for ambient street lights shining onto facade
* blue and alpha unused
* blue and alpha unused


Line 83: Line 83:
== Install texture and lightmap ==
== Install texture and lightmap ==
* copy texture and lightmap to tex.src/
* copy texture and lightmap to tex.src/
* add the snippet from facade_24x19m.py to textures.py:init() starting around line 300
* add the snippet from "facade_24x19m.py" to textures.py:init() starting around line 300


If you're adding a roof, name your texture roof_something.png and use
If you're adding a roof, name your texture "roof_something.png" and append it to the list of ''roofs'' (instead of ''facades'')
<syntaxhighlight lang="python">
<syntaxhighlight lang="python">
roofs.append(Texture('tex.src/roof.png',
roofs.append(Texture('tex.src/roof_something.png',
</syntaxhighlight>
</syntaxhighlight>


153

edits

Navigation menu