Showing posts with label My classes. Show all posts
Showing posts with label My classes. Show all posts

Monday, September 15, 2014

Guess who's teaching at the Home and Garden Expo...

The Home and Garden Expo is the first event I ever knew of, and perhaps the reason why I'm specially fond about it. It was back in 2011, May, when the instructors at Builder's Brewery, the school where I was teaching for more than two years, were asked for extra classes to be given at this Expo. "Sure why not! It sounds fun!" I participated back then, opening the classes season in the Expo, with classes that explained how to build flowers and other related garden setups with the most used tools then: torturing regular prims, and creating sculpt prims with specific tools such as Sculptcrafter. Mesh hadn't arrived yet.

I still remember with a smile when, because of a joke I just did at class, several students thought that I was talking seriously, and so, they turned some of their prims to physical... which did for an spectacle of several petals of the flowers they were building, falling to the ground. If there was a teacher able to create such confusion at class... That was me.

During the Expo, I visited the sims around, admiring what everybody had brought to the Expo, and decided that, from the next year on, I would participate too! At that time, my store was really small, because almost all my time was spent teaching. I just had a few classes to offer, not even a single script that was good enough for professional use by other designers. Scripts started coming later, almost finishing 2011.

I participated in 2012, also, teaching at the Expo. Then again in 2013, this time as second-category sponsor. I didn't teach at the time, because the classroom was open only for one school, which I no longer belonged to.

2014's edition is here, and I'm participating as sim sponsor and classroom sponsor (the latter, together with DeAnn Dufaux, from park Place). The classroom has been open this year to anybody that can teach, and of course, I was not going to let that chance go. If I can make that students pluck petals at class... I can make this :-)

Being sim sponsor scared me a little. My store logo shares space with other names such as Dutchie or Maven Homes. High quality merchants... and me. So I put myself to work. I'm well aware that I still am not at their level, not even close, but nowadays I'm confident enough that given time enough, I can reach to a minimally decent result that I won't be ashamed to show. That's how the greenhouse came up, and so my plot looks like this:


The greenhouse took me four days to complete. I'm slow, when it comes to modelling.

The first day I did the windows and doors (with their LODs, physics and texturing), and laid out the base of the build. Then the next day I continued modelling, solving aspects like the roof and the entrance's roof. Next day I started joining pieces, UV mapping and creating the LOD models and the physic models. Last day, I did the textures. I'm not good at texturing, so I'm quite glad that I didn't ruin the model with my crappy texture skills. A so-so texture will make the best of the models, look ugly. I'm well aware of it, and that's my weakest spot in the "creation chain". A spot I hope I can continue to work on.

