# Ambient exclude transfomed materialin	instances

**URL:** <https://discourse.radiance-online.org/t/ambient-exclude-transfomed-materialin-instances/278>\
**Category:** radiance-general\
**Created:** [April 3, 2007, 5:15pm UTC](https://discourse.radiance-online.org/t/ambient-exclude-transfomed-materialin-instances/278 "2007-04-03T17:15:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giulio\_Antonutto1](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/g/9e8a1a/32.png) [@Giulio\_Antonutto1](https://discourse.radiance-online.org/u/Giulio_Antonutto1)\
**Post date:** [April 3, 2007, 5:15pm UTC](https://discourse.radiance-online.org/t/ambient-exclude-transfomed-materialin-instances/278/1 "2007-04-03T17:15:49Z")

</div>

some UV stuff here and hopefully not too many mistakes...

[http://web.mac.com/geotrupes/iWeb/Main%20site/RadBlog/3690C181-7F9F-43AD](http://web.mac.com/geotrupes/iWeb/Main%20site/RadBlog/3690C181-7F9F-43AD)  
-B5B2-A5D239AD503E.html

G.

> **···**
>
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
> 
> From: [radiance-general-bounces@radiance-online.org](mailto:radiance-general-bounces@radiance-online.org)  
> [[mailto:radiance-general-bounces@radiance-online.org](mailto:radiance-general-bounces@radiance-online.org)] On Behalf Of Jack  
> de Valpine  
> Sent: 03 April 2007 18:10  
> To: Radiance general discussion  
> Subject: Re: [Radiance-general] Ambient exclude transfomed materialin  
> instances
> 
> 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  
> 0  
> 5 1 1 1 0 0
> 
> void plastic Leaf  
> 0  
> 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  
> 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.
> 
> &nbsp;&nbsp;Now lets create the complex materials in mats.tree.rad
> 
> &nbsp;&nbsp;mats.tree.rad:
> 
> &nbsp;&nbsp;#BARK definition  
> &nbsp;&nbsp;void colorpict bark.tile  
> &nbsp;&nbsp;7 red green blue Bark.pic . frac(Lu) frac(Lv)\*\<arB\>  
> &nbsp;&nbsp;0  
> &nbsp;&nbsp;0  
> &nbsp;&nbsp;  
> &nbsp;&nbsp;bark.tile plastic Bark  
> &nbsp;&nbsp;0  
> &nbsp;&nbsp;0  
> &nbsp;&nbsp;5 1 1 1 0 0  
> &nbsp;&nbsp;  
> &nbsp;&nbsp;#LEAF definition  
> &nbsp;&nbsp;void colorpict leaf.tile  
> &nbsp;&nbsp;7 red green blue Bark.pic . frac(Lu) frac(Lv)\*\<arL\>  
> &nbsp;&nbsp;0  
> &nbsp;&nbsp;0  
> &nbsp;&nbsp;  
> &nbsp;&nbsp;leaf.tile plastic leaf.map  
> &nbsp;&nbsp;0  
> &nbsp;&nbsp;0  
> &nbsp;&nbsp;5 1 1 1 0 0  
> &nbsp;&nbsp;  
> &nbsp;&nbsp;leaf mixpict Leaf  
> &nbsp;&nbsp;7 leaf.map void green leaf.matte.pic . frac(Lu) frac(Lv)\*\<arL\>  
> &nbsp;&nbsp;0  
> &nbsp;&nbsp;0
> 
> &nbsp;&nbsp;Now recompile your mesh:
> 
> &nbsp;&nbsp;obj2mesh -a mats.tree.rad tree.obj \> tree.rtm
> 
> &nbsp;&nbsp;Now view it:
> 
> &nbsp;&nbsp;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\> \<[mailto:info@iebele.nl](mailto: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  
> 0  
> 9  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-0.250204 0.195593 13.838  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-1.00383 -0.956752 13.8816  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-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](mailto:Radiance-general@radiance-online.org)  
> [http://www.radiance-online.org/mailman/listinfo/radiance-general](http://www.radiance-online.org/mailman/listinfo/radiance-general)
> 
> --  
> # Jack de Valpine  
> # president  
> #  
> # visarc incorporated  
> # [http://www.visarc.com](http://www.visarc.com)  
> #  
> # channeling technology for superior design and construction  
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Electronic mail messages entering and leaving Arup business  
> systems are scanned for acceptability of content and viruses

---

<div class="post-metadata">

**Author:** ![Jack\_de\_Valpine](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/j/aca169/32.png) [@Jack\_de\_Valpine](https://discourse.radiance-online.org/u/Jack_de_Valpine)\
**Post date:** [April 3, 2007, 5:40pm UTC](https://discourse.radiance-online.org/t/ambient-exclude-transfomed-materialin-instances/278/2 "2007-04-03T17:40:21Z")

</div>

Hi Giulio,

I just checked out your RadBlog. There are some nice tips, tricks and hints here.

Best,

-Jack

Giulio Antonutto wrote:

> **···**
>
> > some UV stuff here and hopefully not too many mistakes...
> > 
> > [http://web.mac.com/geotrupes/iWeb/Main%20site/RadBlog/3690C181-7F9F-43AD-B5B2-A5D239AD503E.html](http://web.mac.com/geotrupes/iWeb/Main%20site/RadBlog/3690C181-7F9F-43AD-B5B2-A5D239AD503E.html)
> > 
> > G.
> > 
> > ------------------------------------------------------------------------
> > 
> > \*From:\* radiance-general-bounces@radiance-online.org [mailto:radiance-general-bounces@radiance-online.org] \*On Behalf Of \*Jack de Valpine  
> > \*Sent:\* 03 April 2007 18:10  
> > \*To:\* Radiance general discussion  
> > \*Subject:\* Re: [Radiance-general] Ambient exclude transfomed materialin instances
> > 
> > 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:
> > 
> > &nbsp;&nbsp;&nbsp;1. bark.pic  
> > &nbsp;&nbsp;&nbsp;2. aspect ratio for bark.pic (y/x), lets call it \<arB\>  
> > &nbsp;&nbsp;&nbsp;3. leaf.pic  
> > &nbsp;&nbsp;&nbsp;4. aspect ration for leaf.pic (y/x), lets call it \<arL\>  
> > &nbsp;&nbsp;&nbsp;5. leaf.matte.pic - this is the alpha/matte channel for the leaf.  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The correct way to setup the matte is for white to represent  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the leaf and black to represent what is not the leaf. This means  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;that you may have to invert the matte the comes from xfrog.
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;Now lets create the complex materials in mats.tree.rad
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;mats.tree.rad:
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;#BARK definition  
> > &nbsp;&nbsp;&nbsp;&nbsp;void colorpict bark.tile  
> > &nbsp;&nbsp;&nbsp;&nbsp;7 red green blue Bark.pic . frac(Lu) frac(Lv)\*\<arB\>  
> > &nbsp;&nbsp;&nbsp;&nbsp;0
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;bark.tile plastic Bark  
> > &nbsp;&nbsp;&nbsp;&nbsp;0  
> > &nbsp;&nbsp;&nbsp;&nbsp;5 1 1 1 0 0
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;#LEAF definition  
> > &nbsp;&nbsp;&nbsp;&nbsp;void colorpict leaf.tile  
> > &nbsp;&nbsp;&nbsp;&nbsp;7 red green blue Bark.pic . frac(Lu) frac(Lv)\*\<arL\>  
> > &nbsp;&nbsp;&nbsp;&nbsp;0
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;leaf.tile plastic leaf.map  
> > &nbsp;&nbsp;&nbsp;&nbsp;0  
> > &nbsp;&nbsp;&nbsp;&nbsp;5 1 1 1 0 0
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;leaf mixpict Leaf  
> > &nbsp;&nbsp;&nbsp;&nbsp;7 leaf.map void green leaf.matte.pic . frac(Lu) frac(Lv)\*\<arL\>  
> > &nbsp;&nbsp;&nbsp;&nbsp;0
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;Now recompile your mesh:
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;obj2mesh -a mats.tree.rad tree.obj \> tree.rtm
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;Now view it:
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;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\> \<mailto: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  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-0.250204 0.195593 13.838  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-1.00383 -0.956752 13.8816  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-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 \<mailto:Radiance-general@radiance-online.org\>  
> > [http://www.radiance-online.org/mailman/listinfo/radiance-general](http://www.radiance-online.org/mailman/listinfo/radiance-general)
> > 
> > --  
> > # Jack de Valpine  
> > # president  
> > #  
> > # visarc incorporated  
> > # [http://www.visarc.com](http://www.visarc.com)  
> > #  
> > # channeling technology for superior design and construction  
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > Electronic mail messages entering and leaving Arup business  
> > systems are scanned for acceptability of content and viruses  
> > &nbsp;&nbsp;------------------------------------------------------------------------
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > Radiance-general mailing list  
> > Radiance-general@radiance-online.org  
> > [http://www.radiance-online.org/mailman/listinfo/radiance-general](http://www.radiance-online.org/mailman/listinfo/radiance-general)  
> > &nbsp;&nbsp;  
> > --  
> > # Jack de Valpine  
> > # president  
> > #  
> > # visarc incorporated  
> > # [http://www.visarc.com](http://www.visarc.com)  
> > #  
> > # channeling technology for superior design and construction
