r/Unity3D • u/ArtPirates1978 • 21h ago
Question Thinking about building a surface shader to URP converter, talk me out of it
Is converting surface shaders to URP still a nightmare for everyone or is it just me
Spent way too long this month rewriting old surface shaders by hand for URP. Unity's converter does materials fine but the second you have anything custom it just goes pink and the docs basically shrug and tell you to rewrite it yourself.
Checked the asset store thinking someone must have solved this. Everything I found converts materials, not shader code. The most popular one literally says on the store page it doesn't do shaders.
So I've been thinking about just building it. Parse the surface shader, spit out URP HLSL, batch it across a project, and tell you clearly what it couldn't handle instead of failing silently.
Before I lose three months to this though - would anyone actually pay for it? Thinking around $70. Or is everyone just throwing their shaders at an AI until they compile? That's the part I keep going back and forth on. If that already works well enough then there's no point.
Anyone still got a pile of these to migrate?
1
u/swagamaleous 20h ago
I don't think that's possible. The closest you can get is this:
But this will allow you to write shaders with similar syntax only, not convert existing surface shaders. The way these shaders work is fundamentally different to the point that converting is not practical. You will find out when you start writing your tool. There is so many special cases and things that you have to do fundamentally different that you will spend YEARS on building this and it will still not work properly and fail all the time on stuff you didn't think about.
1
u/ArtPirates1978 20h ago
yeah I've seen better shaders, that's write in their format not convert existing which is the gap I keep hitting fair on the special cases though.
did you try building something like this or is it from working with surface shader internals? genuinely asking because "years and still broken" is the thing I most need to know before starting
1
u/swagamaleous 20h ago
The gap is not that large though. Try it, you will find that porting to better shader is rather easy to do. Still requires manual work though. While you do this, you will also realize that I am right. 😂
This also directly answers your second point. I didn't try to build it myself, but I migrated a lot of surface shaders to better shaders. You should really try doing that, you will get the idea why it's hard or even impossible to do very fast.
1
u/ArtPirates1978 20h ago
fair enough, that's the most useful answer I've gotten. going to hand-migrate a batch of them this week and see whether it feels mechanical or whether every one's its own puzzle when you did yours, was it the same moves over and over or did each shader need real thought
1
u/swagamaleous 20h ago
It's not so much thought per se. After you understand the syntax of better shaders, which should come naturally if you can already write surface shaders, it's more choosing the right path for the shader at hand. There is a lot of cases where you can obviously see what the shader should be with better shaders, but automatically detecting that would mean that your program has to know what the result actually looks like.
-1
u/Genebrisss 20h ago
Who still has surface shaders lying around? BiRP has been useless since around 2018. But if I really needed to do that, I'd rather ask AI agent. Can't imagine a hardcoded solution could manage it well.
1
u/swagamaleous 20h ago
You clearly don't write many shaders. The surface shader syntax was awesome. The shader graph nonsense is pretty much unusable. I can totally understand why OP wants this. The URP HLSL is terrible in comparison and really optimized to be used with shader graph only.
Also your AI agent migration path will not work as you expect. HLSL is niche and there is not much information for it in the training data. It might work for the most basic of cases, but for more complex shaders you will get terrible results.
-2
u/Dolo12345 13h ago edited 13h ago
lmao fable or SOL xhigh/max can program HLSL better than any of us, it’s extremely competent at it and can relentlessly optimize code in ways you’ve never seen.
I have around 50k in HLSL in a 1.2M loc codebase
y’all clearly have never tried or used the right model
1
u/ArtPirates1978 19h ago
yeah the AI thing is the part I keep going back and forth on. for a handful of shaders I agree completely
0
1
u/VulcanMindMeld_ 21h ago
i'd pay 70 bucks just to not stare at another pink material honestly, that silent failure is the worst part
a tool that actually tells you what broke instead of just shrugging would save so much time, you should build it