Different Add-Ons Sharing The Same Texture

Post requests, images, descriptions and reports about work in progress here.
Topic author
BlindedByTheLight
Posts: 485
Joined: 19.03.2005
With us: 20 years
Location: Los Angeles, CA

Different Add-Ons Sharing The Same Texture

Post #1by BlindedByTheLight » 05.04.2005, 20:14

I noticed something very convenient the other day (which leads to my question eventually)...

Say, for example, that I have several AltTextures for Earth but I want them ALL to use/share the same NormalMap. My first thought was that I would, obviously, have to declare the NormalMap individually in each of my Earth add-on AltTexture SSC files - since AltTextures do not "inherit" surface declarations from the referring body's original SSC file (except for clouds - which are retained for AltTextures).

My second thought was that I would have to place COPIES of the NormalMap inside each texture folder of each individual AltTexture directory. This worked. But then I wondered... "Is there a way I can have the AltTextures share the NormalMap WITHOUT multiple copies."

As I'm sure many of you know... yes, there is. When I put the NormalMap in Celestia's MAIN textures folder (the one in the Celestia Resources folder), all of my AltTextures were able to find it. That's good in one sense... b/c I now don't have to keep multiple copies of the NormalMap. But bad in another... b/c now I'm spreading out my add-ons OUTSIDE of my main add-on folder. So, when I update (or switch back forth between 1.32 and 1.4pre - which I do a lot), it becomes more complicated then just dragging-and-dropping my addons folder into the various Celestia versions.

I had thought maybe I could create some kind of SECONDARY MASTER TEXTURES folder (I'm calling the one in the Celestia Resources folder the "PRIMARY" MASTER TEXTURES folder). In other words, when a NormalMap is declared in an AltTexture SSC file, first Celestia looks in that particular AltSurface's texture folder (which it seeminglydoes) then it looks in the PRIMARY textures file in the Celestia Resources folder (which it also seemeingly does)... THEN I was hoping it might look it a SECONDARY "master" textures folder inside my extras directory. But that didn't work.

Any one have any other ideas? Is what I'm asking possible? If not... should I post this in the features request section? It's come up a few times in various different scenarios for me.
Steven Binder, Mac OS X 10.4.10

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 23
With us: 23 years
Location: Hamburg, Germany

Post #2by t00fri » 05.04.2005, 20:59

since you did not consider symbolic links for texture sharing, I suppose you are a Windows user...

Symbolic links in UNIX/Linux operating systems very simply allow to place "virtual" copies of files anywhere in the directory tree, without costing any additional /bytes/...

Celestia is a multi-platform application and hence new features should have counterparts in all supported operating systems, NOT just Windows...

Bye Fridger

Topic author
BlindedByTheLight
Posts: 485
Joined: 19.03.2005
With us: 20 years
Location: Los Angeles, CA

Post #3by BlindedByTheLight » 05.04.2005, 22:54

Hi Fridger...

since you did not consider symbolic links for texture sharing, I suppose you are a Windows user...

Symbolic links in UNIX/Linux operating systems very simply allow to place "virtual" copies of files anywhere in the directory tree, without costing any additional /bytes/...

Celestia is a multi-platform application and hence new features should have counterparts in all supported operating systems, NOT just Windows...

Bye Fridger


Actually - I'm a Mac user... and I did try, at one point, aliases - which I believe are similiar to symbolic links (the difference being, I think, Mac aliases don't "break" if you move the original file). However, the alias approach did not work and the aliased files were not recognized - HOWEVER, that's besides the point... even if it did work, using symbolic links seems to require potentially substantial amounts of extra work from the solution I proposed (which, unless I am mistaken IS platform-independent...)

Regarding the extra work....

For example, if I add a "master" NormalMap declaration in 25 different AltSurface SSC's (that each have their own compartmentalized directories with their own corresponding textures folders)... it seems you are suggesting that I could place symbolic links for my one "master" NormalMap WITHIN each of those texture directories. Assuming I get that to work - that still requires creating/placing 25 symbolic links.