Anyway... I've mentioned that this year I will be teaching at the Home and Garden Expo. Everybody is welcome to attend, and I'd like to see you around. I will be making classes in voice, so my apologies in advance for my accent (I'm not native; If it's bad when I write, it's worse when I speak.) If you ever wanted to know if I'm a man in RL, my voice may give you a clue about. I won't spoil the surprise :o)

Following, there's the schedule. I hope you will find something interesting, and see you in the Expo!

FRIDAY, SEPTEMBER 19TH, 2 PM
LAG: WHAT CAN (ALL) SL RESIDENTS DO, TO MINIMIZE IT?

Format: Voice
Estimated time: 60 minutes
If there's something that can ruin our SL experience, that is lag. This doesn't mean that we should think, there's not a solution. There it is a solution to lag, if only each one of us contributes a little bit. In the past, scripts alone did for much of the problem, but nowadays with mesh, there's a new player on the game. Accompany me in this session, where I'll explain about different sources of lag, and what can you do to help minimizing it.

SATURDAY, SEPTEMBER 20TH, 2 PM
INTRODUCTION TO MESH FOR CREATORS

Format: Voice
Estimated time: 60 minutes
Since Mesh hit the SL grid in August 2011, the visual quality of SL has given a big step forward, and nowadays, learning about mesh is a must for all creators. Whether you plan on learning a program (like Blender), or you prefer relying on templates made by other creators, there are several relevant concepts that you need to know about: Land impact, Physics, LODs, AO maps, Materials... We'll talk about all this, during this session.

SUNDAY, SEPTEMBER 21TH, 2 PM
ZERO-LAG SCRIPTING TIPS FOR CREATORS

Format: Voice
Estimated time: 60 minutes
Did you know that you can have several scripting effects running, with no scripts at all in your objects? In this class, we will explain the tricks and tips, which will help you in designing items that will have less scripts... and so, will cause less server side lag.

MONDAY, SEPTEMBER 22TH, 2 PM
(VERY BASIC) INTRODUCTION TO SCRIPTS FOR CREATORS

Format: Voice
Estimated time: 60 minutes
When we want that our items turn on/off lights, change textures, open doors, play songs, animate avatars... We need scripts. Some scripts will be complex, and we'll need from a scripter, or purchasing them, but some other tasks are easy enough, so we could write them on our own. In each case, there are some basic concepts about scripts that we should know about. This session will be devoted to clarify all those basic concepts.

TUESDAY, SEPTEMBER 23TH, 2 PM
BASICS ON PERMISSIONS FOR CREATORS

Format: Voice
Estimated time: 60 minutes
Setting permissions correctly is a critical task in order to ensure that we do not distribute animations, scripts, sound clips, textures... against the license terms of the supplies we purchase. In this class, we'll discuss the basics of the permissions system in SL, as well as several common mistakes that we have to avoid.

FRIDAY, SEPTEMBER 26TH, 2 PM
INTRODUCTION TO 3D MODELLING IN BLENDER FOR SL

Format: Voice
Estimated time: 75 minutes
Do you want to unleash your creativity by bringing 3D models to SL, but you aren't clear about how to go about it? In this class we'll give an introduction to all of the prerequisites and necessary steps we have to follow, using as an example the open source program Blender.

Saturday, September 13, 2014

Resident Resource - "Lag! Your Animation Overrider"

This tutorial is available at: Resident Resource - "Lag! Your Animation Overrider"



This class was written in September 2011. Since then, viewers like Emergence and Phoenix succumbed, so the bits referring to them can be safely skipped. I've kept them for the sake of completion, since this was the original material I used to teach. The text hasn't been updated, but hopefully some ideas will still remain interesting to know about. Please forgive my 2011-English (Of course, suggestions to correct it are more than welcome.)

Also, I've decided to set out the original supplies for this class in a box at the store, within the books section, for free. Head over here and get the class supplies if you wish to follow the practice. The items are inside a Black Tulip textured box.

LAG! YOUR ANIMATION OVERRIDER


Welcome everybody. I am Auryn Beorn and I'll be your instructor for this class.

It's a while since we're discussing in some classes about the sources of lag, and what we can do to avoid it the most possible (as much as us, as residents, can do about). It all began as an unique class that was intended for 90 minutes. It went for three hours and the AO topic had no time for being discussed, so I've finally found the moment to do it separately.

As you sure know, "lag" is the common word used to name a slow reaction time when we're using an online application, like Second Life, World of Warcraft... anything like this that you can think of.

The fact of existing a slow reaction time means that "something's happening", either at client side, or at server side. The reasons and main culprits are discussed in detail in the class "LAG! Every script counts" and will not be the focus for this class.

In other classes we see why the scripts are such a big deal, as well as which effects and properties assure us that we can remove scripts from the objects if necessary. Also, we all know about resizers being the evil, etc, etc, regarding the avatar appearance, more specifically.

This class is to study what an animation overrider is, and what we can do to create a low scripted animation override, as well as be conscious of why we're asked to take it off when in crowded places, among other details.

WHAT IS AN ANIMATION OVERRIDER?


When we all get to SL, we're gifted with walking like ducks and standing like robots.

We, as avatars, have a predefined set of states that can be animated: Walking, standing, sitting, jumping, turning to left, turning to right, crouching, hovering, etc.

But the default animations are not... How to say... Specially glamorous.

Not even human (I know nobody walking like ducks.)

So, since scripts allow to animate avatars, and scripts allow to control your avatar keys, people smarter than the designer of the default animations decided to script what is called an "animation overrider" (and better animators, to create decent animations.)

So there we have them again: if we want to walk like humans, we need to wear scripts attached.

WHY ARE THEY ALWAYS A TARGET OF THE REQUESTS FOR DETACHING SCRIPTS?


We know that an important problem we have with scripts is... If there are many, they fill quick the memory. That's why it's so important to proceed deleting as soon as we can the resizers, specially the older ones, with one script per child prim.

But sometimes, just reducing the script count is not enough. We may have an animation overrider that only needs from two scripts (and we're preparing such an AO here, at class), and still, 40 avatars wearing the AO is an issue.

What does the AO have that makes it being so painful?

A 0.25 seconds timer (or even more frequent!)

That means: Per avatar, the server needs to pay attention each 0.25 seconds to all of our animation overriders.

Why such a small time?

Because that's a reasonable time for the script detecting a change in our state, so it can stop the previous animation and run the appropriated one.

An example for what I mean with this: When we are walking, it doesn't make sense to play other than a walking animation. But as soon as we stop walking to, say, sit, the walking animation should be stopped, then the sitting one animation initiated. Those state changes happen quick, that's why the script needs to be asking for our current state so often. That's why nobody would program an AO script and give the timer 5 seconds, to reduce lag... The requirements for an AO mean a timer that runs quick.

So yes, we can cut down the total of scripts that our AO's have, and that will of course improve the memory usage for the server, but we still have the problem of the timer.

Still, to focus all what we're discussing here, let me try to advance the "sections."

On one hand, yes, because reducing the script count is important, we're seeing how to make a "script cut" version of our AO's, and we'll do it here.

But also... We've said that the AO is requesting each 0.25 seconds our state.

If we detach the AO, yes, problem solved.

But AO's can be deactivated, not needing to be detached.

If we get an AO that needs only two scripts (which is a good thing!), we could simply deactivate it when not needed, and that way, the timer, which is the biggest load for the server this time, won't be active also, right?

So one may wonder, when could we just deactivate a two-scripts-AO, to help with lag?

Like... Right now. We're all sitting, right?

So if we're all the time sitting, why make the server check each 0.25 seconds if we're sitting or not?

I mean, at class, to say an example, we're pretty much aware of when we're sitting (and for a long time! At least at my classes :P )

We could make an habit of this:

  • Sit
  • Deactivate AO
  • Stand up
  • Activate AO

(I know I have an animation active, but I'll say why in a moment)

There are many situations where we spend our SL's sitting on something:

  • A chair
  • A couch
  • A poseball dancing
Among others :P

Why not deactivate the AO in those situations?

Just by doing that, we'll help a lot the server.

For each state, there are default animations. When we sit on a prim, by default, there's a sitting animation that will be activated on us. This can be changed by a script that starts a different animation than the default one.

So having the AO overriding poseballs scripts is not a good idea, since the poseballs themselves have a script to animate our avatar.


We're now completely aware that by creating a script-cut version of our AO plus getting the habit of deactivating the AO each time we *sit* (which is often), we're helping a lot reducing lag.

Also... Some viewers have a client side AO. That's even better!

Emergence, Phoenix, Firestorm and Singularity have client side AO.

That is what I'm using: the client side AO... So that's why I have my sitting animation on... :o)

Not because I was setting a bad example, but because I have the client AO on!

The client side AO relies on the bridge script, which all the users of those viewers always have on. So, since the viewer can take care of the keys we press and that script already can communicate with the server to be aware of state changes/notify of the new animation to play, why use an inworld AO?

Ok, so we've identified a problem: script count + timer.

We've thought about a possible solution: script cut + deactivate when not necessary/client side AO when possible.

CREATING A LOW-SCRIPTED VERSION OF OUR ANIMATION OVERRIDER


Usually, we don't need more functions from our animation overrider than actually... let it override the animations. Dances, facial gestures and other extras are not much needed at a class, shopping or maybe even roleplaying. Even the dances may be an option... as all the dance places already have danceballs... why overload the place with more scripts for that?

So we can create a low-scripted version for our animation overrider, that will cut the script count for it from the usual 20 scripts the AO's have, to only TWO. Now think on a crowded club, and think what if all the avatars use a cut-script version of their AO. We're talking about a serious reduction of the number of scripts. Not as spectacular as when we remove the resizer scripts, but yet, important.

And the best of all! We don't need to renounce to our animations. We don't need to walk like a duck in a club. So let's do *here* the work of creating this low-scripted version of our animation overrider. Once we're finished, you all will have an AO to choose, depending on how crowded do you expect to be the place.

I've chosen creating a couple of prims to hold within the open source animation overrider ZHAO-II, that you can find as the object "AO base (ZHAO interface)" included in the class supplies. All the animation overriders need from a notecard that tells which animations we're using for each state, and the ZHAO notecard type is, by far, the most widely used.

So... Let's begin with how to create a script-cut version of our AO. This work will be useful EVEN if we have a client side AO, since the notecard that we are going to create now has THE SAME FORMAT than the one the client AO requires.

If any of you has, by chance, a no copy AO attached, the following links contain two really basic AO from Vista that can purchase, so we can do the practice here, not risking your own AO at class!

For the girls: https://marketplace.secondlife.com/p/VA-VISTA-BASIC-FEMALE-AO-V08-basic-line/298453
For the guys: https://marketplace.secondlife.com/p/VISTA-MALE-BASIC-AO-V08-basic-line/298450

2014 NOTE: If you have a no copy AO, do not try to do this with it unless you're sure that there's no maintenance going on. One way to know if there's any kind of maintenance going on is by checking the SL status page. Keep in mind this: If there's any issue in the grid, it takes some time until LL are notified and they update the status page. If you notice any kind of inventory issues, or that you cannot attach/detach items... DO NOT REZ no copy items! Wait until you see an update announcement in the status page, and then refresh the page until making sure the issue is resolved.

What should we do, then?

Try not going ahead! We'll follow each step slowly.

Rez a copy of your own AO on the ground: It will be a small thing, so don't lose it from sight :-)

Not the AO from supplies: Your own AO.

Right click on your AO, and select "Open". It will take a moment to load everything.

Do we all have open a window that is loading a (most likely, long) list of animations, some scripts and notecards?

When you have that list loaded, click "Copy to Inventory".

That will make a whole copy in your inventory: once the copy is all done, you can take your AO back.

REZ the object "AO base (ZHAO interface)" from the class supplies and edit it.

Drop all the *animations* from your AO within the same prim that has the two scripts "ZHAO-II-core 7/29.1" and "ZHAO-II-interface 7/21.1".

Just the animations that we've copied in our inventory, at the moment. Let's wait a moment for the notecard.

Now we need to set the notecard.

Since this notecard we're setting is going to be full perms, we can do this step now in our inventory (we can drop FULL PERMISSIONS items within an attached HUD: it's only when the items are NOT full perms when we have to rez it to add contents.)

Before taking the AO back into your inventory, rename it to something that makes sense for you. For example, you can rename your HUD My Script-Cut AO before taking it into your inventory. This is just so you know this will be your script-cut AO with your animations.

Once renamed, take it.

The last step is editing a Default notecard, for it to be contained in the AO, so we can load it once finished, following a specific format.

Create a notecard in your supplies folder named Default.

You can choose other name if you wish, but keep in mind that this notecard name will appear as a button option in a dialog window, so DON'T USE more than 24 characters for the name of the notecard!

I've included several sample notecards in the supplies to show different formats that our AO's may be using: we'll refer to them later.

I've also included a notecard named Default - Sample from supplies: This one has the exact format that ZHAO-II expects from it. So let's study first the format of this notecard, and then we'll study how to "translate" our own AO notecard to this format.

Please, open the Default - Sample from supplies notecard.

After opening it, you all see that it has several lines, and all those lines have the same structure.

That is:

First, between [ and ], it has a word, a very specific word that has to be written as you see there, with the spaces around, exactly as there.

Those special words, like Standing, Walking, Falling... correspond with the states that our avatars allow to have animated, and we have to write that exactly as we see there:

[ Standing ]
[ Falling ]
etc.

Then, after the closing ], we specify which animation corresponds to that state. That animation has to be in the inventory of our AO prim: In the same prim where the scripts are, and we have to use the same exact name that the animation has.

