Is it posible to write fixed pipeline "reflective shader with normal map"? If so, how?
Answer by Aras
Jan 03, 2011 at 03:15 PM
You want a cubemap reflection perturbed by a normal map, per pixel? No, that's not really possible with fixed function.
And yeah, there's no performance difference between programmable & fixed function shaders, if you do the shaders right. The programmable GPUs these days do not have any fixed function stuff, so they just generate shaders behind the scenes. In Unity's OpenGL ES 2.0 implementation we do generate the shaders ourselves, since GLES2.0 does not have fixed function stuff at all.
Answer by skovacs1
Dec 15, 2010 at 04:23 PM
For the programmable pipeline, check out the 4-th last shader (Example/WorldRefl Normalmap) here.
This should compile out to multiple passes in the compiled shader and I believe that would include the passes for fixed-function cards if applicable, no?
You might be right, although I'm not certain. My suspicion is that these shaders will do much more than I want: like include lights and so on. I just want to have base texture with environment reflection in some areas.
It's fairly easy to write an unlit programmable shader that does what you ask. Could you elaborate on why it must be "fixed pipeline", if you don't mind my asking?
it must be wrong belief that fixed pipeline is faster :)
I cannot say that it is not faster at all, but there are reasons that there is a programmable pipeline and that shaders can run code - a fixed-function pipeline is very restrictive and harder to read and write. In general, while they may be marginally more performant, restricting yourself to fixed-functions is generally going to make your life much harder. Unfortunately for your question, that is beyond where I and most users here in UnityAnswers are willing to fight with it. If you want an unlit normal-mapped reflective programmable shader, I can help with that however.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users post good questions and use the site effectively we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
No one has followed this question yet.
normal maps on iOS with a custom shader.. Works, but not the way I need it to
can you make a surface shader be drawn before or after a certain pass?
Two Normal Maps on same Material
Shader issue: Normal map from tangent to world space - Textures flipping?
Using dualforward in a shader for specularity and lightmaps