Important Message

You are browsing the archived Lancers Reactor forums. You cannot register or login.
The content may be outdated and links may not be functional.


To get the latest in Freelancer news, mods, modding and downloads, go to
The-Starport

texturing planets - breaking the limit

Here you can discuss building custom ships, texturing and 3D modeling in Freelancer

Post Mon Jan 31, 2005 3:25 pm

texturing planets - breaking the limit

Here is a recent screenshot of Jupiter for my TC:

http://img189.exs.cx/img189/3692/screen346hx.jpg (~380kb)


As you can see the texture is messed. Now I am looking for the reason. If this issue is resolved the doors are open to fully customized planet textures, people, so let's crack this baby open!

What you can see here, and I have confirmed it additionally with test textures containing numbers on them, is that Freelancer is mapping a sphere with a cube UVW, and can put a different image in any side of the cube. That means 6 sides, 6 textures.

Now, I modelled a 3D jupiter at high resolution in 3ds max, and rendered images of it exactly from top, bottom, front, back, left and right.

Those pictures make up the textures after some editing. First, I cut out the planet itself in PaintShopPro (with the "magic hand" a matter of seconds), so I had the plain planet shots from all sides. Now, those had a size of 1211x1211 each. So, to calculate the square that actually makes up the texture put on one of the UV-cube's sides, I found an easy way. The diagonal of the square is exactly the diameter of the visible sphere, which is said 1211 pixels. So, with a bit of basic geometry, the result was a suqare size of 856x856 (which can be used, btw, for all my planetary renders sicne they are on same scale etc., just different textures on the same sphere). Now, I cut exactly that out and put it on the sides. The result is shown on the screenshot image.

On the top side, you see the upper cap of the sphere. The red thing directly in the edge is actually - seen from above the original sphere, part of the red ring on the surface that you can see quite some space below!

Now, the reason for this is quite simple. The cube is inside the planet, not outside around it. In other words, for those that can understand this kind of things, I calculated the cut-out square from a plain circle, and did not the whole thing from a sphere.

I will go ahead and try again cutting the texture out of the renders. This time, I will not calculate the square size in a circle image, but the cube size inside a 3-dimensional sphere. From thast cube I should get smaller squares as sides than my 856x856 (ignore the actual number, as stated it depends on the original render image size, and it was huge). Applying those should do the job, well, in theory.

I will keep you up to date with screenshots once I have textured it again.

What I have seen so far is proof enough that there is a mathematical way to find the actual square to cut out of those renders. Once you know those, you can put up pretty much any texture on a planet, and by adding additional material entries in the MAT and TXM file, you can have real 6-sided maps. Some people say planets use the same texture for the front and the back etc., but that's just because MS seemed lazy to make up all 6, but you can still do them yourself, since the original SPH file defines all 6 (pluse the atmosphere), but just assigns 1 texture to 2 opposite sides of the cube simply.

EDIT: I love mathematics. 30 seconds after posting and jsut started doing skethces and algebra, I found the formula. The square's edges must have a length of

a=d/sqrt(3)
(d=diameter of the sphere, sqrt(3)= sqare root of 3)

instead of my old formula
a=d/sqrt(2)

Instead of the original formula of Pythagoras, you need the enhance version, which is not a²+b²=c², but a²+b²+c²=d² in a 3-dimensional space!

UPDATE:
http://img189.exs.cx/img189/4204/screen364ka.jpg

Looks even worse.

Now, and I only realized this at this very point (i.e 2 minutes before I am writing this ), that I cannot simply cut out squares., as FL is using square textures, but they are then deformed to fit on the exploded cube.

That makes things worse. I understand now what part of the texture I have to cut out exactly, it is a square but with edges bent out. I just need a way to define this exactly, either in 3ds max in PaintShopPro.

I will try a couple of things. I might try to somehow use a Box UV gizmo in 3dsmax used with some fitting deforming modifier (if possible), or create a box deformed in the very way you can see it on the screenshots, and make new renders with the edges of that box visible on top of the sphere, so that you can use those lines ot cut the shape out, and after that somehow bend it to a square *shrugs*.
Thinking of it, the last part seems impossible so far in gaphics editing for me. I think I will have to go with the 3D solution. Whatever kind that exactly is.

