- Home /
particles/multiply shader not working on fbx
I started by using a primitive "Plane" as the ground. I textured it with a diffuse shader for grass, and a particles/multiply shader for random splotchiness to distract from the grass tiling. It looks like this: http://dl.dropbox.com/u/6927019/ground1.png
This is good so far, except I want the ground to be more subdivided so I can adjust height by changing vertices. Since there is no way to specify that in Unity for the Plane primitive, I create one in Lightwave 3D, convert it to fbx (just like all my other 3D assets), and use that instead.
However, the particles/multiply shader on the fbx results in a black mesh instead of shading it as expected. THE QUESION: Why would the shader work on the primitive but not on the fbx?
I know that the fbx has UV coordinates because the diffuse shader works properly on it.
Answer by Gillissie · May 03, 2011 at 12:25 AM
I found that I could use the "Simple Additive" example from the documentation, and change the blend mode to multiply and get the effect I am after without using the particle shader.
http://unity3d.com/support/documentation/Components/SL-Blend.html
I think that's even the best solution ;) The particle shaders use always the vertex color (it's used to tint each particle differently). If you mesh doesn't contain vertex colors it will be multiplied by (0,0,0,0) which results in black. The built-in meshes (cube, plane,...) have a white vertex color that's why it works with the built-in mesh. I'm glad you've found a solution that fits your needs.
Answer by Bunny83 · May 02, 2011 at 09:37 PM
There's technically no difference between the built-in plane mesh and an imported mesh. There's probably something wrong with your mesh. Maybe:
- your vertex normals point into the wrong direction. Try the Unity generated normals. Just check your importsettings of your fbx model.
- your UVs are messed up in some weird way.
- you used different materials when you tested it with the built-in plane.
- you have exported vertex colors?
I always use "Generate" for the normals on the fbx importer. Like I said above, the UV's work properly when using the normal diffuse shader. I'm using the exact same materials as the plane. I didn't do anything special to export vertex colors. Even if I did, the diffuse texture wouldn't work right. I'm thinking it's a bug, but I wanted to make sure before submitting a bug.
I'm thinking it's something about the particle shaders that don't like imported meshes. The problem is the same on any fbx that I've imported.
I'm pretty sure that's not a bug of Unity. The particle shaders aren't made for "normal" geometry. $$anonymous$$ost of them use the alpha channel for blending or other things. Even the render queue position is different because they count as transparent. Do you use a light? Otherwise the normal diffuse shader would render also black.
Yes. Like I said, the diffuse shader works perfectly. I would be happy to use a shader that uses multiply blending, but isn't the particle shader, but there isn't one in the standard assets and I don't know how to write shaders.
$$anonymous$$akes me wonder, what shader do the shadow maps use? That's exactly the effect I'm looking for.