StrataCafe Forums
StrataCafe Forums
Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 StrataCafe
 Strata Design 3D CX
 Scripting in CX 5.0
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

jbradley
Inquisitive

USA
64 Posts

Posted - 04/11/2006 :  12:36:12  Show Profile
I figured it would be best to start a new thread specifically for questions about scripting in CX 5.

Because the next version is not released yet, there's only so much detail we'll be able to go into. Questions about Lua in general, or how the new scripting system might help you out in the future are more than welcome topics.

Feel free to ask away. We'll do our best to answer any questions we can.


Jon Bradley
Animator / VFX Artist

jbradley
Inquisitive

USA
64 Posts

Posted - 04/11/2006 :  12:40:14  Show Profile
Copied from another topic, "Ask Away" where some of the new features in CX 5 are being discussed.

---------

Scripting in 5.0 is integrated in quite a few major ways into the application:

Script FX
Most of you have already heard this term by now and don't quite know what to make of it. In short, Script FX is a new 'shader' system in Strata that allows deep access to the core of any object it is attached to.

This new class of FX shaders (i use the term shader loosely) will allow you to control surface deformations, manipulate the lighting on the object, use surface normals, play with the final rendered layers in multiple ways, etc.

The Script FX allows access points to the rendering pipeline in Strata so that you can modify the object before it goes to rendering, while it's rendering, and even after rendering for post process type effects. There are lot of opportunities here to make Strata do what you want - it's all about user control.

Console
A scripting console is available within the application that will be useful for general coding tasks, such as executing functions, printing out variables and manipulating code that you may write.

Nodes
Scripting is integrated in the position, scale, and rotation nodes for each object - accessible through the Project Window. This provides easy access to control these properties of the object explicitly. Want to write a script to rotate your object around an axis continuously (or randomly), forever, while keyframe animations are playing? No problem, just a couple lines of script and you're on your way.

Scripting Menu
There will be a new scripting menu in the application that will allow you to execute common scripts that you use. This menu may be modified through Lua scripts that automatically load on startup of CX 5.
Go to Top of Page

Michael
Admin

Canada
2641 Posts

Posted - 04/11/2006 :  15:59:43  Show Profile  Visit Michael's Homepage  Send Michael an AOL message
Jon, I think folks might just not have any clue what to ask, seeing as this is entirely new ground for Strata users.

Some example images in this thread might give people a better idea of what kinds of things they can expect from scripting in Strata.

Michael Luscombe
Go to Top of Page

MrChristopher
Regularly Educational

USA
1152 Posts

Posted - 04/11/2006 :  16:42:10  Show Profile  Send MrChristopher an AOL message
I agree, how about showing one of the bloom examples? I also think some examples of how it can be tied into animation would be good.

Chris
Go to Top of Page

JeffrySG
Regularly Helpful

USA
543 Posts

Posted - 04/11/2006 :  17:21:56  Show Profile  Visit JeffrySG's Homepage
I guess I have a script-noob question... How will all of this be implemented? do we have to actually type out a script into a text field? will there be a way for us to exchange / post / and share scripts with each other as little files of some sort? Maybe there'd be a place on the Cafe that will have scripts to download? and generally, how hard do you think it will be for people to start scripting simple things? do you need any programming experience or will some of it be pretty intuitive?
thx!!! :-)
Go to Top of Page

jquan8799
Infrequent Poster

USA
11 Posts

Posted - 04/11/2006 :  19:35:07  Show Profile  Visit jquan8799's Homepage
While images and animations of scripts in action would be great, I'd also like to see some example code. Other topics would be error and syntax-handling (what happens if I input bad code?) and file I/O (am I protected from deleting my own hard drive?).
Go to Top of Page

dannepop
Regularly Educational

Sweden
1009 Posts

Posted - 04/12/2006 :  02:28:31  Show Profile  Visit dannepop's Homepage  Click to see dannepop's MSN Messenger address
Is there a way to attach these scripts to the timeline?

Danne/


Danne
Strata 3D CX 4.2 - TiBook G4 1 Gig
"The problem with knowing what we want is we just might get it."
Go to Top of Page

jbradley
Inquisitive

USA
64 Posts

Posted - 04/12/2006 :  08:32:30  Show Profile
quote:
Originally posted by MrChristopher

I agree, how about showing one of the bloom examples? I also think some examples of how it can be tied into animation would be good.



Agreed. Snapshots are always nice. :) I will be uploading some Scripting FX snapshots, and maybe some movies to my gallery in the next day. I will post here when some images are available.

cheers,


Jon Bradley
Animator / VFX Artist
Go to Top of Page

jbradley
Inquisitive

USA
64 Posts

Posted - 04/12/2006 :  08:39:18  Show Profile
quote:


