[Radiance-general] Re: Texture mapping, openGL.

Greg Ward gregoryjward at gmail.com
Sun May 18 08:00:02 PDT 2008


Hi Iebele,

In order to explain the calculation of barycentric coordinates, I'd  
have to read and understand my code again, when it's easier just to  
use it.  This is one of the benefits of source code, after all -- you  
don't have to figure everything out all over each time you need it.   
The routines you want are in tmesh.{h,c} in src/common, and there is  
a nice routine comp_baryc() that makes it pretty easy.  In fact, the  
simplest thing to do is modify tmesh2rad to output what you want.   
Line 252 in src/cv/tmesh.c is just begging for a hack.

If C programming is a hurdle, you could probably construct a set of  
rcalc formats or macro replacements (m4) to substitute your mixpict's  
for the colorpict's that tmesh2rad produces.

Best of luck,
-Greg

> From: iebele <info at iebele.nl>
> Date: May 18, 2008 6:18:56 AM PDT
>
> Hi Greg,
>
> My model uses transparent textures, which is not supported by  
> tmesh2rad.
> Added some extras line in the output of tmesh2rad for the  
> tranparent texture, which works fine:
>
> void mixpict T-Pat
> 7 TCOLOR void green
> ./test_alpha.pic
> tmesh.cal u v
> 0 7
> 2
> 0.1  0.0  0.0
> 0.0  0.1  0.0
>
> It would be nice if I had a better understanding of  the A1-A7  
> variables. I like to calcultate these whitin my program, so I can  
> export the scene to radiance including the mixpict.
>
> Could you explain to me how to calculate the A1-A7 variables for  
> tmesh.cal, given a set of vertexcoordinates and  texturecoordinates?
>
> -Iebele
>
>
>> Hi Iebele,
>>
>> Did you try tmesh2rad?
>>
>> -Greg
>>
>>> From: iebele <info at iebele.nl>
>>> Date: May 17, 2008 3:29:44 PM PDT
>>>
>>> Dear all,
>>>
>>> I have a project running fine with textures in openGL which I  
>>> like to export to radiance.
>>> For the texture mapping in openGL texture coordinates are drawn  
>>> for every point of a polygon point like this:
>>>
>>>    glTexCoord2f ( tx, ty );
>>>    glNormal3f ( nx, ny, nz );
>>>    glVertex3f ( px, py, pz );
>>>
>>> I am puzzled how to translate this  into a radiance scene  
>>> description, /whithout/ the use of obj2mesh. Does any of you have  
>>> an example available of  a picture mapped on a polygon using  
>>> texture coordinates?
>>>
>>> -Iebele
>>



More information about the Radiance-general mailing list