Many states only allow one animation, and ZHAO-II will complain if it finds one of these states having specified for it MORE than one animation. Fix the notecard is simple here: make that state have just an animation, as ZHAO-II indicates in its error message.

But a few allow several animations. When a state allows several animations, what the AO does is, usually, to cycle between them.

Which states have multiple animations allowed? Stands, walks, sits and ground-sits.

How do we assign more than one animation to the states that allow so?

As we can see in the notecard, simply separating each one of the animations we want for the stand, by the | (pipe) character, like the sample from the supplies that you have now open:
[ Walking ]08WALKSEP4|08WALKELEGANT|08WALKSEP2HIPS|08WALKSEPBACK|08WALKHAPPY&SEXY|08WALKH&SHIP|08WALKH&Spocket|08WALKhead|sexywalk

This means that, for the Walking state, ZHAO-II will cycle among the animations:
08WALKSEP4
08WALKELEGANT
08WALKSEP2HIPS
08WALKSEPBACK
08WALKHAPPY&SEXY
08WALKH&SHIP
08WALKH&Spocket
08WALKhead
sexywalk

And that means also, that we should have those animations in the AO prim, OR THERE WILL BE RUN-TIME ERRORS (that are visible, AND VERY ANNOYING, for many users, in their local chat!)

Also important: the animation names can't have spaces between them and the | to join all of them in the same line.

Another note: the Standing state admits more than 12 animations (walks, sits and ground sits are limited to 12), but we have to add up to 12 per notecard line, as we can see in the example notecard open (to overcome a LSL limit about reading notecards):
[ Standing ]VACOOL1.1xF|VACOOL1.2xF|VACOOL1.2bisxx|VACOOL1.3xF|VACOOL1.4xFx|cool27|VACOOL2.2F|VACOOL2.3xF2|VACOOL2.3x2F|VACOOL2.4FX|VACOOL30
[ Standing ]cool6Fbis|VACOOL9b|VACOOL9|cool4.2F1|cool4.2F|VACOOL4.4|cool7|cool6F08|VACOOL2.4Fxxx|VACOOL2.4Fxx2|VACOOL4.4FAUG2|VACOOL1

NOTE: Where the pipe | character is located depends on our keyboard. Some keyboards have it pressing ALT GR + 1, others have it pressing SHIFT + BACKLASH. Check your keyboard configuration for this matter. As a last solution, you can always copy/paste it from this notecard: |


Ok up to here? Clear the format of the notecard, as a start?

