If we are talking about doing Custom Nodes and other things then it is needed. There are definitely times you want to reference the sampler and not just a color or a value when doing procedural stuff.
Plus as I am doing a Black and White to Normal Map Node. It takes sampling the texture 4 times which means I will need access to the Sampler2D or I would have to make 4 inputs for offset samples which is not ideal.
I was looking at what it would take to add it and my first impression is it would not be that hard.
Well This is going to be not easy as this is not a value type. Again why do you need a sampler? I’m not convince at all you need more than what the texture block will return.
What else can you do besides reading a color from the sampler?
I promise people will request the holy crap out of it as soon as we release customNodes, unless I miss understand how they are going to work. But for example, right now if I wanted to make a normalMap procedurally generated from a Black and White image, given the current setup I would need to make 4 texture nodes offset the uv on each of them, and then pass those 4 colors to input instead of just passing the texture sampler itself. It is also needed for when we want to do textureBased sampled noise, incase people don’t want to use procedural.
The Node editor is just another means to construct shaders, if we do not have access to a sampler2d variable our ability to build cool stuff is going to be hindered.
I understand where you are coming from though, as it’s not a output that you can just hook up to something and see a value.
Yes but sampler2d is not enough. You will need the texture matrix, and the uv. So having 4 texture blocks seems reasonable.
In your case you will have to either ignore texture matrix, or re-invent the wheel and rebuild the texture matrix etc…Or ignore texture matrix, but then people will complaint about their uOffset/vOffset etc not being supported…
For noise, or stuff like that maybe hosting the sampler would work? Exposing the sampler is too complicated for the purpose of the NME. By complicated I mean from the user standpoint
I mean just create them inside your block. If your block needs to read data multiple time with a specific behavior I see no problem to create a sampler inside your block (like what the textureBlock does)
So what about dynamic inputs like in this use case. Lets say a user wants to make a FBN node, but in it they want to be able to drag into an input a noise function of some kind? Is this going to be solved with Custom Nodes, I don’t see how unless a custom node can output a reference to a function.
Well not sure how this works with other node editor but I had no plan for dynamic input. In this case I would say that the FBN can take a float value as input and you can plug in that input either a float or the output of another node (which could be a noise block)
If we have code nodes then we will need like ‘Static Function Blocks’ Where its a node that has no input or output but includes some code that creates the namespace for a function that can be accessed by any Custom Node or Custom Code node.
So that way you would just replace the Static Function Blocks name to whatever is referenced in the Custom Node block so like in the Custom Code block you have a function ‘globalNoise’ that you are using, it would point directly to whatever function was in the Static Function Block with that name.