[Radiance-general] obj2mesh, UV coordinates and image aspect

Thomas Bleicher tbleicher at arcor.de
Mon Feb 20 13:21:42 CET 2006


On 20.02.2006, at 10:39, Francesco Anselmo wrote:

> I remember having similar problems and having fixed them with this
> check:
> w,h = img.getSize()
> if w>h:
>    objfile.write("vt " + str(uvco[0]*(float(w)/float(h))) + " " +
> str(uvco[1]) + "\n")
> else:
>    objfile.write("vt " + str(uvco[0]) + " " +
> str(uvco[1]*(float(h)/float(w))) + "\n")

Thanks for the hint. I mad a few tests with different images
and found that the exported UV coords are always in the range
(0,1) for _both_ dimensions. I think this is the common range
for UVs in all CG applications except Radiance. Here we have
coords range (0,1) for the smaller dimension and (0,l/s) for
the larger, so above 1 for all non-square images.

As a result the texture image area is croped to the lower left
square of the image. Your code multiplies the coords for the
larger side with the image aspect (>1!) to cover the whole
image in Radiance texture space. I'll have to go that way, too,
(no big thing for a dedicated Radiance exporter) but I wish
there was a way to define the texture with the right image aspect
so any uv enabled *.obj file could be mapped correctly without
rewriting the coords.

> void colorpict facematerialbasename
> 7 red green blue facematerialbasename.pic . Lu Lv
> 0
> 0

Just checked the meaning of 'frac()' and I think Lu/Lv is in
fact the better choice for uv coord mapping than frac(Lu/Lv).
The vertices do not have to cover the whole image after all.

> Hope to have understood your problem, and that this helps.

Yes. Another step closer to Blender world domination.

Thomas



More information about the Radiance-general mailing list