Following is the complete list of states that can be animated for our avatar, updated to 2011-08-15, according to the wiki (source, here: http://wiki.secondlife.com/wiki/LlGetAnimation )
Crouching            Hovering         Hovering Down    Hovering Up
Jumping              PreJumping       Running          Sitting
Sitting on Ground    Standing         Striding         Standing Up
Flying               FlyingSlow       Falling Down
Landing              Soft Landing     CrouchWalking
Turning Left         Turning Right    Walking

2014 note: This list remains valid nowadays.

Striding is when the avatar is stuck on the edge of an object or on top of another avatar. About Standing: After falling a long distance, the Landing animation state is skipped and the Standing Up state is used.

IMPORTANT: This means that additions from specific AO's, like turning when swimming or diving, are not a state controlled by a "normal AO script" (like ZHAO-II), but a specific extension of such an AO that also checks the water level in the timer (by using the llWater function: http://wiki.secondlife.com/wiki/LlWater )


Now... How do we "translate" our own AO notecard to this format?

Some AO's will make this task easy. Others will require more work from us. I've prepared several sample notecards that show different formats, and then included how the "translation" should be done.

The notecards (no modify/no transfer so you don't confuse them with the one you have to use in your AO) are:
ORIGINAL AO NOTECARD              "TRANSLATED" AO NOTECARD
--------------------------------------------------------------------
VISTA AO - Example                VISTA AO - For ZHAO-II
VISTA - Old Format Example        VISTA Old Format - For ZHAO-II
GuyMocaps - Example               GuyMocaps - For ZHAO-II
MyAO Default - Example            MyAO Default - For ZHAO-II

The easiest case comes from AO's like Vista which, from the 2.0 version, use the same format that ZHAO-II expects, with a single exception: the [ Typing ] state, which is NOT acknowledged by this ZHAO version.

Open the Vista AO - Example and VISTA AO - For ZHAO-II notecards to see that the differences are minimal. Easy peasy, this case. But sometimes we'll have to do more work.

Close those notecards, and let's open now, to compare, the VISTA - Old Format Example and VISTA Old Format - For ZHAO-II notecards.

To mention an example, notice how the following block in the Vista - Old Format Example notecard:


:: [ Standing 1 ] ::
casual stand 1
:: [ Standing 2 ] ::
casual stand 2
:: [ Standing 3 ] ::
casual stand 3
:: [ Standing 4 ] ::
casual stand 1
:: [ Standing 5 ] ::
casual stand 2


has been translated to the following in a ZHAO-II notecard (Vista Old Format - For ZHAO II in your supplies, removing duplicate animations):

[ Standing ]casual stand 1|casual stand 2|casual stand 3

Similarly, we'd translate the rest. More work to do, but still, easy.


NOTE: When translating an AO notecard to ZHAO-II format, don't forget that only standing, walking, sitting and ground sitting are the states that allow us more than one animation, but none of the rest!

Some AO's may have a notecard format that differs a lot from the standard ZHAO-II format.

To illustrate this, we can check, for example, how the My AO Default - Example notecard refers to the normal and ground sits:
[Sit.N]D1479-Sit.N,D1480-Sit.N,D1481-Sit.N,D1482-Sit.N,D1483-Sit.N,D1184-Sit.N
[Sit.G]D1485-Sit.G (185cm),D1486-Sit.G (185cm),D1487-Sit.G (185cm),D1488-Sit.G (185cm),D1489-Sit.G (185cm),D1490-Sit.G (185cm)

and how this should be written in our ZHAO-II notecard, as the MyAO Default - For ZHAO-II notecard shows:
[ Sitting ]D1479-Sit.N|D1480-Sit.N|D1481-Sit.N|D1482-Sit.N|D1483-Sit.N|D1184-Sit.N
[ Sitting On Ground ]D1485-Sit.G (185cm)|D1486-Sit.G (185cm)|D1487-Sit.G (185cm)|D1488-Sit.G (185cm)|D1489-Sit.G (185cm)|D1490-Sit.G (185cm)

There's another example in the supplies, GuyMocaps - Example which, as an example, has the walking animations as follows:
a,cartwheel,drunkwalk2,fliprun,handstdwalk,MDHUskip,morpheuswalk,mwalk2MC,mwalking1,mwalking3,mwalking4,mwalking2

and this should be written this way in our ZHAO-II notecard, as the GuyMocaps - For ZHAO-II notecard shows:
[ Walking ]cartwheel|drunkwalk2|fliprun|handstdwalk|MDHUskip|morpheuswalk|mwalk2MC|mwalking1|mwalking3|mwalking4|mwalking2

Check these examples on your own in case you need it.


Once we're done getting ready our ZHAO-II notecard, wear the AO we've got ready with your animations.

Edit it, click the "Content" tab.

Rename the empty Default notecard from the AO included in the supplies to Empty (it's always a good idea to have a clean reference of the notecard format.) Supplies have also a copy of this empty notecard, Empty - Keep it as base to start with!

Drop this Default notecard we've created from our AO's configuration after translating to what ZHAO-II expects.

Close the "Edit" window.

Click the white "page" button from the AO. Select "Load" from the menu it shows, then select to load the Default notecard.

Ready to go.

CLIENT SIDE ANIMATION OVERRIDER


Now, why have I insisted this much in having clear the format for the ZHAO notecard?

Because if we're using Emergence, Phoenix, Firestorm, Singularity... We may use a client side AO, and this client side AO requires a notecard with the SAME FORMAT that we've now studied, so all the work made before can be used for this too.

How do we make it work?

IMPORTANT 2014 NOTE: As time went by, each viewer has developed/polished their way of setting up a client side AO, and so the following information might be obsolete/inaccurate. Please DO REFER to the documentation of each viewer for the most current information, if what's explained below doesn't correspond to what your viewer shows. The text below is kept because that's how things worked back in 2011, for the sake of completion with class text, as explained in the opening.

First, we have to copy the ANIMATIONS AND THE ZHAO-II NOTECARD WE'VE CREATED in a special folder. The scripts are not to be copied there.

This folder depends on the viewer we use. So far, I've compiled this list:
Emergence      #emergence
Phoenix        #Phoenix
Singularity    #Phoenix
FireStorm      #FireStorm/#AO

Now, either click CTRL SHIFT O (letter o), or select Phoenix: AO / Emergence/AO / Singularity/Animation Override... from your menu.

That brings up a window.

Do you see a zone of that window saying Drop a ZHAO II Notecard here?

That's it: drag the notecard directly into that zone of the window. We're not done yet! But almost.

Now we have to click "Reload" to make sure the notecard is loaded (still, one more step to follow!)

There it is a "Override Anims" check box below the Reload button. We have to click it!

If we get warnings, that might mean that some animations we've said in the notecard are not in the viewer folder.

Once the notecard is loaded, then we can check clicking "More" for the default animation we want for each state, and if we want to randomly cycle among them. That's it all what we need to have the client side AO working.


And this is all!

You don't need to be ashamed of having an AO and walk like a duck anymore: Now you know how to be as glamorous as animations allow us, at low-lag cost!

-- Auryn Beorn

Monday, July 14, 2014

Thoughts on UV mapping

I would like to think that it doesn't happen often, but truth being said, I don't know how often I make this mistake when teaching: assuming that something as natural to me as breathing, is also equally evident to everybody else. It happened when I started teaching UV mapping.

Basically, UV mapping consists in "laying flat" your 3D model, so you can create a texture for it (textures are flat entities). In my mind, that was exactly the same as playing making my own cardboard dolls and items, an activity I devoted myself for a long time while I was a little girl.

My world was a world where my parents had to skip dinner so my brother and I could have it. Their budget was pretty tight, and clearly, toys for the little kids wasn't a priority. But there was cardboard, there were color crayons I used to steal from my aunts in my summer visits, scissors and glue. I spent hours figuring out how to design my own toys, trying to make them "real", "3D". I didn't know what I was doing at the moment: I was mentally seaming and unwrapping 3D models on cardboard. It became natural to me, and I assumed that everybody else had similar experiences with cardboard games. To my surprise, these experiences weren't that common, and some of my students don't even recall to ever have constructed a dice from cardboard, which is one of the basic layouts to use.

That's how I built a whole unit assuming that everybody would naturally knew where to seam basic models. And with that assumption I went into explaining how you would cut and align the pieces of your models, to make understand how hard it is to do it manually, so I could introduce how Blender marks seams and cuts and aligns the pieces for you. And then I went into showing how our UV map can tell us where are structural issues in the geometry. And then I finally explained one way to decide where to place the seams, based in decisions we can take when seaming simple primitives.

And there it was: confusion. I seemed to be almost the only one clearly knowing why we had to seam at all, and visualizing the relationship seams-unwrapped model. Barely nobody knew why I was taking those decisions, how they would apply them on their own... Why I was doing everything I was doing. It actually was a struggle.

So 167 pages after, I decided to sort of start again. Taking advantage of the fact that we already knew the tools, we would seam models, from basic to a little less basic, to adding a bit more of detail. I took the chance to introduce more concepts, more insight to the process and nomenclature, and more methods. It seemed to help fixing my initial mistake of assuming that some of my experiences were a common place to everybody. Fortunately, my students have patience with me, and they know we eventually reach to somewhere.

That mistake makes me think (worry) about being too self-centered, and if perhaps my little world is too little. But how does one go about being more social, to learn about more experiences from others, when you're devoted to your work and said work requires concentration?

I don't know the answer.

Friday, December 20, 2013

Creator Resource - Creating HUDs: The Builders Part

This tutorial is currently available at Creator Resource: Creating HUDs, the builders part



What is a HUD? What is the purpose? How do I create a HUD?
I'm a builder and want to create a HUD so a scripter works the code, what should I take into account?

Creating HUDs is usually a team work between builders and scripters. Come join this class to have answers for the questions above and learn, as a builder, what to take into account to design your HUD the best way for the scripting it may require.


Table of contents




WHAT IS A HUD?


"HUD" stands for "Heads Up Display", that's it, an object that gets attached to one from a few special points in our viewer and shows in our window, but it's not seen inworld by the rest of avatars around. They provide us with an interface to control many things we can think of: our avatar (like animation overriders), objects around, nowadays with the new viewers they can even display media on them.

We sure have used lots of HUDs, being the most popular uses:

  • Animation overrides
  • Multi-tools
  • RP and combat systems
  • Books, magazines...
  • Texture/Color/etc change for hair, shoes...

and many more.

To use them is very simple: we just have to attach them to any of the EIGHT special HUD points that SL allows us, and begin clicking :o)

The available points for HUDs are:

  • top-left
  • top
  • top-right
  • bottom-left
  • bottom
  • bottom-right
  • center
  • center2

There are no left and no right attachment points, as of 2013-12-20.

However, nowadays we can use the "Add" function instead of "Wear", so we may have several HUD attachments in the same HUD attachment point, if the HUDs are designed to be placed in the same HUD slot.


FIRST COMMON QUESTIONS ABOUT HUD OBJECTS


One of the first questions that may pop into our minds is, Is there any restriction about what we can attach to a HUD?

And the answer is: NO.

We can attach even a castle if we feel in the mood.

Of course, the castles being as big as they are, they'll cover all the screen... But can we attach a big castle to the HUD? Yes, we can do it.

So yes, as long as what we want to attach is an object, there are no limits on what we can attach to HUD: From a jewelry nano bead to any other object, no matter the size or the contents (that this is useful or not, is a different matter.)

There are a few properties that HUD objects won't show: we'll discuss them later in the corresponding section of this class.

Do HUDs affect to lag in any specific manner?

No: If our HUD contains lots of 1024x1024 textures that change often, is heavily scripted, has many listeners, sensors, timers... It will be a laggy object, but if textures are kept to small resolution, the scripting is wise... We should not expect more lag from a HUD object than from the same object inworld.

Even more: since a HUD does not exist inworld, the server does not have to check about the possible collisions against it. So common sense applies here: design the textures (sizes) and the scripting wisely, and your HUD won't be a problem.


HOW DO I BUILD A HUD? ARE THERE ANY RESTRICTIONS?


One could wonder, have HUD objects any specific building requirement?

And the answer is NO: If you know how to build, you know how to build a HUD, as we're going to see now.

The only difference is this: If, after building our HUD, we need to add a new prim, or unlink a prim to delete it... That forces us to REZ the HUD inworld, add/unlink the prim, take it again back to inventory, and then attach.

Let's go over building one by doing a small practice.

So please, rez now a box.

In your "General" tab, name it, for example, "Test Box for HUD":


Texture the box with the blank texture.
Then make a SHIFT COPY by following the Y axis (the green arrow.)

Now for this new copy, select another color than white, just to distinguish them. I will tint mine dark red. Then, make this red one smaller, say, a 0.25 cube (it doesn't matter as long as it's smaller.)

Move the red inside the white like this, and link them:


Just this, it can be a HUD :-)

NOTE: a HUD can be even just *one* prim. One prim that has a very complicated texture with many options drawn could be a HUD :-)

