PDA

View Full Version : Light Object Data members/methods



Tinkertanker
08-10-2003, 12:49 PM
I'm writing an lscript that needs to both read and write to the values of light objects.

I can write:

Color,
Intensity,
Cone angle,
Soft edge angle,
Shadow type,
Shadow color,
Shadow map size,
Shadow fuzziness.

but, there seems to be no way to read most of these values,

I can only read,

Color,
Shadow type.

In particular I can't read shadow color. Please tell me I'm missing something here. I thought that there would be corresponding methods for reading these values as for writing them.

Cheers

TT

fxnut
08-14-2003, 06:03 PM
Hey TT,

I've just started looking at Lscript and I'm using LScriptUser.pdf and LScriptReference.pdf as my information source. I know the SDK moderately well, but I'm getting a bit confused with LScript, especially after your post!

You said in your post that you could write to the following light parameters:

Color, Intensity, Cone angle, Soft edge angle, Shadow type, Shadow color, Shadow map size, Shadow fuzziness.

How?! I couldn't find anything in the docs that would allow you to modify those parameters. Now when I looked through the docs, I was able to find information that would let me read the following values:

Light Type, Shadow Type, Cone Angles, Range, Limited Range Flag, Affect Diffuse Flag, Affect Specular Flag, Affect Caustics Flag, Lens Flare Flag, Volumetric Flag, Ambient Colour, Main Colour

Yet, you say you can only read Colour and Shadow Type! Understand my confusion?!!

Could you maybe enlighten me, by either posting some example code, or by letting me know where you're getting your information from. What class of LScript are you writing?

Thanks!!

Regards

Andy

Titus
08-15-2003, 01:45 AM
Hi there,

I know what you are suffering but I have a tip. Part of the information missing is not missing, it is hidden. If you want to set values to light, objects, cameras, etc you can use all Layout's commands described at the SDK documentation. So you can find lscript commands at the C plugin documentation (on my hard disk is at this location: C:\3D\LW7\sdk\documentation\commands\layout.html).

An example:

AddSpotlight(mylight);
ShadowType(0);
ShadowMapSize(512);
ShadowMapFuzziness(20);
LightColor(1, 1, 1);
LightIntensity(1);


---------------------

Lights

Commands that set light parameters operate on the currently selected light. You can use the functions returned by the Light Info global to get the current values of these parameters.

AddDistantLight sname
AddPointLight sname
AddSpotlight sname
AddLinearLight sname
AddAreaLight sname
Add a light of the given type to the scene.

ClearAllLights
Remove all lights from the scene.

SaveLight
Save the light's parameters to a file. The user is prompted for the filename. The light information is stored in the format used for scene files.

DistantLight
PointLight
Spotlight
LinearLight
AreaLight
Set the type of the light.

LightColor gred ggreen gblue
LightIntensity gintensity
Set the color and intensity of the selected light.

LightFalloffType ntype
LightRange gdistance
Set the falloff type and range (or nominal distance) for the light. The falloff type affects the interpretation of the range value. These parameters aren't valid for distant lights.

AffectDiffuse
AffectSpecular
AffectCaustics
AffectOpenGL
Toggle these effects for the light.

LightConeAngle gangle
LightEdgeAngle gangle
Set the cone angle and soft edge angle for a spotlight.

LightQuality nquality
Set the quality level for a linear or area light.

ShadowType ntype
Set the light's shadow type.

CacheShadowMap
Toggle the Cache Shadow Map option for a shadow-mapped light.

ShadowMapSize nsize
Set the dimension of the shadow map for a light. A shadow map is a 2D array of pixels. The amount of memory it uses is proportional to the square of the size.

ShadowMapFuzziness gfuzziness
Set the amount of blur or softness for the shadow map.

ShadowMapFitCone
ShadowMapAngle gangle
Set the "field of view" for a shadow map. This is the angle subtended by the shadow map at the position of the light. The FitCone toggle sets this angle equal to the cone angle of a spotlight.

LensFlare
Toggle a lens flare effect for the light.

FlareIntensity gintensity
Set the lens flare intensity.

VolumetricLighting
Toggle volumetrics for the light.

fxnut
08-15-2003, 04:26 AM
Titus,

Aren't the commands you're talking about used as "Command Sequences"? Is it not the case that they can only be used in "generic" type scripts, and not, say, an "itemAnimation" type of script? Or am I completely wrong on this?

Andy

