Search Unity

Custom shaders for SRP

Discussion in 'General Graphics' started by C-Gabriel, Jul 22, 2020.

  1. C-Gabriel

    C-Gabriel

    Joined:
    Jan 27, 2016
    Posts:
    119
    Hi there,

    Are you guys writing custom shaders for SRP? How do you tackle it and what are the best practices? My instinct is to go to the SRP git, copy/paste a shader, and work from there (usually simple lit or unlit). That's clearly not the best way of doing it, (probably one of the worst) as it's easy to run into issues later if the package is updated. Also, the shaders have so much code duplication. Even a simple shader like Unlit https://github.com/Unity-Technologi...nder-pipelines.universal/Shaders/Unlit.shader has 2 SubShaders for 2 different ShaderModels (2.0 and 4.5).
    I'm thinking the shader graph might be a solution, but it's somehow limited for more advanced stuff and might be more costly on mobile devices. I personally prefer to write my shaders as that gives the best control.

    The way it stands now, although SRP might be better performance-wise, custom shaders are pretty hard to handle in a safe and ergonomic manner. I'm considering rolling back to the old renderer for the reasons listed above. What are your thoughts?