The only limit for the number of prims a HUD can be made of are the SAME limits we have for the objects inworld: 256 linked primitives per object. That's the max of prims we can link, no matter the object is a HUD or not (Check here for the reference: http://wiki.secondlife.com/wiki/Limits#Building)

Ok, so do we have our "Test Box for HUD" object linked?

Take it back to inventory and look for it in the "Objects" system folder.

Now, right click over your object in inventory: this will open a menu.

Look for the "Attach To HUD" submenu and move your mouse over it.

When hovering on it, we see that the viewer offers us the EIGHT attachment points mentioned before, to select one.


Now, select CENTER for this one.
And yes, it's going to cover a lot of the screen :-)


You should have now something very similar to what the picture shows. The red box can be pointing to the same side, or the opposite. It's fine whichever side, don't worry about that :-)

Now that we have this huge thing on... Since it's possible that some of you don't know how to move a HUD object, let's learn that first.

Right click over the HUD object.
Select "Edit".
You see now that arrows appear in the center of the object, same way as when we edit objects inworld, right?


So moving the object in the HUD is done the same way we move an object inworld: we can drag the arrows and the object will move along that direction.

Notice this, though: The HUD is not 3D. The objects attached are 3D, yes, but what we see is a 2D projection of them. Still, we can move objects and ROTATE them in the HUD.

Now, let me explain something... (little side note)

Right after attaching the box in our HUD, the first we've all seen is the attack of a giant box in our HUDs. And the box was simply 0.5 meters inworld!

This leads to an obvious question: What's the size of the HUD display area?

Good and bad news: We can know only the vertical visible size of the HUD. There's no way to know the measure of the horizontal size.

The vertical size corresponds with the Z axis.
Including the menu bars of our SL window and the mottom menu options, the height of our HUD area is ALWAYS ONE METER, no matter the resolution of your screen/SL window size.

This is handy to know if, for example, you have to create a HUD that hides when the avatar goes into mouselook. Your script could change the Z of the HUD to, say, two meters, and the HUD would not be visible by the avatar.

So we have an horizontal, undefined width, and it moves along the Y axis. Then, positive values of Y are when we move from the center of our screen, which always has coordinates (0,0), to the left.

Then, we have the height of the visible area, which is always one meter, and it moves with the Z axis.

And what happens to X?

X measures how "sunk" is the HUD in the screen (although we'll see it always the same size.)

Changes in X may help us to the following: Design a HUD with several panels, they having different X. We know, now, that the ones with a lesser X will be hidden by the ones with a greater X, so a scripter could use this to swap panels.


Now, this is advice that comes from experience: Don't make your buttons to be thin :-)

As you can see in your test HUD now, we only see a 2D projection of our object, no matter how thick are the buttons. If we try now to resize the HUD (how? In a moment,) if our buttons were too thin, we'll quickly stumble against the 0.01 minimal size that SL allows for our prims, and we could not shrink our HUD much.

And since we know, now, that one meter inworld will fill all the vertical part of the screen, it's obvious that we're needing to shrink our HUDs quite a bit.

So let me quickly show an example here of what I mean with what we should NOT do when designing a HUD. I'm going to rez one HUD object I created. (Almost 2014 note: This HUD dates from 2010 =))

Please, zoom around.
Do you see that my buttons are NOT thin, but quite thick indeed?


(the buttons are even thicker... sunk in the main, black prim)

I don't care about the size that, anyway, won't be shown in the screen:


So why make them thin, and find myself stuck soon in a 0.01 problem?
I make them big.

Is there any recommended size to start with? I usually begin building at one meter (which will cover the whole vertical size,) then shrink once I attach in the HUD. Experience will tell you what works best for you.


I've said that the HUD screen area is one meter vertical, undefined, horizontal. But we have know, before editing things, that the total HUD area is quite bigger in fact. If we lose a sock, we may explore that area :o)

Let me explain what I mean.

Please, right click again in your HUD object, select edit.
And now, use the mouse wheel to zoom out.

NOTE: If you don't have mousewheel, you'll achieve the same by holding pressed ALT key, click with the left mouse button, and move the mouse backward.

Do you all see, as here, that it appears a white frame, and there's more space around?


That white frame delimits always the screen area. But yes, we can move objects further (and thus, make them disappear from our sight.)

When one loses a HUD, has to do this to get to the total HUD area: edit something else in the HUD so we can zoom out. Then find your object, click it, and move it back within the white area. (Unfortunately, what we can't do is zoom in MORE than the own HUD screen area.)

So, when we lose a sock, now we know how to look for it, yes? :o) (or when we WANT to lose a sock, where to send it)

It could be possible that we have no attached HUDs in the visible area, and we want to know if there's something out of the visible area. There's no way to zoom in the HUD unless we're editing something in the HUD, so this is a simple solution:

  • Rez a box
  • Take it
  • Attach it to HUD: Center

And now we for sure have something in the visible area to edit, to be able to zoom out in the HUD total area. Once we've found what we've lost, we can detach the box.

If you are in a place where you cannot rez, then you can try this (which might be quicker in many cases):

Check the "Worn Items" tab from the inventory window, and look for your HUD item there. If you don't find it there, then have a look at your "Marketplace" tab. Worn items from that tab do not show (yet?) under the "Worn Items" tab.

NOTE: When we close the edit window, we're closing the zoom-out in the HUD automatically, and will get again only the screen area, 1 meter height.

Now, how can we edit something that is in the HUD, once we've attached the object? Can we do the same edit options we do inworld?

Almost: remember what was said before... We CAN'T link/delink in the HUD: We have to rez first, then link, or delink, take the object back to inventory and attach it again to the HUD.

But apart from that...

Can we edit linked parts?
Yes.

Can we rotate the objects in HUD?
Yes.

Move them?
We've seen also that yes.

And do we rotate, scale, etc, the same way we do it inworld?
Again, yes.

It's very easy to check this: Please edit again your HUD. If you click now, in the edit window, the "Rotate" option, do you see that the wheels to rotate appear?


Rotate doesn't have handles, but wheels, don't forget!

Also, the keys keep working: holding CTRL in edit mode will make the rotating wheels to show up. And we can hold CTRL pressed, click over the wheel and rotate.

But I don't recommend this, for rotating, for a reason: The HUD is a 2D projection, and we can't zoom around it as we do with the 3D objects inworld. So if we're not specially careful using the wheels, most likely we'll rotate the pieces wrong.

What to do then?
Use the edit boxes for the rotation, in the "Edit" window.

But for size... If you want to resize the whole object at once, use the WHITE HANDLES that show when we click "Stretch", because if we type directly numbers in the edit boxes... This will resize ONLY the root prim, or the child prim we had selected.


Trying to resize a whole linkset typing numbers only changes the size of the selected prim: Inworld and in the HUD. If we aren't into "Edit linked parts", this is the root prim.

You can now detach the test HUD.

IMPORTANT: When you prepare a HUD for sale, make sure that you attach it to your HUD, move it to the position you want it, and then detach it, prior to pack it. Why this? Because it is when you detach the HUD when all the data related, including the position within the HUD, is saved. (This is true for any attachment, not only HUD objects.)


PROPERTIES THAT ARE NOT SUPPORTED IN HUD OBJECTS


Now that we're talking about what we can do in our HUDs... It's time to think about what we can't do in our HUD objects.

Yes, we've said that there are no building restrictions, meaning, we can attach any object to the HUD points, and we build them inworld, so same rules for the limit of child prims and others apply too.

But there are a few restrictions when working with HUD objects that we have to know about.

The first difference comes with sounds: If a sound is played using llPlaySound, in a HUD, only the person wearing the HUD listens it.

Also, sadly, particles usually won't work (they could in experimental viewers... but don't take this for granted! most of the people if not all, will not see them in the HUD object.)

