#archived-shaders

1 messages ยท Page 88 of 1

fast shore
#

I'm trying to just have a color gradient as the skybox

#

This is urp so I expect a lot of stupid problems that aren't very well documented

#

RenderType = bacgkround helped

regal stag
#

iirc it either needs a specific tag or the name needs to contain Skybox for the warning to be removed

fast shore
#

Yeah I pried apart a bunch of shader and looks like it's just render type thing

fast shore
#

Man, anyone used Amplify around here? I noticed I had it purchased and gave it a try but can't get it to render skyboxes in urp

#

And in built-in shader graph it just works. Are there some tags you need to enable?

#

For debugging purposed it should be red, but only 1 side of it is, and everything else has broken depth

#

Ah, it's that light mode thing

deft osprey
#

In Shadergraph, there should probably be a way to describe the 'type' of an input in a subgraph, so that by default Unity displays the dropdown choice for the subgraph node. A lot of my subgraphs are 'visually useless' because I use an input parameter. I don't know how to explain this but compare the top to the bottom of this example

regal stag
#

Note that feature requires Unity 2021.2+

deft osprey
hexed sorrel
#

Hey all! I'm currently trying to use a HLSL shader / .shader material to blit a "Gaussian Blur" effect onto a Render Texture however, no matter what shader I try (even basic ones), the material in the preview seems to be outputting correctly, when I check the frame debugger it will always output a full black screen, if anyone knows what may be going on any help would be amazing! I've been trying to look into this now for a couple days and can't seem to find anything explaining why this may be occuring, I'll attach a screenshot of the material in the preview and the outputted render texture, along with the scriptable renderer feature pass in a thread below!
Thanks all!

obsidian wasp
#

Any idea why the rain (VFX particle lines) disappear at this specific angle/distance? They still exist + the splashes still appear on collision, the initial rain just can't be seen. If I disable the sea plane the problem is solved, so I suspect it has something to do with the water shader. (In fact, you can see the rain that is appearing on top of the boat, only the rain that is "masked" by the sea is invisible)

woven badger
obsidian wasp
worldly kiln
#

Hi, I have this shader i got from a tutorial on how to make a portal, and im trying to use it for a vr game, but whenever I try testing it, it only shows on the left eye, and the right eye just doesnt render the portal and renders everything else, i think this is the shader because everything else is set correctly, can anyone help?

Shader "Unlit/Portal"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100

    Pass
    {
        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        // make fog work
        #pragma multi_compile_fog
        
        #include "UnityCG.cginc"

        struct appdata
        {
            float4 vertex : POSITION;
            float2 uv : TEXCOORD0;
        };

        struct v2f
        {
            float4 uv : TEXCOORD0;
            float4 vertex : SV_POSITION;
        };

        sampler2D _MainTex;
        float4 _MainTex_ST;
        
        v2f vert (appdata v)
        {
            v2f o;
            o.vertex = UnityObjectToClipPos(v.vertex);
            o.uv = ComputeScreenPos(o.vertex);
            return o;
        }
        
        fixed4 frag (v2f i) : SV_Target
        {
            fixed4 col = tex2D(_MainTex, i.uv.xy / i.uv.w);
            return col;
        }
        ENDCG
    }
}

}

worldly kiln
#

Ok, thanks!

#

It Now works flawlessly, thank you

fast shore
#

What would be an approach to creating star-like shapes similar to those? (the ones that go โœจ )

#

Simple to do with a texture, but I was wondering whether it can be done procedurally

#

One of those things that seem simple from visual standpoint but borderline impossible in shader programming. I think you really can only use a texture for this

frigid jay
fast shore
frigid jay
fast shore
#

Yea

#

The issue is placing them on a plane, multiple instances of

#

I already learned that shaders aren't the best fit for that

frigid jay
#

Make a graphics buffer with per-star data. Position and scale

#

Use Graphics.DrawProcedural to draw all stars in one call

#

Use vertex shader to expand each star mesh (2 triangles) using per-instance scale data + position offset

fast shore
#

Yeah, a hybrid solution will work

#

I don't think it's possible with just shader, without any other draw commands

#

You can kinda fake the round stars with noise pow, but this is far too complex

frigid jay
fast shore
#

Wow stars aside this guys explains some of the concepts of shader math really well

shadow thistle
#

Hello, i was thinking that perhaps here i could find help.
I'm making buttons for my game and i have decorations that change colors over time by shifting their hue, and i wanted to create my button so that it changes color too. Now, i hae no idea how to do this. Shader doesn't work (at least the one i wrote) and what my first idea was a colormap. Idk if that's a known global term, but: R value is how much of texture 1, G is how much of texture 2... and with that the texture is now basically a variable, and combining the multiples i get a texture that can change. My main issue is combining this with 9-slice, cuz it's a button.
My general idea was:

  • default: global1 for border, white for center
  • hover: global2 for border, white for center
  • active: global2 for border, global1 for center
    global1 is HSV(Time, 100%, 60%), global2 is HSV(Time + 180ยฐ, 100%, 60%)
    If i should seek help in another chanel, tell me, i have no idea how to solve this.
desert herald
fast shore
#

And it was like, casual

#

He's just making an effect and dropping useful info in the meantime

desert herald
#

The best thing about them is that he claims he's not a mathematician, so gives "visual" explanations about shader math with desmos n stuff

fast shore
#

Math is highly visual tbh

#

Shaders ARE almost pure math if you think about it

#

I think there's a misconception that visualizations exist to make math easier to understand when it's really just how it works

desert herald
#

Yes, but many tutorials are just formulas shown on blackboard with some mathematical gibberish that I don't understand so well as artofcode

fast shore
#

It's a conspiracy by mathematicians to make math harder to understand and make them look smarter fr

#

But jokes aside this dude rocks

desert herald
#

Totally xd

fast shore
#

Also while we're here, is manually doing aspect ratio calculations in order to prevent checkerboard from stretching in screen space the only way of doing that?

#

Or is there a node for this I missed?

frigid jay
slow socket
#

Hey guys, I'm testing out some shaders on sprites and I've run into a problem: Using sprite sheets causes the shader to be applied to the whole texture instead of treating the sliced sprite as its own texture, any workaround for that?
(on the left is a sprite part of a 5x5 sprite sheet and on the right is a sprite not part of a sprite sheet)

mighty pivot
#

Is it even possible to create a simple black outline shader for hard surface and soft surface objects at once?

Like I feel like this is harder than it should be lmao

#

this is inside of blender,
Would making screen space outlines be easier or should I make an actual shader to achieve this?

fast shore
#

I feel like I need to understand the root of the issue instead of ignoring it and randomly tweaking stuff until it disappears

#

Why does this happen?

#

This is a custom skybox. Sometimes it would just do that (not draw anything at all over previous frame)

#

It's similar to when you put "unitialized" as your camera background type. Here, all I did was remove SV_POSITION and add UNITY_VPOS_TYPE screenPos : VPOS to try and use screen space

fast shore
#

Also I'm not super familiar with shader performance and how much GPU time matters. Is this normal performance for a skybox shader? (left is on, right is off)

fast shore
#

Nonsensically it performs better than empty no material skybox in a standalone build, in terms of GPU load (left is with skybox material, right is without skybox material)

#

No idea what's wrong lol

dim yoke
fast shore
#

I'm reading up that nvidia profiler thing rn

#

NSight or whatever

hollow swift
#

Thank you for the shader graph, again. I implemented it and played around with it a bit. Even though I can get the shader to work I feel like I don't fully understand the parameters. I would expect to just feed in the length of the line and the percentage of where the texture is being cut. Can you help me understand the parameters better? ๐Ÿ™‚

amber saffron
# hollow swift Thank you for the shader graph, again. I implemented it and played around with i...

I think I did some more changes afterward, so in doubt, here is the version I have currently.

For the 9 slices to work, you need a minimum of 2 vec4 inputs indeed, where in the texture the slices are, and where in the "output" to place them.
But I found that it's not obvious at all to place those values, so I decided to use pixel numbers instead.

  • The "reference size" is the size of the texture used for slicing.
  • The "display size" is the actual size of the final "sprite", it should be bigger than the reference size.
  • The "borders" is the slices (left, right bottom top) sizes of the texture.

It's easier to input that you want a texture of 32x32px to be "scaled" to 100x100px with borders that are 10px width than to set the precise UV values in floating points.

  • The "uv" input is your reference UV. It uses UV0 by default, but you can override it.

  • You can set the center and borders tiling mode with the dropdowns.

  • The "uv" output, is the sliced UVs, use this to sample the texture.

  • The "ddx" and "ddy" outputs are to use with a SampleGrad function, to avoir mip map glitches in cases if your sprite texture has mip maps (see the custom function screenshot)

fast shore
fast shore
#

Oh no, I'm hitting floating precision issues and they aren't looking simple to solve

obsidian wasp
#

Tried adapting acerola's compute shader for ortho camera + my project's grass data structs, but the culling is ridiculously aggressive. Shader people, is there anything egregiously wrong with how I'm sampling the camera as to cause everything to be culled?

relevant snippets, since I imagine this is an issue with vote.

InstancesBehavior.cs

cullingComputeShader.SetMatrix("MATRIX_VP", cullingCamera.projectionMatrix * cullingCamera.transform.worldToLocalMatrix);
cullingComputeShader.SetVector("_CameraPosition", cullingCamera.transform.position);
cullingComputeShader.SetFloat("_Distance", 200f);
cullingComputeShader.SetFloat("_OrthographicSize", cullingCamera.orthographicSize);
cullingComputeShader.SetFloat("_AspectRatio", cullingCamera.aspect);

cullingComputeShader.SetBuffer(0, "_GrassDataBuffer", info.dataBuffer);
cullingComputeShader.SetBuffer(0, "_VoteBuffer", voteBuffer);
cullingComputeShader.Dispatch(0, Mathf.CeilToInt(info.dataBuffer.count / 128f), 1, 1);

Culling.compute

