• Hi Guest!

    We have posted a new VaM2 dev log on Patreon, starting a monthly cadence of written progress updates between Beta releases. Highlights include the new Gizmos System, Selection Carousel, and Modes System with Context-Specific Editing. Beta1.2 is 15 of 21 items complete.

    Read the full post on Patreon, or follow progress on the public Trello roadmap.

VaM 1.x Applying transparent material via script

Threads regarding the original VaM 1.x

coinstacc

Active member
Joined
Aug 26, 2024
Messages
46
Reactions
155
I have a plugin concept that would involve spawning in some Unity primitives, but I'd want them to be semi-transparent. I've messed around with some of the shaders (TransparentGlossNMNoCullSeparateAlpha, I believe) that are used on built-in models but haven't been able to then adjust the alpha values, they always stay opaque, even when just reapplying the material to the VaM sphere atom. Is there anything that would keep the shader from being properly applied to a mesh through script, or any kind of special setup VaM does for its transparent materials that I'd be missing? (Seems like most if not all of the vamifier plugins omit transparent materials when they're applied, which makes me think it's a bit more complicated than what Unity does at a base level.)

(Alternatively, if anyone knows any plugins that use primitive shapes with applied transparency, let me know! Have only been able to find ones like SimSheetGrabber that use basic opaque ones.)
 
C#:
        private void debugPosition(Vector3 pos)
        {
            if (DebugCube != null) DestroyImmediate(DebugCube);
            DebugCube = GameObject.CreatePrimitive(PrimitiveType.Cube);
            DebugCube.name = "hzmBoundsCube";
            DebugCube.transform.position = pos;
            DebugCube.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
            DebugCube.GetComponent<Collider>().enabled = false;
                    
            MeshRenderer mr = DebugCube.GetComponent<MeshRenderer>();
            mr.material = new Material(Shader.Find("Particles/Additive"));
            mr.material.SetColor("_TintColor", new Color(0.8f, 0.1f, 1f, 0.01f));
        }
 
Upvote 0
Back
Top Bottom