Hey forum, I’m running into undiscovered territory here. Basically, this is just a simple flag waving shader with culling and cutoff added to it. Right now, I also want it to obtain vertex color from the mesh, but unfortunately for me, the structs have ‘:’ in them. Does anyone know how to still retain this current shader but have the frag and struct be in a way I can add float3 vertColors?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FlagShader : MonoBehaviour
{
void Start()
{
Mesh mesh = GetComponent<MeshFilter>().mesh;
Vector3[] vertices = mesh.vertices;
Color[] colors = new Color[vertices.Length];
for (int i = 0; i < vertices.Length; i++)
colors[i] = Color.blue;
mesh.colors = colors;
}
}
The flagpole looked fine in Death Mountains. Unfortunately, a new problem started showing when I use fog in the Haunted Wastelands…
When I set the render queue to transparent, it looks correct but doesn’t have fog. And when I set it to opaque, it has that odd looking white geometry clipping inside it. Weird thing is, when I disable the fog, the white geometry is gone but still apparent. Anyone know what’s the cause of this?
@Alvarezmd901 How is this fog issue related to vertex color? Might be a good idea to start a new thread.
You probably have to apply the fog color. See the default Unlit shader you can create from menus how to do that, basically you just add a few macros to your shader. But I didn’t have time to properly read your code, but saw that those lines are missing. So, I’m not sure if that’s the fix but there’s no fog data used.