By contrast, with Celestia RIGHT NOW, I could simply drop the NormalMap in the textures directory inside Celestia's "Celestia Resources" directory and ALL the AltSurfaces that reference that file can use it - WITHOUT having to make any symbolic links anywhere.

Each system has drawbacks and advantages:

The symbolic link version has the advantage of being able to have ONE single, unified add-ons folder - that can easily be dragged-and-dropped between versions of Celestia - WITHOUT wasting extra disk-space on duplicates of textures (b/c of the symbolic links). However, it has the DISADVANTAGES of requiring extra work in the adding symbolic links - and all the problems/complications that potentially introduces should files get moved around or the links broken.

Likewise, the currently-available option of "dropping the texture into the 'master' textures folder" has the ADVANTAGES of being incredibly simple (and therefore easier to do and troubleshoot should there be problems). But it has the DISADVANTAGE that it makes it harder to drag-and-drop your add-ons folder between versions of Celestia b/c now parts of your add-on folder MUST reside in directories of the main Celestia app. And, even if you just drop a symbolic link into Celestia's main textures folder, you will STILL have this problem - you'll have to keep track of it and recreate when switching to new versions.

Which is where I came up with the third option. I know Celestia has a predetermined way of looking for textures - I think first in the Celestia Resources texture directory THEN (if there are AltSurfaces SSC's in the extras folder) in the particular texture directories of those particular SSCs. But, if Celestia could ALSO be told to look in a THIRD textures folder (say, a "master" textures folder in the add-ons folder) we could have the best of all worlds - we would have an easily drag-and-droppable addons folder that could have a shared AltSurface texture INSIDE it - without having to make dozens of symbolic links in the specific SSC directories that reference it..

The solution doesn't interfere with any current organizational hierarchies, is platform independent and multi-platform functional, adds more flexibility, would require less work from the user with more options and, best of all, seems as easy to implement as putting a third "look-up" location for textures (in the addons folder).

In fact, the more I ponder, I wonder if this is not already implemented in Celestia in some way I'm missing... b/c, if you're going to have a master textures folder in the program apps directory (which there is), it stands to reason there should also be a secondary master textures folder in the addons folder...

Thoughts?
Steven Binder, Mac OS X 10.4.10

jestr
Posts: 612
Joined: 14.09.2003
With us: 21 years 6 months
Location: Bridgwater,UK

Post #4by jestr » 05.04.2005, 23:24

Why not make a new folder for Earth/Moon in your 'extras' folder.Include a ssc to Modify/Replace Earth in the solarsys.ssc-pointing to all your required textures and Altsurfaces,and keep all of these in hires/medres/lores folders inside your new Earth folder,Jestr

Topic author
BlindedByTheLight
Posts: 485
Joined: 19.03.2005
With us: 20 years
Location: Los Angeles, CA

Post #5by BlindedByTheLight » 06.04.2005, 00:09

Well, Jestr... first of all - thanks for the AWSOME textures!

Now... on to your suggestion - which I'm not sure I completely understand (since I'm not too familiar with the behaviors of the modify/replace command - I've seen it but it doesn't seem to be referenced in the literature at all).

Anyhoo, let me rephrase what you said - so you can see if I'm following you.

1) Create a new folder for Earth in my addons folder (in the extras folder) - let's call it Earth/Moon

2) Within this Earth/Moon folder, create an ssc that "replaces" earth

3) WITHIN THAT SAME SSC (yes?) or, at least, in the same Earth folder... have all my AltSurface declarations

4) Place ALL of my Earth textures in that one "master Earth" textures folder (hires, medres, lores) that is enclosed within the Earth/Moon folder.

I hope I have it right. In any case, there are two problems with this - one of them being a matter of taste, the other of practical functionality. I'll start with functionality.

Unfortunately, there is a bug in the Mac OS X version (both in 1.32 and 1.4pre) that places a limit on the maximum number of alternate textures Celestia will support.

