1
0
mirror of https://github.com/AcChosen/VR-Stage-Lighting.git synced 2025-02-17 10:48:35 +01:00
0
VRSL AudioLink: Setting Up Fixtures
AcChosen edited this page 2022-11-08 19:24:43 -05:00

This is the second part of "AudioLink integration of VRSL" tutorial/wiki series. This page is a continuation of the previous tutorial, VRSL AudioLink: Initial Setup. Before you begin this page, ensure that you have gone through that tutorial first and been through all the prerequisites for that tutorial as well as many things may not make sense/will be shown without much context unless you have been through the first tutorial. In this section, we will be looking at:

  • How to add AudioLink VRSL fixtures to the scene and have them react to AudioLink.
  • Going over the different parameters of an AudioLink VRSL Fixture and how to properly set them.

Adding AudioLink VRSL Fixtures To The Scene

All of AudioLink Prefabs for VRSL are located in Assets/VR-Stage-Lighting/Prefabs/AudioLink and can be dragged in as normal. For this tutorial, however, we will be using the VRSL Control Panel to spawn our fixtures instead as it's a bit easier to access.

To begin, open the VRSL Control Panel as shown here:

And you should have a window like this appear.

We need to get the Audio Link Prefab Spawn Buttons. To get there, go inside of the control panel and open the Show Options dropdown button:

The menu should now reveal more buttons and menus as shown:

Now click the newly appeared Show AudioLink Prefab Spawn Buttons dropdown button:

And a bunch more buttons should appear as shown:

In the previous tutorial, we used this set of buttons to spawn the standard AudioLink prefab object as well as the special AudioLinkController-WithVRSLSmoothing prefab.

Right below those buttons, you can see what fixture types are available to us. As more updates get pushed, more fixtures may be added and this menu may be expanded or changed altogether for organizational reasons. So do keep that in mind for readers from the future!

For now, we will be spawning a couple of spotlights to play with in our example. Go ahead and spawn the first spotlight by clicking the SpotLight button. This should spawn a spotlight audiolink prefab at the origin of the world like so:

Assuming your project is set up properly, as demonstrated in the previous tutorials, a spotlight should appear and look like so:

When we spawn the spotlight, the spotlight prefab itself will already be selected. With the gizmo in the scene, we can move the spotlight to our desired location. We will go ahead and move the spotlight near our video player for the sake of convenience.

Let's repeat those previous steps and spawn 2 more spotlights and line them up next to our first spotlight like so:

You can also just duplicate or copy/paste the first spotlight we created.

So before start looking at the fixtures, we should take a look at how the VRSL Control Panel is affected by the added VRSL fixtures. If you go ahead and close the options menus by hitting the Hide Options dropdown button, you'll notice at the bottom of the control panel there's this massive double-sided list called the Fixture List.

This list shows all the DMX and Audiolink fixtures in your scene. Since we are working on an AudioLink scene, we have already disabled the DMX list on the left. If you look on the right side, however, you will see there are 4 dropdown categories. These categories sort the fixtures based on their initial band setting. Initial band setting in this context means the audio band the lights are set to react to before the world is loaded. By default, all AudioLink VRSL fixtures spawn with their band set to Band 0 (Bass).

With that in mind, if we open up the Band 0 (Bass) category, we will see our 3 fixtures listed there!

And if we open up the dropdown for one of the fixtures, we can see all the settings for that fixture!

These settings are identical to the ones on the AudioLink VRSL Script that is on the fixture prefab itself. The settings here are copied verbatim for the sake of convenience. We are mentioning this now so you can keep this in the back of your mind when you are working on large projects and want to mass-edit many fixtures at once.

Let's go ahead and close the Control Panel and lets take a look at the fixtures themselves.

Let's click on our first AudioLInk Fixture prefab and get a quick glance at the settings.

Before we nose dive into that, let's address the elephant in the room: How do we connect the fixtures to AudioLink? Assuming everything has been set up correctly so far, they should already be connected! The fixture shaders themselves have access to the global _AudioTexture shader texture property, so if AudioLink is working properly in your world, the fixtures should appropriately react to them.

To ensure this, go ahead and hit play in the editor window. In the previous tutorial, we set up USharp Video to be able to play videos inside of the editor. So if that part is setup, you'll see the lights immediately start reacting to the music, as shown here:

As you can see here, all 3 fixtures are reacting to the Bass band of AudioLink, which is the default band when you spawn a new VRSL AudioLink fixture. If you can confirm the lights reacting to AudioLink, let's go ahead and learn about the actual parameters to get these lights to actually look good.

