Shader Array node and beyond

Started by WAS, August 07, 2019, 10:00:52 pm

Previous topic - Next topic

WAS

August 07, 2019, 10:00:52 pm Last Edit: August 08, 2019, 08:39:05 pm by WASasquatch
Will there be improvements to the shader array? It's always been super slow, I'm not sure why. I tested 4 merged shapes at 4 locations that were masked and it seemed faster.

There's so much that I've wanted to try and do with it. Additionally I wonder if we will ever see a scatter type node based on the shader array (or maybe a mode of it) that can take input and distribute it at different scales or rotations or even merge modes like highest and lowest. Would be super helpful for shader building for surfaces especially, probably also really handy for terrains too.
Check out my Terragen Discord: https://discord.gg/Vy5FRTE

N-drju

Shader array is something that has always intrigued me. By the sheer look of it, I could draft some neat applications to it in my imagination but I have never been sure of what the next step should be. Do you, by any chance, have any example .tgd of what you were doing with it?
"This year - a factory of semiconductors. Next year - a factory of whole conductors!"

WAS

Quote from: N-drju on August 08, 2019, 08:25:32 amShader array is something that has always intrigued me. By the sheer look of it, I could draft some neat applications to it in my imagination but I have never been sure of what the next step should be. Do you, by any chance, have any example .tgd of what you were doing with it?

The Shader Array itself isn't really good for anything organic in it's current form, hence the request for a scattering mode/shader. But for an example of what I was trying to do with it recently, is create a procedural park sidewalk. This was so slow that it wasn't even funny (think Hetzen's Manhatten is slow? Ha!) I used it to create each sidewalk segment, shrink for it's center roughing and side smoothing, and than also using it to array all the bases of the light posts (circles).

This was so slow that it was much more practical to just use image maps repeating over and over and using procedural shaders to shade the displacements.

Other uses could be fake city buildings in grids, mixing grids at different sizes, and of course different building shapes. Think grid sizes overlayed, filling spaces with a different array of different buildings.
Check out my Terragen Discord: https://discord.gg/Vy5FRTE

cyphyr

I've used it to create waves that run parallel to a shore.

(I'd also like a radial array please :D)

Scatter would be good too but maybe that could be an adaptation of the object populator.

It would be great to be able to "scatter" images with random size and rotation. Leaves on a forest floor for example.
www.richardfraser.co.uk
https://www.facebook.com/RichardFraserVFX/
/|\

Ryzen 9 3900X @3.79Ghz, 64Gb (TG4 benchmark 6:20)
i7 5930K @3.5Ghz, 32Gb (TG4 benchmark 13.44)

N-drju

I think I need to take yet another look at it and analyze. Because I have no idea how one may create what you two have just mentioned with ShA. :P
"This year - a factory of semiconductors. Next year - a factory of whole conductors!"

cyphyr

Use a long square simple shape shader to make a beach.


Make a similar long but now very thin simple shape shader and use that as a displacement shader on the water

You now have a single wave running parallel to a long straight beach.

Add a shader array between the long thin SSS and the water displacement shader.

You should now have an array or parallel waves

If you add two fractal warp shaders, one to the beach and one after the shader array and make the values the same in each you will have a randomly shaped beach with waves that run parallel to it.

Simples :)


www.richardfraser.co.uk
https://www.facebook.com/RichardFraserVFX/
/|\

Ryzen 9 3900X @3.79Ghz, 64Gb (TG4 benchmark 6:20)
i7 5930K @3.5Ghz, 32Gb (TG4 benchmark 13.44)

N-drju

Interesting, interesting...

Could it also be used to create gently winding roads...? A stretch of asphalt with lane lines turning IAW the main road? :) Sounds like an analogical use...
"This year - a factory of semiconductors. Next year - a factory of whole conductors!"

WAS

Quote from: N-drju on August 09, 2019, 06:22:40 amInteresting, interesting...

Could it also be used to create gently winding roads...? A stretch of asphalt with lane lines turning IAW the main road? :) Sounds like an analogical use...
You could just use SSS shapes. The dashed lines could be accomplished with the Shader Array though, but would likely start getting slow with the roads length.

That's where I'd use a image map for the lanes.

And you can warp the whole setup by a vector displacement fed a PF on X or Z with no variance.
Check out my Terragen Discord: https://discord.gg/Vy5FRTE

Dune

Dashed lines can be done with a sinus function over get position in texture and x to scalar, and some divide + number for length of stripes. That is fast enough.

There are tgd's about doing roads like that.

WAS

August 10, 2019, 04:00:38 pm #9 Last Edit: August 11, 2019, 05:40:34 pm by WASasquatch
Quote from: Dune on August 10, 2019, 03:17:08 amDashed lines can be done with a sinus function over get position in texture and x to scalar, and some divide + number for length of stripes. That is fast enough.

There are tgd's about doing roads like that.

Keep forgetting about that! Could use that for cement sidewalk pathways too theoretically. Wouldn't be much helpful for actual shapes but more the square slabs.
Check out my Terragen Discord: https://discord.gg/Vy5FRTE

jwiede

I still think you're ikely to hit a performance bottleneck issue with those kinds of uses, though.

As WASas mentioned in OP, there seems to be a more fundamental performance problem with how the shader is built, and that's limiting it from anything beyond fairly basic uses.  When you look at similar shader/texture bomber/array/replicator-type entities in other systems, they don't appear to incur anywhere near as much overhead, so it seems like there's significant room for improvement inside Shader Array w.r.t. performance (or possibly requires re-implement closer to how alternatives do it).