faulknermano
08-15-2003, 07:17 AM
Aren't the commands you're talking about used as "Command Sequences"? Is it not the case that they can only be used in "generic" type scripts, and not, say, an "itemAnimation" type of script? Or am I completely wrong on this?

almost correct. well, actually, technically speaking you are wrong. the lscript version 2.6 (if i am not mistaken) will allow you to executed CS commands on any architecture. but the execution timing is not being watched by lscript, so you have to be careful when and how you execute your CS commands.

in call back scripts, it is always best to go the channel object agent route when you want to animate something over time. if animation is not required, then just make sure that the CS commands are being fired at the appropriate times.

regarding datamembers: as a workaround, you can always look at the scene file.

faulknermano
08-15-2003, 07:30 AM
Originally posted by Tinkertanker
I'm writing an lscript that needs to both read and write to the values of light objects.

I can write:

Color,
Intensity,
Cone angle,
Soft edge angle,
Shadow type,
Shadow color,
Shadow map size,
Shadow fuzziness.

but, there seems to be no way to read most of these values,

I can only read,

Color,
Shadow type.

In particular I can't read shadow color. Please tell me I'm missing something here. I thought that there would be corresponding methods for reading these values as for writing them.

Cheers

TT

intensity can only be arrived by a workaround: lowering your light intensity to zero, getting the color value, then ramping it up back to 100 percent and then getting the color value of that. interpolate the two values to get the original intensity.

cone angle can also be accessed via the coneangles method. it's in the docs.

as with the other stuff, if you cant access directly, then access it via the scene file.

Titus
08-15-2003, 10:16 AM
I've been working for years with MEL scripting (Maya) and I don't understand why Lscript is so complicated. It takes me as much as four times to write the same tools in LW.

faulknermano: Your last comment gave me the impression I need to think more out of the box to get things done.

fxnut
08-15-2003, 11:32 AM
Thanks for clarifying that for me Felipe. I've just got two questions:

1) Is LScript 2.6 included with the LW7.5b update? (and is it worth upgrading to? I've heard that there have been a few problems with LW7.5b)

2) Does anyone know where the LScript 2.5 Update documentation is stored? It's not going to be much good upgrading to V2.6 if I'm missing all the upgrade information for 2.5.

Tom Speed
08-15-2003, 06:03 PM
Originally posted by Titus
I've been working for years with MEL scripting (Maya) and I don't understand why Lscript is so complicated. It takes me as much as four times to write the same tools in LW.


Having never used Maya/MEL I can't compare it to LScript.

You said you've worked with MEL for years, so you obviously know it good, yet you state LScript is complicated. I suspect you just don't know it as well as MEL. Give it a chance, it's pretty powerful. :)


Cya!
Tom

Titus
08-15-2003, 09:52 PM
Tom Speed: I started to learn Lscript (1.2 or something) before MEL but this was before I got paid for that kind of work. When I became TD then understood how important is to make good tools quickly (keep the job :( ). Sure I'll give myself a chance to master Lscript.

MEL scripting is so easy that you could laugh, in the other side writting Maya plugins is a pain in the butt, just an example: The Maya SDK is written in C++ so you have constructors and destructors, the constructor is the actual function your plugin does (e.g. create a NURBS sphere) and the constructor is the undo function (delete the NURBS sphere), so you have to tell Maya how to undo your action. Of course you can skip this step and just free the memory but then the user cannot undo that action.

faulknermano
08-16-2003, 02:40 AM
Originally posted by Titus
I've been working for years with MEL scripting (Maya) and I don't understand why Lscript is so complicated. It takes me as much as four times to write the same tools in LW.

faulknermano: Your last comment gave me the impression I need to think more out of the box to get things done.

that's how it really is with lscript, i think. however, i think it's easier to write lscript than C.. but to be frank, anything you're familiar with is always going to be easier than one you are not versed in. for example, i have the opposite problem you have: i've written some MEL, but for the real complicated parts i'm having a hard time grasping my small brain around maya's architecture and behaviors. that's why i like 'porting' maya's features over to lw, because i find lscript and lw's architecture friendlier.

visit the lscript mailing list and you'll find that many people there think lscript needs a lot more than what it has now. but there's never been a point in time when anyone was satisfied 100 percent about anything.

my philosophy is "work with it." lscript has limitations and will always have them. MEL has limitations (especially when you compare in the light of lscript), but still, you work with it. you work with it, you work with it, and you work with it, until you get what you want. and if you still cant do it (and it will happen), then you exercise your right to *****; there's nothing more satisfying than bitching when you know you're right. :D LOL!