Texture animation, sculpted prims and even TARGET OMEGA and flexi prims do work in a HUD object. Glow doesn't, but shininess does.

The hover text is supported BUT this is important: The text does NOT scale with the size of the HUD. If we make the HUD smaller, the hovertext will have the SAME size, so keep this in mind if your HUD is small :-)

The hover text sometimes may help you saving on textures, and it's also useful to display values that change often (like the ones that come from combat/RP HUD objects, with meters for several properties of our player.)

Shared media also works in HUDs, but since V2.2.

And don't forget this... A HUD object is an attachment, so, like any other attachment, if our HUD has a sensor active, it will not detect the avatar that has it attached.


A NOTE ABOUT HUD OBJECTS AND PERMISSIONS OF THE CONTENTS


When our HUD object is attached, the only assets we can drop in the "Content" tab are those that, for us, the owner, have FULL PERMISSIONS. If we have to drop any asset that has any restriction over the permissions *for us*, we'll have to REZ the HUD object inworld, drop the assets while it being inworld, and then take it back to our inventory. (That's why we have to rez our poses HUDs, for example, since we normally purchase them copy/no transfer.)

Be careful when you do this with NO COPY assets!

Make sure in this case that there are no notified problems that could affect to no copy items rezzed inworld. For this, you can check the grid status page.

A couple of related resources:



ADVICE WHEN YOUR HUD HAS TO BE SCRIPTED BY SOMEONE ELSE


Before finishing, I want to give one more suggestion, apart from all what we've said.

If we're the builders of the HUD, but then we have to contact with a scripter to make it work... It helps A LOT if you put names/descriptions in the prims that you want to be, either having an action on click, or that have to display information/textures.

What do I mean with this?
Again, let me look for an example to rez.

The HUD I'm going to show will also show another suggestion, in case you need to switch textures for on/off actions. In this case, the customer used the name field of the prims, for prims that were relevant when clicked.

Please, inspect this object.
Go into edit linked parts.
And click the prims.


Do you see that they have specific, unique names?

Why is it important to put names/descriptions to the prims?
Because each one of this buttons has a specific action, and they could be linked in any order.

Even if you're not a scripter, you should know that is better if a script does NOT rely on link numbers. If the script simply looks for specific names/descriptions, and retrieves the link numbers, that makes a scripter's life a lot easier AND should you unlink/relink your object, the script will (should) continue working THE SAME.

So do you all promise me that, from now on, you'll put names/descriptions in the prims you expect actions from, or information to be displayed? :-)

"Make a scripter happy... Use names/descriptions in the prims" :o)


Now, let me "break" this HUD a bit :-)
Look at this button. (The dagger button in the picture, which has been duplicated twice to show the side faces.)


It has, apart from the visible texture (the only we'll see when we attach the HUD), two more textures.

The two textures that should be used for on/off, each one at one side. The reason of doing this, is to have the textures preloaded, so your user doesn't wait for textures to load when switching on/off.

This is something I recommend doing: If you're building HUDs, and need to switch textures, have them in the sides of the buttons. They're not going to be seen anyway, because we only see the 2D projection. The rest is between the HUD and us :o)

(Make sure, though, of using small textures. For small HUD buttons, 128x128 pixels could be more than enough. Even 64x64 could be enough. 1024x1024 textures for small buttons... NO!)

Now, don't forget this: we can hollow and path cut boxes, so this makes up to 9 textures that we could apply in each face. One has to be always the texture that we show to the user: but that makes 9-1 = 8 textures that we can preload per button, should we need them.


MISCELLANEOUS QUESTIONS


QUESTION: Let's suppose that we want to rez a HUD to be able of link/delink, and turns out that the HUD contains a script that makes the HUD to be deleted if the object is rezzed instead of attached. What to do in that case, to be able to link/delink prims to the HUD object?

If the prims are copy/modify, and the script is copy at least, the following is a possibility:

  • Make a copy of your HUD object
  • Attach this copy
  • Delete the script that is making it to be deleted on rez
  • Detach the copy, rez inworld and work with it
  • Attach it again and add the copy of the script that you deleted, in order to be able to rez and work with it

Alternatively, go to a region where scripts are deactivated. (IMPORTANT: If you do this, make sure you're no higher than 50 meters above the mesh terrain, otherwise, scripts WILL be active.)

If the prims are no modify, you would not be able to link/delink anyway. In that case you can contact the creator to see if they can make the specific variation you want for the HUD object.


QUESTION: If particles can't be shown in the HUD... How could we create a HUD to make particles effects?

For that, your HUD object has to communicate via llWhisper/llSay/llShout/llRegionSay with an emitter inworld, that should receive the parameters, process them, and generate the corresponding particles effect.


QUESTION: Is it advisable to speak with the scripter before building the actual HUD?

Yes, always. Creating a HUD is a team work, so this previous dialog should happen to avoid later changes in the specifications (which can drive mad the scripter, since at times, a change in the specification could mean to have to redesign the whole scripting.)


And this is all for this class. I hope you come away with new knowledge.

-- Auryn Beorn

Thursday, October 24, 2013

Creator Resource - Doors in SL

This tutorial is currently at Creator Resource - Doors in SL



You will need basic building skills to follow this tutorial, such as rezzing prims, texturing their faces and know what the root/child prims are. Knowledge about creating sculpt prims and/or mesh is not required to understand what the scripts will do. It's only advisable if you plan modelling your own sculpt/mesh doors :-)

TABLE OF CONTENTS


Introduction: What do we mean by "using doors" in our builds?


When building in SL, when we say that we want to make "a door", we're implying a little more. What we normally mean is that we want to build an object that will work as a door, this is, than apart of having the appearance of a door, it will open and close as a door would do.

Building the door in itself isn't complicated. The issues arise when we want to add our door the desired interactivity. Suddenly we may find that our whole build rotates, or that the door is rotating around the wrong axis, or moving around the wrong axis, or that the way the door rotates, is not how we would like it to be, and the fix has to be performed in the build rather than in the script.

For all those reasons, I've spent some time putting together all the information that I consider essential for builders, and that I hope will help you understanding what you're after when you want to add doors to your builds. It's important because you'll learn how your door should be designed, what kind of script to use and why.

Note: When we talk about doors, we don't refer to doors strictly. If you think about it, a drawer that opens and closes presents the same kind of issues: an object that should slide. A music box's lid that opens and closes, it's again the same case: it's an object, the lid, that should rotate in order to open and close. Like these two, I'm sure that you can think of many other objects and uses, and all of them fall within the same category: "doors". For all of them, the same principles explained here, apply :-)


Sliding doors


Simply put, a sliding door is a door we will expect moving, but not rotating. From a textured door to a mesh door, they don't have specific requirements. The kind of scripts used normally will let you decide which direction to follow, how far the door should move in that desired direction, and during how much time.


Sliding doors: How to build them


We're going to begin our study of sliding doors by completing a "little project" that consists of building a door that will be simply a box using textures from our "Library" folder.

Wait, I don't have a "Library" folder in my inventory...

If that's the case, follow the "Advanced: Show Debug Settings" menu, look for the "NoInventoryLibrary" setting, and set it to FALSE, as the picture shows:


Rez a box. Give it a name under the "General" tab. For example, name it "My Sliding Door Example".

Now position it at integer coordinates (without decimals), like the picture shows:


Resize it to, for example:
X = 1.75
Y = 0.25
Z = 3

Now, to texture, select the "front" and "back" faces, and apply to it the "door51" texture, which is under "Library: Textures: Textures by Marlin Studios". Then select the edges, and apply to it the "Brazillian rosewood" texture, which is under "Library: Textures: Wood".

If you want to have showing only one door on your box (since the texture is of a double door), change the settings of face #1 to the following:

Repeats Per Face
Horizontal (U): 0.5    [X] FLIP
Vertical (V):   1.0

Texture Offset
Horizontal (U): 0.25
Vertical (V):   0.0

and then the settings of the opposite side (face #3) to:

Repeats Per Face
Horizontal (U): 0.5
Vertical (V):   1.0

Texture Offset
Horizontal (U): 0.25
Vertical (V):   0.0

There's no need to modify the repeats and offsets of the edges, so we'll just leave them be with the defaults.

We have a door to slide! :-)


Sliding doors: What we should expect from a "sliding door script", what we should expect to edit in it


There are so many free full permissions scripts to move doors, that is impossible to cover each single variation and say what to change and where exactly. Instead of that, I've decided to talk about the general aspects that all of them cover, so you know what to look for exactly in your particular script, or even, to know if that specific script is of some use for you or not.

A "sliding door script" simply takes the following information into account:

  • How much time the door should be sliding
  • How many steps during that time
    • Few steps will make the motion to be less smooth, but it will cause less lag, for less calculations will be involved
    • Many steps will make the motion to be smoother, but it will cause more lag, for more calculations will be required
  • What axis to follow in the motion. Some force your door to a predefined axis (so you should build it a bit differently than explained: basically rotating and resizing in another way - the script should tell you this in the comments). In that case, they give an extra parameter for the direction the door should move (like "left" and "right").

This means that such a script will have at some place a section where you introduce the new values. Some of those scripts may require from you that you reset it if you change the initial position of the door. You should read all the comments in the script to be aware of that. If there are no comments, you may try to guess by looking if the script contains the text llGetPos(); at some place... but if the script has no comments, I'd rather suggest to look for another script with comments (comments in scripts are colored orange.)

This is important to know because, for example, if it's required to have the script reset manually, you should not give your customers a no modify object. When prims are no modify, we cannot manually reset the scripts they contain.

If what I've just said sounds like "huh?" to you, then I urge you to read this tutorial about the most basic of permissions in SL. What an user can or cannot do with modify/no modify objects is covered specifically in this section.

A simplified sliding door script would just:

Move the door from one initial position to an end position. The motion is almost instant (our viewer will give it some smoothness, over a short time that we do not control), but it has the advantage of not overloading the server with intermediate calculations. If we're having several linked pieces, this is recommended, for performance and lag reasons.

If we want our sliding door being composed of more than one prim (a door and a knob, for example), like it has been pointed before, check the "Linked doors. More than one door prim. What to do?" section at the end of this tutorial. Check it also if editing those values in a script is not your strong suit. A professional door system will save you a lot of headaches and script editing :-)


