New script: a flight over Mars

All about writing scripts for Celestia in Lua and the .cel system
howard
Posts: 18
Joined: 04.06.2004
With us: 20 years 5 months
Location: Colorado Springs/Denver

Post #21by howard » 10.07.2004, 15:37

Toti,

This is an interesting concept. I have actually explored and tried something similar with MEL scripts in Maya but got busy and frustrated with working out the c, the language used in the sim I was working with. Again I am only an artist, not a computer scientist!

Toti wrote: you could write scripts to import Celestia's ssc files into Blender and (via VSOP 87 routines, etc.) automatically keyframe the objects they describe, in order to match Celestia bodies' trajectories.

Ok, so to help my feeble mind first what are VSOP 87 routines"? I am not enough of an expert on Celestia yet but is it really the ssc file that you would use to bring all the Celestia content (3d and otherwise) into Blender? I could use a little more of an explination (with respect).

Toti wrote: Once done, you could save the scene (in Blender's own format) and work with it like any usual animation, doing wireframe or GL-shaded, real-time previsualizations.
I want to run everything in realtime. Audiences are stunned when they think their watching a typical CG film and you inturupt the motion and fly at will. I also want to avoid the cost of using a VDDR and keep everything on a single box.

Toti wrote: Once finished, your spline points could be exported (again, Phyton) to Celestia for final use.

That's the idea...

Is this something you have considered previously or a new idea. If so or if you have some experience with such a concept I would love to explore the idea in more depth with you. I am with immediate need to get this "editing" interface, however it gets done, completed very, very soon.


Toti wrote: No, the spline doesn't get drawn.

Could it?

Toti wrote: Now you have your first bspline "datum". You are near crater1, at 3 times the planet's radius, looking at crater1.
You can repeat the process for other surface features. (It is fast)
Finally, the spline routines will create a soft trajectory between them. You can run the script to check the results, then you can tweak the points to improve the movements. There is little "interactive editing", as you see ;)



So you are generating the data already. Would it be hard to writ a routine that outputs this to a file to be used in Blender. Seems these coordinates once initially captured could be used in many ways.

don
Posts: 1709
Joined: 12.07.2003
With us: 21 years 3 months
Location: Colorado, USA (7000 ft)

Re: New script: a flight over Mars

Post #22by don » 10.07.2004, 22:31

Toti wrote:this script features a short voyage over Mars' surface.

EXCELLENT work Toti! :D 8O 8)

Looks very easy to customize for other objects, though I haven't tried myself. And the code scales to different size images without problems.

A couple of notes for you, and anyone else who might use the code...

* Change the wait() statement (third line from the bottom) to wait(0.01) or some other small value, to give Celestia's main code a chance to execute. With wait(), it is not possible to pause the script.

* Watch out for long lines of text. They run right off the right side of the screen / window. Hard-code a "\n" in the text to insert a newline (CR/LF). I was going to add auto line-wrapping to Celestia but Chris didn't want it. So I've written some Lua/celx functions that come close. Harald just added a screen dimensions function to celx, which will make this fully possible in celx.

* When viewing a texture with shadows, it would help to properly align the sun first.

* It would help if ambient light was turned up only when viewing the dark side of an object. In this example script, it becomes overpowering on the daylight side with the std mars.jpg texture.

Thanks again for your great programming work to provide these smooth location and camera movement functions! :D

Cheers,
-Don G.
My Celestia Scripting Resources page

Avatar: Total Lunar Eclipse from our back yard, Oct 2004. Panasonic FZ1 digital camera (no telescope), 36X digital zoom, 8 second exposure at f6.5.

Topic author
Toti
Developer
Posts: 338
Joined: 10.02.2004
With us: 20 years 8 months

Post #23by Toti » 11.07.2004, 19:54

Howard wrote:Ok, so to help my feeble mind first what are VSOP 87 routines"? I am not enough of an expert on Celestia yet but is it really the ssc file that you would use to bring all the Celestia content (3d and otherwise) into Blender? I could use a little more of an explination (with respect).
Computing Newton equations for every pair of bodies in real time is almost impossible, because it involves about n^2 calculations for a set of n objects.
But you can precompute a few terms and somehow "merge" them using polynomial techniques, in order to get a very good approximation to the Newtonian solution. One theoretical work that gives support for this idea is called VSOP87.
Within Celestia, object positions can be calculated using several algorithmic approaches, including a VSOP87 theory based one.
The ssc specifies which of these methods is used to compute each body's trajectory. It also describes its physical properties (radius, oblateness, textures, atmosphere, etc.) and Keplerian orbital elements.
My idea involves using these algorithms to precompute selected bodies' positions for a time lapse, something like this (very simplified) pseudocode:

Code: Select all

for bd = body_0 to body_n do
           for tm = time_0 to time_n in timestep do
                 compute bd position, orientation, etc. for tm
                 keyframe bd position, orientation, etc. for tm

Now the selected objects are loaded into Blender, and their trajectories (that Celestia computes in realtime) have been keyframed, that is, you have taken a few orbital position/orientation samples and Blender will interpolate the in-between points.
As a result they will move very much like the Celestia ones. Reducing timestep will increase precision. I am not sure if the involved error margin would be tolerable for your purposes, though.

Howard wrote:
Toti wrote:Once finished, your spline points could be exported (again, Phyton) to Celestia for final use.
That's the idea...

Is this something you have considered previously or a new idea.
It's just a new idea. Like with any complex project, I recommend you to check the details, before doing anything else. Perhaps you should contact someone at Blender's development team.

Howard wrote:
Toti wrote:Once done, you could save the scene (in Blender's own format) and work with it like any usual animation, doing wireframe or GL-shaded, real-time previsualizations.

I want to run everything in realtime. Audiences are stunned when they think their watching a typical CG film and you inturupt the motion and fly at will. I also want to avoid the cost of using a VDDR and keep everything on a single box.
That's what I meant. You build the path (the splines) at design time. Then, you export them to Celestia for real time visualization. You save the Blender scene only to avoid having to import the whole thing again.

Howard wrote:
Toti wrote:No, the spline doesn't get drawn.
Could it?
Not now. Celestia currently doesn't support custom drawing (you can't add lines, circles, etc.) :(

Howard wrote:So you are generating the data already. Would it be hard to writ a routine that outputs this to a file to be used in Blender. Seems these coordinates once initially captured could be used in many ways.

The problem is that there would be nothing to compare/synchronize the spline with (ie. no planets, no sun, etc.) Once imported into Blender, you'd only get an almost empty scene with a curve in it. Not very useful at all.

I hope this helps

EDIT: it's not n! for n objects, but n^2 :oops:
Last edited by Toti on 20.08.2004, 19:33, edited 1 time in total.

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

Post #24by selden » 11.07.2004, 23:26

Toti wrote:Not now. Celestia currently doesn't support custom drawing (you can't add lines, circles, etc.)


The new CMOD model format available in Celestia v1.3.2pre3 (and later) makes it relatively straight-forward to display lines drawn in space. Of course, this only works if they're all precalculated and your use of them is compatible with them being loaded when Celestia starts up.
Selden

danielj
Posts: 1477
Joined: 15.08.2003
With us: 21 years 2 months

Re: New script: a flight over Mars

Post #25by danielj » 12.07.2004, 17:39

