Ambient exclude transfomed material in instances

Hi Greg and Iebele,

I have a comment and a question on this.

First, Iebele, I have also just gotten a 3D xfrog tree. FYI, it is possible to generate an obj, convert to a radiance mesh and use Local u,v coordinate mapping to get the leaf and bark materials to apply. I have a tree right now that basically has a few materials defined for it:

   1. bark with colorpict modifier
   2. leaf with colorpict modifier
   3. leaf-mix mixpict - this uses an alpha version of the leaf to mix
      between void (ie where the alpha is black) and the leaf material (2)

The question for Greg is this, to exclude the leaves from the ambient calculation what needs to be listed in the exclude file the "leaf" material and/or the "leaf-mix" material?

Iebele, the one thing to note is that the obj file that comes out of xfrog does not play well with obj2mesh or obj2rad. Thus I have to bring it into PolyTrans and re-export as an obj to get a file that radiance is happy with.

Best,

-Jack

Gregory J. Ward wrote:

···

Hello Iebele,

Since you have too many materials in your "ambient exclude" list, you're best hope is to switch to an "ambient include" list, instead. Create a file listing all of the materials, hopefully not xform'ed and duplicated like your leaves, that you would like to include in the interreflection calculation. These can be put in a file and incorporated with a single -aI option.

The other alternative is to switch off the irradiance cache using -aa 0 and assign other parameters to make the problem tractable over all surfaces.

-Greg

From: iebele <[email protected]>
Date: April 2, 2007 9:08:03 AM PDT

Hi,

I have a complex scene in which I use instances which I want to exclude from ambient calculation.

The problem is that I use !xform ..... with file A that include materials to create another file B that is later used as an instance.
I need the materials in file A excluded from ambient calculation.
The exclusion does not seem to work in my case, which makes the rendering times enormous ( lightyear - 0.01 % progress per hour in the picturel, very very much rays )

Any help is most welcome.

-Iebele

_______________________________________________
Radiance-general mailing list
[email protected]
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

Hi Jack,

Thanks for the idea of using obj2mesh.

As to your question, the final modifier is the one that must be excluded (or included) using the -a[eEiI] option. I Iebele's file, this means the mixpict modifier.

Do you know what error comes out of obj2mesh using the xfrog .OBJ file?

-Greg

···

From: Jack de Valpine <[email protected]>
Date: April 2, 2007 2:00:36 PM PDT

Hi Greg and Iebele,

I have a comment and a question on this.

First, Iebele, I have also just gotten a 3D xfrog tree. FYI, it is possible to generate an obj, convert to a radiance mesh and use Local u,v coordinate mapping to get the leaf and bark materials to apply. I have a tree right now that basically has a few materials defined for it:
bark with colorpict modifier
leaf with colorpict modifier
leaf-mix mixpict - this uses an alpha version of the leaf to mix between void (ie where the alpha is black) and the leaf material (2)
The question for Greg is this, to exclude the leaves from the ambient calculation what needs to be listed in the exclude file the "leaf" material and/or the "leaf-mix" material?

Iebele, the one thing to note is that the obj file that comes out of xfrog does not play well with obj2mesh or obj2rad. Thus I have to bring it into PolyTrans and re-export as an obj to get a file that radiance is happy with.

Best,

-Jack

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 <[email protected]>
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
[email protected]
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

Hi Iebele,

Your welcome. It is fortunate that I have also been starting to work with xfrog trees, so this is pretty fresh in my mind.

My experience with different trees in xfrog is pretty limited. I have experimented with one of the example ones, which is what I used to base the polytrans intermediate translation method on. The other one is from an xfrog tree that came with a pre-exported obj that I purchased on TurboSquid.

I am not sure how familiar you are with Polytrans. It does have some tools for (re)calculating uv tangent vectors. I wonder if this would be worth trying on one of the trees that causes problems.

-Jack

iebele wrote:

···

Hi Jack,

Wow, that is a nice tutorial you wrote! Thank you so much, it has been of great help, I now have the trees rendered exactly as they appear in xfrog.

The obj to obj conversion using Polytrans to prepare the files for feeding them to obj2mesh does not work for all the trees in the Xfrog libraries. The example files that are shipped with the demo version of Xfrog go well. But some (at least those I happen to work with) of the library files do not happily convert to a Radiance mesh using the obj to obj conversion in Polytrans. The coordinate mapping is lost somewhere during this proces - some warnings of both Polytrans and obj2mesh probably relate to that.

Exporting to 3DS in Xfrog, and convert that file to OBJ using Polytrans works fine for obj2mesh, apart from the fact that the whole model is rotated, which is solved by adding a transform:

       void mesh tree
       7 tree.rtm -rx 90 -ry 0 -rz 0
       0

-Iebele

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 <[email protected]>
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
[email protected]
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
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

_______________________________________________
Radiance-general mailing list
[email protected]
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