http://celestiaproject.net/forum/viewtopic.php ... highlight=

I believe the limit is nine AltTextures. After that, Celestia won't allow a Mac OS X user to change the textures or, if it does, it is unpredictable and randrom. Which means, for now, I CANNOT have all my AltSurfaces for a body "bunched" up in one master Earth folder. I need to keep each AltSurface compartmenatlized into its own easily-removable folder for Celestia to work (though I could just pull out the AltSurface SSC file... though I'm loathe to start separating packages like that for fear of losing something along the way).

However, there is also a matter of taste. I would PREFER to keep each AltSurface as compartmentalized as possible - to facilitate the sharing of textures, etc. That way, I could just go in my master Earth folder... and pick out some of the various SUB-folders containing the completed "packages" containing my AltSurfaces and share them individually (as I have become the "source" in my hood...).

True, doing it this way presents its own problem - how/where to put "shared" textures - which some have solved with symbolic links. Which I thought could also be solved by having a second "master" repository for textures - hence my initial post.

I guess, at the end of the day, there are a variety of organizational hierarchies and schemes, each with their own pro's and con's, each appealing to different types of users sensibilities, each seeming probably as silly to one as useful to another... :) Though I still wouldn't mind that second "master" textures location to be auto-checked by the program on start-up...

In any case, on top of all this... back to my question on the Replace/Modify... should I ask here or make another post?
Last edited by BlindedByTheLight on 06.04.2005, 05:13, edited 3 times in total.
Steven Binder, Mac OS X 10.4.10

jestr
Posts: 612
Joined: 14.09.2003
With us: 21 years 6 months
Location: Bridgwater,UK

Post #6by jestr » 06.04.2005, 00:22

Heres my 'alternate' Earth ssc

Code: Select all


Modify "Earth" "Sol"
{
   Texture "JMII.dds"
   NightTexture "earthnight.*"
   #NormalMap "JMIInormal.*"
   Color [ 0.85 0.85 1.0 ]
   SpecularColor [ 0.5 0.5 0.55 ]
   SpecularPower 10.0
   HazeColor [ 1 1 1 ]
   HazeDensity 0.3
   Radius 6378.140  # equatorial
   # Oblateness 0.0034
   Atmosphere {
      Height 60
      Lower [ 0.43 0.52 0.65 ]
      Upper [ 0.26 0.47 0.64 ]
      Sky [ 0.40 0.6 1.0 ]
      Sunset [ 1.0 0.6 0.2 ]
      # Sunset [ 0.3 1.0 0.5 ]
      CloudHeight  7
      CloudSpeed 65
      CloudMap "earth-clouds.*"
   }

   CustomOrbit "vsop87-earth"
   EllipticalOrbit {   
      Period            1.0000
      SemiMajorAxis     1.0000
      Eccentricity      0.0167
      Inclination       0.0001
      AscendingNode   348.739
      LongOfPericenter 102.947
           MeanLongitude   100.464
   }

   RotationPeriod   23.9344694 # 23.93419
   Obliquity        -23.45
   RotationOffset   280.5    # offset at default epoch J2000

   Albedo            0.30
}

AltSurface "JMII DDS" "Sol/Earth"
{
   Texture "JMII DDS.ctx"
        NightTexture "JNight DDS.ctx"
        NormalMap "JNormal DDS.ctx"
   HazeColor [ 1 1 1 ]
   HazeDensity 0.25
   SpecularColor [ 0.5 0.5 0.55 ]
   SpecularPower 22.0
}

AltSurface "Political World" "Sol/Earth"
{
   Texture "JMII DDS.ctx"
   HazeColor [ 1 1 1 ]
   HazeDensity 0.3
   SpecularColor [ 0.5 0.5 0.55 ]
   SpecularPower 12.0 
   OverlayTexture "PoliticalWorld PNG.ctx"
   
   
}

