#Switching from shader graph to shader code
1 messages · Page 1 of 1 (latest)
1rst question I'd ask is : why ?
If you want to go slowly, you can use ShaderGraph's custom function node to write code that will be executed in SG.
It uses the HLSL language and shadergraph nodes are named like the code function that they use (you can also look at the generated code examples from SG doc).
If you want to go to "raw" shader code, take a look at ShaderToy. It uses GLSL, which is very close to HLSL so you won't be lost.
Then ultimately, if you want to do Unity shaders, you'll need to dig into the official ShaderLab syntax documentation, for declaring properties and passes.
The Book of Shaders is a good general ressource about shaders that is worth reading through, and The Unity Shader Bible for Unity oriented shader code.
"The shader you use with the Blitter API must be a hand-coded shader. Shader Graph shaders aren't compatible with the Blitter API."
https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@14.0/manual/customize/blit-overview.html#:~:text=The shader you use with the Blitter API must be a hand-coded shader. Shader Graph shaders aren't compatible with the Blitter API.
It's the reason ig I want to switch.
Or maybe 1 of the reasons.
Hmm, I've used "Fullscreen" graph types with Blitter.BlitCameraTexture and it seemed to work fine, though maybe that statement is still true for other Blitter API functions 🤔
URP 14.0 aka Unity 2022.3. didn't have Fullscreen graph type yet, so missing that official blitting method
Nevermind, it did
Currently reading your blog Cyan...
About render pass
Looks like you are typing.
Feel free to ping me when you post the message 😊.
TIL that you can have URLs with highlighted text 🙃
My pleasure
You are still typing.
React to this message to ensure that it's not a random kid or pet playing with your keyboard LOL.
Also no reason why you can't use both graphs and shader code in a project btw. No need to "switch" completely.
Writing a code shader for a Blitter function is likely just one pass so not too bad, but shaders used on scene objects can have many (like for drawing shadows, into depth/normal textures etc). Still possible to write but can be quite lengthy. Can look at the shaders under the URP package for examples, and/or I've also got a URP shader code article on my blog.
Graphs handle a lot of the setup & those additional passes for you to let you focus on the important parts (vertex/fragment function logic)
(Sorry, writing and doing other things at the same time so took longer)
There no need to.
Actually Thanks instead for your time 😊