Rotating doors


In this case, first we have to consider is what we understand as "rotating doors". All prims in SL have the ability of rotating, and they all do taking as a pivot point the center of the prim. So whenever we rotate a prim, we are rotating it around its center.

This is telling us that a "rotating door" is a door that we want to see, well... rotating :-)

But actually, we mean a little more here.

Let's take a look at the following picture, which is basically, the door we designed for the sliding case, which now has a cylinder in the middle, along the Z axis, to make us think of a "pivot":


If we rotate the door around the Z axis, since it will do from its center, this is what will happen:


A script will always do that: if we tell a script "rotate this prim these and these degrees around these and these axes", the script will always apply that rotation making the prim to pivot around the center. It doesn't matter what we do, scripting wise. If we want that the door, instead of rotating that way, visibly (the key word here) rotating, for example, like in the picture:


What we have to do, and the picture is suggesting it... is to alter the prim! We'll cover this by talking how to achieve this with regular prims, sculpt prims and mesh. But before, a word or two about what a script would do exactly...


Rotating doors: What a script would do in this case?


If you've ever joined a scripting group, you likely have realized that barely anybody likes rotations. What is it that makes rotations so hated? It is because of the following facts, which you, as a builder, have to be aware of:

  • If a script rotates the root prim, it will normally rotate the whole build with it
  • If we want to rotate a child prim, we need to perform a calculation that not everybody understands

This is why builders often feel so confused when editing a script to rotate a door, often preferring to leave the doors unlinked. Even scripters have issues with them!

So if we have a basic "rotating door script", this is what we may expect from it: It will rotate the prim containing the script. If this prim is the root prim, everything else that is linked to the door, will also rotate with the door. That's why these simple scripts, when used, don't "like" when we link the door to the build. Because they normally aren't ready to perform the necessary calculations that are required in a linked build.

Are we then left with no other choice than unlinked doors when we want them rotating? Of course not. You may head to the "Linked doors. More than one door prim. What to do?" section and read about it. But whether you read that section or not, what follows is important: in the next three sections, we're explaining how to modify regular prims, sculpts and mesh, so when they are rotated by a script, visually, they will look as expected.


Rotating doors. Building the door: Regular prims


There are some ways of making a regular prim to have visible only half of it, so when it rotates, it does around the visible hinge. For this, we have to understand the following two properties:

  • Path Cut
  • Slice (Boxes and cylinders)

Path Cut

Path cut is a property that operates on the XY plane, around the Z axis of the prim. When we change the path cut property of a box, for example, like in the picture, we see that the prim is indeed "cut":


What we've said before, "operates on the XY plane, around the Z axis of the prim", means that we cannot decide around which axis we want to "cut" (path cut) the prim. It's always around the Z axis:


So if we want the path cut showing in another axis, what we have to do, always, is to rotate the prim:


finding a good angle so it begins to look like a door:


and modifying the path cut to finally have a door that visibly, will rotate around its hinge:


When you texture this, remember that the prim has been rotated, and cut. Don't expect that the door texture will look right at the first try :-)


We will need to rotate the texture:


If the texture isn't of a double door like this one, then we'll also have to change the repeats and offset it:


("door31", also in your "Library: Textures: Textures by Marlin Studios" folder)

This is the principle behind using path cut to get prims that visually will rotate around a hinge. More complex primitives, such as torus, tube and ring, may require from you to also tweak "Profile Cut" (a secondary cut type that these prims allow). When working with spheres, you may also want to check out the "Dimple" property, which is exclusive of spheres.

Slice (Boxes and cylinders)

Slice is a property that we can find in boxes and cylinders, that removes "slices" of the prim, either beginning by its bottom ("Slice Begin"):


or by its top ("Slice End"):


This slice happens only in the Z axis, so once again, if we need a different configuration, we will have to rotate the prim, taking into account also that this will affect too to the texturing.

All clear with regular prims?

Then now let's study how to design our sculpted doors, so they will rotate around their hinges :-)


Rotating doors. Building the door: Sculpt prims


The same idea explained for regular prims applies here: prims rotate around the center, so what we have to do is to make the VISUAL part of the sculpted prim (the door in this case) to occupy just HALF the bounding box. That will make the effect, when the sculpt prim rotates, that it visually does around the hinge:


The prim continues rotating around the center! What we've made here is altering the bounding box. If you don't know what the bounding box of a sculpt prim is, then please check out this tutorial, "Introduction to sculpt prims", which explains what this and other essential terms mean :-)

As we can see, when working with sculpt prims, the important is understanding how we're designing the bounding box: The relevant is that the hinge is in the middle of the bounding box. We have, of course, to make sure that the sculpting tool allows us to manipulate the bounding box if we want to create these doors! The discussion about the tools is also covered in the "Introduction to sculpt prims" class.

Click here to know how to do this using Prim Generator (link to the Prim Generator class)

Now, this is relevant to sculpt prims. The door shows a problem: unless we make it phantom, the part of the bounding box with no visible geometry could hit us if this door is open and we are in its way!

