Download

Wierd Sampler limit issue with tesselation on landscape material.

Hey guys, I’m stumped. I’m using wrapped samplers, 45 so far, for a ummmm well large landscape material, and it’s telling me I’m maxed out. But not with just the wrap samplers, which have no problems, I deleted a bunch to check and it didn’t change the error. It only pops up when I add to the tesselation maps. It’s like they’re being read as normal samplers instead of the wrap sampler.
I’ve had the same issue with normal samplers, so I moved all the tesselation heightmaps into the alpha channels of the textures to cut down the number, but the same problem cropped up once I hit a certain number of tesselation layers.

Anybody got an idea of what the problem is?

b0cd672341f160e2579bd10fe9ccc371813a1687.jpeg

Maybe as first step would be to vreak down the spaghetti graph into compartmentalized function to increase readability.
It would also helpy you narrow down where the issues are within the graph.
The “Distance based tesselation” part (lower right) looks like code cduplication which makes maintenanace of such graphs agonizingly laborious.
Apart form that, the captiosn are so small, the screenshot doesnt help much.:slight_smile:

It reads fine for me. :stuck_out_tongue: Haha. Yeah, it’s a bit messy. Lemme break it down.

The distance based tessellation controls for distance and has a hard switch to turn it off. It’s based on camera direction and object distance, the ‘object’ in question being the landscape components. This seems to work quite well, the only issue being that cracks are popping up at the edges of the components, which I’ll fix at some point. Crack free displacement just breaks tessellation. I could do a pixel depth call, but that’s a lot of per frame calculations, so it’s probably cheaper to be loading per landscape component. If anyone thinks there’s a better version, I’d love to hear it. I’m compiling available landscape knowledge and putting it into a cheat sheet pdf. There aren’t a lot of resources on controlling things for distance.

5eccc3b6e34b2e5f4cd4c1173787a5c3a2ac297f.jpeg

The diffuse maps have the tessellation heightmaps, or in a few cases the roughness maps in their alpha channel. Most of the roughness and metallicity calculations are just maths from multiplying the rgb channels.

920be506a370b75794996bb65154d95d2027cce7.jpeg

The normal maps are pretty straightforward, though there’s two vectors controlling some broken normals, I haven’t scrubbed them clean with nvidia yet, so I’m just getting rid of false shadowing till I get to that.

04db590cae43fb5ffba4ef512ff8defaeab50e19.jpeg

The tessellation is individually controlled with scalars multiplying the alpha channels from their respective diffuse maps. This is then plugged into the distance tessellation calculation so that they’re globally cut off at the right distance.

5797b5d2912e430a72fca379c80b4ac7de832b8e.jpeg

The texture scale is controlled by multiplying the landscape co-ordinates with scalars. I’ll cut them down when I have a better idea of how large the different textures need to be.

f2926e5c9db3af78f873aae531e38a0602c1d1f9.jpeg

The mess you can see is the roughness and metallicity controls. They don’t have any samplers and are just maths. So they’ll mostly just be confusing if I tried to screenshot that. The path material is also maths, and shouldn’t be a concern.

Also. The reason I’m saying it’s tessellation:

Disconnect a node. Doesn’t matter which one. Or whether it’s a separate wrap sampler. The material compiles fine.

Beforebreak.jpg

Connect it. It dies. This doesn’t happen with any other part of the material. Both the diffuse and normals will compile fine if I add more samplers, they don’t cause a hitch. It’s only the moment the extra node is attached to the tessellation landscape layer blend. Both diffuse and normal have much more nodes on their blends as well, mostly because I’m not tessellating all the materials.

5d440be91166a603aa3ea0e6841736252bf660fc.jpeg

Yeah. Its pretty hard to tell which node causes the “implicit truncation”.
Somehow the graph seems syntactically valid but somewhere along a type conversion is not behaving as expected.
But as I said, if you split the graph into functions, you would see where the 5 reported errors are located as they would show up within the function tab.

When you say split the graph into functions, what exactly do you mean. That’s a stupid question, but I haven’t gotten through exploring material functions as of yet, and this material is mostly directly plugging stuff into the layer blends. Should I break the tessellation nodes into functions? Do I put the entire layer blend into a function? In which case, can it be extended for more textures to be added? Etc etc. I’m looking into it, but I don’t quite get how I could use them.

For example, these two node groups

Graph.JPG

are very simmilar. They could be a function.
The whole graph is a bit complex for me to rebuild on the fly, but if you are willing to send me the material, I can break it down into functions.
Then you can see how functions work and how they simplify the graph layout and we can narrow furtehr down your shader errors…

I uploaded it to Mega: MEGA

Feel free to take a look and gasp in horror haha. Even a few samples would be a huge help. I’m definitely going to start factoring in functions once I understand how to actually use them properly.

Hi,

just downloaded it. Ill go over it tomorrow. :slight_smile:

You are a true saviour sir. :o

No Problem :slight_smile:

I started with the tesselation part. Im not quite finished but here is a little preview.

Your tesselation graph looked like this:

Graph.JPG

I took the part of the structure that is identical to both parts and put it into a function:

dd1298673be6c19d5dce2f3c07b557742082987f.jpeg

Then I created another function that uses thisone.
As you can see, I changed the “Tesselation” paramter from scalar to a boolean. Its a bit more elegant and self explanitory.
One step further would be connecting it directly to the tesselation iput of the material and leave the false branch unconnected.
Then, in case tesselation is turned off, the whole node branch would be truncated.
This would be much more performant than just “muting” the tesselation with a zero value where the calulation costs are still there.

77fe740d3a6924ab57fe7c6eb5d51dfcdf02864d.jpeg

And, finally, in ther material, it appears like this:

ffd68cfabd99aa45928d2d109b39e5c0ea536307.jpeg

I also did the same for the “Complex path” stuff, the coordinates, etc.
Currently Im fixing up the metallic part…:slight_smile:

This is a preview of the big picture. Still a mess, but Im getting there…

ce9882046facf539dcd05e8ef69dbfdc3a547acd.jpeg

There are also some other things I noticed where you made life harder than necessary. But Ill point that out when the material is finished.:slight_smile:

That is amazing and terrifying at the same time. I love it! *takes notes