I cannot find clear information about shader placeholders in the documentation ($UV, $CH, $DECODE, etc)

Hi, I’m trying to find “official” documentation about the shader placeholders used inside the PC engine.
I know about some of them and how they’re working from searching the forum and looking inside the source code of the standard material, but it will be great if these were documented inside the User Manual as official documentation, all of these are very useful and I believe they should be more visible and better documented.
As an example of a situation I’m in that could be clarified easily with more documentation:

  • I’m getting warnings that
 DEPRECATED: Shader chunk macro $texture2DSAMPLE(XXX) is deprecated. Please use $DECODE(texture2D(XXX)) instead.

but if I switch from $texture2DSAMPLE which was returning vec4 to $DECODE which is returning vec3, I’m loosing the alpha channel.
You could see from this situation that a clear explanation of these placeholders, how are they converting from one color space to another, how are they treating the alpha channel, could help with the confusion. In this particular case, it would be great to know how was the old $texture2DSAMPLE doing the conversion, I’m assuming it was converting the rgb channels but it left the alpha intact. Why was that lost with $DECODE?

1 Like

Hi @heretique,

There isn’t any documentation on the shader chunks system (it’s still an unofficial API), it’s internally used by the engine and it’s in active development.

You can study the source code of the standard material program here to better understand how those placeholder values are being parsed/replaced on runtime:

About this @mvaligursky may be able to comment on.

1 Like