Specifically talking about sculpt prims, this leads us to the need of linking phantom and non phantom prims, having an adequate collision prim. Click here for a detailed, technical explanation about linking phantom and non phantom prims. It covers other relevant details as understanding how the Land Impact works, and why we shouldn't worry about using this method with sculpt prims.

But of course, if we make the sculpt door phantom, that means, when it's closed, users will be able to walk through! Working with sculpts, the solution consists in using one or more extra prims, completely transparent, that will not be phantom, and will have the physical boundaries we need. For example, with a door, we will need a transparent box, having the size of the visible part of the sculpt. And remember! If this is to be controlled by a script... the transparent box should be moved too! Otherwise, the user will stumble against an invisible part :-)

Fortunately, this last is better solved if using mesh. So if you're waiting to know how to proceed in order to make a mesh door... It's that time now! Let's study how to design our mesh doors, so they will rotate too around their hinges and have an adequate physical presence :-)


Rotating doors. Building the door: MESH


We've studied so far how the doors should be built either in prims or sculpted, should we want them to look natural when pivoting around their hinges. Now, how would we model a mesh door having the same feature?

The case of sculpt prims may suggest us that we should, somehow, "modify the bounding box" of the mesh object, so we can offset the door and have the hinge in the center of the bounding box.

I will explain how to make these doors in Blender, because it's the program I use, but I hope that the idea I will develop will be easy enough for a Maya or 3DS Max user to follow. The final step refers to uploading the mesh to SL and setting up the object inworld, so then again that's common regardless of the program used to model the door.

I don't know if there are other ways of achieving the same result. I was exploring this one when I tried to offset a mesh object so particles would emit from the point I wanted them, and it worked. This made me think that it would work with doors too. I tried the concept, and it worked indeed. So having found this one method that can be used, I didn't pursue any other way: that's why I don't know if there are other ways of getting to the same place. If you know of another way, I'd like to hear from it. (Also, I'm not claiming this is my innovative idea, only how I got on my own to this place.)

I'm explaining now the whole process of creating a mesh door that will rotate around its hinge, over a mesh gate I released for the store.

This is the gate in Blender, still having the supporting pillar visible:


You may notice that there's "something" to the left of the pillar. If I now hide the pillar (H key in Blender) and go to the front view (NUM KEY 1), when I select the gate, the outlines tell me that apart than the gate itself, there's a tiny extra to the left:


By changing the "Viewport Shading" to "Bounding Box":


what we see is that the "tiny little thing" is extending the bounding box of my mesh gate:


Going back to "Texture" as "Viewport Shading", and then going to the top view (NUM KEY 7), we see better that this "little thing" is a small triangle:


If you've worked a bit in Blender, you know that each object has a special point known as "pivot point". We can change this pivot point to wherever we want, and within Blender, that will make the object to rotate around the pivot point. I'm pretty sure that Maya/3DS Max have a similar concept.

We could think that just by changing the pivot point to where the hinge is, that would be enough. But it's not enough. When we upload our model to SL, SL will only acknowledge as pivot point the point that is in the center of the model's bounding box. So if we want to have a pivot exactly where we want, we have to modify our model within Blender, extending the bounding box as needed. And how do we extend it? Simply adding a little triangle to either the top or the bottom opposite corner. Only a vertex will not work: it has to be a triangle. Make it small if you will, but not too small that you'll run into issues when uploading (btw, should you run into issues when uploading, check this thread, where Gaia Clary shares what she's found out so far regarding upload errors and what to do to fix them.)

We're not done yet.

Now, we want to assign one separate material to the little triangle face. Why? So once in SL, we can texture it separately, and simply make it completely transparent, so the triangle will not show at all:


Then we have to make sure of applying rotation and scale (CTRL A for the menu showing below, then choose "Rotation & Scale"). That will change all the local references of size and rotation so they will coincide with the world (global) ones. In less technical terms, it's going to save you trouble :o)


How is it going to save you trouble? For example, if you have a different rotation than X = 0, Y = 0, Z = 0, and then start modeling the physical boundaries of the door, it could happen that, once in the mesh uploader, you see that the visible geometry and the physics don't coincide at all: don't continue and upload, because once you have the mesh inworld, the physics will continue not matching the visible geometry. Instead, go back to Blender, apply rotation and scale, and export your models again.

I'm mentioning "physics" more than once. Does this mean that apart than assigning a material for the extra triangle alone, there's yet more work to do? Right, there's still a bit more we have to do.

We also have to create a physics model for our gate. Since the expected is that we can't walk through the gate, just a box makes the role of gate when it comes to physics. And check out the little triangle! We have to add it too in our physics model! Otherwise, we are in the same case than before: the bounding box will not be the same once in SL :-)


So we make sure that the physics model and the visible geometry have the same size of the bounding box, we make sure that the physics "box" will match the boundaries of the gate, and we're ready to export both the geometry and the physics as separate .dae files, and upload the gate into SL.

NOTE: Remember that you can work in wireframe mode (Z key in Blender) and also make more than one layer visible at a time (select one layer, then hit SHIFT and click on to a second layer: both will be visible). So you may have your visible geometry in layer #1 (say), then the physics in layer #2, and make both layers visible by first clicking on the layer 1, then hold SHIFT, then click on the layer 2. Also, remember that the numbers under the "Dimensions" boxes are telling you the size of the bounding box. The door and the physics model, ideally, should have the same numbers there :-)

Next step is uploading the model to SL. So we proceed as usual, and load our geometry:


Then we go to the "Physics" tab and load our .dae containing the physics. We should see the physics "embracing" the geometry, and the little triangle extending the bounding box, at the opposite corner:


Just a bigger view to show it better:


So with this, we upload our door to SL... And we aren't done yet!

Two more details :-)

First: Make sure that you texture the little triangle it being totally transparent. I like to use the "*Default Transparent Texture" from the "Library" folder, under "Textures" here, apart than raising the Transparency amount to 100, for one reason: if your door uses a script that changes the transparency of all faces, that would unveil the little triangle too. So if the texture is transparent, you will not have to modify the script so the little triangle face is skipped.


Second: Under the "Features" tab, make sure of changing "Physics Type" to "Prim", or you will not be able of walking through the part of the bounding box with no visible geometry :-)


Now, finally, our mesh door is ready to pivot around its hinge! \o/


Linked doors. More than one door prim. What to do?


At this point, we know how to build doors (drawers, etc) that will slide, or that will rotate around a pivot (their hinge). Whether they're made of regular prims, sculpt prims or mesh, we now know all the tricks. We also know how very basic scripts will work in very simple cases. We also understand why if we drop a rotation script in the root of a build, the whole build is going to rotate, not the door!

A note from experience as a customer: customers will greatly appreciate that the doors are linked to the build. Even though I know how to move the door and the build all together to another place, it's always a hassle having to remember. Normally, I move the build, realize that the door hasn't moved, undo, select the door, move everything again... It's annoying. It's annoying to an advanced user. So now imagine how this is for a customer that has no idea about what to do if, when moving the house, the doors are left behind.

When we want to have doors linked to our build, or we need our doors being composed of more than one object, or both, we have always to evaluate pros and cons of all the possibilities. If you wish to use one script per door-prim, and have unlinked doors, because to you, it's essential that the rotation happens exactly during 3.84 seconds and not the interpolation the viewers perform for prim-motion, then I will not be the one telling you not to do so. But remember that every script you add, adds to server side lag.

If you don't mind that the motion is the interpolation performed by the viewer, and prefer having all of your doors linked to the build and controlled by ONE single, low lag, script, then you can head to Marketplace and check out my own professional door script, which you can find here, recently upgraded to V2, that performs all the basic functions you would expect from a door script (change position, rotation, size), and then, quite a lot more of extra functions (vehicles compatible, interface with other scripts, AVsitter/MLP compatible, special features to create Murphy beds...), helped by a very complete auxiliary configuration tool, that will simplify your work.

Whatever your choice is, let it be an informed one :-)