[numthreads(128, 1, 1)]
void Vote(uint3 id : SV_DispatchThreadID) {
    float4 position = float4(_GrassDataBuffer[id.x].TRS._m03_m13_m23, 1.0f);
    
    float4 viewspace = mul(MATRIX_VP, position);

    bool inView;
    bool withinDistance;

    float2 viewport = float2(_OrthographicSize * _AspectRatio, _OrthographicSize);
    float2 viewportMin = _CameraPosition.xy - viewport;
    float2 viewportMax = _CameraPosition.xy + viewport;

    inView = all(position.xy >= viewportMin && position.xy <= viewportMax) && viewspace.z > 0;
    withinDistance = abs(viewspace.z) < _Distance;

    _VoteBuffer[id.x] = inView * withinDistance; // If I set this to 1, all grass is rendered
}
neat orchid
#

I'm trying to figure out how to plug a triplanar heightmap into tessellation displacement

#

I see tutorials for UV

#

but I can't even plug the triplanar nodes into the same stuff

pure echo
#

im trying to make a very simple pixelated look kind of starfield shader

#

i tried adding a contrast node thinking it ws just because certain stars might be so dim its causing it to flicker. But im not sure if thats the case

#

there is basically just a quad background with this shader on it with the camera as the parent so when the camera moves the quad moves, with the position node in the shader causing the offset to look like the whol ebackground is moving

mighty nebula
#

Hey all, I need to "assemble" a texure from particles, I want particles flying in from one side and then locking into place to build up a texture. The texture is not big (about 100x700 pixels). Needs to run under URP

Is this possible with a shader? How would I go about doing this, roughly

snow carbon
#

how do I use fog with unlit materials?

kind juniper
kind juniper
hexed sorrel
#

Does anyone happen to know the requirements of the "renderingData.cullResults" if I am drawing it to a target in a scriptable renderer pass? Currently trying to draw a tilemap to a RTHandle however it only seems to draw when the tilemap has a "Sprite-Lit-Default" I assume that means my "drawingSettings" are only masking "Lit" materials but I'm just wondering if there's a way to change that?

hexed sorrel
hexed sorrel
turbid mortar
#

Does anybody know how I might be able to sample the color of a pixel of the HDRP physically based sky ?

fast shore
kind juniper
# fast shore Do you actually read the messages or just reply to the images

You said (left is with skybox material, right is without skybox material) and left is on, right is off.

I see now that the second screenshot has an increase in 3D measure, which I didn't notice earlier. However, it's not clear what that metric expresses. And there is no such contradiction in the profiler data on the first screenshot.

fast shore
#

Yeah that's what's nonsensical

#

Why is my gpu being utilized more in a standalone build with no skybox?

#

I'm pretty sure that's just a gpu utilization graph

sharp frost
#

is Shader Graph is good for vegetation rendering in mobile?

kind juniper
# fast shore Why is my gpu being utilized more in a standalone build with no skybox?

For example, it could be updating faster due to lack of the draw call making it use more resources in the short amount of time. On the other hand, that draw call could be very inefficient using only small portion of the GPU resources, thus reducing the average GPU usage.
It's really hard to say without understanding what metric that is and how it's calculated

amber saffron
amber saffron
#

The answer still applies, overdraw is caused by having multiple things rendering into the same pixel, it is not directly related to the tool itself.

sharp frost
#

Got it.
So is there any way to reduce overdraw?

amber saffron
# sharp frost Got it. So is there any way to reduce overdraw?
  • Use LODs to avoid have sub pixel triangles
  • Use opaque materials instead of transparent as much as possible (ie. alpha cut instead of transparent for leaves)
  • But avoid large area of transparent pixels that are cut off by "cutting" around the shape with the mesh
sharp frost
amber saffron
#

A depth prepass might also help with overdraw.

sharp frost
#

Thanks @amber saffron .
I will try it.

bright flame
#

I am trying to set up a double-sided material on this curtain mesh, however when I use the universal render pipeline/lit shader and set render face to both, my material color is completely different on the backside. I also tried using the Ciconia Studio double-sided shaders, but they just turn my object fully pink. I also tried selecting the material and clicking on 'Convert selected Built-in materials to URP', but this also did nothing. Does anyone know why this is happening?

grizzled bolt
bright flame
#

Thank you for the explanation! Do you know how I can set up a proper double sided material in my scene? Since none of the custom shaders work for me.

amber saffron
grizzled bolt
bright flame
#

But I am not sure how expensive this double-sided shader would be.

grizzled bolt
#

GPUs are good at rendering lots of polygons, and URP can handle different shaders well
So both are good options really

dim yoke
#

Because URP uses SRP Batcher, there is also an overhead of having multiple different shaders in your scene so if that's the only object that would need the shader, it might actually be faster to just do douple sided mesh and use a standard shader even though it makes the polycount higher. That should mostly affect the memory consuption because the pixel shader won't even run for a triangles pointing away from the camera.

neat orchid
#

So does nobody know how to plug a triplanar heightmap into tessellation displacement in shader graph?

#

0 information exists online

amber saffron
#
GitHub

Node library for ShaderGraph. Contribute to Remy-Maetz/sg-node-library development by creating an account on GitHub.

neat orchid
#

I will try to make it on my own because I actually want to learn

#

But I will use my own if I don't figure it out

#

I am blending it per vertex color...that is doable with lerp, yea?

amber saffron
#

Keep in mind that blending triplanar multiplies the number of texture samples, and can end up beeing costly.

neat orchid
#

I have 4 right now and I will use the 5th one

#

That fine?

#

Should still be better than just a texture blend, right?

#

Vertex color is the fastest, should be

amber saffron
# neat orchid I have 4 right now and I will use the 5th one

I'm not sure to understand.
What I'm saying, is that if you use vertex color to blend the result of triplanar nodes, which are texture samples, you can end up having 12 (4 color channel x 3 samples per triplanar) samples per pixel/vertex.

neat orchid
#

I understand, I understand

#

But where do you plug these? I guess I'll just download yours and see

amber saffron
mental plinth
#

hi im trying to get grahpics or textures similar to that of lethal company - heads up i dont have a lot of time and i know nothing about unity

kind juniper
#

Hi I'm trying to get million dollars similar to how Elon Musk has. I don't have a lot of time and I don't know anything about making money

azure geyser
#

In Unity 6, when exactly is RecordRenderGraph called?

I have a list of renderers where I need to access each renderer's texture in the ExecutePass callback function. Do I have to create and maintain another list of TextureHandle's? If so, where do I do that? In RecordRenderGraph?

mellow orchid
#

First time Shader Graph user... thought I finally had what I needed figured out.. but..
Why is this happening? I cant understand.. Why can't I use this value to modify the transform and also output to Vertex Position?

amber saffron
# mellow orchid

Replace the "Sample Texture 2D" node with "Sample Texture 2D LOD"

#

To put is short, the first one can only be used in the fragment context.

supple kayak
#

Hello! So I am currently in the process of creating a landscape material and I have this color gradient that I sample depending on the current y position(divided by maxHeight to get range from 0-1) and it works fine. The problem is when I want to have multiple different terrains which all have their own "max heights". Now I do know that there are material variants but creating a variant for every single terrain tile and set the max height doesnt seem practical. So my question is. Is there a way to get the y position between 0-1 without knowing/setting a maximum height? I do know there are heightmap textures I can use, but that doesnt resolve my problem. I would still have to create a material variant for every terrain tile.

amber saffron
supple kayak
#

When I split the bounds size and use the G value instead of the height parameter I get this weird effect

amber saffron
supple kayak
#

hmmm ye I guess your right, thanks anyways!

neat orchid
#

and therefore everything important is inside it

#

I would test with that but I am getting the validation error, can't find GUID

amber saffron
amber saffron
#

But indeed, for you need you use "Triplanar Sample LOD". Unless you want to have different textures per faces, than you have the other variants ๐Ÿ™‚

proud sage
#

Hi, how can I make the position of the cube affect the entire height of the character?

amber saffron
proud sage
#

That the height of the cube does not affect the dissolving effect

amber saffron
proud sage
#

yes

proud sage
amber saffron
# proud sage yes

Then you simply have to insert swizzle nodes with "XZ" in text field, between the two positions and the "distance" node.

proud sage
#

I want the effect to occur when approaching a door

amber saffron
proud sage
#

Oh yes, forgive me, I read wrong

#

Yes, that worked, thanks!

proud sage
amber saffron
#

You'll need to calculate the mask differently, and pass the dimension of the cube.
Subtract the "current" position and the cube position, to the position relative to the cube center.
Divide that value by the cube dimensions.
Take the absolute of that, and combine the X, Y and Z value to have a 3D mask
The combining part is up to you to decide what "shape" the mask will have, you could simply multiply the values together to have some sort of "stretched sphere" shape.

fast shore
#

Shader eats up 5.5ms in build with vsync off ๐Ÿ’€

#

Looks pretty tho. What a shame

proud sage
amber saffron
#

Nah, subtract only once, the cube position from the "absolute world position"

proud sage
#

that's the result then, and I connect this with the node of dividing by the distance, right?

neat orchid
#

I'm using unity 6 preview if that means anything

mighty nebula
#

Can someone recommend a good and up-to-date tutorial for VFX Graph?

slow socket
#

Hey everyone, I'm trying to make a shader for a segmented health bar. Currently I'm using this set up but I'm not happy with it because of the segment space right at the start of the bar and the lack of control over the segment spaces width

Anyone know a better set up?

primal hatch
# mighty nebula Can someone recommend a good and up-to-date tutorial for VFX Graph?

Have you gone through the samples available with the VFX package? Those demos cover so much territory. Then on top of that they have more advanced examples here. https://github.com/Unity-Technologies/VisualEffectGraph-Samples

GitHub

Visual Effect Graph - Samples Project. Contribute to Unity-Technologies/VisualEffectGraph-Samples development by creating an account on GitHub.

ivory niche
#

In URP is there a node/simple way to get the grabpass / pixels behind a transparent mesh? I'm using Scene Node atm, but it's not great. Is it possible to get it by using the custom function?

kind juniper
ivory niche
kind juniper
#

Basically, if it distorts things in front of it, it means that they are rendered before the transparent object and so are included in the scene color.

#

A forward renderer would usually render opaque geometry first and then transparent, regardless of what's in front of what, iirc.

ivory niche
kind juniper
#

A deferred renderer would render the depth maps first, so when the actual object is rendered, it would clip whatever is hidden behind other objects.

