Creating a custom Substrate Shader Model/BSDF

No problem. Honestly, I wouldn’t hold my breath though. I’ve been waiting for a very long time for them to add something that would make it easier, and it is unlikely to ever happen tbh. Why I took matters into my own hands finally :laughing:

2 Likes

Nice work! I compiled the code however I can’t seem to find the pin for the rimlight.

In the most recent versions on github I’ve removed the “rimlight” pin and replaced it with three pins for “Masked Color”. Whatever you plug into these will be applied in the same way the rimlight was – letting you plug in an extra 'fake lighting term that is masked by the object shadows properly".

Doing it this way exposes these pins for additional uses, like fake snow sparkles/glints that are properly masked by cast shadows!

1 Like

Thanks for the explanation!

@DMeville This is the best thread on rendering stuff I’ve seen, and I’m trying to do the same thing. But your github repo is gone! Any chance it was just relocated somewhere you can link?

Thanks! The github is still there, but since it is a fork of the Unreal Engine source, it is only viewable if your account has been accepted into the Epic Games organization. You can view the instructions on how to get access here: Downloading Unreal Engine Source Code | Unreal Engine 5.5 Documentation | Epic Developer Community

Once you have access to the Unreal Engine github, you should be able to view my fork that is linked in this thread too :slight_smile:

Working on porting these changes to 5.7, struggling as some things have changed with how the data is stored/loaded from the substrate buffer that is giving me these out of memory errors that I’m trying to work through why and what needs to change.

EDIT: Actually I think this error is not from packing/unpacking, but from trying to assign that unpacked data into an invalided memory address (the SLAB_CUSTOM0() VGPRs not being defined properly?). HmmmmmMMMMMM

Also I saw that there’s an official toon bsdf now as of yesterday! https://github.com/EpicGames/UnrealEngine/commit/9d8e641d2d249fa5cc0a46bdd3c2b32e6f7b1fb0#diff-68d2fa1bded577940d9244fac4fbfe83e1da82e323e3844771b3ccc94c04ae5fR43

I’m really curious on how well does subtrate works as default for stylized work. I really want to make my own stylized painting game.

Depends on what you mean, but probably fine. It shouldn’t really be any different than non-substrate rendering. You can still use most of the tricks you could use if not using substrate (like overlay materials to do toon lighting, post processes, etc).

Maybe one downside would be since substrate is newer there’s less tutorials/documentation around it (which is why I’m writing this thread :P)

1 Like

Getting somewhere…

Git commit here showing the changes to get a single custom pin working through substrate in 5.7. Updating to UE5-main now though to see the Substrate Toon BSDF, as I might want to base my custom slab off of that instead for my personal project. (and at the very least it’s another exmaple on how to make an entirely custom slab)

https://github.com/EpicGames/UnrealEngine/commit/e5adc9c556b8053555cc2bb90d3c0216e830efff

All working in UE5-main now! Have the shadow sharpness pin, masked rgb pins to make a rimlight that only appears in non-shadowed areas (or whatever you hook up to those pins) and a glittermask for the Single Layer Water for those extra sparkles: https://github.com/DMeville/UnrealEngine-Custom-Substrate/commit/8c5f216d9abd850c7c0483ea91be746067c68ef3

2 Likes

Yeah that makes a lot of sense. the idea is taking painted meshes and having the light react to it like if it were photoshop with different blending modes to help cement the look of it being painted rather than using PBR rendering. and so far what you have is really promising!

oh the link does not work

How many custom pins can you add to substrate and can some be vectors?

As many as you want, I suppose. But it’s not free performance wise, It costs extra bytes per pixel for every extra pin!

Yes the pins can be float1/2/3/4. I just made them all float1’s for simplicity sake

This is such a gem, thank you!

1 Like