Shader Array node and beyond

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

Previous topic - Next topic

WAS

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.

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.

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.richardfraservfx.com
https://www.facebook.com/RichardFraserVFX/
/|\

Ryzen 9 5950X OC@4Ghz, 64Gb (TG4 benchmark 4:13)

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.richardfraservfx.com
https://www.facebook.com/RichardFraserVFX/
/|\

Ryzen 9 5950X OC@4Ghz, 64Gb (TG4 benchmark 4:13)

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.

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

#9
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.

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).