ivory niche
# kind juniper A deferred renderer would render the depth maps first, so when the actual object...

Found something that works, but need to convert it to unity 6: https://github.com/lukakldiashvili/URP-Transparent-Distortion-Example

Seems like you need to create a render feature.

GitHub

Example Unity URP project, demonstrating distortion(heatwave) effect on opaque and transparent objects - GitHub - lukakldiashvili/URP-Transparent-Distortion-Example: Example Unity URP project, dem...

kind juniper
#

You could probably just check the depth buffer in your shader and discard pixels that fail the check.

sharp frost
#

I don't know what is the use of it?
Anyone have any idea what is the use of this node and where its recommended? Will put any impact on output?

kind juniper
sharp frost
amber saffron
mental bone
#

Hey guys, I'm trying to conseptualise a certain shader feature. It's a shiled vfx shader. Now my idea is to have a buffer of a fixed size with the positions for the hit sphere masks that is being written to from c# based on the collision hits. I also want the hits to smoothly fade however. Would writing emission values to a seperate buffer every frame from c# be a good idea or is there a better way to do it in the shader? Maybe another option is to dispatch a compute shader to write the emission values everytime we get a new hit or something.

amber saffron
#

Else, indeed using a compute to handle the buffer update, and to avoid writing to the buffer from cpu, the compute could also have some input variable to add new hits to the buffer.

neat orchid
#

do you happen to know what exactly I need to import, just to avoid my project being messy (this is my test project now). If not, doesn't matter, it isn't a lot memory

#

one last thing, when I mentioned vertex shaders, you mentioned 4 textures blending. Can't I easily use 5 due to the fact I'm blending 2 new textures on the first lerp?

amber saffron
amber saffron
neat orchid
#

but what it had was texture 1 and texture 2 lerp on the G channel of vertex color

#

then result of that lerp lerps with texture 3 on B channel

#

and result of that lerp lerps with texture 4 on A channel

#

that's 4 textures and R is unused

neat orchid
#

there's nothing wrong with that right? 5 is the max I can do with vertex color to my knowledge

amber saffron
#

No, nothing wrong

fast shore
#

After some optimizations I'm down to 0.7ms drop from the previous 5.5ms (VSync off) ๐Ÿ˜ˆ

#

I'm assuming everything under 1ms is fine? For lower end devices

#

The shader is for a skybox, so it will be visible 99% of the time

gritty sand
#

Hey folks, trying to figure out the best method, inherited code and trying to reduce the slowness of it.

Its generating a scene which is being sent over network. The setup right now uses 6 cameras side by side, each renders to a texture, then each texture gets sent as a frame. It seems to me, and correct me if I'm wrong here, but it would probably be much more efficient to use a single, much larger camera, write that to a texture, then blit a section of that texture to 6 temp render textures, and send each. Seems like multiple cameras and multiple textures would have way more overhead. Sound about accurate?

shell wadi
gritty sand
#

There are other bits I'm going to dig into later with some of the other scripts, but a big chunk (20-30ms) is purely waiting on the renders. Trimming down the quantity of cameras (and upping the resolution, 1 camera @UHD vs 4 cameras @HD) makes a significant improvement. I can't send them at higher than 4k though, which is why I was thinking blit would be more efficient

amber saffron
#

This is a bit unrelated to shaders

amber saffron
gritty sand
amber saffron
gritty sand
amber saffron
#

Oh, so it's a video stream, not simply an image ?
Did you check Render Streaming ?

gritty sand
gritty sand
neat orchid
#

triplanar sample lod doesn't work on its own so I tried plugging triplanar data build into the data input of the subgraph

#

and now at least the triplanar works but I get immense graphical glitches

#

shadows popping in and out all over the screen...I might assume it's because of the tiling mismatch with the normal map

#

but how?

#

isn't the size the tiling? I plugged the same tiling input for those and I still get the glitches

#

maybe it's not that

ancient inlet
#

Any idea how i can make my shader work for UI? Im using built-in instead of URP, maybe thats why?

neat orchid
#

like an effect out of nightmares

stone estuary
#

im trying to create an overlay effect with render features using shader graph, this is the graph im using and it keeps putting out this error "Shader error in 'Shader Graphs/Master': redefinition of '_CameraDepthTexture"

#

the shader material is Fullscreen, does anybody know why this is happening?

amber saffron
amber saffron
stone estuary
amber saffron
neat orchid
#

only, mine is a heightmap and goes into the vertex shader

#

but I did everything exactly the same as you

#

I actually fixed the shadow part first (world vs absolute world duhh), now shadows are static but it looks all messed up

#

it may be the effect is too strong, but I can't reduce it...shouldn't I be able to do that by reducing the normal vector?

neat orchid
#

yeah, 0.01 didn't do a whole lot

#

I don't know man

#

at parts it looks like it works although it's too strong, should reduce it

#

