Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extracting Blender Original Coordinates (ORCO)

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.

like image 763
kvark Avatar asked Apr 27 '11 18:04

kvark


1 Answers

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.

like image 86
kvark Avatar answered Oct 05 '22 04:10

kvark