Here is a comprehensive list and description of each parameter on the AudioLink VRSL Script. Each parameter will be numbered and its description and number will be written below it. NOTE: THIS IS MOSTLY A MASSIVE INFORMATION DUMP ABOUT THE VRSL SCRIPT. THIS IS BETTER USED AS A REFERENCE GUIDE FROM HERE ON OUT FOR THE NEXT FEW SECTIONS OF THE TUTORIAL. IF YOU ALREADY HAVE AN IDEA OF HOW THESE WORK, GO AHEAD AND MOVE ON TO THE NEXT SECTION.

  1. Enable Audio Link: Enables or disables AudioLink on this particular fixture. Disabling Audiolink will cause the light to not react to any pulses and simply stay on at whatever setting it is currently set to. It is enabled by default.
  2. Band: Allows you to choose the frequency band the fixture is reacting to. The available bands are from 0 to 3. Band 0 = Bass. Band 1 = Low Mids. Band 2 = High Mids. Band 3 = Treble.
  3. Delay: Set a delay on the audio link reaction. This setting will set an offset of when the light will actually react to the audio link pulses. This is good for creating "chase" style effects where one light will pulse after another for that particular band.
  4. Band Multiplier: This value is multiplied by the standard 0-1 audio link band value to the light. Use this if you want your lights to pulsate more aggressively/brighter. Set it to 1 to disable.
  5. Enable Color Chord: Enables AudioLink's Color Chord feature onto this fixture. AudioLink will tint the light based on the general "chord" that it detects from the music. Color Chord will override all other colors that are set to this fixture until it is disabled.
  6. Global Intensity: A generic intensity slider from 0 to 1. This is property is useful for manually setting the max brightness of a particular fixture. This is multiplied by the Final Intensity property, so whichever property is the lowest, is the maximum brightness that the fixture can achieve.
  7. Final Intensity: Another generic intensity slider from 0 to 1. This is property is useful for manually setting the max brightness of a particular fixture. This is multiplied by the Global Intensity property, so whichever property is the lowest, is the maximum brightness that the fixture can achieve.
  8. Light Color Tint: The color of the light! This is an HDR property, so it has its own "Intensity" slider as well for simulated HDR colors. Lights are additive in nature, so changing the color to black will turn the light off.
  9. Enable Color Texture Sampling: Enables Texture Color Sampling for this fixture. This allows the color of the light to be tinted by the texture set in the VRSL Control Panel. You can change the texture in the VRSL Control Panel or on the VRSL-LocalUIControlPanel at runtime.
  10. Texture Sampling Coordinates: These are the UV coordinates that dictate where on the texture the fixture will sample from when texture sampling is enabled. UV coordinates are a pair of coordinate values that range from 0 to 1, with (0,0) being the bottom left and (1,1) being the top right. The default is (0.5, 0.5) which is the dead center of the texture.
  11. Target To Follow: The target for this fixture to follow. Currently, this only applies to the spotlight and wash light. Using animation constraints, the script has all moving lights point to a target. This is key to controlling how the light moves as the light will always follow this target and must have a target at all times. You can use this property to set a new target or change the target at runtime. The default target is an empty gameobject called PanTiltTarget which is a child of the object that the script is located on.
  12. Spin Speed: (Spotlight Only) This controls the spin speed/direction of GOBOs for the spotlight. Negative values spin left, and positive ones spin right.
  13. Enable Auto Spin: (Spotlight Only) This enables or disables the spinning feature of GOBOs for the spotlight. This is enabled by default.
  14. Select GOBO: (Spotlight Only) This selects a GOBO from the preset of GOBOs that a spotlight can choose from. Including the default blank GOBO, there are a total of 8 GOBOs to choose from.
  15. Obj Renderes: This is the list of mesh renderer objects that this script affects. This is useful for creating custom VRSL AudioLink Fixture types. WARNING: It is recommended not to touch this property unless you know what you are doing.
  16. Cone Width: (Spotlight/Washlight Only) This controls the radius of the beam for these fixtures. Increase it to make it wider, decrease it to make it smaller.
  17. Cone Length: (Spotlight/WashlightOnly) This controls the length of the volumetric beam for these fixtures. Increase to make it longer, decrease to make it shorter.
  18. Max Cone Length: (Spotlight/WashlightOnly) This controls the maximum length of the volumetric beam. This is from regular cone length in that it actually stretches the mesh of the cone that represents the volumetric. It is recommended not to change this much unless you really need to extend the length of the beam past the default.

You can change any of these properties in play mode OR in edit mode and see how they affect the light in different ways.

