THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/08/2012 at 10:01, xxxxxxxx wrote:
User Information:
Cinema 4D Version:
Platform:
Language(s) :
---------
Hello,
I'am programmatically creating a mesh which in fact is nothing than just a deformed plane. I want to create an UVW tag onto the virtual object of my generator object to enable UVW mapping for texture-tags. But my current approach is not giving satisfying results.
The algorithm is to lay out the points of the mesh just like a plane in 2D space, and it looks ok in the UV Edit editor.
if (info.generate_uvw) {
UVWTag* tag = UVWTag::Alloc(n_polys);
if (not tag) {
goto end;
}
info.target->InsertTag(tag);
UVWStruct uvwpoly;
LONG poly_i = 0;
Real useg = (Real) info.useg; // Width Segments
Real vseg = (Real) info.vseg; // Height Segments
for (LONG i=0; i < info.useg; i++) {
for (LONG j=0; j < info.vseg; j++) {
uvwpoly.d = Vector((i / useg), (j / vseg), 0);
uvwpoly.c = Vector(((i + 1) / useg), (j / vseg), 0);
uvwpoly.b = Vector(((i + 1) / useg), ((j + 1) / vseg), 0);
uvwpoly.a = Vector((i / useg), ((j + 1) / vseg), 0);
tag->SetSlow(poly_i, uvwpoly);
poly_i++;
}
}
}
The edges might appear like disabled Phong, but it isn't.
No changes were made to the phong tag.
Is there some deep magic behind UVW generation? :smile:
Thank you in advance,
Niklas