Chain Strange Behaviours and Bugs

For a harpoon ability I need a visual chain that has…
1: Variable length by adding/removing links… (not stretching the texture)
2: Is subject to lighting like a standard shader (i.e. not a particle shader). I want it to be dark if there is no light source (not self illuminated).
3: Shadows + bump map + specular map are nice to haves (but not 100% necessary).

Here’s a video of where I’m at so far.

I started out trying the lineRenderer but that didn’t work because the standard shader is completely black. If I use the particle shader with the lineRenderer then it is self illuminated even in the darkness which is unacceptable. So instead I am using a plane mesh with 2 triangles and I’m re-sizing the mesh each Update. It seems to work OK except for a few bugs.

1: When zoomed in or if the chain gets long (where >50% of it is off screen) then it completely disappears. See video.
2: The standard shader isn’t fully transparent even in the 100 transparent sections. This gives a box outline of the chain’s plane mesh (see photo)
3: The standard shader has a strange shadow with dots (see photo)
4: The standard shader is dull and flat (see video and photo). I have had this problem before… the standard shader seems to always be dull but I’m not sure how to fix.

5: If I use a different shader (like legacy transparent bumped diffuse) the white transparent box goes away, but there is no shadow. Also it still becomes invisible when part of the chain is off-screen.

Any suggestions on how to fix these bugs or how to properly make a variable length chain would be appreciated. Thanks in advance.

Edit: mesh.RecalculateBounds() fixes bug #1
Edit2: Standard: Cutout seems to be better than Standard: Transparent
Edit3: The reason for the white transparent border and shadow dots in areas of 100% transparency is because the Standard shader still has specular at 56, 56, 56 even when set to 0. Never use Standard shader, always use Standard (Specular). See this for details.

1 Like

2: Use cutout (like you mentioned) or fade. Transparent is for glass or similarly optically transparent surfaces, where an alpha of zero means no albedo, but still has specular. Using the Standard Specular with a black specular color can also work around this.
3: The standard shader by default uses a dithered shadow to emulate partially transparent shadows. This works well with soft shadows, but kind of terrible with hard shadows. Using cutout, or a custom surface shader can avoid this. However the fact you’re seeing dithering in the “clear” areas of your mesh make me think it might not actually be fully transparent in your texture.

Also note the cutout mode can be affected by shadows, neither transparent or fade can.

1 Like