In this section, we will set up our three spotlights in three different ways so we can get an idea of how to use these properties.

For the first spotlight, we're going to change its color to purple, give it a GOBO, and set its band to the Upper Mids.

So first, let's change its color, go to the Light Color Tint property, and click on it. A Color picker menu will appear, go ahead and choose a nice purple color!

Now let's give it a GOBO! Go to the Select GOBO property and set it to 8 to get the "Astro Dots" GOBO. It should look something like this!:

Finally, we will set the band for this fixture to band 2, which is the Upper Mids band in AudioLink. To do this, simply set the Band property to 2 like so:

If we go ahead and hit play, you can see how the band treats the light differently from the others:

For the second spotlight, we will enable Color Chord on it while disabling the pulsation feature, give it a wider beam, and then give it a GOBO but remove the spinning feature!

To begin, enable the Enable Color Chord checkbox. If you're in edit mode, you won't see anything change until you are in play mode.

Next, we'll give a wider beam. Set the Cone Width property to 5. This should give it a much wider beam that covers a bigger area, like so:

Next, we'll give it another GOBO and disable the spinning feature. Go to the Select GOBO property and set that to 4. This will give it the "5-Pointed Star" GOBO. Click the Enable Auto Spin property to disable the spinning feature as well. If you have "Animated Properties" enabled in your scene view, you should see the gobo stop spinning as well.

Finally, we'll also disable the AudioLink pulsing by toggling the Enable Audio Link property. Even though Color Chord is an AudioLink-specific feature, this property only disables the default pulsation feature for AudioLink, but Color Chord will still function as normal at runtime. It should look something like this:

Go ahead and hit the play button and see how this fixture now differs from the others. It should look something like this:

Setting Up Texture Sampling with USharp Video

So for the final fixture, we're going to have this fixture sample from our video texture. Similar to the previous tutorial, in this example, we are using USharp Video, so in this tutorial, we'll be going over how to set it up with that video player.

The first challenge we'll have to overcome is exporting the USharp Video's output into a render texture that we can sample from. Thankfully, USharp Video has a pretty simple way of doing this for us. What we'll want to do first is create an empty game object and add the Render Texture Output script component to it. After that, hit the Convert to UdonBehaviour button on the script. It should look something like this:

As noted by the warning in our script, it says we need to add a source video player for it to export from. So go ahead and drag our USharpVideo prefab into the script's Source Video Player property like so:

Next, we'll need to create a render texture for the video player to output from. The script has a button that does this for us. Hit the big Setup Output Texture button. This will pop up a small dialog box that says Render Texture Creator. Go ahead and leave it at its defaults and hit Create Texture.

And save it somewhere useful, like the root Assets folder. This is the texture object you'll be sampling from.

You should now have a file called VideoOutputTexture somewhere in your project folder. The script we added to the empty game object will be how our video player gets sent to a render texture, so it'll be a good idea to rename your empty game object to something that will explain the purpose of the script. We named ours "Render Texture Output".

The next step is to set this texture to be the texture that the VRSL AudioLink fixture should sample from. To do that, open up the VRSL Control Panel and click the Show Options Button. You should see something like this:

In the control panel, there will be a section that says VRSL AudioLink Target Sample Texture as well as a slot for a texture object to go in. Drag your VideoOutputTexture render texture into that slot and hit the "Force Update Target Sample Texture Button" like so:

Congratulations, you have now set up your fixtures to be able to sample from your USharp Video Player.

Now, we can enable texture sampling on our final fixture and set our texture coordinates for where we want to sample in our video.

To do this go to our 3rd spotlight and check the Enable Color Texture Sampling property. This will turn on texture sampling for this specific fixture.

By default, the fixture will sample from the very center of our texture. In this example, since the only color in my chosen example video is no in the center, we will move the sampling point a little bit to the right. Use the Texture Sampling Coordinates property to choose a spot to sample your video from. I chose (0.6, 0.5) as increasing the X value moves the point to the right a little bit.

And that should be it. Your spotlight will now sample from your video texture. Here is the final preview of what that should look like. The main color in my example video is yellow as the video contains mostly a static image, so the light will now flash yellow.

Here's a preview of it in-game:

Finishing Up

And that will be it for this page! This is what we've covered in depth:

  • How to add fixtures with the control panel and how to connect them to AudioLink
  • What properties are available to AudioLink fixtures
  • How to change those properties in the inspector
  • How to set up Video Texture Sampling with the Usharp Video Player.

For the next tutorial, we will look at how to actually control and animate the fixtures to do different things. You can get to that tutorial from here: VRSL AudioLink: Controlling Fixtures