Tuesday, December 28, 2021

Creating a Pearl Effect with ALM Materials

 

Oh yes, we all love the lighting possibilities ALM (Advanced Lighting Model) offers to us. Just think about the beautiful shine light creates on surfaces, especially combined with detailed bump and specular maps. Or the stunning effects you can create with the projecting feature. It's just plain awesome and super fun to play with!
 
But did you know that it is even possible to create a realistic Mother-Of-Pearl effect with ALM?  
 
I actually found out about it by accident when I was too lazy to make a specular texture and just used the diffuse texture that was almost, but not quite, grayscale. On the surface of the model, which I had colored so dark that is was almost black, suddenly all those faint colors of the texture appeared in the soft shine of the model. And yes, I was stunned!
 
Of course I had to test the effect if it was really working or just the result of my imagination and ... wow, yes, it did work, and it worked greatly. And of course, the next thing I did was turning this new and exciting feature I had just learned about into a class.
That's how the "Pearl in a Shell"- class was born and this is the build we make during class:

No worries, I won't run you through the whole class now. If you want to make the fancy build, you can always join me inworld for it, right? Here, we will just go over the light effect and work ourselves into a bit more detail than we could in class. 

 

I. Preparations

 
First of all, we will need a prim. 
It doesn't matter much what prim we use, the effect will work on all surfaces. I personally prefer rounded shapes to emphasize the shine depending on the angle of the incoming light. 

Caution:
Please take into consideration that all prims  and sculpts with ALM materials are treated like mesh in Second Life and should be set to Physics Shape Type "Convex Hull" in the Features Tab of your edit window. If you don't do that, you can easily get a very high LI (Land Impact). 
In fact, when I developed the class build above, I forgot it at some point and ended up with 871 (!) LI. 
Yes, 871. Eighthundredseventyone. On a build with 3 prims. Ouch!
 
What, you don't believe me? 
Here's the proof:

I think we can agree that we don't want this. So whatever prim you use, please make sure it is set to Physics Shape Type "Convex Hull" in Features Tab. 😉
 
So for now, I will use a simple sphere and set the Physics Shape Type to "Convex Hull". 
 
Secondly, we will need a Pearl texture. 
Well, basically, we can use ANY texture for the effect, but as it's sort of an iridescent effect you find on pearls, we'll just use a simple mother-of-pearl texture here. 
The one below, I created from a picture of a seashell that was originally made by Illuvis on pixabay. Feel free to download it from here and use it for your own projects if you like.
 
 
Last but not least, we need to have ALM (Advanced Lighting Model) enabled in our viewer. 
By default, it is disabled in most viewers, so you might have to switch it on. In Firestorm viewer, you find it in Preferences > Graphics > General. It's a checkbox under "Shaders". 
Make sure to press "OK" before you close the window to save the setting. 
 

If you have an older system, it might impact your performance, so you probably don't want to leave it on all the time. If your system can take it, it is well worth leaving it on. Many builders use it to enhance their builds and some effects will be totally invisible without it. 
To be honest, since I first switched it on, it never went off again as it adds so much to the overall Second Life experience. 
 

II. Creating the effect 

 
Ok, we have a prim, a pearl texture and ALM enabled. We're ready to go!
 
Select your prim and open the Texture tab
All the settings we need for this effect will be in texture tab. Size and shape of the prim or mesh piece don't matter at all. 
 
1.) Texture (diffuse)
For "Texture (diffuse)", we select a plain white texture.  
This texture is accessible directly in most viewers. Just click into the little texture box on the left side of texture tab and select "blank".  Press "Ok" to confirm. 


If you don't have this feature in your viewer, you can use any other plain texture you have in your inventory. If you color the pearl black, you can even use any other texture you want, it won't harm the effect at all. 

Color:
Color the prim in a dark color. Black will give best results but a dark grey will also give a fine effect. 
The darker your color, the more distinct the effect will turn out. 
Though you will get best results out of black or grey, but please also play with other colors to see the potential and limits of the effect. 
Here, you find a few examples how it looks on different colors: 
 


