Soul Shader

Soul Sketch
2021-04-28 09_58_45-.png

Step Through Children and Parent Spheres

Example usage for a simple rig visualizer

foreach (Transform _child in _parent)
    {
        GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
        sphere.transform.parent = _child.transform;
        sphere.transform.localPosition = new Vector3(0, 0, 0);
        sphere.transform.localRotation = new Quaternion(0, 0, 0, 0);
        sphere.transform.localScale = new Vector3(0.1F, 0.1F, 0.1F);
        Debug.Log(_child);
    }

Nebula Crystal Shader

crystal_1.gif

cheap overlay

Cheap Overlay - col * tint * 2

Set tint to vector3(0.5F, 0.5F, 0.5F) by default (Neutral State)


Apply Vertex color

public class ApplyVertexColor : MonoBehaviour
{
    [SerializeField] public Color color_one, color_two;

    void ApplyVertexColors()
    {
        Mesh mesh = GetComponent<MeshFilter>().mesh;
        Vector3[] vertices = mesh.vertices;

        // create new colors array where the colors will be created.
        Color[] colors = new Color[vertices.Length];

        for (int i = 0; i < vertices.Length; i++)
            colors[i] = Color.Lerp(color_one, color_two, vertices[i].y);

        // assign the array of colors to the Mesh.
        mesh.colors = colors;
    }
}

Custom HATCHING Funct.

image_001_[0000-0150].gif
image_003_[0000-0150].gif
2021-04-29 10_26_16-.png

Async Loading Addressables

Prototype and research of how to load addressable packages into a scene from a mock server.

public AssetReference AddressableName;

private IEnumerator LoadRoutine()
  {
      yield return null;    

      var asyncOperation = Addressables.DownloadDependenciesAsync(_label);
      //var asyncOperation = Addressables.LoadSceneAsync(AddressableName, LoadSceneMode.Additive);

      while (!asyncOperation.IsDone)
      {
          //Output the current progress
          DebugText.text = "Loading progress: " + (asyncOperation.PercentComplete * 100).ToString("F00") + "%";
          ProgressNumber.text = (asyncOperation.PercentComplete * 100f).ToString("F0") + ("%");
          ProgressSlider.value = asyncOperation.PercentComplete;

          yield return null;
      }

      if (asyncOperation.Status == AsyncOperationStatus.Succeeded)
      {
          ProgressNumber.text = ("100%");
          ProgressSlider.value = asyncOperation.PercentComplete;
          DebugText.text = ("Loading completed.");
          //Addressables.LoadSceneAsync(AddressableName, LoadSceneMode.Additive).Completed += OnSceneLoaded;
      }
      else
      {
          DebugLog("Failed to load scene at address:" + AddressableName.ToString());
      }
  }

 private async Task Get(string label)
  {
      var locations = await Addressables.LoadResourceLocationsAsync(label).Task;

      foreach (var location in locations)
          await Addressables.LoadSceneAsync(location, LoadSceneMode.Additive).Task;
  }

  public void LoadAddressablePrefab()
  {
      Addressables.InstantiateAsync(AddressableName, this.gameObject.transform).Completed += LoadAddressable_Completed;
  }

  public void ReleaseAddressablePrefab()
  {
      Addressables.ReleaseInstance(_go);
  }

Read Texture from file to Render Target

Sample code for loading a photo from the web into a UI render target.

WWW www = new WWW(photoPath);     
byte[] tmpBytes = File.ReadAllBytes(photoPath);    
Texture2D texTmp = new Texture2D(1, 1);    
texTmp.LoadImage(tmpBytes);

//Debug.Log("Raw size: " + texTmp.width + " x " + texTmp.height);    
//www.LoadImageIntoTexture(texTmp);

PortraitImage.GetComponent<RectTransform>().sizeDelta = new 
 Vector2(texTmp.width * 0.5F, texTmp.height * 0.5F);    
PortraitImage.texture = texTmp;

Sort objects to dictionary

Sample code for sorting GameObjects into user-created categories.

Example of how creating a flow map helped me understand how to build the different parts of the function.

Example of how creating a flow map helped me understand how to build the different parts of the function.

Dictionary<string, List<GameObject>> EntryLibrary = new Dictionary<string, List<GameObject>>();

void CreateDictionary()
{
    //Sort out items based on tags and create category:[index] pair
    List<GameObject> var = new List<GameObject>();

    foreach (string tag in category_types)
    {
        foreach (GameObject asset in AssetStack)
        {
            if (asset.CompareTag(tag))
            {
                var.Add(asst.gameObject);
            }
        }

    AssetLibrary.Add(tag, var);
    var = new List<GameObject>();
    }

    foreach (KeyValuePair<string, List<GameObject>> dictPair in AssetLibrary)
    {
        Debug.Log(dictPair.Key);

        foreach (GameObject item in dictPair.Value)
        {
            Debug.Log("Item stored in " +dictPair.Key+": " +item.ToString());
            int index = AssetLibrary[dictPair.Key].IndexOf(item);
            Debug.Log(index);
            Debug.Log(item);
        }
    }
}