|
|
Line 1: |
Line 1: |
− | == Image formatting == | + | == Script talk == |
− | I'm putting out a request for help from the more experienced wiki users on a few matters:
| + | * I moved the (GUI) script to an extra page so it is possible to download it here AND edit it with the wiki interface. See [[HowTo:Radiosity baking in Blender#Script]] and [[HowTo:Radiosity baking in Blender/vccopy.py]]--[[User:pontiac|Pontiac]] 16:47, 23 Sep 2005 (PDT) |
− | * Image formatting: Is there a way of inserting some (vertical) space between the images and the text? Image captions? --[[User:tiny paintings|tiny paintings]] 12:22, 22 Sep 2005 (PDT)
| |
− | ** Space is possible via several ways (CSS padding/spacing, tables, etc...) where do you want to add spaces? --[[User:pontiac|Pontiac]] 13:10, 22 Sep 2005 (PDT)
| |
− | *** Here: [[HowTo:Radiosity_baking_in_Blender#A_step_by_step_guide]]. --[[User:tiny paintings|tiny paintings]] 13:19, 22 Sep 2005 (PDT)
| |
− | **** Ok, done (by using <nowiki><BR/></nowiki>s). Now the auto-numbering is correct again as well (no newlines). --[[User:pontiac|Pontiac]] 09:02, 23 Sep 2005 (PDT)
| |
− | ** images captions, thumbnails etc... are only (possible (at least easy) with the wiki-uploaded pictures. Depends on what you want to do. --[[User:pontiac|Pontiac]] 13:10, 22 Sep 2005 (PDT)
| |
− | | |
− | == Geometry changes ==
| |
− | I've followed the tutorial exactly and it does what i expected (not to the end though). But there are a few points that do not work as expected:
| |
− | * The Mesh created by the radiosity progress has a different vertex-count than the source mesh (without the sphere and with <code>MaxEl</code> set to 1)--[[User:pontiac|Pontiac]] 12:29, 23 Sep 2005 (PDT)
| |
− | ** YADDAYADDA
| |
− | *** Ok, here's the test file i mentioned above: [http://vegastrike.sourceforge.net/users/tiny_paintings/radiosity_baking_04_rad.blend radiosity_baking_04_rad.blend]<BR/>On the 1. layer is the original mesh (OB:"Cube") with the vertex colors already applied (and messed up). On the 3. layer ist the geometry that was created by the rad-process (OB:"Mesh.002"). (you can ignor the 2. layer since it's just a copy of the 1. with the same material) --[[User:pontiac|Pontiac]] 01:30, 25 Sep 2005 (PDT)
| |
− | **** Can't open it. Send it to seaghost at hellokitty.com, and include an .obj of the original mesh. --[[User:tiny paintings|tiny paintings]] 05:12, 25 Sep 2005 (PDT)
| |
− | ***** Uploaded it (+OBJ files) again:<BR/>[http://vegastrike.sourceforge.net/users/tiny_paintings/radiosity_baking_04_rad.blend radiosity_baking_04_rad.blend]<BR/>[http://vegastrike.sourceforge.net/users/tiny_paintings/radiosity_baking_04.obj radiosity_baking_04.obj]<BR/>[http://vegastrike.sourceforge.net/users/tiny_paintings/radiosity_baking_04.mtl radiosity_baking_04.mtl]<BR/>--09:15, 25 Sep 2005 (PDT)
| |
− | ***** I still can't get the blend file to work, or rather it seems I can't download it. It downloads at 0.3 kb/s and seems to cancel after a while, says it's done though. Weird, very weird. There other files download fast and are okay. I tried, however, the obj file. With success. Radiosity baked okay and the texture baked dandily too. Are you using the latest version of blender? --[[User:tiny paintings|tiny paintings]] 12:52, 25 Sep 2005 (PDT)
| |
− | ****** I'm using the Blender Bersion 2.37a here (most recent Debian package). Just sent you a mail with the file attached. Dunno why downlaod doesn't work for you. It certainly does for me :-/ --[[User:pontiac|Pontiac]] 13:08, 25 Sep 2005 (PDT)
| |
− | ****** Okay, I'm able to reproduce your problems now. After a little stdout-debugging I (think I) have found the problem. The object center changes after the radio baking => sorting is messed up because it's done on object space coords. As I see it there are two possible solutions: 1) Transform object space coords -> world space and sort on that (how??) 2) change the object centers (again, how??). --[[User:tiny paintings|tiny paintings]] 05:45, 26 Sep 2005 (PDT)
| |
− | ******* I have a working remedy. I did object -> world transformations. Might not be pretty but it works. I'll post it in a sec... --[[User:tiny paintings|tiny paintings]] 06:04, 26 Sep 2005 (PDT)
| |
− | ******* You might need the absolute coordiantes of the object and add them to the relatives (if i understand the documentation at [http://www.blender3d.org/documentation/237PythonDoc/Object.Object-class.html#loc] or [http://www.blender3d.org/documentation/237PythonDoc/Object.Object-class.html#getLocation] right that is)<BR/><code>object_coords = Blender.Object.Get(ObjectName).loc()</code><BR/>or<BR/><code>object_coords = ...........getLocation()</code><BR/>I don't know if this is already with or without the objects transformation data. But that shouldt be a problem for this simple script. --[[User:pontiac|Pontiac]] 06:34, 26 Sep 2005 (PDT)
| |
− | ******* Ah, i've seen you answer too late ;) --[[User:pontiac|Pontiac]] 06:09, 26 Sep 2005 (PDT)
| |
− | ******* Go try it out so we can wipe this little talk-abomination clean! :) --[[User:tiny paintings|tiny paintings]] 06:15, 26 Sep 2005 (PDT)
| |
− | ******* Ok, i'll try, but this should really be done by the script (if possible, of course). See my comment above. --[[User:pontiac|Pontiac]] 06:34, 26 Sep 2005 (PDT)
| |
− | ******** It does what you suggested, and then some. Translation, scaling, rotation etc. is all in the object to world space matrix. --[[User:tiny paintings|tiny paintings]] 06:37, 26 Sep 2005 (PDT)
| |
− | ******** Ah, ok. I haven't seen the code changes (damn proxy), so i though you meant a menu command (i'm at work right now, so i'll respond later). --[[User:pontiac|Pontiac]] 06:55, 26 Sep 2005 (PDT)
| |
− | ******** Ok, i've got Blender to run here and tested you modified script. It works like a charm now :D I think this talk section can be removed now. --[[User:pontiac|Pontiac]] 07:17, 26 Sep 2005 (PDT)
| |
− | | |
− | == Script Talk ==
| |
− | * There is a third point, but it was only a script error, which i fixed already. (a missing ":")
| |
− | ** I'm making some changes to the tooltip description of the new script, since it's a bit off, really. --[[User:tiny paintings|tiny paintings]] 15:55, 23 Sep 2005 (PDT)
| |
− | *** I confess that i didn't check the tooltips before posting it here ;) Thanks --[[User:pontiac|Pontiac]] 16:21, 23 Sep 2005 (PDT)
| |
− | *** Ah, now i know what you mean, the whole "radiosity data" things i wrote. I inserted that as a dummy (data generated by the radiosity process) ;) --[[User:pontiac|Pontiac]] 16:47, 23 Sep 2005 (PDT)
| |
− | ** Also, the tutorial is becoming rather cluttered with two scripts in it. Maybe you can put my original script in a file, say vccopy.py, and link to it? The GUI-capable script should be downloadable too to avoid the unnecessary copy-open_emacs-paste-save procedure. --[[User:tiny paintings|tiny paintings]] 15:55, 23 Sep 2005 (PDT)
| |
− | *** If you have no problem with it i would vote to keep only the new (GUI) script (your script is 'nearly 1:1 in there), but keep the original script on the talk page for reference. (less clutter on the main page) ... concentrating on one single script is the way to go IMHO --[[User:pontiac|Pontiac]] 16:21, 23 Sep 2005 (PDT)
| |
− | *** I moved the (GUI) script to an extra page so it is possible to download it here AND edit it with the wiki interface. See [[HowTo:Radiosity baking in Blender#Script]] and [[HowTo:Radiosity baking in Blender/vccopy.py]]--[[User:pontiac|Pontiac]] 16:47, 23 Sep 2005 (PDT)
| |
| === Possible improvments === | | === Possible improvments === |
| * Somehow change the script so that it sets the object centers correctly. Then we can remove the object->world transformation, sort on object space coords and and the vertex color copy would work even if one or both of the meshes are moved around. Not very urgent, just don't move the meshes around! | | * Somehow change the script so that it sets the object centers correctly. Then we can remove the object->world transformation, sort on object space coords and and the vertex color copy would work even if one or both of the meshes are moved around. Not very urgent, just don't move the meshes around! |
| | | |
− | == old Script== | + | == Original script== |
− | ''This is the original Script by [[User:tiny paintings|tiny paintings]]. See the main page for the most recent version'' | + | ''This is the original Script by [[User:tiny paintings|tiny paintings]]. See the main page for the most recent version.'' |
| + | |
| + | :'''Warning: This script contains a serious bug and will only work if your objects origin (the little purple dot) is in the origin.''' |
| | | |
| You have to pardon my python n00bness, this is all I could come up with. Feel free to improve it! | | You have to pardon my python n00bness, this is all I could come up with. Feel free to improve it! |
Script talk
Possible improvments
- Somehow change the script so that it sets the object centers correctly. Then we can remove the object->world transformation, sort on object space coords and and the vertex color copy would work even if one or both of the meshes are moved around. Not very urgent, just don't move the meshes around!
Original script
This is the original Script by tiny paintings. See the main page for the most recent version.
- Warning: This script contains a serious bug and will only work if your objects origin (the little purple dot) is in the origin.
You have to pardon my python n00bness, this is all I could come up with. Feel free to improve it!
import Blender
# WHAT DOES IT DO?
# This script copies the vertex color information from one mesh
# to another, and does so correctly assuming the meshes have the
# same geometry, vertex-wise.
# IMPORTANT: Assumes meshes with exactly equal geometry, vertex-wise.
fromObj = "Mesh" # Set this to the resulting mesh from radio calcuation
toObj = "Fuselage_default" # Set this to the name of your original, UV-mapped mesh.
me_from = Blender.Object.Get(fromObj).getData()
me_to = Blender.Object.Get(toObj).getData()
if not me_to and not me_from:
print "ERROR: Source/destination object does not exist"
elif len(me_to.verts) != len(me_from.verts):
print "ERROR: Source and destination objects must have the same number of vertices"
else:
# make two lists sorted on coordinates,
# containing a face and vertex index i and j respectively
l_to = []
l_from = []
# format: [ (x,y,z, face index, vertex index), ... ]
for i in range(len(me_to.faces)):
for j in range(len(me_to.faces[i].v)):
vert = me_to.faces[i].v[j].co
l_to.append((vert[0], vert[1], vert[2], i, j))
for j in range(len(me_from.faces[i].v)):
vert = me_from.faces[i].v[j].co
l_from.append((vert[0], vert[1], vert[2], i, j))
# Sort the lists after vertex coordinates
l_to.sort()
l_from.sort()
for i in range(len(l_to)):
to_f = l_to[i][3]
from_f = l_from[i][3]
to_v = l_to[i][4]
from_v = l_from[i][4]
me_to.faces[to_f].col[to_v] = me_from.faces[from_f].col[from_v]
me_to.update()
print "Copied vertex color information from object "+fromObj+" to object "+toObj+"."