(ignore the seams showing, I think that's the problem of my mesh

#

but at other parts, it looks like this

amber saffron
#

Show the graph ?

#

Here, if I do displacement, I have this (URP btw) :

neat orchid
#

I guess that's what happens when you don't make it yourself, and don't follow the logic of the subgraphs

amber saffron
#

Adding also a normal map with strength setting helps a lot for lighting :

neat orchid
#

I multiplied the normal vector before the input

#

and only put the position as the input of the subgraph, didn't multiply later

#

I don't really follow the logic there

#

yeah, I have normal strength as a factor

#

so I did itall before the sample lod because I don't really understand how the subgraph works

amber saffron
# neat orchid I guess that's what happens when you don't make it yourself, and don't follow th...

You never showed a screenshot of the graph itself, so it is extremely difficult to know where you did a wrong connection.
It's not about having made the subgraph yourself or not, the "triplanar data build" and "triplanar sample" pairs are mostly a reinterpration of unity triplanar sample, it just allows to reuse the projection settings on multiple sample nodes. The logic afterwards is the exact same as the built-in triplanar sample node.

#

Top two nodes = bottom node (with one more setting, and ok, not the same names)

neat orchid
#

ah I understand now

#

I misunderstood the purpose of the subgraph

#

yes ok I can fix that

#

ok I can fix it now

#

two things tho

#

is ''size'' in the data build the tiling

amber saffron
#

Yes

neat orchid
#

and what is the reason for the split before multiply

amber saffron
amber saffron
neat orchid
ancient inlet
#

on top of that, theres a weird purple background for some reason

#

this is the image i use

neat orchid
#

lol

#

I'm gonna post the shader but it's pretty much what you did

#

sorry for the untidy graph, my other stuff is on the left side of the master stack

amber saffron
neat orchid
#

also, the last add goes into the tessellation displaement

#

wait, yours doesn't use tessellation...is there a difference?

amber saffron
neat orchid
#

ah ok yes

amber saffron
#

Does the mesh have normal seams (hard edges) ? f yes, that could easilly explain the holes you have, as the vertices are displaced along their normals, and will likely leave holes at those seams.

ancient inlet
neat orchid
#

I got it working semi correctly before

#

now it's completely broken, half of it is missing and it gets culled when it's on the right side of the camera

#

something's up

#

when I remove the heightmap and put amplitude at 0, it still happens all the same, but I can see the displacement change

#

but it still happens

amber saffron
neat orchid
#

no it doesn't

#

with or without heightmap

regal stag
amber saffron
neat orchid
amber saffron
# neat orchid <@532477925250039820>

Ok, my bad, HDRP tessellation displacement, takes a displacement vector, not a position. Simply don't add the position before connecting there.

neat orchid
#

wait I'll try to investigate, maybe tessellation works differently in other ways

#

nope, should be pretty much exactly this

#

oh my god, I plugged it into position instead of tessellation displacement

#

what a moron

amber saffron
neat orchid
#

it works functionally but something is still off

#

you said your size was reciprocal of tiling...but when I plug the reciprocal node it makes it reciprocal of what it should be

#

so when I plug tiling in directly, it increases and decreases as it should

#

I think it works now

#

let's see in game with the right lighting

amber saffron
neat orchid
#

reduces it, just like tiling my other texture maps

#

makes more tiles

ancient inlet
#

seems to be working now ty

amber saffron
ancient inlet
#

tho its still has the purple background

amber saffron
neat orchid
#

I think it's working, chief

amber saffron
neat orchid
#

I'm painting them manually

ancient inlet
amber saffron
proud sage
neat orchid
#

I use texture heightmaps just to displace the textures themselves, not blending the whole terrain

neat orchid
#

don't tell me

ancient inlet
#

oh i ithink i get it

amber saffron
ancient inlet
#

changed it to transparent, still the same tho

amber saffron
regal stag
ancient inlet
#

ohh i see, ty finally fixed this

neat orchid
amber saffron
neat orchid
#

Give me I reason why my shader is better please

amber saffron
proud sage
neat orchid
#

besides, it still isn't working properly after all

#

I get weird shadow issues

#

let's try if I have them with layeredlittessellation

amber saffron
proud sage
neat orchid
#

Thanks remy, you've been very helpful

#

Although I still get some weird banding, it's probably due to the curved and warped terrain

neat orchid
#

OK I've applied the same shader from my terrain to a flat plane

#

it's not a tessellation factor problem

obsidian wasp
#

Moving convo here. Outside of textures, any sort of shader that leverages noise can break up the flatness and monotony of things. You can also do things like instancing grass/vegetation to add a sense of depth to scenes.

#

@gloomy gust

gloomy gust
obsidian wasp
#

particle that spawns another on collision.

gloomy gust
#

awesome, thanks!

#

are there other particle effect systems ot her than shuriken?

hexed sorrel
#

Hey all! I've currently got a bit of an issue where I am trying to get my RendererFeature to default to "wrap" my RTHandles/Textures that are passed to my Material, however with my current solution of:

settings.GaussianBlurShaderMAT.GetTexture("_MainTex").wrapMode = TextureWrapMode.Clamp;
settings.GaussianBlurShaderMAT.GetTexture("_MainTex2").wrapMode = TextureWrapMode.Clamp;

whenever it is reallocated it will change the wrap mode back to "repeat" which causes a flashing effect, I'm just wondering if anyone knows of a way to assign the default wrapmode to a material using a HLSL shader, either through the renderer feature or the shader directly, any help would be amazing thanks all!

hexed sorrel
gloomy gust
kind juniper
gloomy gust
#

oh zamn

#

can you programatically update VFX graph?

kind juniper
#

Sure, you can expose parameters to the C# side just like with materials/shaders(shader graphs).

gloomy gust
shell wadi
#

Hey all, designing my own per-object lightmapping system, at the "got a lightmap texture" stage, but running into what I assume is a solved problem where UVs of many of my objects are mapped to the same parts of a texture (ie. wood), so when shading the object with the lightmap texture a bunch of bits appear incorrectly lightmapped. Is there any way in shaders to solve this or would I have to go back to each mesh and create a brand new 'lightmap' UV?

#

+Assume if I go through the second option I'll basically need to make a new Shader Graph lit shader that uses that second set of UVs for lighting

kind juniper
muted laurel
#

I was getting some unexpected results with my shader. from my heightmap, I tried setting the color value of everything below 0.5 to red and it turns out the color data of the texture in the shader is "pushed down"?

#

is there something that happens to the texture when I pass it to the shader? because before its in the shader the texture values are the same as the heightmap..

torpid vault
mystic trench
#

Hi all, I'm upgrading a shader to URP from the standard render pipeline and I can't find any information on what the replacement for UNITY_SAMPLE_TEXCUBE is or should be. How do I go about sampling light probes in URP shaders? Thanks! ๐Ÿ™‚

mental bone
torpid vault
#

Anybody have a good idea on how to make a shader that does this kind of twisting starburst thing? I'm hoping to make something purely in shadergraph, maybe use a cone mesh if I need to.
The trick I'm running into is that I want to make this use a flat speedlines texture that can be looped on its UVs. And that is throwing me off.

I cannot find a way to combine the effects of the Twirl and the Polar Coordinates UV nodes that is saitsfactory,.
Is this even possible? Am I missing something or trying to do something impossible?

amber saffron
#

And before you ask, that's how you can animate it :

muted laurel
torpid vault
#

see now is when I grapple with feeling soooo stupid for 7 hours grappling with this and not seeing that kind of obvious answer
but also
good brain, ask for help, dont waste another 7 overdesigning a workaround

torpid vault
amber saffron
muted laurel
#

how do I prevent it from doing the conversion when I put the texture in the shader?

amber saffron
muted laurel
#

currently my texture is actually made from a heightmap, I'm passing it is as height data basically

#

is there a way to disable sRGB like here?

#

im doing this right now in my script

amber saffron
#

See bool linear = false default argument in the api.

muted laurel
#

actually I think the API tells me defaults

amber saffron
muted laurel
#

ah well

amber saffron
muted laurel
#

yeah

#

I am able to do it from my own function

#

so idk, probably enforced in the constructors in the engine code to specify all arguments

#

thanks for the help... I appreciate it... I spent like 4 hours trying to understand why things were a little off

amber saffron
neat orchid
#

ok guys I'm a little bit stumped

#

so yesterday I've been trying to work on triplanar tessellation displacement for my shader. I did everything I should in theory, but I think my heightmap doesn't work properly

amber saffron
neat orchid
#

clearly doesn't work yet

#

However, there is another layer to this, a more subtle one

#

When I use layered-lit-tessellation, it still doesn't look as good as lit-tessellation and it really should cause it's a professional unity shader

#

you can still see the quad on the right looks higher quality

#

so not only is my own shader worse than lit-tessellation, unity's own layered-lit-tessellation is also worse

#

and I'm a bit stumped

amber saffron
# neat orchid so not only is my own shader worse than lit-tessellation, unity's own layered-li...

On you shader, the tesselation seems ok, but the rendering seems to miss some "contrast" in AO and/or normals.
Did you try to tweak the triplanar blending settings ?

For the layered vs regular lit video, what are the mapping options ? both using triplanar ?
The layered quad is displayed at and angle, and I can clearly see a blending seem at some point, where textures are overlayed and "washed out", if you also angle the regular lit quad it should give the same result.

neat orchid
#

If you mean tweaking the blending power in the input, I tried but didn't see a difference

#

I may try again

#

Actually, since I'm painting the texture with a brush, MAYBE I didn't paint with 100% opacity but fat chance

#

For the second, both are triplanar, yes. You mean angle of the mesh? I will try putting it at the same transform

opaque grove
#

I asked this in the programming channel and was suggested to come here as it may be more shader related - Im trying to make a HDRP Lit material transparent through code, and im not sure why it wont apply correctly, using the following code it will make the material black, the alpha will be 0, the Surface Type will be Transparent, but visually the model just appears black instead of invisible, is there some setting I need to change by code or some way to force the material to update or something? Note that if I make literally any change at all to the inspector for the material, it does go invisible correctly, im using instanced materials instead of shared materials because I only want to affect this one specific model

for (int i = 0; i < rend.Length; i++) { var m = rend[i].materials; SetMats(m); rend[i].materials = m; Debug.Log(m[0].color + " | " + rend[i].materials[0].color); }

void SetMats(Material[] mats)
        {
            for (int i = 0; i < mats.Length; i++) { mats[i].SetFloat("_SurfaceType", 1f); mats[i].SetColor("_BaseColor", Color.clear); }
        }

(rend is an array of skinned mesh renderers on the model in question, and the log gives me the expect values of zero for both "m" and the renderers material)

amber saffron
#

There is also a dedicated HDMaterial type to handle things like the surface type.

neat orchid
#

unless I'm crazy, it looks right now

#

you can see the border between the two meshes, mine on the left, lit-tessellation on the right

opaque grove
# amber saffron Neet to [Validate](https://docs.unity3d.com/Packages/com.unity.render-pipelines....

Hmm, that sounds like it would be convenient, though it doesnt seem that HDMaterial exists in the HDRP version I have (12.x - and it doesnt seem that I can upgrade in Unity 2021.x) - though the docs suggest it changes alpha clipping keywords, is there anywhere that lists which keywords specifically it sets to manually do it maybe? I didnt think setting alpha would be more difficult than setting the base color the material uses lol

neat orchid
warm moss
#

There's actually a crapton of properties dependent on the surface type. If you want to change the surface type at runtime and not in the editor and you can't call Validate, good luck, I had to copy a crapton of HDRP code into the codebase to do that.

opaque grove
# warm moss There's actually a crapton of properties dependent on the surface type. If you w...

All I really wanna do, is make a bunch of HDRP Lit materials go from whatever color they have, to an alpha of 0 over a short period of time at runtime to simulate something "vanishing", I figured that wouldnt be much more than just someMaterial.SetColor("_BaseColor", new Color(0, 0, 0, 0)); and call it a day, fair enough if I also have to set a "Opaque" surface type to "Transparent" to allow the 4th param to apply, but I figured that would be the extent of what would be needed to use alpha by code - im trying to use the Debug mode to peak at all the keywords and even using the same keywords it doesnt seem to apply visually... Maybe itll be easier to just make a new material for each of the mesh renderers instead of trying to change the alpha?

amber saffron
amber saffron
opaque grove
amber saffron
warm moss
#

An opaque object switching to a transparent shader will have depth sorting issues, I don't recommend it. It's better to do a an animated dissolve in a shader with clip transparency.

neat orchid
mental bone
#

The float4 idea is great I keep forgetting to pack stuff ๐Ÿ˜„. The compute can just hold a buffer of float4 right ?

amber saffron
mental bone
#

Now I want to overoptimise this thing and use a single large buffer for all shields etc etc

amber saffron
mental bone
#

Honestly your initial idea of just setting a vector array per material will work just fine

mental bone
amber saffron
mental bone
#

Ah right forgot about globals

#

I can write to the array from a job that would make it fast enough

#

No need to dabble in more compute nonsense ๐Ÿคฃ

stone estuary
#

is it possible to make this shader work with a noise node instead of a single float

void GaussianBlur_float(UnityTexture2D Texture, float2 UV, float Blur, UnitySamplerState Sampler, out float3 Out_RGB, out float Out_Alpha)
{
    float4 col = float4(0.0, 0.0, 0.0, 0.0);
    float kernelSum = 0.0;

    int upper = ((Blur - 1) / 2);
    int lower = -upper;

    for (int x = lower; x <= upper; ++x)
    {
        for (int y = lower; y <= upper; ++y)
        {
            kernelSum ++;

            float2 offset = float2(_BlitTexture_TexelSize.x * x, _BlitTexture_TexelSize.y * y);
            col += Texture.Sample(Sampler, UV + offset);
        }
    }

    col /= kernelSum;
    Out_RGB = float3(col.r, col.g, col.b);
    Out_Alpha = col.a;
}

regal stag
stone estuary
#

i think ill still go with it since it is good enough

stone estuary
#

ive ran into an issue with this, because the depth texture is only the size of the sprite and blurring it makes the sprites outline bigger the blurred sprite is not cut out properly

#

if i blur the depth texturei think it should work.

stone estuary
slender ore
#

Does shader graph work with UI? I am trying to set up an image with shader graph material and everything looks fine untill I press play and shader vanishes

regal stag
slender ore
regal stag
#

Unlit types probably make more sense for UI

supple kayak
#

Hello! I am looking into implementing a "shore" look for my landscape low poly material. Basically I need to set a "sand color" where I would be close to water(water would be where y-pos = 0) . Now I know that I can use the position and get the Y height and if its in a specific range set it to the sand color. The reason I dont want to do this is since I am taking real world data as my landscape. There could be possibly somewhere deep inside of the landscape where the y position would be in that specific range and it would color it with the "sand color", even though there would be no water close. So I dont want it to be dependent on the y-height but more so the distance from the current vertex to the closest "water vertex(where again the y-pos is 0) " I have been playing around with the shader graph for this but couldn't really figure it out on my own so now im back on square one, so if anyone knows more about this pls let me know :)

native spoke
#

Hey everyone! I'm working on a Force Field shader in Unity, and I'm looking for help with mapping the player's proximity to the alpha value, so that the closer the player gets, the more visible the force field becomes.

I want to create a card-like border that gradually appears as the player approaches. Right now, I'm using a distance check between the player's position and the object's position, but I'm struggling to get the alpha to smoothly increase as the player gets closer.

Thanks in advance for any help! ๐Ÿ™

proper sluice
#

Howdy, I apologize if I am in the wrong section of the discord for this, I created some models in Blender, and when I brought it over to Unity it doesn't seem to be showing one of the materials on the model, I was wondering if someone might be willing to give me some pointers regarding this.

worn hemlock
#

Does anyone know how to fix shader errors in "TextMeshPro". Im using HDRP

proper sluice
neat orchid
proper sluice
tropic pond
#

Does Ray Tracing/Path Tracing work for you in Unity 6? It doesn't work for me. But RTX works in Unity 2022.

neat orchid
#

above the add component, where it says material, click on the arrow

tropic pond
neat orchid
#

to the left of the material preview ball, click the arrow

proper sluice
neat orchid
#

did you figure out what you need to do?

proper sluice
#

Think so, just booted back up and to try and apply it

neat orchid
#

so you will see albedo or base map, normal map, etc.

#

you need to slot the textures in

warm pulsar
#

Can I use a Transform node to transform a vector with a length? It looks like setting it to "Direction" or "Normal" causes it to normalize the resulting vector.

#

I guess I can transform [0,0,0] and subtract that from the result of transforming my vector in "Position" mode..

regal stag
warm pulsar
#

Ah! Yep, there it is

regal stag
#

Very hidden feature, quite annoying

warm pulsar
#

how sneaky

#

thanks!

#

I completely glossed over that section of the doc page

fiery zephyr
#

not sure if this is the right place to ask ! but i'm using a render texture to reduce the resolution of my game. I wanted to emulate the old 2.5d look of the early 80s but it seems to be giving me some weird half opacity pixels on the corner of some squares

#

moving the camera doesn't help , i've been a bit stuck on it for a while

#

if it helps, my render texture is 128 x 96

hushed silo
#

turn off antialiasing, and if your'e scaling it somehow use nearest neighbor or something

fiery zephyr
#

is there any more anti alias settings

hushed silo
#

on camera itself, dunno if that's independent of rt one

fiery zephyr
#

ah yeah i found it

#

in project settings

hushed silo
#

yo may have a project wide one also

#

yeh

fiery zephyr
#

sweet ! thankyou :)

