[Radiance-general] texture mapping

Greg Ward [email protected]
Thu, 22 May 2003 10:38:32 -0700


Hi Lebele,

> From: "atelier iebele abel - toren.com" <[email protected]>
>
> Q1.
>
> I experimented  with texture cordinates in the tmesh.cal parameters.
> Instead of u and v I used  :
> mod(u,max(1,1))  mod(u,max(1,1))
> I don't know what this really means, but I tried to tile the texture,
> like in picture.cal (tile_u tile_v)
> I get good results for only one part of my model ( the trunk of the 
> tree
> ) but other parts (the leaves) act very strange.
> Do you have a suggestions? And where can I find some documentation 
> about
> mod, frac, tri etc... (It is not explained in the book, is it?)

Chapter 4 in "Rendering with Radiance" covers some of the basics of 
.cal file construction, but many of the specifics you just have to pick 
up from looking at other .cal files, particularly the rayinit.cal file 
in ray/src/rt/.

I don't understand how you got any results from mod(u,max(1,1)) 
mod(u,max(1,1)), since the variable "u" is not defined.  You should 
have gotten an error from this specificaiton.  Probably what you meant 
to use was frac(Lu) frac(Lv), which are the same as mod(Lu,1) 
mod(Lv,1).  The functions frac(x) and mod(n,d) are defined in 
rayinit.cal.  This specification should work for a square image tile.

> Q2.
>
> When using tmesh2rad I specify a picture (-p). But what if I need a
> tranparant texture?
> Following your suggestion somewhere else in this discussion I create a
> transparant picture like the example below.
> These do not have texture coordinates like above, but as you will
> understand, I cannot write such for each triangle of a leave (more as
> 20.000 in a tree).
> Do you have a tip or workaround for this?

Yes -- instead of using tile_u and tile_v with picture.cal, specify "." 
for the .cal file and use frac(Lu) and frac(Lv) in both your colorpict 
and your mixpict primitives, using obj2mesh rather than tmesh2rad to 
convert your models.  Does this make sense?

-Greg