Blob shadow shader rewrite

Hi everyone,

I’m projecting texures onto objects using the blob shadow projector, but I’d like to tweak the looks of it a bit and I guess that requires a new shader? (the reason I’m using a projector is because I need different images to move across the surface independent of eachother)

What I want is for the projection to be “self-illuminated”, so that no matter how dark the object is that I’m projecting onto the image is always full color. Check the attached file for a visual guide, the sphere on the left uses a standard blob shadow projection, and the one on the right is a reference for how I want it to look.

Unfortunately I have no idea of how to do this, so any help is much appreciated…

/thanks

13647--463--$shader_compare_515.jpg

Use a spotlight with a cookie: that probably does what you want.

d.

Silly me. Cookie, of course, don’t know why i had to make it so complicated.

thanks

/P

it’s not working very well with the cookie…

I need to project a lot of textures onto this sphere, and doing so with a light+cookie gives strange results:

Some of the cookies are not visible. The detail of the cookie is not visible and motion is not smooth but seems to jump from polygon to polygon.

:frowning:

/P

Spotlight cookies are greyscale from the alpha of the texture, so projectors are definately the way to go here

Is the problem that you have pixellights turned off? Low detail and jumping from poly to poly sounds like vertex lighting. You can increase the number of pixellights during editing by changing the Project Settings > Quality.

What Morgan said: Cookies are only supported by pixel lights. The quality settings have a limit on how many pixel lights can affect any object (after that they are turned into cheaper vertex lights).

Back to original question: do you want the projector to “add” (i.e. illuminate) to any existing color? If so, then using the shader in projector’s material like this should do the trick. Basically this is the standard projector’s shader (Standard Assets/Blob-Shadow/ShadowProjection) with just modified Blend command to add onto existing image (instead of multiplying)

Shader "Projector/Additive" { 
	Properties {
		_ShadowTex ("Cookie", 2D) = "" { TexGen ObjectLinear }
		_FalloffTex ("FallOff", 2D) = "" { TexGen ObjectLinear }
	}
	Subshader {
		Pass {
			ZWrite off
			Fog { Color (1, 1, 1) }
			ColorMask RGB
			Blend One One
			SetTexture [_ShadowTex] {
				combine texture, ONE - texture
				Matrix [_Projector]
			}
			SetTexture [_FalloffTex] {
				constantColor (1,1,1,0)
				combine previous lerp (texture) constant
				Matrix [_ProjectorClip]
			}
		}
	}
}

Hmm, Aras - it seems that your shader would fade the object to white as the projector moved away from whatever it was projecting on. Try this one instead.

Shader "Projector/Additive" {
   Properties {
      _ShadowTex ("Cookie", 2D) = "" { TexGen ObjectLinear }
      _FalloffTex ("FallOff", 2D) = "" { TexGen ObjectLinear }
   }
   Subshader {
      Pass {
         ZWrite off
         Fog { Color (1, 1, 1) }
         ColorMask RGB
         Blend One One
         SetTexture [_ShadowTex] {
            combine texture, ONE - texture
            Matrix [_Projector]
         }
         SetTexture [_FalloffTex] {
            constantColor (0,0,0,0)
            combine previous lerp (texture) constant
            Matrix [_ProjectorClip]
         }
      }
   }
}

Thanks guys,

haven’t had time to test things yet but I’ll sit down with it tonight.

Need to teach myself shaders soon… :slight_smile:

/P