I am referring to the shader GraphGrid from this aset: https://assetstore.unity.com/packages/essentials/starter-assets-thirdperson-urp-196526
The one with the blue digital flikering effect.
How can this shader be customised to be used with a brush on terrain layers and apply the same shader effect to terrain shader.
I'm using Unity 6.2. URP. Saw that there are some terrain shaders in Unity 6.3 but not sure if this helps me.
#Custom use of URPTriplanar shader Q
1 messages · Page 1 of 1 (latest)
The 6.3 templates are probably the only practical way of making custom terrain shaders in URP
6.2 is unsupported anyway
have you used or followed any particular tutorial for this scenario/setup?
Triplanar in general? Plenty
Custom Terrain shaders? Tried it a couple of times before 6.3 and "not practical" is a very kind word for it
You may also consider decal renderers
They can project a triplanar or any kind of texture within their volume on anything opaque
Could potentially be more practical than working the grid shader into Terrain
im researching now
but I dont think it can be done with animated shaders, liek this grid. Have you seen it?
I have and sure it can
Shader Graph's sample Production Ready Shaders that can be found in package manager under its entry includes animated decal shaders
The "caustics" example is much like triplanar and quite animated
Specifically it seems to be using a cheaper approximate way to do triplanar projection but you can just as well use any kind of projection you need
@frank escarp The "material projection" decal example has the old familiar triplanar
No animation but that's not directly tied to projection
animation as in the flickering effect of the grid lines produced by the shader
Yes, that looked like it was just an emission intensity of the specific grid part being controlled by sine time
"animation" is an inexact term in this context and as far as I know there are no situations where a shader cannot be made to animate
Thank you!
is this the exact shader graph that I can use for my case? could you help me please to connect the dots?
Maybe you got it already but here
Flickery sine wave copied directly from the shader in starter assets
The Face Normal sub-graph copied from Production Ready Shaders' "material projection" shader I mentioned earlier
Decal shaders can't directly get world normals with the Normal Vector node, so solving that would've been tricky without an example
This is also something that seems to have changed by version 6.3. as the new template uses a slightly different method for URP for some reason:
#ifndef GET_SCENE_NORMAL
#define GET_SCENE_NORMAL
#if !defined(SHADERGRAPH_PREVIEW)
#if defined(UNIVERSAL_PIPELINE_CORE_INCLUDED) //URP
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl"
void GetSceneNormal_float(float2 ScreenPos, out float3 WorldNormal)
{
WorldNormal = SampleSceneNormals(ScreenPos);
}
void GetSceneNormal_half(float2 ScreenPos, out float3 WorldNormal)
{
WorldNormal = SampleSceneNormals(ScreenPos);
}
#else //HDRP
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl"
void GetSceneNormal_float(float2 ScreenPos, out float3 WorldNormal)
{
uint2 positionSS = ScreenPos * _ScreenSize.xy;
NormalData normalData;
DecodeFromNormalBuffer(positionSS, normalData);
WorldNormal = normalData.normalWS;
}
#endif
#else
void GetSceneNormal_float(float2 ScreenPos, UnityTexture2D _CameraNormalsTexture, out float3 WorldNormal)
{
WorldNormal = float3(0,1,0);
}
void GetSceneNormal_half(float2 ScreenPos, UnityTexture2D _CameraNormalsTexture, out float3 WorldNormal)
{
WorldNormal = float3(0,1,0);
}
#endif
#endif
Than you very much! I tried something but didn't get what I expected and saved it for later.
I will get back to test it tonight and I will try to implement it!
I understand that this should be attached to the decal projector gameObject?
as the material of an URP decal projector
i am unnable to create nodes for colorT2 and SwitchOnSRP. are those also taken from the script you provided me?
by following this setup I see onyl the base color projected.
The code is for 6.3.
The post at reply is a screenshot from the official 6.0. example
I don't really mean for you to replicate the setup, but to get it from the importable sample
Or rather not replicate the setup just based on the image, but to get the original nodes
When you import the samples it'll give the version of the sample that is most appropriate for your editor and URP version
I'm not sure if the custom function node has dependencies or if it's compatible with 6.2. so you should check what kind of nodes you get from the samples for your version
I upgraded to 6.3 .
I have no knowledge of shaders, so I am not sure how to use the samples, or the techniques I need to know and apply to make it work.
After upgrading you should get the samples for your version, meaning just download and import them again, and confirm they work on their own
Then you can work on modifying them as needed
But likely you need to get some practice and basic familiarity with SG first
and still, why my result differs from yours?
I don't know what nodes you have
Or what graph settings you have
everything is the same as you provided, I fix it for showing the flickering, but when it goes, the grid lines are going as well, which is not desired.
moreover, can this use a mask, to make the projection in a not so uniform geometry and defined as the square projection? I wanted to have this placed on terrain, looking like a splash , for example.
You have to be more specific, so far it seems you've attempted to follow two unrelated examples
I would really need to see your graph settings too
Should be easy, but best choose one challenge to focus on at a time
Where's that particular face normal custom function from?
Also, are the materials in your world using a custom shader, like a toon shader of some kind
Decals attempt to override certain properties of the material behind them
If the materials don't have those properties, as is often the case with custom shader, the decal could fail
I don't recall off the top of my head what's the process for making a decal shader that just replaces color instead of overriding properties
But what you can test is the scene included in the shader samples to verify the decal feature is working in general, then you can test the included decal materials in your scene to verify that they do work with your assets also
I am not sure, I just created a node, typed face normal, and I got that. Input>Geometry>FaceNormal.
No, those dont have custom shaders, and even thou it was mostly related to the terrain. the objects were just to see the depth in that moment.
I believe the decals are not a good solution for my case if the projection cannot be edited to have another shape, then I will disregard the attempt. I just wanted to edit the appearences of some parts of the terrain. Including the objects from that space into the projection was nice, but I don't think its what i need.
That could mean that it's the node the 6.3. sample uses for HDRP rather than URP, or it's the node of the same name from a previous version's samples
Depending on when you imported the samples
If you didn't, it's probably because 6.3. includes some of the samples as templates now
Yes, the shape can be changed arbitrarily by modifying the Alpha with a 0 to 1 value that changes over space in Object space, such as any distance function
But that probably doesn't mean much if you haven't seen these concepts in action before
acting as a mask you mean?
If by mask you mean shaping the decal volume and/or the projected texture