AltSurface "Unshaded Earth" "Sol/Earth"
{
   Texture "earth-unshaded-hs-32k.ctx"
        NightTexture "JNight DDS.ctx"
        NormalMap "JNormal DDS.ctx"
   HazeColor [ 1 1 1 ]
   HazeDensity 0.25
        SpecularTexture "JMSpec PNG VT.ctx"
   SpecularColor [ 0.5 0.5 0.55 ]
   SpecularPower 12.0
}



Jestr

Topic author
BlindedByTheLight
Posts: 485
Joined: 19.03.2005
With us: 20 years
Location: Los Angeles, CA

Post #7by BlindedByTheLight » 06.04.2005, 05:07

So, unlike plain-old AltSurface declarations... it looks like you had to copy & paste ALL of the earth info from the solarsys.ssc?

Also... I'm curious - BOTH your JMII DDS and Political World AltSurface declarations reference the same texture ("JMII DDS.ctx")... how is that so?


AltSurface "JMII DDS" "Sol/Earth"
{
Texture "JMII DDS.ctx"

}

AltSurface "Political World" "Sol/Earth"
{
Texture "JMII DDS.ctx"
}
Steven Binder, Mac OS X 10.4.10

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

Post #8by selden » 06.04.2005, 11:47

With the Modify prefix, you only need to include the parameters that you want to change. You don't need to include all of them, although it doesn't hurt.
Selden

jestr
Posts: 612
Joined: 14.09.2003
With us: 21 years 6 months
Location: Bridgwater,UK

Post #9by jestr » 06.04.2005, 12:34

The political world AltSurface has a semi-transparent overlay texture on top of the JMII DDs,Jestr

Topic author
BlindedByTheLight
Posts: 485
Joined: 19.03.2005
With us: 20 years
Location: Los Angeles, CA

Post #10by BlindedByTheLight » 09.04.2005, 06:30

Hey there... figured I'd drop another post since I've gotten a few e-mails regarding organizational tips.

I just download a new Neptune ring and it's pretty much a drag-and-drop install - in that I'm supposed to drag and drop it into the hires textures folder inside my main Celestia Resources folder. Pretty easy - no SSCs to modify, no directories to create.

The only problem is... when switching between my Celestia 1.32 and 1.4 builds, I now have to remember to swap out the items in my main hires textures folder as well. Which is where having a "secondary" hires textures folder in my addons folder would be a great addition...

Or am I beating a dead horse?
Steven Binder, Mac OS X 10.4.10

Topic author
BlindedByTheLight
Posts: 485
Joined: 19.03.2005
With us: 20 years
Location: Los Angeles, CA

Post #11by BlindedByTheLight » 13.04.2005, 22:15

Selden,

You had written:

With the Modify prefix, you only need to include the parameters that you want to change. You don't need to include all of them, although it doesn't hurt.


I think I get what you were suggesting... but I have a question about the "it doesn't hurt" comment. It wouldn't hurt - but only if none of the orbital parameters have changed, right? I ask b/c I've noticed that sometimes, for certain objects, some of those paraments MIGHT be changed... which means, if I were to copy some parameters from, say 1.32, but then 1.4 tweaked them a bit - I would be replacing the new tweaks with my 1.32 "modified" version.

True?

Thanks in advance,
Steve
Steven Binder, Mac OS X 10.4.10

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

Post #12by selden » 13.04.2005, 22:28

True.

I was a little too hasty in my answer.
Selden

Topic author
BlindedByTheLight
Posts: 485
Joined: 19.03.2005
With us: 20 years
Location: Los Angeles, CA

Post #13by BlindedByTheLight » 13.04.2005, 22:33

No worries. ANY answer is much appreciate. :)

Oh - and Jestr... finally see the light vis a vis your suggestions. I was a bit flummuxed (sp?) by the modify/replace command (since replace killed my moons)... but I think I got it figured out now. Thanks!
Steven Binder, Mac OS X 10.4.10


Return to “Add-on development”