swap out a texture of a planet at a particular point in time

All about writing scripts for Celestia in Lua and the .cel system
Topic author
ncc1701d
Posts: 29
Joined: 21.01.2006
With us: 18 years 5 months

swap out a texture of a planet at a particular point in time

Post #1by ncc1701d » 17.04.2008, 16:17

Is it possible through scripting to swap out a texture of a planet at a particular point in time in time?
Has anyone done that? If possible can someone point me in right direction on getting started?
Thanks
steve

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 21 years 10 months
Location: NY, USA

Re: swap out a texture of a planet at a particular point in time

Post #2by selden » 17.04.2008, 21:18

Steve,

Unfortunately, not yet.

There are two or three different ways to cause several different objects to be visible at different times. [edit]If the objects differ only in their surface textures, it'll appear that their textures are changing.[/edit]

1. specify Beginning and Ending times in the SSC definition
2. use a Lua script to modify the objects' Visible attributes (requires Celestia built from svn, will be in v1.6.0)
3. define ScriptedOrbit functions which cause the objects to be located at the expected positions when desired (requires Celestia v1.5.0 or later)

[edit]
Here's a script which causes the named object to become invisible in Celestia built from svn:

Code: Select all

 obj = celestia:find("Sol/named_object")
 obj:setvisible(false)

[/edit]
Selden

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 21 years 10 months
Location: NY, USA

Re: swap out a texture of a planet at a particular point in time

Post #3by selden » 19.04.2008, 12:09

Steve,

There are a couple of other texture selection methods, although they don't have any time aspect to them.

If you are willing to swap the texture image manually, you can specify the different surface maps using AltSurface declarations. Then you can select among them using the right-mouse-button popup menu.

If you have only three different textures per object, you can select among them by placing them in the folders /textures/hires/, lores and medres. Then type r and R to switch among them.

In principle, one ought to be able to select among AltTextures using a script, but I can't find the appropriate CEL or CELX commands.
Selden

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 5 months
Location: Nancy, France

Re: swap out a texture of a planet at a particular point in time

Post #4by Vincent » 19.04.2008, 12:36

selden wrote:In principle, one ought to be able to select among AltTextures using a script, but I can't find the appropriate CEL or CELX commands.
http://en.wikibooks.org/wiki/Celestia/C ... setsurface

Actually, the setsurface celx method should be moved from observer to object.
This would allow user to define a specific AltTexture for each object.
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 21 years 10 months
Location: NY, USA

Re: swap out a texture of a planet at a particular point in time

Post #5by selden » 19.04.2008, 13:12

Vincent,

My understanding is that it'd require more than just modifying the celx code. Currently, the same AltSurface name applies to all objects simultaneously. Personally, I think that's a good thing, since one can define a family of surface textures that will be seen on all objects by selecting just one AltSurface name.
Selden

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 5 months
Location: Nancy, France

Re: swap out a texture of a planet at a particular point in time

Post #6by Vincent » 19.04.2008, 13:26

selden wrote:My understanding is that it'd require more than just modifying the celx code.
Yes, I was aware of that when I wrote my suggestion.

selden wrote:Currently, the same AltSurface name applies to all objects simultaneously. Personally, I think that's a good thing, since one can define a family of surface textures that will be seen on all objects by selecting just one AltSurface name.
This is a good point, indeed, which is far more coherent from a scientifical point of view.
Moving the setsurface method to object would be quite useful from the addons creators point of view.
So I agree on favouring the scientifical use of the setsurface method.
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3


Return to “Scripting”