Hello, I’ve been trying to make a VisualShader that creates seamless textures by mixing two texture images and using noise for the weight. It all works perfectly, only that I also need the final texture to have a “nearest” sampling filter so it looks pixelated.
The only way I’ve found so far is by setting the Texture2Ds to be SamplerPorts, taking in a Texture2DParameter that takes in the texture image as a parameter. But I’d like to not have to manually insert the texture file parameter from outside the shader, and instead just have it hardcoded from within it instead, since I’ll be making plenty of these as unique shaders for different materials.
So in other words: how can I have the equivalent of a Texture2D (Texture) node that lets me change its sampling filter? Or alternatively, how to set the sampling filter of the entire final texture?
For setting the filter, we need to be able to add, for e.g. filter_nearest in the sampler2D’s declaration like this:uniform sampler2D tex_frg_2: filter_nearest. But there is no way of doing that through visual shader, so the answer is NO, you can’t set the filter for Texture2D node from visual shader itself, its necessary to use the Tex2D’s sampler2D port for that
Oh so Texture2D is just the texture() function from gdshader syntax? But why would the devs give the “Texture” option, it is unnecessarily confusing since you have to inject a sampler2D anyway😐I think it should be removed
All visual shader is, is a wrapper to gdshader syntax. The visual shader is compiled into a gdshader at the end of the day.
Although I would say it is confusingly named they should have kept it closer to gdshader naming, but both spatial and canvas shaders exist in the same source file.
Here is the source for all visual shader node gdshader represention. It’s a little abstracted but there is a class per node, and enough context to see what each node represents.