I've made an exporter (in Python) from Blender (2.5+) to a custom format. What bothers me is that most models I download contain no UV layers but instead are using auto-generated texture coordinates.
The question is: how can I access Blender-generated coordinates (ORCO) from Python?
Edit-2: Example file: http://dl.dropbox.com/u/16317117/orco.blend
Created by loading the default scene with a cube and changing its texture unit type to 'Wood'. The default mapping is already Generated:Flat. If you render the scene, you can see that wood texture is applied correctly, as if the cube had a proper UV unwrap.
Edit-3: The Answer.
I've found an answer in the Yafaray blender exporter source. Thank you, guys! If you see this thread - please, respond, so that I can award you a bounty.
Generated coordinate (ORCO) is a 'normalized' local coordinate of the vertex. Basically, given the local bounding box of the object: Orco(v) = 2*(v-center)/size
.
Generated coordinate (ORCO) is a 'normalized' local coordinate of the vertex. Basically, given the local bounding box of the object: Orco(v) = 2*(v-center)/size.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With