#

sorted it right out

robust acorn
#

anyone know if Unity 6 allows for easily adding full screen shaders to UI?

#

I know they added UGUI support for ShaderGraph, but unsure if that means full screen shaders or only to specific elements

north kelp
#

Does Unity 6 Shadergraph support Stencils yet? If so where/how?

#

currently i have to compile the shader, open it, and add this block to anything i need stenciled, which invalidates using shadergraph to edit it after:
Stencil
{
Ref 3
Comp [_StencilComp]
Pass Keep
}

fading pebble
#

I'm using a PNG of a circle with a transparent background, for some reason my output does respect the opacity and the preview looks like this:

#

in game it looks like this

#

should just be a circle. The shader is very simple:

fading pebble
kind juniper
#

If you look at the base color output that you're using it's a float3 - just the color data.

fading pebble
kind juniper
tardy crypt
#

There's no tools or anything for helping convert shaders into shader graphs or vice versa, correct?

kind juniper
kind juniper
#

But no tools to make a graph out of code afaik.

fading pebble
tardy crypt
#

If the shader says it was made with the Amplify Shader Editor but it's a shader there's no way either?

kind juniper
kind juniper
fading pebble
kind juniper
fading pebble
kind juniper
fading pebble
#

Oh im playing with it as you're giving me information

muted laurel
#

I've reached this point with my shader work:

#

which is not bad, but I'm also generating a huge texture for the entire world for the shader

#

is this what is normally done?

#

it's difficult to envision how I would otherwise do it

#

the colors drawn to the screen are based off the heightmap data in the texture

bitter wigeon
#

In webgl I noticed the URP decal projector isn't working. It works great on desktop builds. Is that something I need to enable or does webgl build not support it?

muted laurel
#

I've got this banding thing going on because my texture resolution for the shader is pretty low

#

how do I make it smoothed? like bilinear sampling

#

or do I need to do the math manually in the shader

civic lantern
#

Could always split it into multiple smaller textures

civic lantern
muted laurel
muted laurel
civic lantern
#

If yes, what format does it use?

muted laurel
#

here is the part where I create the texture object

#

then this is where i pass it to the shader

#

and in the shader it's sampler2D noiseTexture;

civic lantern
#

That would give you 32 bits per color channel

#

Instead of you current 8 bits per channel (RGBA32 = 8+8+8+8 bits)

muted laurel
#

hm but I don't think that changes what's happening here

#

noiseTexture is pretty much just a heightmap

#

here, I made the change and also reduced the resolution of the texture

civic lantern
#

Im talking about the banding issue

muted laurel
#

ok, one second

#

the textures I'm drawing are this format

#

sorry, I think I'm realizing that I am not providing accurate information

#

here, I reduced the resolution a lot

#

so the noise texture is pretty low res here, each square is one single height map value

#

and then based on that, it draws a blend of textures

#

if I increase the resolution of the noise texture, it'll look more like the image from earlier with banding

#

so I think the problem is that the shader is not interpolating height values between neighboring height values? I could be wrong

#

@civic lantern does this make sense

#

the shader takes the worldPos of the pixel (which I scale to the correct spot in the noise texture)

civic lantern
#

So you want bilinear filtering instead of sharp pixels?

muted laurel
#

yeah I would like it to be smooth

civic lantern
muted laurel
#

is that what determines how the texture is sampled

civic lantern
#

Yep

muted laurel
#

perfect

#

thank you

#

this is the first time I've tried doing any of this stuff and my first time with unity too ๐Ÿ’€

civic lantern
#

And I clearly see banding there

muted laurel
#

yeah, sorry about that

civic lantern
#

But yeah the banding becomes less noticeable with bilinear I guess

muted laurel
#

I realized halfway through that I misrepresented what the core problem was

#

how do I get transparency in a shader? I would like to make a water shader

#

with variable transparency cuz the shoreline vs deep water and all that

#

which is just alpha i guess

flint wasp
# muted laurel how do I get transparency in a shader? I would like to make a water shader

Idk about built-in, but on URP you need to do this
Tags {"RenderPipeline" = "UniversalPipeline" "Queue" = "Transparent" "RenderType"="Transparent" }
ZWrite On
Blend SrcAlpha OneMinusSrcAlpha

Or whatever the equivalent is on shadergraph.
Basically these directives tells the shader 1. to be rendered on the transparent pass of the pipeline, and 2. to write its output by blending it as
final.rgb = out.rgb * out.alpha + original.rgb * (1-out.alpha).

muted laurel
#

how do I know if I'm using URP

flint wasp
#

If you don't know then you're likely not using URP

#

I believe in the built-in pipeline it should be similar. Though you obviously don't need to specify URP as the renderpipeline

muted laurel
#

so this is the built-in pipeline?

flint wasp
#

Yes

muted laurel
#

what does ZWrite On do?

#

should I even be trying to make a water shader with a surface shader script

worn hemlock
#

does anyone know how to make textmeshpro shaders compatiblew with HDRP because im getting tons of errors

karmic hatch
supple kayak
#

Hello! I am looking into implementing a "shore" look for my landscape low poly material. Basically I need to set a "sand color" where I would be close to water(water would be where y-pos = 0) .
Now I know that I can use the position and get the Y height and if its in a specific range set it to the sand color.
The reason I dont want to do this is since I am taking real world data as my landscape. There could be possibly somewhere deep inside of the landscape where the y position would be in that specific range and it would color it with the "sand color", even though there would be no water close.
So I dont want it to be dependent on the y-height but more so the distance from the current vertex to the closest "water vertex(where again the y-pos is 0) " I have been playing around with the shader graph for this but couldn't really figure it out on my own so now im back on square one, so if anyone knows more about this pls let me know :)

amber saffron
tardy crypt
#

Looking up on Google for how to make a radial gradient for color in shader graph and this is one of the few things I can find. Surely this isn't the most efficient way to pull it off, no?

#

I would just like to add a color gradient changing from the inside to exterior of a texture for the shader.

supple kayak
amber saffron
supple kayak
#

Yes, I do have a heightmap I can use as a texture. The thing is it would be a different heightmap for all the different islands I would have, so I would need to create material variants for all and I am not sure if there is an automatic way of setting it

amber saffron
#

The shapes are aliased because I am using the step node, but using smoothstep or a custom "anti aliased step" based on derivatives can make it look smooth.

tardy crypt
#

Sorry if I was misleading, the shader graph I linked wasn't what I was working on specifically

#

I was just trying to find a method to make a radial gradient and add it into a different shader graph I was working on.

#

I was simply linking it as the only example I could seemingly find rn.

amber saffron
tardy crypt
#

That seems far more simplistic, ty.

supple kayak
muted laurel
#

does shader graph have built-in procedural noise?

supple kayak
#

OMG, what kind of searching wizard are you haha

#

I swear I searched those exact things

amber saffron
muted laurel
amber saffron
muted laurel
#

I imagine some sort of preprocessing where you calculate distance from coastlines... but how do you know whether the coastline is in-land or not.. especially if you have a very messy terrain with high persistence for example

muted laurel
#

unless google is failing me

amber saffron
amber saffron
muted laurel
#

yeah, that's fair

#

hm, I'm also thinking about the edges of a water shader now, to create a foamy look at the coastline. that preprocessing step would actually do exactly whats required

supple kayak
#

@amber saffron sorry me again. So I am trying to see how I can now use this heightmapTex in my shader graph to get the desired effect. I still know that I want to get the distance from the current vertex to where it would be black in the heightmap texture but I dont exactly know how to do that

amber saffron
supple kayak
muted laurel
#

although initially getting a point where it's guaranteed to be not* inland is not obvious to me

amber saffron
supple kayak
muted laurel
daring cobalt
#

Is there a way to achieve this look in unitys shader. I dont know anything about the unitys shader graphs. It feels this can be done in few nodes. I think either way i need to learn how to use shader graphs to get the desired look that i want. Is there any good tutos for it to get started ?

amber saffron
muted laurel
#

yes, but I don't see how you'd differentiate between the border of the island and the border of some pool inland

amber saffron
muted laurel
#

ah yeah, I was just thinking about it because my map for example looks like this

amber saffron
muted laurel
#

so unless I implement a falloff for the edges of the map, there's no guarantee that it's a water height (in the ocean not in a pool)

amber saffron
# muted laurel

Yeah, ok, trickier.
You can also start by masking every pixels that are bellow a certain level (like, 20m bellow water level).
Or start from the lowest possible value.

muted laurel
#

yeah i thought that might be a solution

#

should be valid aside from more extreme edge cases

muted laurel
amber saffron
#
  1. "blur" the coast line map so you have a distance field that is easy to use to make shader effect ๐Ÿ™‚
#

(I love distance fields)

muted laurel
#

that's probably the most performative way to create your texture

supple kayak
#

Do you mean like finding all points that are in the ocean with C#? Because I do not know in any way to do that logic with shadergraph

muted laurel
#

yea

#

you could start with every pixel set to a height of 1.0, set every coastline pixel to your coastline height, set every water pixel to 0.0, then blur it

#

I suppose the blur part can be done in shadergraph? @amber saffron

#

distance field enjoyer

amber saffron
#

Oh ! Thinking about it, you could use Mixture at real time to process the height map and generate that coast mask.

muted laurel
#

what is that?

amber saffron
amber saffron
muted laurel
#

how would it allow you to make the coast mask

#

I am actually pretty interested because I am going to be working in similar problems

supple kayak
#

but even if I manage to create this coast texture. How would I manage to get the distance between a world position and a texture 2d im kind of confused lol

amber saffron
# muted laurel how would it allow you to make the coast mask

The point is, the tool allows you to create textures by chaining nodes together. But the difference with shadergraph is that it works in a multi-pass way, each node in the graph is one or multiple passes (flood fill or blur for example).
So you can build a graph to generate the water mask, and run it on the input heightmap.

muted laurel
#

alright, I think I don't understand because I haven't used shader graph before, which I will learn shortly because it seems much more effective to work with than writing the code manually

amber saffron
supple kayak
#

hmmm alrigt

muted laurel
#

shader graph reminds me a lot of ue5 blueprints

amber saffron
stone estuary
#

is there a way to get the scene depth node as a texture?

#

i tried using "_CameraDepthTexture" but it gave me this error Shader error in 'Shader Graphs/blur': redefinition of '_CameraDepthTexture' at line 199 (on d3d11)

potent rapids
shy birch
bitter wigeon
#

does webgl build support URP decal projectors? Desktop build looks fine but can't see the decals on webgl

jolly adder
#

Hey guys,
I want to add river to my game. I have a shader water and I can make it move. I want to know how I can specific the flow ? Is it possible to adjust the plane mesh like by normals to specify the flow ?

stone estuary
shy birch
stone estuary
shy birch
amber saffron
broken sinew
#

I resurrect thee from 4 years later

orchid briar
broken sinew
#

you seem to be one of 2 people I ever saw experimenting with object picking and shaders

#

do you have any learning resources or can share if you had success with implementing scene view picking in unity editor?

orchid briar
#

nope

broken sinew
#

damn, sorry for pinging you then :/ Can you just explain what was the thing you have been workign on in the message I replied to?

orchid briar
#

nope

broken sinew
#

oh :c

stone estuary
#

this is what i tried hacking together but i didnt work (please dont judge i was just experimenting and didnt really know what i was doing)

void GaussianBlurDepth_float(float2 UV, float Blur, UnitySamplerState Sampler, out float Out, out float Out_Alpha)
{
    float4 col = float4(0.0, 0.0, 0.0, 0.0);
    float kernelSum = 0.0;

    int upper = ((Blur - 1) / 2);
    int lower = -upper;

    for (int x = lower; x <= upper; ++x)
    {
        for (int y = lower; y <= upper; ++y)
        {
            kernelSum ++;

            float2 offset = float2(_CameraDepthTexture_TexelSize.x * x, _CameraDepthTexture_TexelSize.y * y);
            col += _CameraDepthTexture.Sample(Sampler, UV + offset);
        }
    }

    col /= kernelSum;
    Out = col.r;
    Out_Alpha = col.a;
}
#

is there a way to get something like this working?

lilac mist
#

Hm, has anyone created something like an intersection shader for 2d sprites?

#

I've seen countless examples of it in 3d but none in 2d. Like if I wanted an effect that only applied on edges where the sprite is occluded by another sprite or overlapping another sprite

#

As an example in 3d it might look like this

eager folio
lilac mist
#

Hm, I don't know much about sdfs, how would I use them to detect if a sprite is overlapped?

lilac mist
#

It seems like SDFs would primaily be useful for standard shapes like cubes or circles, am I misunderstanding this?

muted laurel
#

do I need URP for shader graph for 2d stuff?

muted laurel
fiery zephyr
lilac mist
#

But my initial research into them makes it seem complicated

#

like, it's more suited towards simple objects as opposed to arbitrary shapes

muted laurel
#

yes, SDFs are a concept used in techniques like raymarching mostly

muted laurel
#

switching to URP broke my shaders, is there a quick way to fix them?

#

these are both builtin surface shaders

tardy crypt
#

Learning shader graphs and wanting to emulate an effect. The inside of this effect is transparent (Pink VFX). When I make a shader graph, mine has just black in the center. Guessing I need to adjust the alpha? Is there an easy way to do this where it'll only make the center transparent? Something like a reverse fresnel effect then I'm guessing?

ebon moss
#

hey I got this shader code and these results. Why is it that the white plane is experiencing the sin more whereas the black plane is just taking a smaller part of the domain curve

regal stag
ebon moss
regal stag
ebon moss
#

oh I figured it out, i wasn't multiplying the sin input enough since its by degrees and then I needed to scale the amplitude down

muted laurel
#

you can't put arrays into shader graph...?

#

what ๐Ÿ—ฟ

regal stag
ebon moss
#

I just disabled convert units

muted laurel
#

is there a way to get a float array in shadergraph? like you can with the builtin shader code?

#

is it wrong of me to assume something like this should be easy

regal stag
regal stag
muted laurel
#

yeah I gathered as much

#

I wanted to use Shader Graph because I just thought that the iteration time would be far better than doing the next thing i want in code

#

and now stuff is broken so I gotta redo old stuff first lol

regal stag
#

