Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by rocket5tim · Mar 14, 2010 at 11:07 PM · shaderiphoneshadowprojector

blob shadow z-fighting on iphone

I can't seem to get my blob shadow from z-fighting with the ground plane on iphone. The shadow looks fine in Unity. I'm using the blob from iPhone Standard Assets.

I've followed suggestions on other threads: turned off mips, tried RGBA 16 and 32 bit, set it to orthographic, scripted it to follow my player rather than parenting to get rid of rotations, turned off cast/receive shadows on the ground planes, etc.

My ground geometry is a maya .mb with "meshes have colliders" checked. The ground texture is using the Diffuse shader, but I've tried iphone/Vertex Colored and just about ever other shader. Basically I have the same setup as the Penelope project.

I'm starting to wonder if this is a bug.

alt text

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by rocket5tim · Mar 16, 2010 at 02:36 PM

I found the solution. Add the following line under Pass {} in the ProjectorMultiply.shader:

Offset -1, -1

Here's the complete shader with the line added.

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

Subshader { Tags { "RenderType"="Transparent-1" } 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] } } } }

Offset is described in the Culling & Depth Testing doc: "For example Offset 0, -1 pulls the polygon closer to the camera ignoring the polygon's slope, whereas Offset -1, -1 will pull the polygon even closer when looking at a grazing angle."

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
2

Answer by Jaap Kreijkamp · Mar 15, 2010 at 05:57 AM

I can imagine you're tired of trying everything but one more thing you could try is modifying the Camera near and far plane, increasing value for near, decreasing value for far as much as possible. If you basically have a flat underground you could also consider using a plane with the shadow on it instead of a shadow projector, easier and faster. Place the plane a few cm above ground (and/or modify the texture offset of the shader).

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image rocket5tim · Mar 15, 2010 at 04:17 PM 0
Share

I tried the camera changes, but it didn't fix the z-fighting. FYI, my near clip is now 12 and far clip is 250 (was default 0.3 and 1000 before). And I don't have flat terrain so I can't do the shadow plane trick.

avatar image
1

Answer by Dwair · Mar 16, 2010 at 10:54 AM

I'm using shadows on Unity too, and they are a little CPU intensive for my proyects, but try this:

The projector ignore layers property is also useful for some glitches like that, just put your ground in a completely different layer and make the projector ignore all layers except that. It worked for me :)

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image rocket5tim · Mar 16, 2010 at 02:09 PM 0
Share

Thanks for the response. But sadly that still didn't fix it.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Do blob shadow projectors work on iPhone? 1 Answer

how to make a shader that only shows the shadow while the rest becomes completly transparent? 5 Answers

Support for dynamic shadows on newer iOS devices (supporting OpenGL ES 2.0) 1 Answer

Optimise adding shadows in scene using Unity iPhone 2 Answers

Need help with projector shader 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges