Roland Melkert Wrote:Joshua Delahunty Wrote:Congratulations, Roland. This was easy for me to get working, and it looks fantastic in LDCad!Thanks,
[I did a half-mapping of each half-sphere, top and bottom -- was able to use the same image in either case, didn't have to slice or dice that at all]
The current implementation in LDCad uses a hack to make full sphere mapping possible as the literal spec will cause problems past 180 degree. So I'm using longitude / latitude mapping to generate the texture coordinates to get around that. It's an optional (currently enabled) feature though as I wasn't sure the spec was intended to support >180 deg (by limiting this on the authoring side.)
Also there will still be problems at the poles when using certain orientations of the texture (resulting from misalignment of vertices).
The original PLANAR work came straight from the OpenGL docs as a suggestion for this type of mapping.
The CYLINDRICAL and SPHERICAL specs were from the same book. We opted to try to make it as easy to implement as possible. I never figured it would take so many years, though It was MEANT to be really straightforward (create a set of U-Vs, the style would just change how they were calculated, the main loop should not have had to change much).
I actually only used half-and-half because it's what I hit on first that worked (model a half-sphere, get it texmapped, move on), I'm glad I didn't spend a bunch of time trying to use only one TEXMAP statement.
I'm talking to the author of Foundry (our reference platform) to try to get those implemented in there, and it looks like I'll be the one to patch LDView soon (with some pointers from Travis) -- I may be the Foundry programmer on this one too. I've asked Leo to consider them for LeoCAD. That only leaves BrickSmith as a concern right now, as I can't imagine doing this in software for MLCAD.
-- joshua