Any help is appreaciated. It is not anymore a secret what we do need, but the problem is: What are the tools we need to create this? I, for my part, will play a bit with 3ds max, as I can imagine there could be something I haven't just used yet at all (so many many functions) that does exactly this. Hmm.

I hope you could follow me, as this matter is somehow hard to explain, I can pretty much see the spheres and cubes and squares in my mind, but bringing it to text so you can get what I am saying is kind of hard, so tell me if something is unclear.

Upate (last one for tonight):
I tried around in 3dsmax, I couldn't find a method so quickly, and the render-to-texture function does not behave the way FL uses for planets.

I have already thought of simply making a custom object, but I don't want to.

Now to the original HighRes renderings again. to experiment, I did an overlay of the cut-out square on the original visible circle (sphere seen from one side.

I found if I could simply draw the circle that has the same diameter as the diagonals of this square and cut that circle then out, I would have the actual shape in FL. I would then only have to find some kind of squeeze function that could deform this to a square.
But I also would need a way to exactly select this circle. Drawing with the mosue is not precise enough, there should be a way to enter a number!

Edited by - Mephistopheles on 1/31/2005 4:34:27 PM

Post Mon Jan 31, 2005 4:27 pm

Meph, the planet I sent you used a spherical map. You do not have to use cubemaps- take your sphere into UVMapper and give it a sphere map, and then export the CMP...

FL's planets generally do use cubemaps, but that was just a choice the modelers made- FL supports spherical, cubical and planar mapping.

Post Tue Feb 01, 2005 1:05 am

Due, thanks. I did not know FL would support spherical maps, since the exporter crashed on na cylindrical, I though it wouldn't do spherical. Woot, jupiter now is as it should.

I will leave the original sph, make it a tad smaller, include a cmp with phantom physics around it for the visual, but do all normal stuff to the sph like atmopshere, the wireframe in the hud etc. by simply making the cmp mesh non-targetable.

Still sad I did not manage to make a texture for a sph. Well, I think I can live with that as no one will see the difference actually in the end.

Post Tue Feb 01, 2005 1:37 am

*UPDATE! Yay!

http://img187.exs.cx/my.php?loc=img187& ... n378dh.jpg

This is it. The first real screenshot of my mod.

As you can see, the visual 3db is layed around the physical sphere object (with LOD 0, 1 for the sphere underlying). The visual however is visit = 128 and has the sphere as its parent, so without knowing what's going on you would think that there is actually a real proper texture to the SPH. which there is not.

Post Tue Feb 01, 2005 3:11 am

Cool, glad to see that it worked out. I would suggest a larger rez for that texture though- I've had no problems with DDS up to 2048/2048, although one must be careful, of course, since at that size it's eating up > 4MB of texture RAM

Post Tue Feb 01, 2005 11:55 am

lol, 128MB plain graphics memory I have.

Actually, the problem is the current texture's size. It is some 1440x720, increasing its size does no increase the resolution at all.

I originally tried this on Jupiter because the model I tried from the Solar System mod here had even worse texture put on a SPH with the known problems unsolved.

I will use my standard sphere now for all the planets and moons I got textures for (=all planets+all major moons), I can produce the exact scale with MS and FLModelTool for each one so it does fit perfectly, also I found removing the 0, 1 LOD from the physical sphere was the better chocie then, because otherwise the atmosphere wouldn't be rendered either. Instead, I removed the TXM entries except for the atmosphere, and it works without any flaws now even that I have both SPH and 3DB at exact the same size. I will first put in all planets, if any of the textures is not perfect I can edit them later anytime and import them again, that does not affect UVmaps gladly.

Edited by - Mephistopheles on 2/1/2005 2:28:55 PM

Post Wed Apr 26, 2006 9:13 am

Hello. This thread is old, but I would really like to know how you solve this problem? Could you tell me step-by-step how oyu create new planets?

Return to Freelancer 3D Modeling and Texturing Forum