2.) Bumpiness (normal)
To create this effect, we wouldn't really need to use bumpiness at all. It does make a difference in some settings but it's not so very significant, so feel free to skip it if you like. 
If you want to use bumpiness, you will get best results when you use a blank bump map, like we did for the diffuse texture above. 

Check the checkbox "Bumpiness (normal)" in Texture tab of your viewer. 
Click into the grey texture box and select "blank" from the window that pops up. 
 

If you don't have the blank option in your viewer, just leave the bumpiness on "None".
The pearl effect will be just as beautiful, not worries. 

3.) Shininess (Specular) 
The Shininess and texture we use as a specular map will be the essential key to the whole effect. 
You might have used texture sets before which include different textures for Texture (diffuse), Bumpiness (normal) and Shininess (specular). While bump maps are usually blue with greenish/brownish/pinkish structures, specular maps seem to be just a monochrome grayscale version of the diffuse texture. As a matter of fact, those specular maps are not much more than a map that tells the surface where to be more shiny (bright parts) and where to be less shiny (dark parts).

But Shininess can do so much more:
If you use a colored specular map, like we're about to do, you will see that the map does not only show higher and lower shine but also includes the colors that are embedded in the specular map. This behavior is the base for our pearl effect. 

Check the checkbox "Shininess (specular)". 
Find your pearl texture in your inventory and drag it over into the grey texture box under "Shininess (specular)". Alternatively, your can click into the box and select the texture from your inventory there. 
 

Shininess Settings: 
The settings of Glossiness and Environment will affect how your effect looks in the final outcome. 
Depending on which effect you want to create, I recommend the following values: 
 
Glossiness:
Higher glossiness values will cause a smaller and sharper area to display the shininess at a time, while lower values will make the effect appear on a wider area but also appear more dull. 
Good glossiness values are between 30 and 70 but can go higher on flat surfaces. 
 
Environment:
Higher environment values will give the prim a stronger overall reflectance while cutting the colorful shine a bit down. Lower environment values will make the object appear more silky and give the color effect more room. 
Good environment values are between 10 and 20 but again can go much higher on flat surfaces. 
 


III. Enhancing the effect

 
All ALM effects depend - of course - on 1 factor: Light!
At the moment, our effect might not look very spectacular as it only uses the SL "sunlight" which usually doesn't give the best of result, coming to prims. On flat surfaces, it can happen that we don't see any change at all but just a black boring surface. 

To further enhance our effect and make it as stunning as possible, we can add further light sources. 
Just 1 single light prim makes a big change and if another prim wouldn't really fit into our design concept, we can just make it invisible. The emanated light will not be effected by color or shape of the prim. 

So let's add a light prim to our pearl: 
Rezz a new prim and set it to Physics Shape Type "Convex Hull" in Features tab
As you might want to link it to the build at some point, this is important in order not to mess up your LI. 

Still in Features tab, check the "Light"-checkbox. 
You can leave all other values at default, it's fine as it is. Adding color to the light would tint the whole effect in the color of the light. It might look good on some effects but can also take away from the specular texture you used.
 

When you now move the light box around, the shine effect will move with it, according to it's angle to the light prim. It will also change when the camera or avatar moves around it and changes it's angle of sight towards the light and the pearl. 
 
With the new light source, you can also see the differences between the Shininess settings a lot better and pick the perfect setting for your effect. 
 




I hope you enjoyed  this article and it inspired you to play a bit with Advanced Lighting Model effects and the use of Material Textures in Second Life. Let me know what you think in the comments, I'd love to hear about your experiences and projects. 
 
Have a great time and see you soon,
Wolf Song

No comments:

Post a Comment

Create a Custom Texture for Bought Mesh

  Mesh! What a wonderful and beautiful thing to have! How much detail, how many faces, shadows and SO realistic! We all want it, don't w...