[quote="danielj"]The following error appeared :
Fatal error
[string "C:\Arquivos de Programa\Softwares de Astronomia\Celestia\Marsf..."]:1:unexpected symbol near ?{'

Why no one answer my question?I said the problem,it is above.What does it mean?I want too to see the Mars flight.
My notepad is missed.I guess the Wordpad don?t write in the same way.Is it true?

don
Posts: 1709
Joined: 12.07.2003
With us: 21 years 3 months
Location: Colorado, USA (7000 ft)

Post #26by don » 12.07.2004, 18:00

The error you posted tells us all that you did NOT follow the very basic, step-by-step instructions that Mr. Hegwood was kind enough to provide to you.

So, the only answer to your problem is to do it again, until you get it right.

What else are we supposed to say?
-Don G.

My Celestia Scripting Resources page



Avatar: Total Lunar Eclipse from our back yard, Oct 2004. Panasonic FZ1 digital camera (no telescope), 36X digital zoom, 8 second exposure at f6.5.

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

Post #27by selden » 12.07.2004, 18:01

Daniel,

Several people answered.
All said "Cut and paste the text again. Be very careful. Make sure your file is named .CELX"

Even if the "right click menu" doesn't let you use Notepad, you should be able to start Notepad from the Run menu.

Single-click the "Start" menu in the toolbar.
Double-click the "Run..." icon
Type
Notepad
in the "Open:" field
Click on OK

If you must use WordPad, be sure to select "Save As..."
and select "Save as Type ... Text document"
Selden

danielj
Posts: 1477
Joined: 15.08.2003
With us: 21 years 2 months

Post #28by danielj » 12.07.2004, 18:27

You don?t understand.My notepad disappeared;a virus deleted it.Do you think I have to reinstall the Windows?

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

Post #29by selden » 12.07.2004, 19:00

Sorry: yes.

You don't know what else it might have trashed.
For example, some virus programs install mail software that spammers use to send their junk. Others install Web pages that serve illegal pornography -- just one page at a time, so you wouldn't notice.

Also, if you haven't already, invest in a modern anti-virus program and keep it up to date.

You have my sympathy.
Selden

Topic author
Toti
Developer
Posts: 338
Joined: 10.02.2004
With us: 20 years 8 months

Post #30by Toti » 12.07.2004, 22:28

Don,
Thanks for the feedback :D
Of course, I will include your suggestions. I expect to use some of the latest LUA enhacements of 1.3.2 final.

Selden wrote:The new CMOD model format available in Celestia v1.3.2pre3 (and later) makes it relatively straight-forward to display lines drawn in space. Of course, this only works if they're all precalculated and your use of them is compatible with them being loaded when Celestia starts up.

Indeed. But it's more complicated: you must write another script that samples the spline using some specified stepvalue, generating a CMOD file with the observer, lookat and up vectors in the selected body's coordinate system. For any geometry modification, the CMOD must be regenerated, and Celestia restarted in order to update the curve. (This is why I deliberately neglected this approach)
With some CELX graphical routines the CMOD part would be completely unnecessary because direct drawing of the curve would be possible.

Bob Hegwood
Posts: 1048
Joined: 19.10.2003
With us: 21 years
Location: Germantown, Ohio - USA

Re: New script: a flight over Mars

Post #31by Bob Hegwood » 13.07.2004, 05:32

danielj wrote:The following error appeared:]:1:unexpected symbol near ?{'

New information from the Brain-Dead...

If you double-click on the Mar celx script in Windows Explorer, you WILL get an
error concerning the missing bracket(s) in the celx script. Is this a bug in Celestia?

Daniej, try simply opening the Mars celx script from the Celestia
"File" "Open Script" command and see if that works.

Does on my PC...

Take care, Bob
Bob Hegwood
Windows XP-SP2, 256Meg 1024x768 Resolution
Intel Celeron 1400 MHz CPU
Intel 82815 Graphics Controller
OpenGL Version: 1.1.2 - Build 4.13.01.3196
Celestia 1.4.0 Pre6 FT1

don
Posts: 1709
Joined: 12.07.2003
With us: 21 years 3 months
Location: Colorado, USA (7000 ft)

Post #32by don » 13.07.2004, 06:31

When I double-click a celx script it runs. The error about brackets is only for cel scripts.
-Don G.

My Celestia Scripting Resources page



Avatar: Total Lunar Eclipse from our back yard, Oct 2004. Panasonic FZ1 digital camera (no telescope), 36X digital zoom, 8 second exposure at f6.5.

Bob Hegwood
Posts: 1048
Joined: 19.10.2003
With us: 21 years
Location: Germantown, Ohio - USA

Post #33by Bob Hegwood » 14.07.2004, 05:43

So how then did THAT get screwed on my system?

I un-installed Celestia in order to repair the other problem,
but I didn't realize that this one was lurking around. It acts
as if Celestia is trying to run a cel script without the braces.

Curious. At any rate, I thought it might help Daniel, but I
guess not. <shrug>

Take care, Bob
Bob Hegwood

Windows XP-SP2, 256Meg 1024x768 Resolution

Intel Celeron 1400 MHz CPU

Intel 82815 Graphics Controller

OpenGL Version: 1.1.2 - Build 4.13.01.3196

Celestia 1.4.0 Pre6 FT1

don
Posts: 1709
Joined: 12.07.2003
With us: 21 years 3 months
Location: Colorado, USA (7000 ft)

Post #34by don » 14.07.2004, 06:16

Hi Bob,

It sounds like it's turn for the celx file association to be broken on your system, just like the cel association was <sigh>. Wish I had an easy answer, but since you already UN-installed Celestia and then re-installed it, that should have fixed it.

Try the following ...

Windows Explorer: Tools / Folder Options / File Types tab / press the "c" key

Scroll down a bit if necessary to find the CEL and CELX entries.

The "File Types" column should be "Celestia Script" for both.

In the lower part, it should say "Opens with: celestia".

Is this what yours shows?

Do you have an "Advanced" button in this box?
-Don G.

My Celestia Scripting Resources page



Avatar: Total Lunar Eclipse from our back yard, Oct 2004. Panasonic FZ1 digital camera (no telescope), 36X digital zoom, 8 second exposure at f6.5.

Topic author
Toti
Developer
Posts: 338
Joined: 10.02.2004
With us: 20 years 8 months

Post #35by Toti » 14.07.2004, 06:20

Bob Hegwood wrote:If you double-click on the Mar celx script in Windows Explorer, you WILL get an
error concerning the missing bracket(s) in the celx script. Is this a bug in Celestia?

This happens in my system, too, with CELX scripts.
But I could reproduce the error message that Daniel posted above, by saving the script with MS-Word format.
This message popped up in a small window, not as a flashed text.

Bob Hegwood
Posts: 1048
Joined: 19.10.2003
With us: 21 years
Location: Germantown, Ohio - USA

Post #36by Bob Hegwood » 14.07.2004, 06:50

don wrote:Scroll down a bit if necessary to find the CEL and CELX entries.

The "File Types" column should be "Celestia Script" for both.

In the lower part, it should say "Opens with: celestia".

Is this what yours shows?

Do you have an "Advanced" button in this box?

My screen shows that both the CEL and CELX scripts "Open With"
Celestia, but no advanced info tab

As Toti mentioned, it happens in his system too.
Just thought I'd mention it for the less fortunate out
there. :wink:

Thanks, Bob
Bob Hegwood

Windows XP-SP2, 256Meg 1024x768 Resolution

Intel Celeron 1400 MHz CPU

Intel 82815 Graphics Controller

OpenGL Version: 1.1.2 - Build 4.13.01.3196

Celestia 1.4.0 Pre6 FT1

don
Posts: 1709
Joined: 12.07.2003
With us: 21 years 3 months
Location: Colorado, USA (7000 ft)

Post #37by don » 14.07.2004, 07:08

Try this...

Start / Run / enter: regedit / OK

Select File / Export (make a backup)

Enter a filename and location to store the backup registry file.

Highlight "My Computer" at the very top of the left list.

Press ctrl+f.

Enter "celestia script" (no quotes).

Check ALL checkboxes.

Press Enter.

When found, it will be on the left side, at the bottom of the list, named "celestia_script".

Click the "+" symbols until you see "Command" under celestia_script.

Click the Command folder.

Click the single entry (Default) on the rigt pane and select Modify.

Press ctrl+c

Click the Cancel button.

Select File / Exit.

Paste the copied data to a plain text file or directly into a message here.

It *should* look like the following:
"C:\Programs\Celestia\celestia.exe" --once --dir "C:\Programs\Celestia" -u "%1"

The double quotes should be part of the data. The "C:\Programs\" part should be the path to YOUR Celestia.

Does your look like this?
-Don G.

My Celestia Scripting Resources page



Avatar: Total Lunar Eclipse from our back yard, Oct 2004. Panasonic FZ1 digital camera (no telescope), 36X digital zoom, 8 second exposure at f6.5.

ANDREA
Posts: 1543
Joined: 01.06.2002
With us: 22 years 5 months
Location: Rome, ITALY

Re: New script: a flight over Mars

Post #38by ANDREA » 14.07.2004, 14:28

[quote="Toti"][/quote]
Hello Toti, first of all thank you very much for your Tour, it gives a very nice and interesting new way of looking at astronomical objects, and I'm sure that my "clients" will be very happy to see it. :D
So I've already translated it in Italian language, and I'm beginning to study a bit of LUA in order to make some changes/additions. :wink:
I was interested in positioning scripts in a different way, so I've used the Harald Schmidt's instructions as given in his Cel_Script_Guide_v1-0g.doc i.e.:
print(string:text[, number:duration[, number:horig, [number:vorig, [number:hoffset, [number:voffset]]]]])

This gave me some doubt, due to the different location of commas (before and after the square brackets).
I used this script:

FEATURES = {
{ 180, 50, 15, 134, 205, 1, },
{print (string:Ed eccoci pronti per partecipare ad un impressionante\n viaggio sul quarto pianeta partendo dal Sole[, number:duration 5[, number:horig 0, [number:vorig 0, [number:hoffset -5, [number:voffset -5]]]]])},

that was giving the following error: :?

;39; Function arguments expected near "eccoci"

I have tried to change a lot of this script, but I think I'm missing some main information. :oops:
Can you inform me if the scripts can be positioned at will on the screen, or not? 8O
And if yes, how? 8O

Another need: to stay longer on an object, if the related text is short, can it be made longer adding spaces in the text with spacebar?
Thanks a lot!

Andrea :D
"Something is always better than nothing!"
HP Omen 15-DC1040nl- Intel® Core i7 9750H, 2.6/4.5 GHz- 1TB PCIe NVMe M.2 SSD+ 1TB SATA 6 SSD- 32GB SDRAM DDR4 2666 MHz- Nvidia GeForce GTX 1660 Ti 6 GB-WIN 11 PRO

don
Posts: 1709
Joined: 12.07.2003
With us: 21 years 3 months
Location: Colorado, USA (7000 ft)

Re: New script: a flight over Mars

Post #39by don » 14.07.2004, 16:00

ANDREA wrote:print(string:text[, number:duration[, number:horig, [number:vorig, [number:hoffset, [number:voffset]]]]])
Hi Andrea,

Where it says "number:" that means the value to be placed there is a number.

Where it says "string:" that means the value to be placed there is quoted text.

The text after the colon ":" defines the argument name, for humans only.

Square brackets represent optional arguments.

Thus a celx print statement is written like this...

Code: Select all

print ("Hello", 3)

Which would print the word Hello and wait 3 seconds.

Your print statement would be written like...

Code: Select all

print ("Ed eccoci pronti per partecipare ad un impressionante\nviaggio sul quarto pianeta partendo dal Sole", 5, 0, 0, -5, -5)



ANDREA wrote:FEATURES = {
{ 180, 50, 15, 134, 205, 1, },
{print (string:Ed eccoci pronti per partecipare ad un impressionante\n viaggio sul quarto pianeta partendo dal Sole[, number:duration 5[, number:horig 0, [number:vorig 0, [number:hoffset -5, [number:voffset -5]]]]])}
To use Toti's script, you must replace only the numbers and quoted text here. You cannot add a command statement to this section of code.


ANDREA wrote:Can you inform me if the scripts can be positioned at will on the screen, or not?
When using Toti's script, each line of text you replace will be printed in the same position on-screen (lower-left).


ANDREA wrote:Another need: to stay longer on an object, if the related text is short, can it be made longer adding spaces in the text with spacebar?

At the top of the script, there is a variable called SEC_LETTER. This value defines how many seconds to display each charactere in a string, with an initial value of 0.1. If you want text to remain on-screen for a longer period of time, increase this value (to 0.15 or 0.2?) and test to see what is good for you.

Does this help?
-Don G.

My Celestia Scripting Resources page



Avatar: Total Lunar Eclipse from our back yard, Oct 2004. Panasonic FZ1 digital camera (no telescope), 36X digital zoom, 8 second exposure at f6.5.

Bob Hegwood
Posts: 1048
Joined: 19.10.2003
With us: 21 years
Location: Germantown, Ohio - USA

Post #40by Bob Hegwood » 14.07.2004, 16:40

don wrote:When found, it will be on the left side, at the bottom of the list, named "celestia_script".

Don,

Did as you described above, but could find NO references to "celestia script"
in my registry. Just to be sure, did a search using just "celestia" but still got
back nothing which had "script" in it's description anywhere.

EDIT: Un-checked the "Match Full Word" option since YOU DID TELL ME TO
CHECK ALL THE BOXES... and I found the entries.

This is what I get Don:

C:\Program Files\Celestia\celestia.exe --once --dir "C:\Program Files\Celestia" -u "%1"


Thanks, Bob
Bob Hegwood

Windows XP-SP2, 256Meg 1024x768 Resolution

Intel Celeron 1400 MHz CPU

Intel 82815 Graphics Controller

OpenGL Version: 1.1.2 - Build 4.13.01.3196

Celestia 1.4.0 Pre6 FT1


Return to “Scripting”