I guess I have a script-noob question... How will all of this be implemented? do we have to actually type out a script into a text field? will there be a way for us to exchange / post / and share scripts with each other as little files of some sort? Maybe there'd be a place on the Cafe that will have scripts to download?


Yes and yes. The scritping in Strata is pretty low level, but it does allow some higher level stuff - such as the Script FX shaders, which will be .sfx files that you can exchange with others. It's very likely there will be a section on the Cafe for these things shortly after CX 5 is available. That's more of a question for Michael though.

Scripting is just text. Scripting on the position/scale/rotation of objects, or FX shaders, consists of two scripts - one to set up any parameters you want to use (a one-time setup) and one as a runtime script. This part is evaluated every frame (or sub-frame). The additional scripting in the application is for adding menu elements to the Scripting menu, for loading classes that you may use in your other scripts, etc.

Maybe not the best analogy, but...if you are familiar with Flash, think of it as the timeline in Flash where you can add Actionscript functions or scripting - but you can also write classes to use in those timeline scripts.

quote:
and generally, how hard do you think it will be for people to start scripting simple things? do you need any programming experience or will some of it be pretty intuitive?



Well, we're doing our best to make it as intuitive as possible. There will hopefully be a bunch of demo scripts and FX shaders that will be available for you to pick apart and learn from. I would say that programming in Lua is about the same amount of effort as picking up Actionscript for Flash, with the added benefit that Lua is vastly more powerful.



Jon Bradley
Animator / VFX Artist
Go to Top of Page

jbradley
Inquisitive

USA
64 Posts

Posted - 04/12/2006 :  08:53:35  Show Profile
quote:
Originally posted by jquan8799

While images and animations of scripts in action would be great, I'd also like to see some example code. Other topics would be error and syntax-handling (what happens if I input bad code?) and file I/O (am I protected from deleting my own hard drive?).



Here's a quick example of what some Lua code may look like to spin an object on the Y axis, continuously while the timeline is playing.

You first start out by creating an initialization script by defining some constants that you would use. This keeps the scripting efficient, since this code is a one-time execution until it's changed.


--  The axis we'll spin on
local axis = s3d.vec.y_axis:Clone ()

--  The rotations per second
local rps = 4

--  The amount we'll rotate the object each time
local angle = 2*rps*math.pi


And then, the code that will execute each and every frame:


--  Local variable in the rotation node is "rotation" representing
--  the current rotation at "time"
local rot = s3d.vec.Quaternion (rotation)

--  Create a temporary quaternion that represents the axis we'll
--  rotate around and the angle we'll be at, at a specific time
local addRot = s3d.vec.Quaternion (axis, time * angle)

--  Finally multiply our rotation quaternion by the temporary
--  quaternion, setting the actual rotation of our object at the time
return rot : Multiply (addRot)


If there's an error in your script, it will not compile and it will throw an error. Lua has built-in error checking. There's a 'result' dialog for all the scripting entry points - except the console, where it's just printed right to the console. The response will let you know if the code executed with success or if there was an error.

edit: The code above is just to illustrate how one may actually go about coding the rotation effect - some of the conventions I've used in the above code may change at any point before CX 5 is released.


Jon Bradley
Animator / VFX Artist

Edited by - jbradley on 04/12/2006 08:58:50
Go to Top of Page

jbradley
Inquisitive

USA
64 Posts

Posted - 04/12/2006 :  08:56:04  Show Profile
quote:
Originally posted by dannepop

Is there a way to attach these scripts to the timeline?



You don't really 'attach' them to the timeline. For each of the three major nodes, position/scale/rotation, you'll be able to enter a dialog where a script can be added. These script will evaluate while the timeline is playing.

The cool thing is that you can also share information between objects - so you can use the position of one object to affect the scale of another, if you so wanted. :)

cheers.

Jon Bradley
Animator / VFX Artist
Go to Top of Page

jquan8799
Infrequent Poster

USA
11 Posts

Posted - 04/13/2006 :  12:12:21  Show Profile  Visit jquan8799's Homepage
quote:
Originally posted by jbradley

-- Local variable in the rotation node is "rotation" representing
-- the current rotation at "time"
local rot = s3d.vec.Quaternion (rotation)
>SNIP<
some of the conventions I've used in the above code may change at any point before CX 5 is released.



Ooh -- quaternions: powerful juju. I hope these don't go away! Thanks for the code snippet; really useful to see something.

I see that Lua's math library seems to be intact. Is there any way we can get a preview of what sort of vector and quaternion functions might be included?

For example, I've used quaternions in another language to make a camera lag smoothly when tracking another object in 3D. It'd be great if I could replicate that.
Go to Top of Page

jbradley
Inquisitive

USA
64 Posts

