Shadow projector on Unity iPhone

Hi Folks,

Has anyone managed to get the blob shadow projector working under Unity iPhone? I have been building up a scene based on the 3DPlatformTutorial that worked perfectly fine on Unity Indie, but I cannot get the shadow projector working for the life of me!

The licence page Real-time tools for 3D, AR, and VR development | Products suggests that shadow projectors are supported under Unity iPhone Publishing Basic, so I’m wondering what I’m missing here. I just tried to use the Blob-Shadow from the example project…

Any clues, anyone?

Regards,

Nello

Hi,

We are using projectors in !Rebolt! for blob shadows and for craters and things and they work fine. Are you getting any result at all, or just an incorrect result?

No result at all, using the exact component supplied with the example project. Kinda don’t know where to go next…

I am using them here… work fine in 1.0.1… they didn’t work in 1.0 though.

Are you sure you are using the correct shader? FX/Projector Multiply?

I’ve just upgraded to 1.01 - maybe passing through the 1.00 stage did something evil?

I’m using Hidden/Projector Multiply which is the shader used by the original example. Where did you get FX/Projector Multiply? This sounds like it may be my problem! I’ll have a look through all the components on my machine.

(Can’t help but notice you’re in Melbourne - me too! I’m in Surrey Hills, where are you?)

Thanks for getting involved and replying to my post. I’ll try to find that shader and go from there.

Regards,

Nello

Just figured out how to get the projector stuff to work for me. Couple of the things that caught me up were having to re-import the texture because the original one had DXT compression (which of course the iPhone doesn’t like) and also the need to re-import it with RGBA not just the auto RGB pick at the top of the list.

Hope that might help.

Also I’m in Melbourne. I used to live in Box Hill just near Surrey Hills. Living down at Rye now. The beach is wonderful for getting the creative juices flowing.

Cheers

Michael

Causality, you hit the nail on the head - pure genius!

You get 5 gold stars AND an Elephant Stamp, plus my eternal gratitude. Thank you so much!

Also, who would have thought that Melbourne would be chock-full of Unity developers? Fantastic. We should have lunch some time and claim it as a conference. :smile:

Thanks for your messages and help, guys. Good luck with it all!

Nello

I am using this shader and getting no results. Any suggestions?

Shader "FX/Projector Multiply" { 
	Properties {
		_ShadowTex ("Cookie", 2D) = "gray" { TexGen ObjectLinear }
		_FalloffTex ("FallOff", 2D) = "white" { TexGen ObjectLinear	}
	}

	Subshader {
		Tags { "RenderType"="Transparent" }
		Pass {
			ZWrite Off
			Offset -1, -1

			Fog { Color (1, 1, 1) }
			AlphaTest Greater 0
			ColorMask RGB
			Blend DstColor Zero
			SetTexture [_ShadowTex] {
				combine texture, ONE - texture
				Matrix [_Projector]
			}
			SetTexture [_FalloffTex] {
				constantColor (1,1,1,0)
				combine previous lerp (texture) constant
				Matrix [_ProjectorClip]
			}
		}
	}
}

I thought I had a blob-shadow working (turned-off mip-maps when importing shadow texture, which got rid of the texture compression artifacts), but nothing appears on the app version.

Is anyone able to post a package with a working blob-shadow?

I just tried it for the first time - dragged the standard assets blob shadow projector onto an object, worked fine when playing in the Editor, doesn’t work when I build and run on my iPod Touch. Tried both PVRTC and RGBA formats for the shadow texture, with and without the falloff texture. I do see some shadow-like flickering, so I think somethings’ happening.

I think the problem seems to be if the mesh it is trying to project on is made up of large polys it gets confused. I can get the shadow to project on a small mesh (my character), but on my ground mesh it isn’t working.

I just realized the same thing - I was testing on a plane that’s stretched out.

This is exactly the issue. It projects the texture material over the entire mesh not just the small focal area.

This is very frustrating.

I have played around with Ray casting of shadows, and it kinda works but stinks on non-flat surfaces because it realize on collision hits to projected position.

I really wished Unity would push out a hot fix for this one.

Mmm, is there no way to get this working like it should?
When unity says it is supported I suppose they have tested it and found it to be working right?

Mm, hope someone gets it to work well, and shares it here.

Got it working! I think it is something to do with the order that the blob-shadow is being rendered. What I did was reposition the blob-shadow using a LateUpdate.

Instead of making the blob-shadow a child of the object you want it to follow, place it as a separate object, position it where you want it to be in relation to the ‘followObject’ and attach this script to it:

public var followObject: GameObject;

private var myOffset: Vector3 = Vector3(0,0,0);

function Awake() {
	if (followObject) {
		myOffset = transform.position - followObject.transform.position;
	}
}

function LateUpdate () {
	// make sure the position matches the parent
	if (followObject) {
		transform.position = followObject.transform.position + myOffset;
		transform.eulerAngles.y = followObject.transform.eulerAngles.y;
	}
}

Then assign your followObject in the inspector. I also like this because it makes the blob shadow point directly downwards. If your blob has an aspect ratio of 1 you can remove the line that adjusts the y angle (as you won’t notice it).

I’m using a similar script that tracks the position of a follow object (yeah, I realized my mistake in making it a child of a rolling ball!) but with an additional “lightsource” variable and I sync the rotation of the projector with that of the light source so the blob matches the lighting. I don’t quite have blob shadows working on the device, but the result looks right in the Editor.

Thanks,transparence! :smile:

Could you share a simple project example?

I am getting the same results as the others. It appears to work right in editor but still fails in Runtime.

I know this is thread is a little outdated, but I found the solution for me getting blob shadows projecting on large models on the iphone was to switch the projector to othoragraphic.

Hi,
How make the projector works on transparents material?
Actually it works perfectly for me except on transparent cutout or diffuse surfaces.

Is it possible to modify the shader to make it works on transparent surfaces with or without sorting

Thanks for your reply !

Attached snapshot :
With diffuse it works fine

With any transparent shader it doesnt’work