[mini-tutorial] Creating new material nodes

Today I worked out how to create new material nodes from HLSL code. I’ve written some quick details on how I did it here.

It’s pretty basic at the moment but I thought I better write up what I’ve done in case anyone else is interested.

Ooh that’s really interesting :slight_smile: I definitely gotta try this sometime, thanks for the guide!

I wish there was better documentation about these stuff and more in-depth tutorials.

Quick question: how difficult do you think it would be to implement a for-loop node? maybe arrays? :stuck_out_tongue: I imagine that would require a lot of deep engine changes unfortunately.

A loop node wouldn’t be easy. Just in terms of code you’d need to make sure it was in a format that could cross compile, loops in shaders aren’t quite like loops in CPU code.

The way I would probably do this is make it so it unrolled the loop and generated all the code for each iteration, which would mean no dynamic loops. It’s not a trivial task but I don’t think you’d have to change anything more than I did if you went down that path.

I’m hoping to have some more detailed tutorials about the rendering system over the next few weeks, depending what else I discover.