LDraw.org Discussion Forums
TEXMAP SPHERICAL - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: Models and Parts (https://forums.ldraw.org/forum-18.html)
+--- Forum: Parts Authoring (https://forums.ldraw.org/forum-19.html)
+--- Thread: TEXMAP SPHERICAL (/thread-18219.html)



TEXMAP SPHERICAL - Joshua Delahunty - 2015-12-07

While working on VEX parts (I know, boo; hiss, that's not LEGO) Smile, I finally had a real-world reason to map spherically.

The HEXBUG folks have a VEX IQ compatible set called Orbit, which is a built-it-yourself Orrery, and it includes three spheres that would need the texture mapping treatment (our Sun, the Earth and its moon).

I have mapped the latter two.

Congratulations, Roland. This was easy for me to get working, and it looks fantastic in LDCad!

[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]

-- joshua


Re: TEXMAP SPHERICAL - Roland Melkert - 2015-12-07

Joshua Delahunty Wrote:Congratulations, Roland. This was easy for me to get working, and it looks fantastic in LDCad!

[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]
Thanks,

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).


Re: TEXMAP SPHERICAL - Joshua Delahunty - 2015-12-07

Roland Melkert Wrote:
Joshua Delahunty Wrote:Congratulations, Roland. This was easy for me to get working, and it looks fantastic in LDCad!

[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]
Thanks,

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 Sad 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. Smile

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. Sad

-- joshua


Re: TEXMAP SPHERICAL - Joshua Delahunty - 2015-12-08

Yikes, just realized you already did the "earth thing". Here's a broader perspective...

-- joshua