Can ASE reuse samplers?

Node-based Shader Editor

Can ASE reuse samplers?

Postby jake_from_bend » Tue Nov 20, 2018 1:36 am

I'm working on a custom Terrain shader, and am hitting the 14 sampler wall.
We're stuffing the textures to the gills. Each texture set is 5 textures packed into 2 RGBA maps (Color, Gloss, Derivative, AO, and Displacement all packed into 8 channels.)

Unity has macros that allow you to reuse samplers, for example: "UNITY_DECLARE_TEX2D_NOSAMPLER()"
So if i hand edit the shader code, I can get past the limit, but at that point, I can no longer use ASE to modify the shader graph.

Is there any workaround? Texture Arrays are a dealbreaker due to the GPU stalls we've encountered on some of the target hardware.
jake_from_bend
 
Posts: 10
Joined: Tue Oct 23, 2018 6:50 pm

Re: Can ASE reuse samplers?

Postby Amplify_Borba » Tue Nov 20, 2018 12:33 pm

Hello, you can set your Texture Samplers' Mode to Reference, so it uses a Sampler property from another Texture Sample node instead of creating a new one:

Image

You can also use a Texture Object node connected to different Samplers:

Image

Please let me know if this helps, thanks!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Can ASE reuse samplers?

Postby jake_from_bend » Tue Nov 20, 2018 7:02 pm

Unless I'm doing something incorrectly, I can't connect the 'reference' sampler to a second texture object.
sharedSampler.JPG
sharedSampler.JPG (63.58 KiB) Viewed 4052 times
jake_from_bend
 
Posts: 10
Joined: Tue Oct 23, 2018 6:50 pm

Re: Can ASE reuse samplers?

Postby Amplify_Borba » Wed Nov 21, 2018 11:34 am

Apologies for not being clear enough, the Texture Object can only connect to Texture Samples in Object Mode, since when they are set to Reference they are already using the Sampler property from another Texture Sample node.

Both images I shared above are for two distinct scenarios, in the first one a single Texture Sample is used, and referenced by another, while in the second one a Texture Object is connected to two Texture Samples in Object Mode.

To prevent the needless duplication of textures, you can either use a Texture Object and connect it to several Texture Sample nodes in Object Mode, or use one or more Texture Samples in Reference Mode, pointing to an already existing Texture Sample.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Can ASE reuse samplers?

Postby jake_from_bend » Tue Nov 27, 2018 2:31 am

Okay, i think i understand both of those scenarios, but i'm not sure that either of them are applicable to what i'm trying to do.

What I'd like to do is reuse the same sampler with multiple textures. Not multiple samplers with the same texture. I think this is where the confusion is.

This is something you can do in Unity's shader code by using their built-in macros (https://docs.unity3d.com/Manual/SL-SamplerStates.html). You can also do this in UE4 by setting the sample type to "shared."

My use case is that i have a landscape shader I've written by hand that blends between 9 layers (x2 textures per layer), a world-space normal-map, and a macro color map. That's 21 textures total, which would be impossible to do in a single pass if each texture used a unique sampler. (I don't want to use an add-pass shader since it effectively renders the terrain twice.)
I technically only need to use 2 samplers, since the macro textures all share UVs as do the detail maps, but to make the shader a little faster on the GPU, i'm using one sampler for each detail layer and one for the macros. (10 total).

This works great, but since it isn't in ASE, I can't hand it off to an artist to maintain, which is the desired goal.
jake_from_bend
 
Posts: 10
Joined: Tue Oct 23, 2018 6:50 pm

Re: Can ASE reuse samplers?

Postby Amplify_Borba » Tue Nov 27, 2018 11:33 am

I see, thank you for elaborating!

Unfortunately, this is not something that we support at this time, but I'm going to register this as a request for our developer to consider.

We'll be sure to let you know as soon as we have any developments regarding this matter, please let us know if you have any further questions.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Can ASE reuse samplers?

Postby jake_from_bend » Tue Nov 27, 2018 7:04 pm

Thanks!
Yeah, that's kinda what i figured. It would be a great addition. I'm positive that feature would make Amplify even more valuable to shader artists.
jake_from_bend
 
Posts: 10
Joined: Tue Oct 23, 2018 6:50 pm

Re: Can ASE reuse samplers?

Postby Arugin » Tue Feb 26, 2019 5:19 pm

Any news on this? This feature is super usefull for terrain/planetary shaders. And this is only one that prevents me from transition from Unity shader graph to Amplify.
Arugin
 
Posts: 1
Joined: Tue Feb 26, 2019 5:16 pm

Re: Can ASE reuse samplers?

Postby bitassembler » Wed Feb 27, 2019 10:03 am

This feature would be super great. Looking forward to this one too. Currently, you have to do this with tedious texture arrays.
bitassembler
 
Posts: 2
Joined: Tue Feb 26, 2019 7:07 pm

Re: Can ASE reuse samplers?

Postby Amplify_Borba » Thu Feb 28, 2019 3:57 pm

Hey guys, our developer hasn't been able to tackle this feature just yet, but please rest assured that it is registered and will be considered as soon as it's possible!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 10 guests