Posted - 04/14/2006 :  16:25:36  Show Profile
quote:
Ooh -- quaternions: powerful juju. I hope these don't go away! Thanks for the code snippet; really useful to see something.

I see that Lua's math library seems to be intact. Is there any way we can get a preview of what sort of vector and quaternion functions might be included?

For example, I've used quaternions in another language to make a camera lag smoothly when tracking another object in 3D. It'd be great if I could replicate that.



There are vector, point, matrix, and quaternion classes available, to name just a few. They are native implementations and are not emulated (C/C++). The full standard distribution of Lua will be available, along with a ton of additional elements strictly to work with Strata.

You should definitely be able to replicate a camera that lags behind an object it is tracking. I do not believe there is a method for quaternion interpolation, but that's easily enough for you to create in Lua.

cheers,

Jon Bradley
Animator / VFX Artist
Go to Top of Page

powersolo
A Regular

USA
177 Posts

Posted - 04/20/2006 :  08:52:02  Show Profile  Visit powersolo's Homepage
I've probably asked this a couple thousand times in as many forums but here it goes again. I'm not a code man, script master, programmer or anything closely related. But I'd LIKE to be. There are so many programs out today that offer more usability if you just "know a little programming". Java, actionscript, html, perl, asp. Is there a place, a source or something that can get someone started "in the most basic sense" with programming in general? I'm very far away and behind when it comes to programming and I think a lot of designers are. Do we spend time learning a programming language, or do we spend time designing? That is our delima. Thanks for any and all comments - except spelling....

Powersolo
Go to Top of Page

powersolo
A Regular

USA
177 Posts

Posted - 04/20/2006 :  09:01:50  Show Profile  Visit powersolo's Homepage
And another quick qestion... does the scripting have to do with just Animation? Or is it used also with modeling and rendering?

Powersolo
Go to Top of Page

Brian Lawson
A Fountain of Information

USA
5217 Posts

Posted - 04/20/2006 :  09:19:47  Show Profile  Visit Brian Lawson's Homepage  Send Brian Lawson an AOL message
Your best source for learning programming is your local community college. There are also plenty of books which can teach you programming.

The scripting covers more than just animation as it gives you access to the rendering pipeline as well meaning you can write scripts which affect the final render.

Brian Lawson
Strata technical support
Go to Top of Page

dannepop
Regularly Educational

Sweden
1009 Posts

Posted - 04/20/2006 :  10:05:09  Show Profile  Visit dannepop's Homepage  Click to see dannepop's MSN Messenger address
Can you really do Arrays with Lua?
Am I missing something?

Danne/


Danne
Strata 3D CX 4.2 - TiBook G4 1 Gig
"The problem with knowing what we want is we just might get it."
Go to Top of Page

powersolo
A Regular

USA
177 Posts

Posted - 04/20/2006 :  15:11:18  Show Profile  Visit powersolo's Homepage
Let's say I took a course in Programming C or C ++. Would that get me to where I would want to be?

thanks,

Powersolo
Go to Top of Page

Brian Lawson
A Fountain of Information

USA
5217 Posts

Posted - 04/20/2006 :  15:17:41  Show Profile  Visit Brian Lawson's Homepage  Send Brian Lawson an AOL message
Yes, that would be an excellent start.

Brian Lawson
Strata technical support
Go to Top of Page

Maik Kaune
A Regular

Germany
259 Posts

Posted - 04/20/2006 :  19:46:11  Show Profile
i wonder why the final decision was LUA ?
What is the difference to JavaScript or Phyton ... to name a few good known competitors in application scripting.

recently i found many JavaScript implementations and JS seems to have some kind of "Revival" (Director, Adobe Apps and AfterFX, Unity3D! )

Wouldn´t it be easier/strategic to sell/promote Strata with JavaScript ?

TIA
Go to Top of Page

mwick
Regularly Helpful

Germany
762 Posts

Posted - 04/21/2006 :  01:34:32  Show Profile  Visit mwick's Homepage
I think it maybe two things (but i really dont know muich about those things): speed and licence-fees.
But it would be interesting to know. Maybe LUA just fitted better to the code of S3D.

Markus

• Strata 3D CX 4.2 Mac and Windows, Render Pro 4.2 on Mac and Windows
• Dual G4 1.25 GHz, OS X 10.3.9, 2 GB of RAM, 480 GB Harddisk, DVD-RW, CDRW, Radeon 9000
• DualCore Athlon X2 4200+, 2 GB RAM, Win XP Pro SP2, 120 GB Harddisc, ATI Radeon 9600
• Sempron 2800+, 1 GB RAM, 120 GB Harddisk, ATI 9200, Win XP Pro SP 1
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
StrataCafe Forums © 2009 StrataCafe Go To Top Of Page
Snitz Forums 2000