Might be a little late (especially if you've upgraded materials as I don't think there's an automatic way to undo that), but ShaderGraph does also work in Built-in RP for Unity 2021.2+

#

Well, mostly functional. There are some features that don't work with the Built-in target. Like Scene Color node and bounds data on the Object node.

muted laurel
#

I'm actually running into this right now

#

I cannot connect vs to unity or this will happen

#

what the hell is this lol it happens automatically if I have a shader graph in my project

ebon moss
muted laurel
#

is anybody else experiencing this? or have seen this??

#

this also just happened in a brand new project with URP

fiery zephyr
#

hi guys, this is probably a really simple problem ! I'm pretty new to unity and im struggling realising how to apply this "dithering" shader I found to my entire game view

#

i tried applying it to a material

ebon moss
fiery zephyr
#

im not exactly sure.. I dont know what files make up the shader

#

this is the github page

#

sorry if this seems pretty obvious I just have no clue

ebon moss
#

click in the shader folder

fiery zephyr
ebon moss
#

right click on that and click create -> material

fiery zephyr
ebon moss
#

try applying it to something

fiery zephyr
#

I tried adding that to my raw image of my game and it just went black

ebon moss
#

does it have parameters you can edit?

fiery zephyr
ebon moss
#

did you try adjusting any of them

fiery zephyr
#

yeah it made the game appear changing the slider, but not any dithering

#

just an opacity change thing

#

like theres a black layer over my game

ebon moss
#

go the textures folder

fiery zephyr
#

noise

#

would make sense for dithering

#

i tried applying that on where it says texture

#

but no luck

#

this is all i get

#

(the scanlines were already there)

ebon moss
#

did you put two different textures in the slots ?

fiery zephyr
#

no, two of the same

#

should I try two different?

ebon moss
#

yeah

#

it prob works by blending between two different textures or something

#

If that doesnt work I cant really help you just read the github docs ig, sorry

#

It looks like the shader is pretty old, so it may not work anymore as well

fiery zephyr
#

no worries, thankyou for you help though man

ebon moss
#

ofc, maybe someone else knows the solution

muted laurel
#

how uh

#

do i make a variable in the shader graph and change its value

#

i want to do this and then use height later

kind juniper
muted laurel
#

is it smart or will it recompute the value every time it needs the value

kind juniper
#

If you copy paste the relevant nodes, obviously that would result in several computations

muted laurel
#

alright

#

and I don't have the privilege of float arrays?

kind juniper
muted laurel
#

that is pretty bad

#

in my old shader code, I passed in an array of textures and, for the height of any point, showed the correct texture

#

that of course requires an array of heights

kind juniper
#

Sampling all the textures in a texture array might take a lot of nodes to implement indeed. Maybe it would be easier to write a custom function node.

dusky arrow
#

Hi what is the equivalent of this function when using Core RP?

muted laurel
#

surely this should show on my mesh?

#

there's no way there's a mistake here right?

#

why is not working

desert orbit
#

@muted laurel no off-topic media, please

muted laurel
#

sorry, will not do it anymore

ebon moss
#

I'm doing some research and getting mixed results. If I were to code a shader using URP, it seems I can't use Standard Surfaces Shaders, but I can use Unlits. Does this mean the only way for me to get lit shader funcitonality is using shader graph, or can I just add lit functionality to the base unlit shader?

flint wasp
#

You should use those

#

The lit shader basically is an unlit shader using those exposed functions

ebon moss
#

Ah thanks, so I just use that functionality from the unlit shader?

flint wasp
#

Yeah

ebon moss
#

Ty

#

Since you seem really knowledgeable I have one more question :P, are compute shaders something you use completely separate from like your unlit shader, or are they used to execute certain parts of the unlit shader more efficinetly and then feed the unlit shader back the results?

flint wasp
#

#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"

Hereโ€™s the library with lighting functions in URP btw

ebon moss
flint wasp
#

E.g. computeshader.SetBuffer()

#

A compute shader can be used to do practically anything though, it doesnโ€™t have to be related to rendering

ebon moss
#

Ok thanks, I'll do some research on it!

ebon moss
flint wasp
#

Yes you can bind buffers to unlit shaders, and any shader I can think of in unity.

ebon moss
#

After adding the line #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" to my URP shader I am getting what seems like a naming conflict error

muted laurel
#

wait, is a shader graph considered a material?

#

because I can just attach it directly as a material

ebon moss
#

you can?

#

it mightjust be using the default instance of that shader graph when you do that

muted laurel
#

because when I try to add it to a material first everything is falling apart

#

oh right, you're probably right about the default instance thing

#

yeah I think it makes sense

#

I didn't set the default texture of the instance of the shader when I attached it to a material

#

so it was not working as expected

obsidian wasp
muted laurel
#

is it possible for a generated texture to be shown in the shader graph? instead of the default texture I put for the property

desert orbit
#

Did you set alpha channel? You should work of of a tutorial to not do this blindly.

desert orbit
#

yes

muted laurel
#

I don't understand what you mean sorry. here's what I am referring to

#

I generate a heightmap in c# and pass it to noiseTexture property in the shader graph

#

it looks like how its supposed to:

#

but inside shader graph it shows the original default random texture i put in

#

or if I dont set a texture as default it is just empty

#

basically I want to see the noise map in the graph after hitting play

desert orbit
# muted laurel

This shader requires alpha channel setup properly. Not sure what you are using now. That's why I said follow a tutorial.

muted laurel
#

I am using sprite lit now

desert orbit
#

sprite shaders require alpha channel to frame object

muted laurel
#

do you mean in the alpha input for the fragment node

desert orbit
#

What object are you applying this to?

muted laurel
#

a quad

#

as I said it shows up exactly fine in the editor after I hit play but I am hoping it's possible that the generated noise map is also visible in the shader graph

desert orbit
#

Also never mind, it's not alpha related. I mixed it up with something else.

#

Make sure generated noise doesn't have extreme values that can go off range.

#

Some types of noises break at extreme ranges.

#

I would recheck what you are actually passing at runtime.

muted laurel
#

what im generating matches exactly what it's supposed to be, I'm comparing it to another quad that shows the same noise texture without using a shader

#

the heights are all clamped to 0.0 to 1.0 in my noise function too

desert orbit
# muted laurel

You need to show the actual graph if you want help. Just from that it looks like you are just directing texture image that is not set on the material itself. Preview there could be from shader preset image.

muted laurel
desert orbit
#

Figure out where the problem is first. Try default uv and then any test image instead of the noise separately at runtime

muted laurel
#

I think you misunderstand me. I want this:

#

to look like this

#

in the shader graph

#

if it's not possible to do this then thats alright

#

it would be nice though

kind juniper
muted laurel
#

Yeah I fear that you are right

#

Finally ported my stuff to shader graph though

#

๐Ÿฅณ๐ŸŽ‰

worn hemlock
#

anyone know how to fix this:
Library\PackageCache\com.unity.render-pipelines.high-definition\Runtime\Lighting\LightLoop\LightLoop.cs(300,69): error CS0117: 'ShaderConfig' does not contain a definition for 'LightClusterMaxCellElementCount'

warm pulsar
#

I have a bunch of extraneous materials lying around as a result

tidal fjord
#

having an odd issue where something is remaining invisible until in editor I go to the gameobject and click the unfold on the shader details, then it pops up and renders properly

#

that dropdown specifically

lilac mist
#

Does multiplying vec4's in the shader graph automatically normalize the result to 0-1?

#

This multiplication between an extremely intense HDR color and values that appear to go all the way up to 1 produces a weak result and doesn't trigger my bloom.

#

But multiplying by 1 (which changes nothing, of course) correctly produces HDR output strong enough to trigger bloom

#

In both cases the output is fed directly to fragment base color

#

The "Barrier color" is very bright and has an intensity of 9.999

granite prism
#

Does anybody know how to setup a shadergraph to outline creases and edges(using a normal map)
So far I haven't had much luck, I even tried fiddling around with Madlaski's pixel outline shadergraph but It hasn't worked out quite well

#

The kind of effect Im trying to achieve

granite prism
#

Nvm I think I kind of did it

#

Problem now is this wierd artifacting

karmic hatch
ebon moss
#

does unity have a built in Fast Fourier Transform for c# or HLSL?
or its compute shaders?

neon hazel
#

I'd like to learn more about Unity's SRP in general, to eventually be able to write my own passes properly etc. I've played around with Shader Graph and know my way around code. Are there any in-depth online courses or such that I could dive in to?

proper rapids
#

sorry I'm beginner I have only hours learning how shader graph works what does this mean?

#

it wont load any preview of the nodes I put

regal stag
proper rapids
stray gorge
#

i am trying to create hqx shader but i dont know what is going on
on the left is base texture, on the right is applied hqx

#
{
    float4 v1 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv + p1 / _Upscale);
    float4 v2 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv + p2 / _Upscale);
    if (ColorDistance(v1, v2) < _Threshold)
    {
        float2 dir = normalize(float2(p2.y - p1.y, -(p2.x - p1.x)));
        float2 lp = uv - (floor(uv + p1) + 0.5);
        float l = saturate((_LineThickness - dot(lp, dir)) * _Upscale);
        sum = lerp(sum, v1, l);
        return true;
    }
    return false;
}
float4 frag(Varyings IN) : SV_Target
{
    float2 uv = IN.uv * _Upscale;
    float4 sumColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv / _Upscale);
    if (Diag(sumColor, uv, float2(-1, 0), float2(0, 1)))
    {
        _LineThickness = 0.3;
        Diag(sumColor, uv, float2(-1, 0), float2(1, 1));
        Diag(sumColor, uv, float2(-1, -1), float2(0, 1));
    }
    _LineThickness = 0.4;
    if (Diag(sumColor, uv, float2(0, 1), float2(1, 0)))
    {
        _LineThickness = 0.3;
        Diag(sumColor, uv, float2(0, 1), float2(1, -1));
        Diag(sumColor, uv, float2(-1, 1), float2(1, 0));
    }
    _LineThickness = 0.4;
    if (Diag(sumColor, uv, float2(1, 0), float2(0, -1)))
    {
        _LineThickness = 0.3;
        Diag(sumColor, uv, float2(1, 0), float2(-1, -1));
        Diag(sumColor, uv, float2(1, 1), float2(0, -1));
    }
    _LineThickness = 0.4;
    if (Diag(sumColor, uv, float2(0, -1), float2(-1, 0)))
    {
        _LineThickness = 0.3;
        Diag(sumColor, uv, float2(0, -1), float2(-1, 1));
        Diag(sumColor, uv, float2(1, -1), float2(-1, 0));
    }
    return sumColor;
}```
#

is there any thing wrong ?

proper rapids
worn hemlock
#

can anyone tell how to convert nature and speedtree shaders to hdrp

wooden ember
#

Question, is there any way to identify what Element equals what area on my figure without trial and error? Maybe a setting in Unity somewhere that would name the elements sp I know what Material goes where. Everything listed as "Blue" are areas I can't for the life of me figure out.

primal hatch
#

Alternatively, open up the model in Blender. Go into Edit mode, select all, hit P and separate by material. This will split each material into its own geometry. You can then find the geometry associated with the Blue instances to find out what it applies to.

wooden ember
#

My Apolagies. I was unclear. I put them as "Blue to try and find out what part is which. I will try what you suggest.

warm pulsar
#

You can fix that by sorting your geometry by material index.

neon hazel
#

Is there a way to get rid of all these inaccurate warnings?

tranquil cave
#

Hi there, I'm about to learn the shaders but I'm totally a noob in this as I'm using sprite unlit shader but when just attaching the texture 2d node to base color it gave the stroke to my sprite in the scene and behaving odd

eager folio
tranquil cave
#

@eager folio thanks alot , I just started shader today thats why I'm really noob

dapper heath
#

heya, hoping someone could help out with my advanced (and out of my depth at this point) grass compute shader issue

as you can see in the picture, it looks alright in most cases, but towards the center of the mesh the grass is placed on, it starts to glitch out

    float gpt = _GrassPerTriangle;
    
    float2 sId = id.xy / gpt;
    float s1 = sId.x;
    float s2 = sId.y;
    
    if (s1 + s2 >= 1)
    {
        s1 = 1 - s1;
        s2 = 1 - s2;
    }
    float4 pos = float4(v1Pos + (s1 * (v2Pos - v1Pos)) + (s2 * (v3Pos - v1Pos)), 1);

unfortunately, there's very little info on how to fix this since, as far as I'm aware, this is a pretty novel grass implementation- it's a compute shader that takes a desired # of blades per triangle and the num of triangles in a mesh, then places them across the surface of the triangle

#

this happens with gpt values of 6+, or lower if the mesh has a smaller number of triangles/is less detailed. I believe it's happening because
float2 sId = id.xy / gpt;
here, id.xy is equivalent to the grass blade's thread index, so as that gets higher, id.xy / gpt starts running into precision issues. but I'm not entirely sure- I've tried clamping this to a small epsilon value and the issue remains. is it possibly an issue with the way I'm calculating positions? for reference, it works completely fine at sub5 gpt values

#

here's how it should look, at smaller gpt values (4, in this case)

north ice
#

What is the difference between a UI shader and one for a spriterenderer? I'm using a custom shader I found and it works when put on an UI Image, but not on a SpriteRenderer. I'm very new to shaders so maybe it's something obvious

mystic trench
#

Trying to sample _CameraDepthTexture in a URP shader and getting a very low-precision result. I'm sampling it with the following line:

float4 receiverDepth = tex2D(_CameraDepthTexture , i.uv.xy);

Any idea what I'm doing wrong? Is there some conversion function somewhere I'm missing?

#

D'oh, I'm trying to parse an R32 into a RGBA value

umbral cargo
#

ShaderGraph question:

I have this section of my ShaderGraph that I only want to run its calculations when my branch node is set to true.

Is there a way for me to have the ShaderGraph not do anything inside of the Displacement group in my screenshot if my Branch node is set to false?

Right now, I feel like it would do it anyway, but then the result would be thrown out.

#

and if not, is this something I could achieve if I wrote HLSL directly? I assume I could use if statements in HLSL that would not execute code if my conditions were not met

muted laurel
#

yeah, you can write a custom node

#

@umbral cargo try this

#

if you need something more involved, you can set the Type to File instead, which is a bit more involved, but essentially a File custom function takes HLSL from a separate file that you create

shell wadi
#

What is the difference between "Baked GI" and "Baked Back GI" in Shader Graph outputs? Can't quite seem to tell

umbral cargo
# muted laurel yeah, you can write a custom node

I don't want to convert my entire Displacement group into HLSL code, I just want a node that basically says "If a condition is met, do the Displacement group nodes, and if not, skip doing that and do nothing"

#

However I do understand that the only way to accomplish what I want might be to convert my Displacement group into HLSL code so that I can achieve that if no node exists to do what I want

muted laurel
#

I'm not sure then, I'm new to this too haha

mental bone
umbral cargo
#

OK thanks. I was hoping to take into consideration the orthographic value (which I use to zoom the camera) to determine whether I run all those calculations on each vertex

#

So at a certain value (zoom level) I could swap the keyword and switch to a different shader variant?

mental bone
#

Yes, you can enable/disable the keyword but then that shader would run for all vertices that use the same material. If you want to do different things per vertex, ie lets say a big plane that only tessalates close to the camera you have to branch with an if

umbral cargo
#

In my case that is ok

mental bone
#

But based in what you said a keyword seems to be able to do the trick

umbral cargo
#

How do you tell a shadergraph to only have nodes that works with certain keywords?

umbral cargo
#

OK sounds like I will need to dig into it tomorrow. Thanks!

tacit anvil
#

Where would I find any documentation on what the ShaderModel tag does?
I found a shader lying around in our project that has this tags block:

        Tags
        {
            "RenderType" = "Opaque"
            "RenderPipeline" = "UniversalPipeline"
            "UniversalMaterialType" = "Lit"
            "IgnoreProjector" = "True"
            "ShaderModel"="4.5"
        }

And I can't find any reference to what that does. Unity docs returns zero hits for ShaderModel, and when I google, the only hits I get is for targeting shader models (which is done with a #pragma, not a tag as far as I can tell), and for random shaders people have posted with the same tag.

umbral cargo
#

While I don't know the point of saying what shader model your shader uses explicitly, Shader Models are GPU dependent instructions and also the version of DirectX (or equivalent, i suppose) installed as far as I know.

tacit anvil
#

Yeah, I'm just wondering if the tag does something at all, and if so, where it's written down what the tag does exactly

umbral cargo
#

It could predate the move to HLSL too. Like maybe shaders used to get something out of that tag but now it doesn't matter.

#

I would not be surprised if some of this stuff sneaks into shaders as a form of superstition and then other people see it and start doing it too

#

But I've always viewed shader programming as a dark art

tacit anvil
#

It's very surprising to me that there's not just a list of "hey, these are the tags that are supported, these are the values they can have". Instead they're seemingly spread over arbitrary spots in the documentation.

regal stag
tacit anvil
#

Thanks!

#

I assume that since the ShaderModel tag isn't mentioned there, it's indeed an outdated thing that's probably just been copied around.

regal stag
#

Don't think I've seen it on older shaders either. Could be that someone has a tutorial with it in, or maybe some graph editors generate it? Not too sure

hexed sorrel
#

Hey all, just wondering if anyone knows how I might go about creating a shader which using two point values can display a smooth curve/lerp of all pixels below those two float values (*Image to describe more accurately), I am trying to create a smooth water flow shader to be used with a tile-based liquid system. Does anyone know of any references or ideas I could use to possibly create a system as such in either an HLSL shader or shader graph?

hexed sorrel
# hexed sorrel

my assumption is the shader would likely be masking out a curve based on those two values, but I am wondering if anyone knows of any way or reference to a similar effect done in a shader, any help would be amazing!

compact bronze
#

How do I access values of a Custom Render Texture shader in a C# script? the shader is not used for a material

hexed sorrel
#

Hey all, just wondering if anyone knows

hexed sorrel
#

^ Thread to save space, more detail inside. Thanks all!

silk sky
#

is it possible to make some sort of radia alpha in the shadergraph of a sprite material? Maybe by using the fresnel node

regal stag
thick willow
#

hey, little ShaderGraph question .. (URP)

what would be the most straight-forward way to properly recalculate my Normals when doing Vertex Displacement?
(the root problem is that the Shadows, both the received and casted ones, are flickering terribly, i can 'hack' this by playing around with the Renderers Shadow Distance etc, but that's not a real solution)

i did of course google this a little, but the most related threads were about Procedural Meshes and just using the Mesh API (obviously), but i'm not doing Procedural Meshes with that Shader .. one other 'Tutorial' i found used like 4x Subgraphs and required a lot of additional Data, that feels pretty bad

(Shader itself is a combination of some dissolve effects and vertex displacement depending on some distance remapped to 0-1,
vertex displacement uses noise with time-based offset)

ping on answer would be appreciated ๐Ÿ™‚

regal stag
thick willow
#

thank you! i'll try a different approach for now, without using time for noise displacement, and see if that's already 'good enough' and stops the insane flickering, but your blog contains pretty cool Shader Breakdowns, will definitely go through a few of them ๐Ÿ˜„

thick willow
#

i did some experiments, and it seems like the 'Remap' Node returns negative values if the 'In' Value is less than the 'In Min Max', after reading the Documentation and seeing it's just a linear interpolation, it's kinda obvious, but i feel like that's kinda unexpected and the term 'Out Min Max' is kinda misleading, because it's not actually clamping the range, so 'Out' can pretty well be at least below 0?!
(Unity 6 LTS, URP)

https://docs.unity3d.com/Packages/com.unity.shadergraph@6.9/manual/Remap-Node.html

warm storm
#

Can somebody explain why my materials are pink, but only when they are instantiated?

mystic trench
#

Technically shader-related too so I'll cross-post here: all references to reflection probes in my shaders are resolving to the default Unity skybox, even when a reflection probe is active and even when the skybox itself in environment settings is replaced. This didn't seem to be an issue before I switched over to URP, perhaps there's a setting I've missed? Any help would be appreciated.

Attached is an image of my current scene with my custom reflection probe visible, and a screenshot of frame debugger showing the incorrect probe being used.

fervent crane
#

[URP ] I am trying to only render a shadow and not the object itself, it kind of works but it just makes the orignal mesh be in it's place looking like a shadow

#
Shader "Custom/ShadowOnly"
{
    SubShader
    {
        Tags { "Queue" = "Geometry" "RenderType" = "Opaque" }
        Pass
        {
            Tags { "LightMode" = "ShadowCaster" }
            ZWrite On
            ColorMask 0
        }
    }
    FallBack "Diffuse"
}

#

What would be the better approach

grizzled bolt
fervent crane
acoustic flame
#

(only applied to the gun right now)

#

as far as I can tell the baked GI node only works on a lit shader, which is kinda absurd bc the only reason i'd want to use it is for an unlit graph lol

honest bison
#

any idea why my camera render texture set to depth is not rendering on mobile openGL?

neon hazel
#

Why am I seeing this type of errors?

#

I don't understand how I could've done something that would affect how those work

#

Could defines have something to do with it?

kind juniper
neon hazel
#

At first I didn't have these defines in my CustomLighting.hlsl. I am a semi-noob, so I'm not aware yet how these may or may not affect it...
#ifndef CUSTOM_LIGHTING_INCLUDED
#define CUSTOM_LIGHTING_INCLUDED

kind juniper
#

If you read the error it mentions MainLight_float. If that's your code, then there is an error there

neon hazel
#

I tried to find the error in my code but couldn't. Do you see some issue here?

{
#if SHADERGRAPH_PREVIEW  
    Direction = float3(0.5, 0.5, 0);
    Color = 1;
    DistanceAtten = 1;
    ShadowAtten = 1;
#else
#if SHADOWS_SCREEN
    float4 clipPos = TransformWorldToHClip(WorldPos);
    float4 shadowCoord = ComputeScreenPos(clipPos);
#else
    float4 shadowCoord = TransformWorldToShadowCoord(WorldPos);
#endif
    Light mainLight = GetMainLight(shadowCoord);
    Direction = mainLight.direction;
    Color = mainLight.color;
    DistanceAtten = mainLight.distanceAttenuation;
    ShadowSamplingData shadowSamplingData = GetMainLightShadowSamplingData();
    float shadowStrength = GetMainLightShadowStrength();
    ShadowAtten = SampleShadowmap(shadowCoord, TEXTURE2D_ARGS(_MainLightShadowmapTexture, sampler_MainLightShadowmapTexture), shadowSamplingData, shadowStrength, false);
#endif
}```
#

