How to put textures on the inside of a sphere?

All about models for Celestia. How-to, programs, work in progress...
Topic author
john71
Posts: 1009
Joined: 10.08.2016
With us: 8 years 4 months

How to put textures on the inside of a sphere?

Post #1by john71 » 22.08.2017, 20:19

OK, this drives me crazy.

I use Blender. I made a sphere, I put a texture on it, I exported it as an obj. file, then I made a cmod file from it (or I make a 3ds file then a cmod file, doesn't matter).

I edited the cmod file, added specularmap and texture to the cmod file.

By the way, this is a Dyson-sphere.

So...it is not working. Celestia did not recognise the cmod file, or puts the texture file only on the outside of the sphere.

This Impossible Dyson add-on has a good model, but I cannot make a new - more detailed - sphere cmod file.

What can be the problem?

Which cmod properties are important regarding the inner texture of a sphere?
Last edited by john71 on 23.08.2017, 16:21, edited 1 time in total.

Avatar
FarGetaNik M
Posts: 484
Joined: 05.06.2012
With us: 12 years 6 months
Location: Germany

Post #2by FarGetaNik » 22.08.2017, 21:43

Hm I'm not sure about that. The addon you linked has the texture on the outside as well, but it's 3ds. So did you have any succes so far?

Usually when inside a mesh, it is not rendered (or only partially). So my idea would be to put another sphere on the inside of the model and apply the texture there, or create 2 hemispheres and put them together with a proper ssc file, or even a merged cmod files using at least 2 materials.

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 3 months
Location: NY, USA

Post #3by selden » 23.08.2017, 03:07

To expand on what FarGetaNik wrote:

Most 3D design programs, like Blender, don't always make it obvious which directions the surface normals are pointing in a model. Surface normals tell a viewing program which direction a surface is facing. 3D design programs usually are happy to draw any surface which isn't obstructed no matter what direction its surface normal points. In contrast, Celestia only draws a surface tile (patch) when that tile's surface normal points toward the viewpoint. Most spherical object meshes have their surface normals pointing only outward. When your viewpoint is on the inside of such a sphere, and if the only surface normals associated with the tiles of the sphere are pointing away from the viewpoint, Celestia won't draw those tiles. As a result, the sphere will be invisible when viewed from inside.

(FWIW, Anim8or, the 3D design program that I prefer, has an option "Flip Normals" which can be used to reverse all of an object's surface normal vectors. You can use it to make all of a sphere's surface normals point inward, for example. I'm sure Blender must have something comparable.)

If you inspect the .SSC for the "ImpossibleDyson", you'll see that it has two objects defined, both with the same name. The first object definition specifies a Mesh which is a 3DS model of a sphere. That model was designed so that all of its surface normals all point inward (toward the central star). That object declaration specifies a surface texture image (kiyoshi.jpg) which happens to be missing. The 3DS mesh itself contains a surface texture image name of mw-msx-2k.png, so that's the one Celestia should try to show you when you're looking at the sphere from the inside, if your viewpoint is close to the star 18 Sco, for example.

The second SSC object definition doesn't specify a Mesh, so Celestia draws its default spherical object, which has its surface normals pointing outward. That declaration specifies the picture "grid.jpg" as its surface texture image. As a result, when you're outside the sphere, you'll see the image "grid.jpg"
Selden

Topic author
john71
Posts: 1009
Joined: 10.08.2016
With us: 8 years 4 months

Post #4by john71 » 23.08.2017, 17:13

Thanks for your help!

It is not Celestia's or the ssc file's fault in any way, because it works with a smaller sphere cmod file:

dyson3.png


I was able to convert the original 3ds file to a cmod ascii file and after that I edited the ascii file to use new texture and specularmap dds files.

It works perfectly!

The problem is that I cannot find ANY clue in the cmod ascii file that why the small "original" sphere model works and the new larger sphere models don't.

Are there data in the cmod file which are inaccessible for the ascii editor?

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 3 months
Location: NY, USA

Post #5by selden » 23.08.2017, 17:32

Everything that's in an ASCII CMOD file is visible to any text editor.

I assume by "larger" you mean a mesh that has more vertices. By itself the dimensions of a sphere are irrelevant since (unless you specify otherwise) Celestia automatically scales objects to the Radius specified in the catalog file.

Have you tried creating an object of your own which has very few vertices?

One possibility is that Blender is putting something in the object file that isn't being translated properly. With a short CMOD text file you'd have a better chance of noticing something that's inappropriate.

What text editor are you using?

Another possibility is that your text editor is somehow damaging the CMOD file. You do have to be careful to use a text editor, not a word processor. Word processors insert binary formatting codes which Celestia can't handle. FWIW, I usually use emacs when I edit CMODs manually.
Selden

Topic author
john71
Posts: 1009
Joined: 10.08.2016
With us: 8 years 4 months

Post #6by john71 » 23.08.2017, 17:51

Here are the cmod files in ascii format:

This one works:

sphere-works.cmod.zip


This one does not:

sphereblender3.cmod.zip


:think:

Added after 1 minute 31 seconds:
I use Notepad++

Added after 5 minutes 52 seconds:
And yes, larger=more vertices.

themartian
Posts: 25
Joined: 16.08.2017
Age: 20
With us: 7 years 3 months

Post #7by themartian » 23.08.2017, 19:01

well, you can make it as a 3ds file in wings3d, invert the sphere model, and make an UV map, to add the texture, and export to 3ds

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 3 months
Location: NY, USA

Post #8by selden » 23.08.2017, 20:23

The problem is that the Material being applied to the surface of the sphere's mesh is not the Material which specifies the surface textures. Something, perhaps Blender, has specified the wrong Material number to be applied to the mesh.

This is a case where Celestia's on-screen log file provides a hint as to the problem. (To see that log file, type a tilde (~) to Celestia. Use the Up- and Down-Arrow keys to navigate up and down in it.)

When a Mesh is loaded which specifies textures, Celestia's on-screen log file lists the mesh as it's being loaded and then it lists the names of the textures being applied to it.

In the case of the failing Blender mesh, no textures are listed in the log file. This means that the Material specified in the model file which is to be applied to the mesh does not specify any surface texture images.

If you inspect the CMOD file, you'll find the statement "trilist 1 238800". This means that Material #1 is to be applied to the surface defined by the list of 238800 vertices (238800/3 triangles) which follows that statement. However, Materials in a CMOD are "0 indexed". In other words, the first Material is number 0 and the second is number 1. The list of Materials at the beginning of the model defines only a single Material, so it is Material #0. Since there is no Material #1, no textures are applied to the surface of the sphere.
Selden

Topic author
john71
Posts: 1009
Joined: 10.08.2016
With us: 8 years 4 months

Post #9by john71 » 24.08.2017, 21:31

Thanks! I made a new cmod file, it has a trilist.

sphere-tri.cmod.zip


But it has no texture on the inside...

How can I put texture on the inside?

I cannot see any more difference between sphere-works.cmod file and this new file...

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 3 months
Location: NY, USA

Post #10by selden » 24.08.2017, 21:44

You need to include a second mesh (and associated trilist) with identical vertices but with their surface normals pointing in the opposite direction. This probably is done most easily by using Blender to create a second identical sphere with its normals flipped. It doesn't have to be in the same model file.
Selden

themartian
Posts: 25
Joined: 16.08.2017
Age: 20
With us: 7 years 3 months

Post #11by themartian » 25.08.2017, 21:59

selden, it also helps if are different models, so that bad illumination of celestia doesn't affects

Topic author
john71
Posts: 1009
Joined: 10.08.2016
With us: 8 years 4 months

Post #12by john71 » 26.08.2017, 18:35

Thanks for your help, I had to use 3ds Max 2018 Autodesk trial version to flip the normals...

After that Blender was able to do the trick.

Dyson-super.png

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 3 months
Location: NY, USA

Post #13by selden » 26.08.2017, 20:35

Sorry, I was under the impression that reversing normals was relatively easy in Blender, otherwise I'd have recommended Anim8or, where it's "trivial": select object (e.g. type Ctrl-A), then select the Edit menu item "Flip Normals" or type Shift-N.

FWIW, a Web search found these instructions for Blender: https://blenderartists.org/forum/showthread.php?6298-My-mesh-is-black-Flip-Normals
Selden

Topic author
john71
Posts: 1009
Joined: 10.08.2016
With us: 8 years 4 months

Post #14by john71 » 26.08.2017, 21:28

No, you really helped me, because without your reply I wouldn't have understood clearly what was causing the problem. I thought it was about putting a texture on the inner side of the sphere but it is a little bit more complicated. I didn't find the "flipping" solution in Blender, it is probably my fault. Anyway, it is a shame that Autodesk is quite expensive, because it seems to be a very good software.

Added after 9 hours 24 minutes:
By the way, Anim8or 1.0 is very good, why didn't I use it??? :sad:


Return to “Modelling”