How to add an image texture to the second Sample2D Uniform in a script? (SOLVED)

Hey there,

how can I add a texture (noise.png) to the second sampler2d Uniform in a script?
(defined as the second entry in ‘Samplers’ as ‘noise_texture’ in a material.)

I hope it’s not too complicated for any of you to solve this…
This should be easy, because many shader rely on a second sampler2D texture …?

(And I hope you don’t say I have to make a render target, I tried that but the workflow is awfully
complicated in comparison to how other engines solve this with ease.)

Best,
tL.

(There was a similar question in March, which has no answer to this problem:)

Oh man, now I see that the second Sampler2D Uniform has a property on the component with the material attached. I can add a texture in there…

:clown_face:

If one of you guys could still tell me how to do this in code, it would be appreciated.
If not, then no problem. It’s all good…)*

EDIT: Well, ok. The Sampler2D are only visible as properties on a model(Quad).
Not on a sprite. I think this is no problem though?? *
But when I think about it, that is just what I wanted to do: Get a second Sampler2D Texture on a material that is attached to a Sprite… :expressionless:

This is a Defold example that uses two texture samplers:

2 Likes

Ah, I think I was blind. It is still that easy. :smile_cat: Thanks!

EDIT: I know why I was ‘blind’. On Defold 1.4.7 on OSX they don’t show up,
on Defold 1.9.5 on Windows, they do.

A lot has happened between those two versions!