Oh maybe it's the Color = 1...

#

Yeah, that could be it very likely... So would that also cause the warning from Lighting.hlsl ?

neon hazel
#

If you have the time, could you explain what exactly these defines are for (why do I want to use them)?
#ifndef CUSTOM_LIGHTING_INCLUDED
#define CUSTOM_LIGHTING_INCLUDED

kind juniper
#

The reason why it mentions a different shader, is because your include is being added to that shader and compiled as part of it.

kind juniper
neon hazel
#

Well, I understood that it's about "only define these things once", but I don't really understand what it means

#

So my guess would be that if I end up including the hlsl in multiple places, in reality it will only exist once?

kind juniper
#

That's the explanation of #ifndef and #define. Not of the actual define

neon hazel
#

So define is like a public static variable..?

#

or a function

kind juniper
kind juniper
#

If you have an #if or #ifdef scope, it would only compile if the condition is true(== 1)

neon hazel
#

Okay, that makes sense

kind juniper
#

This is basically the same as macros and defines in C++. So if you want to read more about them, there are plenty of resources.

As for that specific keyword, I don't know what it does. You'll need to look it up in the docs or google. Unity doesn't have much docs on their built-in shaders workings, especially on urp/hdrp.

neon hazel
#

Thanks. I think this is keyword was just made up by the original creator of the hlsl file which I've already heavily modified

final rampart
#

Hi everyone, how are you? Could you help me create a shader for very low-end phones?

grizzled bolt
echo moatBOT
#

:loudspeaker: Collaborating and Job Posting

We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
โ€ข Collaboration & Jobs

final rampart
#

uuuu what do we have here

kind juniper
#

Simple urp shader(don't remember the exact name) might work as well