Hi Iebele,
To use local u,v coordinate mapping (Lu,Lv) you need to use obj2mesh rather than obj2rad.
Here is the process for making a mesh element:
Define mats.tree.rad using simple materials first as an example.
The names of the materials must correspond to the names of the
materials indicated for the .obj geometry (take a look in the .mtl
file to get the names).
mats.tree.rad:
void plastic Bark
0
5 1 1 1 0 0
void plastic Leaf
0
5 1 1 1 0 0
Generate tree.rtm as follows:
obj2mesh -a mats.tree.rad tree.obj > tree.rtm
Creat tree.mesh.rad as follows:
tree.mesh.rad:
void mesh tree
1 tree.rtm
0
Test you mesh:
objview tree.mesh.rad
Now lets apply more complex materials using local u,v coordinate mapping. To do this you need the following image data:
1. bark.pic
2. aspect ratio for bark.pic (y/x), lets call it <arB>
3. leaf.pic
4. aspect ration for leaf.pic (y/x), lets call it <arL>
5. leaf.matte.pic - this is the alpha/matte channel for the
leaf. The correct way to setup the matte is for white to
represent the leaf and black to represent what is not the
leaf. This means that you may have to invert the matte the
comes from xfrog.
Now lets create the complex materials in mats.tree.rad
mats.tree.rad:
#BARK definition
void colorpict bark.tile
7 red green blue Bark.pic . frac(Lu) frac(Lv)*<arB>
0
bark.tile plastic Bark
0
5 1 1 1 0 0
#LEAF definition
void colorpict leaf.tile
7 red green blue Bark.pic . frac(Lu) frac(Lv)*<arL>
0
leaf.tile plastic leaf.map
0
5 1 1 1 0 0
leaf mixpict Leaf
7 leaf.map void green leaf.matte.pic . frac(Lu) frac(Lv)*<arL>
0
Now recompile your mesh:
obj2mesh -a mats.tree.rad tree.obj > tree.rtm
Now view it:
objview tree.mesh.rad
You should add Bark and Leaf to your ambient exclude file/list if you do not want them in the ambient calculation. You can use tree.mesh.rad along with replmarks, xform or some other method to deploy the tree object in the scene.
This should work fine. Let me know if you have any questions.
-Jack
Gregory J. Ward wrote:
Hi Iebele,
I can't be much help on this, as I'm not familiar with the model, but the general idea with local coordinates is that you don't have to do the mapping yourself. It's supposedly handled by the mesh generation software, and isn't affected by transformations as a global coordinate mapping would be.
I hope this is a helpful clue, as it's about all I have to offer.
-Greg
From: iebele <info@iebele.nl>
Date: April 3, 2007 8:39:12 AM PDT
Thanks Greg an Jack for your excellent and very helpfull suggestions.
I now have succesfully converted the .obj file to rad, using obj2rad ( polytrans did indeed work with Xfrog obj-files, but meshlab did not accept these files Lars ).
However I can't get the mapping right. I've tried a lot, but with no succes. Would you please share with me an example of the materials you use for the bark and the leaves?
I just don't really understand when and how to use Lu and Lv or frac(Lu) and frac(Lv) in the colorpict modifier and how these can ever be placed in a reasonable way on each triangle in the output of obj2rad, which in my case is like :
leaf_col_leaf2 polygon leaf22836.60976
0
9
-0.250204 0.195593 13.838
-1.00383 -0.956752 13.8816
-1.21881 -0.19178 13.5622
I never really understood the meaning of texture-coordinates, but at this time I feel that is what is missing here.
Is there a difference in using obj2rad and obj2mesh for this purpose ? I tried both but with the some odd results concerning the coordinate mapping.
-Iebele
_______________________________________________
Radiance-general mailing list
Radiance-general@radiance-online.org
http://www.radiance-online.org/mailman/listinfo/radiance-general
--
# Jack de Valpine
# president
#
# visarc incorporated
# http://www.visarc.com
#
# channeling technology for superior design and construction
------------------------------------------------------------------------
_______________________________________________
Radiance-general mailing list
Radiance-general@radiance-online.org
http://www.radiance-online.org/mailman/listinfo/radiance-general