1
\$\begingroup\$

I'm experimenting with adding some procedural textures to the unity standard shader. I'd like to add an extra pass (with vert and frag functions), but am unsure about where in the sequence this should go, and how to properly integrate it with the other passes (I want to keep all the standard shader lighting features etc.).

To keep things simple, I'd like to start with adding an extra pass which simply paints the mesh one color. Where should this go (in Standard.shader)?

Note : I've tried adding a pass between passes #1 ("FORWARD"), and #2 ("FORWARD_DELTA"). This works, and casts shadows, but does not recieve shadows.

Thank you!

\$\endgroup\$
7
  • \$\begingroup\$ Have you looked into shader replacement in Unity? \$\endgroup\$ Commented Feb 8, 2017 at 11:56
  • \$\begingroup\$ @DMGregory, thanks. To clarify, I already have a customised version of the standard shader being applied (I'm modifying the source), so I don't think shader replacement can offer anything else there. The problem is in getting the extra pass to work with the lighting model. \$\endgroup\$ Commented Feb 8, 2017 at 14:28
  • \$\begingroup\$ Where I was going with that was that it may be easier to draw with one shader, then draw again with another, rather than wedge an extra pass into a surface shader. The surface shaders compile into many different forms depending on the rendering model, platform, etc. so getting all those combinations right can be tricky. ;) \$\endgroup\$ Commented Feb 8, 2017 at 14:36
  • \$\begingroup\$ @DMGregory I see, thanks. Hmm, I didn't know it was possible to chain two shaders. I can't see where in that shader replacement doc that is mentioned though (unless I misunderstand something) - could you point me to an example please? \$\endgroup\$ Commented Feb 8, 2017 at 14:42
  • \$\begingroup\$ Hi @UpTheCreek, ShaderCat here. A bunch of questions: Are you sure the third pass is getting executed? What version of the Standard Shader? Did you add this pass in Standard.shader? Did you include #pragma multi_compile_fwdadd_fullshadows? \$\endgroup\$ Commented Feb 10, 2017 at 8:30

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.