A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Graphics Experimental Previews' started by thomasdeliot, Feb 12, 2019.
5.8.0+ got Custom Function Nodes
This is the little type your HLSL into the box thing? That's not going to cut it..
You can include whole shader file and call individual function from it.
Yes, but I rewrite the function based on settings, much like I do in MegaSplat and MicroSplat; not something you can easily do in this new node. In this particular case I can just include all combinatorics of the function, but that obviously greatly limits my possibilities. As an example, MicroSplat has the equivalent of around 350 shader_features, which just isn’t possible with Unity’s system. Being able to custom generate code at editor time is very powerful.
They removed the old system for custom nodes, but added a new system for custom nodes. you need SRP 5.8+ for the new system.
Any way to change pre generated texture in runtime?
Just albedo change:
MaterialGameObject.GetComponent<Renderer>().material.SetTexture("What is the correct keyword?", WinterGrass_T);
so what is the correct keyword?
Stochastic Height Sampling for the Unity Shader Graph is now live in the asset store. (Note that this is not the same as the Unity technique, but rather uses a different blend operator so it doesn't require texture conversion, lookup tables, etc- and personally I find the quality to be superior as the height blend operator tends to wash out the source textures a lot less).
Is there any ETA for this?
Are there any news?
Yes, the process is a bit long, but still working on a release within ShaderGraph ! Will update here once it happens.
Thanks for the answer, that's really exciting! I almost lost hope and thought there might have been problems / the project might have been abandoned !
Actually everyone could implement this in Shadergraph with CustomFunction node.
Thanks for good references provided by Thomas Deliot in original shader code in first post (and method explanations in pdf of course).
It works with Unity 2019.1/HDRP5.13/ShaderGraph5.13 for me. I have some problems with DXT scalers (not working/using RGB-half for now and it has color space inaccuracy as could be seen) and have to manually tape of Color space origins which I'm taken from Pre-compute shader in other standard project.
Anyway, if Thomas will share with us with original ShaderGraph implementation it would be really excellent!
Glad to know the code references are useful enough, thanks for sharing your implementation!
In the meantime I'm releasing the ShaderGraph implementation as a prototype here as well. This isn't ideal since it requires a custom ShaderGraph package and a few setup steps for Unity to see it. It requires Unity 2019.2+ and a project using LWRP or HDRP 6.7.1 precisely. I've detailed setup instructions on the github readme, if something isn't clear report back to me here and I'll help/edit it.
I initially thought I could just upload the few code files required and instruct users to add them into their ShaderGraph package, but Unity's package manager doesn't allow that, so this is the only solution for now. I can't backport it to previous ShaderGraph versions as it requires a serialization bugfix from 6.7.1, though I will be able to update it for future versions. Hoping to get this integrated into the official ShaderGraph package soon.
Otherwise, this is a much more useful release than the previous Standard shader variant, as it makes the technique compatible with the new render pipelines and easily usable in custom shaders. We're very interested in seeing how Unity users can benefit from this technique so don't hesitate to provide feedback and show your results here!
@thomasdeliot Just a note to add: both master branch and 1.2 release tag have empty ProceduralTexture2D folder, only way I got this working was by downloading https://github.com/UnityLabs/proced...nload/1.2/procedural-stochastic-texturing.zip linked to the releases as it has the necessary files.
Files should be here: https://github.com/UnityLabs/procedural-stochastic-texturing/tree/1.2/Editor/ProceduralTexture2D but the folder is indeed missing.
Ah indeed, I had messed up the commit. Thanks, fixed it
I'm in to test it)
Tasty, especially with Unity's TextureArray functionality and dirt/rust mask (AO/Curvature+noise) for big variance for grunge materials with respect to performance low drop-down.
As I understand it right, that when ~2019.3 is come out this is feature we could have as standard option of Shadergraph package?
Do you know this article - https://aleksk01010101.wordpress.com ? Very interesting. Currently don't know how to implement cause it still unthreaded and poor info for me unfortunately.
IMHO:Well, this is great with triplanar (especially non-classic, 3 textures 3axis - see attach) materials. Nonetheless, I don't fill that it's really nice idea with creating Procedure Texture 2D (PT2D), cause it drawing your own way for developing. I mean, you can't do anything with PT2D in shadergragraph, like you can do with simple texture right now (and further). I'm realized that this is temporary, but simplistically I'm not sure that it is rational design. If any misunderstandings I'm free to discuss it in private.
Any plans to make this work with Triplanar projection out of the box or will we need to roll our own?
Also, am I right in thinking you have to hard wire the input texture into each shader graph, there's no way at the moment to pass it as a parameter to the resulting material?
@thomasdeliot what happened with the shadergraph integration, is it still happening?
I tried to make a build in Unity 2019.1.12 and its say it needs to compile up to 37 million shader variants on the Standard Stochastic shader. It has been building for about fours days now, and it's only progress of the 8 million shader variant. Based on this pace it will take about 17 days to complete.
@thomasdeliot This is an excellent shader but are there any plans on updating for URP? Or any plans to make it compatible with 2019.3 soon?
Bump, what happend to this amazing project?
@thomasdeliot, come on! It´s an amazing project!
As far as I understand it only works with LWRP 6.7.1
I couldn't manage it to work with the URP or later versions of LWRP
If you don't have LWRP 6.7.1 already installed Unity does not allow you to install that specific version from the package manager, even on Unity 2019.2 the earliest version you can install for LWRP is 6.9.0 and this doesn't work with that version.
So far the whole thing does not work right now
How can we make it work pls?
when i import this project there are 12 errors like this " does not contain a definition for 'TimeParameters' " or "does not contain a definition for 'concretePrecision' "
Library\PackageCache\firstname.lastname@example.org\Editor\ShaderGraph\LightWeightSpriteUnlitSubShader.cs(179,97): error CS0117: 'ShaderGeneratorNames' does not contain a definition for 'TimeParameters'
Library\PackageCache\email@example.com\Editor\ShaderGraph\LightWeightSpriteUnlitSubShader.cs(264,102): error CS1061: 'GraphData' does not contain a definition for 'concretePrecision' and no accessible extension method 'concretePrecision' accepting a first argument of type 'GraphData' could be found (are you missing a using directive or an assembly reference?)
I would also like a compatible version with HDRP 7.3.1
I've ported this to 6.9.1, 7.4.1, 8.1.0 and bleeding edge 10.x here:
https://github.com/0lento/Graphics/tree/stochastic-texturing-10.x (based on hdrp/staging, requires 2020.2.0a17+)
Do note that you need to use Git LFS to clone the graphics repo properly. After that you only need the ShaderGraph package from these branches, for rest you can just use the regular package manager packages.
Worth noting that I haven't changed the original workflow at all - which I think could have a lot of improvements. For example you still need a custom asset for each texture and this custom asset isn't supported as SG's input property type, which practically makes it impossible to make reusable shaders with this approach. What I have provided here is simply a port of the original design and made it work on newer SRPs.
Hi! Is there any way to make this work on 2019.3 and HDRP 7.3.1?
Can't you use 7.4.1 version I linked in a post above? It should be all around better version than 7.3.1.
That being said, if you really need to have it on 7.3.1 and you know how to use git, just checkout 7.3.1 branch from Graphics repo and cherry-pick my 2 commits from the 7.4.1 branch linked above and it should work.
Anybody know if Unity is still working on this, or it has been abandoned?
Is there any alternative to this plugin?
If you need stochastic texturing specifically, @jbooth sells ASE node that does this: https://assetstore.unity.com/packag...ampling-node-for-amplify-shader-editor-143715 + microsplat addon that does this as well: https://assetstore.unity.com/packages/tools/terrain/microsplat-texture-clusters-104223
As for breaking texture tiling, there are countless techniques available which you could implement yourself using SG even. Stochastic texturing does seem to have quite superior results in comparison to most of these techniques. But what works the best does depend on your materials ultimately.
Could you link to some examples please (with tutorials if possible)
Been googling this for a week, without success....
Here's few examples:
Hey @thomasdeliot , do you have a status update on stochastic texturing? Is it still planned to come to mainline shader graph at some point? Has it been abandoned?
This is one of the reasons I don't like the original approach and prefer my variation on it, which uses a height blend operator of either height data or luminosity data, instead of a histogram preserving one. This gets rid of the need for any texture modifications, LUTs, or preprocessing, and just works with your existing texturing data, makes it texture compression agnostic, and IMO looks better for organic surfaces as well.
@jbooth I really love your stochastic texturing in Microsplat, it looks amazing and is stunningly easy to set up. However I'd like to use it on non-terrain objects as well. Would you consider making a Shader Graph node for it? I know you've got an ASE node, but my whole project uses Shader Graph and I'm not keen to buy and install ASE just for this one feature. Idk how difficult it is to port ASE to shader graph.
I did, but then Unity made the API private and broke everyone's nodes. For a while I was hacking the assemblies to keep my stuff working, but it wasn't worth the effort when Unity is being down right adversarial about letting people extend their tools, so now I only support ASE.
ASE is much better though, so you won't regret switching.
Well, I took the HLSL from Microsplat and stuck it in a shader graph node lol
As someone who knows very little about shaders I'm proud of myself for getting this to work
I would very much like to share this, but obviously I can't as the code was written by Mr Booth and is restricted by the asset store license. @jbooth would you be willing to work out something that would allow distribution of the shader graph node? I don't care about personally making money from it or anything, so if you want to just sell it on the asset store I'll send you the files. Or maybe you could include it with the MicroSplat clusters asset.
Edit: although ideally I'd like to just put it up on github for free. I expect you aren't on board with that, but if you are then let me know!
Edit 2: If you do want to discuss this please email firstname.lastname@example.org
This would be an incomplete solution, as you need to apply the same texture choices across multiple texture samplings- ie: normals, diffuse, etc. Otherwise they won't line up correctly between the different PBR inputs. My nodes provided an set of outputs for this so they could be chained together. Additionally my node allowed you to choose which channel contained the height map data, or use the luminosity as the height map. This could all be re-built in the shader graph like you've done now, but since your not able to write real nodes anymore, you can't expose options that affect the code-gen, and thus this, done properly, balloons out into 21 different nodes for all the combinations of options. As such, I chose not to go that route.
Well the thing about selling anything on the asset store is that if the thing you sell generates lots of support requests, it quickly becomes not worth doing. That's why I removed my version in the first place- because after Unity closed the API, every Unity version the API would get changed with no docs or notice, and very quickly the time it took to figure out those changes and update things would eclipse the income the node would generate. So yeah, I'm not particularly keen on supporting Unity's shader graph here, the team chose to lock asset developers out of their solution after many of us already shipped products for it, and that doesn't really build a lot of good will.
Fair enough. Thank you for the detailed response.
Could you elaborate on this? What's wrong with doing the following?
Personally I don't care much about this feature, I can only ever see myself using the alpha channel for heightmaps. I'm happy to live without it.
Also just for the record I agree that Unity has been very sucky about this, and I hope they drastically change their attitudes/practices
Ok so when I actually put that shader on an object it looked all F***ed up. I did some research and I think the reason for the F***iness is that the PBR master node normal input expects a value in tangent space, but normal textures are typically encoded in object space.
I made a second stochastic sampling node that's essentially identical but it calls the UnpackNormal shader macro and it all seems to work properly now.
The blending of the normal maps will be based on the alpha channel of the normal map, not the height map encoded into the alpha map of the diffuse map, so essentially they won't match.
Can't I just encode the height map into both the normal and diffuse map? Or is that what you meant by "apply the same texture choices"?
I mean you could, but that will reduce the quality of your normal map, and you'll be computing the most expensive part of the technique multiple times instead of once.
That makes sense.
Thank you for taking the time to help me learn about these things. I really appreciate it!
hey, can you please tell me how to install it? I really want this Procedural Stochastic Texture plugin. I have unity 2019.4.15f1 and LWRP
First you have to clone that git repo with some git tool that supports Git LFS, then either copy the shader graph package of the directory with the clone into your projects Packages folder or add file/folder reference to it via PM / by editing the manifest directly. Just using the full folder copy is easier so I mentioned it first.
You also need matching SRP package installed on your project, in this case URP 7.4.1 as I never updated this for 7.5.1 (it's a simple to merge my changes to any 7.x version if you know how to use git though).
This is one of the nodes that has a lot of potential, I don't believe that unity abandoned the project.
I really wanted to have it native to the shader graph
Just wanted to ask, why is this not included in the shader graph?
I asked in the shader graph forum about a possible native implementation of this node.
we hope it can be implemented...