Duplicate by same User: http://answers.unity3d.com/questions/1111514/broken-specular-shader-code-cg.html please update your linked question with your new informations, don't ask new ones.
How to write a surface shader for realtime reflection? (CG)
I have a specular shader written in CG and I want to make it reflect anything in the environment. Also, it has to be generic, meaning if something moves I want it to change the reflection.
Good morning. Im back to researching. I am a little let down that not a lot of people know this to the point that Im not receiving anything even overnight. But hey, thats what its all about, patience. Ill keep reading, but in case I get an answer, I want to clarify that I DONT want to use cubemaps, so how did unity create their reflection in their standard shader? I cant seem to weed it out from the 20,000 lines of nonsense you get after compiling the standard shader.
If I'm not mistaken, the reflections used in the Standard shader are all based around Reflection Probes, with a default of using the skybox.
Hi @$$anonymous$$o $$anonymous$$haon,
Yea I think that could be my answer. But how do I program my CG shader to use the probes?
Unfortunately, that one's a bit tougher for me to answer easily. I haven't really looked into enough detail at the Standard shader yet, except to know it's a horrifying mess of redirections and preprocessor directives.
Granted, it does make sense in order to allow for versatility in the shader(s), but it's still quite easy to lose track of, well, anything with the wild assortment of function calls changing values of their arguments.
Follow this Question
Related Questions
Mirror reflection not working as planned 0 Answers
Why does my mirror not reflect my water shader? 0 Answers
Intercept last pass on a surface shader to change RGB of that pixel 0 Answers
Reflecting object through portal and matching exit portal rotation 0 Answers
How to correctly apply direction to reflection from unity_SpecCube0 0 Answers