|
I'm working through the Unity Shader presentation, but I'm running into a problem. With the following code I only get a diffuse output, when I should be getting a specular one:
I'm pretty sure this code is right, and I'm running a Nvida 9000 series card so I don't think the shader ability of the card is to blame. Is there some setting I'm not thinking about that wouldn't allow for specular output to be rendered? Thanks!
(comments are locked)
|
|
Hey, you're right. I never noticed. wtf? I just ran some tests - lots of them. It appears that like yourself, in my copy of Unity 2.6 Pro on Windows at the time of this writing, none of the ShaderLab-based-shaders seem to do specular without a SetTexture call multiplying the primary. This should be corrected. I have confirmed that all of the built-in VertexLit shaders have such a SetTexture call, which is why they all work. If you're looking to do it without the need for a texture in the shader, I looked at the built-in "Specular" shader and without the texture stuff, it looks like:
So, to answer your question(?), ShaderLab does not seem to be applying the specular component without a texture anymore. If you don't want a texture in your shader, you seem to need the above CGShader to perform the vertex lighting calculations. This was not how it used to be as per the Unite08 course you seem to have gotten your shader from and given Aras' above answer, it doesn't seem like it was intended to be this way. That was the conclusion I made after awhile. I guess you apply the texture then for a quick fix... otherwise hope they fix it in 3.0 ^^
Jun 30 '10 at 12:36 PM
afuzzyllama
(comments are locked)
|
|
This is still an issue as of 3.5.2f2.
(comments are locked)
|
|
I'm Using now Unity3.3. But it seems we have the same problem. When i Use the exact code you posted (the one on the Unite 08 presentation). I still don't get the Specular color applied. Why is that?, is there a solution that doesn't require me to write a vertex program?, please Help. Cheers. Solved: I Used a SetTexture statement, SetTexture [_MainTex] { Combine texture * primary DOUBLE, texture * primary } I declared a _MainTex property also, it worked.
Apr 23 '11 at 08:51 PM
Hendrys
(comments are locked)
|
|
I am also having this problem. Specifically, I would like to have no texture work done for certain geometry on the GPU, but I need vertex-only specular for that geometry. Is there a workaround that does not include a SetTexture command?
(comments are locked)
|
|
Does adding "SeparateSpecular On" help? Unfortunately no. It seems when I set the texture it works... otherwise it just does a diffuse shader.
Jun 09 '10 at 05:28 AM
afuzzyllama
(comments are locked)
|
1 2 next page »

After playing around with this a little more, I have found that the specularity is actually enlarged on the back half but when I start to move the object out of the center it goes away. When I bring the object to the edge of the camera view... the specularity shows up and enlarges quickly. Maybe there is something with the glstate/ObjSpaceLightDir/ObjSpaceViewDir in my scene/project/unity?
I don't know if this is the solution but when I set the texture and then made it none the specularity effect started to happen.