|
I'm getting a strange issue with Graphics.DrawMeshNow(). As I change the camera angle, it seems as if it switches to another material from elsewhere in my scene, instead of using the material I am setting the pass of. My code is below:
What am I doing wrong (or not doing)? Edit: A sample project that reproduces the issue can be downloaded here: Download
(comments are locked)
|
|
After some further investigation, it seems that the problem is caused by using the Diffuse shader in the material that DrawMeshNow() uses to draw the mesh. If the shader is changed to VertexLit, the mesh renders with the correct material. I suspect that this is related to DrawMeshNow() not using pixel lighting, although I'd be happy to be corrected by someone who knows better. I am the poster of the original question. Due to a mess up involving trying to change my anonymous account to a registered one, I can no longer login with the account that I created the question with, so I can't approve a solution or edit the question or comments. You're correct: DrawMeshNow does not integrate with lighting at all. So any shader that wants to use lighting will just use light setup of whatever was rendered before. Even VertexLit shader should not give your correct results, but most of the time the artifacts are much smaller than from the per-pixel lit shaders.
Nov 26 '09 at 07:38 AM
Aras ♦♦
Thanks, Aras. That makes sense. Is there a "correct" built-in shader in Unity that would work well with DrawMeshNow, or does one have to write a shader that ignores lighting?
Nov 26 '09 at 09:44 PM
Vester
(comments are locked)
|

Can you create a minimal project exposing the problem and post it here?
@robert - Attached. See above.