#archived-shaders

1 messages ยท Page 80 of 1

indigo ginkgo
#

ohhh

kind juniper
#

Anyway, digging through it is gonna be a pain in the ass. No one does that. You need to get the original source code and compile that instead.

gray hamlet
#

Hey guys
Im making a grass shader in unity.
I have come across an issue, basically.
when you get low enuf, the grass should obviously obscure your view like so:

#

However, when I use the grass as a detail on terrain, this is what I see:

#

as you can see, the colors of the grass seem to become wierdly transparent

#

and alll wierd

#

my shader graph does nothing fancy with the alpha either

#

can someone help me fix this?

chrome dagger
#

hey my Project window isn't showing up. can somebody help?

cosmic prairie
gray hamlet
cosmic prairie
#

try it with alpha clip

gray hamlet
cosmic prairie
gray hamlet
chrome dagger
gray hamlet
#

these are my current settings

#

alpha clipping is ticked so i guess that what u meant

cosmic prairie
gray hamlet
#

and make it opaque?

cosmic prairie
#

try it with opaque + alpha clip

#

yes

gray hamlet
#

i hate how you solved this in 2 minutes

#

yet i took 5 hours and got to nothing

#

thanks :)

cosmic prairie
#

yeah it looked like a z-sorting issue

#

no problem!

ebon basin
#

https://i.imgur.com/dCENOdc.jpeg
looking for some solutions for a vertex shader to give some wavey functionality to the stencil mask's outer edges. I can think of ways of doing it in code, but I was wondering what node solutions I could consider with shader graph.

#

I would assume it's probably simple like pi radius and some sine waves

brazen nimbus
#

Upping this !

hushed silo
#

are there any other ways to do ordering/prevent z fighting than: render queue, vertex displace one on normal? I have a situation where neither of these is working great

mental bone
karmic hatch
#

(then multiply the object-space position by 1 + 0.1 times that and set that as the new object-space position, or similar)

karmic hatch
#

you can't get light directions in shader graph by default; you can either write a custom node for it or pass them in via script

brazen nimbus
karmic hatch
dim yoke
#

WorldSpaceLightPos is only a thing for built-in render pipeline though right? Is that what you are using?

smoky widget
#

How do I make a conditional check of keywords

#

like multiple or

#

"keyword1" or "keyword2" etcc

brazen nimbus
brazen nimbus
broken thorn
#

heya, so rn im trying to make a snow shader using a displacement map, and i split the whole terrain into chunks, but at the borders seams started to appear, so i chekced the uv's and for some reason theres a spike at the edges, anyone got any idea why? maybe a precision thing?
this is the uv's code:

void CSMain(uint3 id : SV_DispatchThreadID)
{
    float2 uv = id.xy / resolution;
    uv = (uv + offset) * scale;
    Result[id.xy] = uv.x; //gradientNoise(uv) + 0.5;
}```
low lichen
broken thorn
#

sure, generator:

{
    [SerializeField] ComputeShader perlinNoise;
    [SerializeField] int resolution = 256;
    [SerializeField, Min(0)] float scale = 1;
    [SerializeField] SnowChunk[] snowChunks;

    public void Generate()
    {
        if (!Application.isPlaying) return;

        foreach (var chunk in snowChunks)
        {
            Vector2 pos = chunk.GetGridPos();
            RenderTexture texture = new RenderTexture(resolution, resolution, 0, RenderTextureFormat.RFloat)
            {
                enableRandomWrite = true
            };
            texture.Create();

            int kernel = perlinNoise.FindKernel("CSMain");
            perlinNoise.SetTexture(kernel, "Result", texture);
            perlinNoise.SetFloat("resolution", resolution);
            perlinNoise.SetFloat("scale", scale);
            perlinNoise.SetFloats("offset", new float[2] { pos.x, pos.y });
            perlinNoise.Dispatch(kernel, resolution / 8, resolution / 8, 1);

            Renderer rend = chunk.GetComponent<Renderer>();
            rend.enabled = true;
            rend.material.SetTexture("_DisplacementMap", texture);
        }
    }
}```
chunk:
```public class SnowChunk : MonoBehaviour
{
    [SerializeField] RenderTexture texture;

    public Vector2 GetGridPos()
        => new Vector2(transform.position.x, transform.position.z) / 5;

}```
low lichen
#

Is the resolution still 256 like the default value?

broken thorn
#

yep

low lichen
#

Ok. What can happen when dividing resolution by numthreads is you get a fraction, which gets floored to an int, meaning you end up with one less threads than you need, so the last few ids won't get processed. But if you're dividing 256 by 8, that shouldn't be a problem.

broken thorn
#

why would it get floored?

#

also even weirder is when i dont apply the scale and offset it seems fine

#

also, if i turn down the resolution to 8, the weird area gets larger:

low lichen
# broken thorn why would it get floored?

I mean if the resolution was, for example, 255. 255 / 8 = 31.875, but because it's an integer division, the fractional part is removed, so 31. With 31 * 8 threads, you only process 248 elements.

broken thorn
#

ooooh got it

#

could it maybe be something with the sampling?

#

im using sampleTexture2DLOD on a render texture

low lichen
broken thorn
#

nope i think its just an artifact because of the low resolution

low lichen
#

Are the two parts supposed to be touching?

#

You want everything to be a light gray color, but the edges are white?

#

I'm not really seeing the displacement, but it's also a very zoomed in and cropped image.

broken thorn
#

yes, so this is what i started with:
there were some weird seams at the edges, so to debug i set the colour and displacement values to the x value of the uv, which then led to the weird flat things at the edges

#

so this was meant to be just a seamless smooth ramp:

#

but instead, weird flat bits

low lichen
#

Is resolution defined as a float in the compute shader?

broken thorn
#

yes it is

low lichen
#

Mm, I think you need to be dividing by 255, not 256. uint3 id will max out at 255, so uv will not reach 1 if you divide it by 256.

#

I think for the edges to align, you need the edges of the textures to overlap by 1 pixel.

smoky widget
#

So, Gpu instancing with shader graph doesn't work???

broken thorn
regal stag
broken thorn
#

this is what it looks like with a resolution and thread size of 2:

#

the edges are taking up exactly 1/4 each of the area

smoky widget
#

So I should define the variables using the instancing buffer start , and similar macros

#

However, what if i do have some global variables? As I understand, having them in the blackboard will break gpu instancing

#

But even built-in, creating a lit shader graph doesn't have the GPU instancing checkbox

smoky widget
#

Ah yay! it works with your nodes

#

I dont understand why it doesn't without it

broken thorn
open scaffold
#

Is it normal for Unity to compile shaders like this for 3 hours (Main culprits are Hidden/Lit, Terrain/Lit and Tree_PBRLit)? I've looked around and found very little about it besides for enabling shader stripping... It's a very simple game, and this seems bizarre, any ideas?

#

I found a post saying I manually need to remove keywords from these shaders, but I didn't even make the problematic shaders, they're native URP

ebon basin
#

https://i.imgur.com/wGVqL27.png
Having trouble understanding what I need to do here to distort this ellipse with some wave functions. I can run a texture over it with alpha values, but that doesn't really meet my requirements of modifying the values that are already there.

#

I'm trying to just modify the edges of the ellipse with some distortion then afterwards plug back in the center radius if that's doable

regal stag
ebon basin
#

Ah, ok. I was playing around with that idea but couldnt really get the values I wanted

#

but now that I know I'll fool around with it a bit more

regal stag
#

I'd probably do something like (Noise * Strength + 1) * UV

ebon basin
#

tyty

ebon basin
regal stag
#

Can also subtract 0.5 after the noise so changing the strength only distorts the ellipse rather than changing it's radius too

#

And if you use a seamless noise texture (instead of Simple Noise), could try using Polar Coordinates as the UV to sample that. Might look neat

ebon basin
restive marten
#

IDk if it belongs here but i downloaded this blood decal and its very bright when theres no light, how do i go about changing that?

restive marten
#

i tried this but that caused it to have a black backroung

kind juniper
sly breach
weary crest
#

Hey, am trying to mask UI using stencil buffer, when am changing the layer of UI element its disappearing from the screen.

#

These are the properties for my layers

#

can anyone help me to find reason why its happening.

regal stag
devout quarry
#

not finding these colors super intuitive, black < blue < purple < cyan?

wet kraken
#

So I've been trying to learn shader graph properly for the past week, there's one effect I'd really like to work out using a sprite shader in URP whereby the sprite inverts the colour of whatever is behind it. I feel like I am very close, I have tried using Scene Position > Scene Color > One Minus but it only returns the colour of the camera background. If there is a way to sample the pixel behind the sprite that might help?

regal stag
# wet kraken So I've been trying to learn shader graph properly for the past week, there's on...

The Scene Color node only shows opaque geometry (it samples the camera's Opaque Texture) so won't include other sprites which use transparent shaders. But if you can find a way to blit the screen at a different stage (After Rendering Transparents) to your own render target you can pass that as a global tex to sample instead of Scene Color.
Might help - https://github.com/Cyanilux/URP_BlitRenderFeature
(But note shaders that sample that global tex need to be rendered with RenderObjects so they can also be in the After Rendering Transparents event)

wet kraken
low lichen
frail fulcrum
#

Hey everyone! I ran into an issue while trying to implement an occlusion shader and would love some help ๐Ÿ™‚

I'm working on a 2D game in Unity and I'm using URP for the render pipeline with Transparency Sort Mode set to Custom Axis (Y-Axis) so that the characters can walk both in front and behind Obstacles based on the Y position. I wanted to implement an occlusion shader so that the pixels of a character behind an Obstacle would render with a different texture (see first image).

To achieve this I set all the Obstacles to use a shader that has a Stencil Ref 1 Comp Always, and a Render Feature for the characters that checks the Stencil value and if it equals 1 overrides the texture with a special Occlusion Texture that I made. It works fine when a character is behind an Obstacle. But it unfortunately also works when a character is in front of an Obstacle (see second image). I'm not sure but could it be because I'm using Custom Axis as the Transparency Sort Mode, so the renders of the elements are sorted dynamically based on their Y position (?)

I don't know if the Stencil test is the right approach for this scenario and I would love to hear your ideas on the matter. Thanks nonetheless โค๏ธ

P.S.: I'm still very new to shading so I'm sorry in advance if it's a trivial question ๐Ÿ˜…

ebon basin
#

So in place you do need that sorting information and use it over the depth value.

#

Not too sure if you can do it all inside of the shader since a lot of this is scene-level sorting, so you may have to do it via script unless someone else has some better suggestions

keen egret
#

Hey, I need the Built-In render pipeline projector component in URP. I tried using the decal renderer feature, but it doesn't work, I'm trying to make a flashlight that doesn't use actual lights.

frail fulcrum
ebon basin
frail fulcrum
ebon basin
#

Right, your own comparison method on where each object is. But again, this is just an idea I've little research about.

#

Usually I do 2.5D stuff so I get the privilege of having that depth information to use.

frail fulcrum
#

Yeah true, but thanks still ๐Ÿ™‚

ebon basin
ebon basin
#

Was for a jam but a little over due lol. Rather iron some stuff instead of releasing something half-finished

sinful timber
#

For the life of me, I cant find a normal base outline shader that works on the Oculus Quest (Meta) and am using URP for my game. Does anyone have any suggestions?

ashen violet
#

hello my sprite fills up the empty space like this when i add a shader what do i do?

halcyon wedge
#

In shader there's the unity_ObjectToWorld and unity_WorldToObject matrices, right?

#

So uh, I'm meant to pass these two matrices, I'm basically writing the CPU side for rendering, thought that this question will be related to shaders-

#

Do these two matrices include rotation and scale?

#

I've only touched upon those two matrices a few days ago, when trying to write my own shader, and honestly? Idk what they really do yet '^^

ebon basin
#

basically the information you get from transforms, so yes

#

just in difference spaces

halcyon wedge
#

Is that the same as Transform.localToWorldMatrix?

#

The naming suggests that they're probably the same thing...

#

Oh, yep! Haha I didn't realize how close I was to adding scale and rotation to my renderer ๐Ÿ˜‚

#

Literally just change Matrix4x4 matrix = Matrix4x4.Translate(renderer.transform.position); to Matrix4x4 matrix = renderer.transform.localToWorldMatrix;

wet kraken
dapper kraken
#

Why does this node have no input or output?
Unity 6 URP 17.0.3

dapper kraken
regal stag
dapper kraken
#

Yes, I thought so too, but nothing changed when I turned it on and off ๐Ÿ˜„

regal stag
#

Ah okay, just bugged out then

dapper kraken
#

quick lightmap specular occlusion tip.
I've seen this in Bakery and unreal. I quickly did this in the shader graph before adding it deeper into the URP.

prime shale
#

nice

#

the one thing that unity DESPERATELY has needed to add by default since the inception of the PBR standard shader

#

specular occlusion is very underated

chilly portal
#

what does this mean? Im new to these things

flint yew
#

it really tells u exactly what to do

#

have u looked in the graphics settings like it suggests?

restive marten
#

@kind juniper i spent all night and day trying to figure it out and i just couldnt. but i did find that if i change the shader to (image attached) it works like a charm

outer elbow
#

I am trying to draw to a render texture, and I want to make that render texture have a transparent background, but I have a problem where it seems that Shader Graph shaders don't write out to the alpha channel for some reason. Regular shaders write out just fine, but Shader Graph shaders don't.

Repro steps:

  1. Create an empty project (2022.3.20f1) with the built-in renderer
  2. Package Manager -> Add the Shader Graph package
  3. Create a new Render Texture asset. Change none of the properties on it
  4. Create a Camera in the hierarchy. Set its Target Texture to the Render Texture from step 3, set its Clear Flags to Solid Color, and set the alpha of the Background color to 0
  5. Create a new Shader Graph shader, using Buitin -> Lit Shader Graph
  6. Set the Shader Graph's Surface Type to Transparent, and verify that its alpha channel output is set to 1 (the default)
  7. Create a Cube in scene that is inside the frustum of the Camera from step 4
  8. Click on the Render Texture and look at it in the inspector. Click on the R, G, B, and A channels to see the cube rendered in each color channel
  9. Apply the default Material for the Shader Graph (from step 5) to the Cube from step 7
  10. Click on the Render Texture again and look at it in the inspector. Click on the R, G, B, and A channels to see the cube rendered in each color channel

Expected:
The cube shows up in the R, G, B, and A channels, in both steps 8 and 10

Actual:
The cube shows up in all four channels in step 8. That's fine.
But in step 10, it shows up in the R, G, B channels, but it DOESN'T show up in the A channel

Is there something I'm missing, or should this be working?

#

(note: this reduced repro is a bit nonsensical on its own, but that's cause it's minimal. the minimal repro doesn't have any actual display of the result of the render texture in scene. In my actual project I am using the render texture in a scene and it still doesn't draw properly unless I set the render texture camera's clear color to have an alpha of 1.0 [255]. and that of course makes the entire alpha channel white, which is not what I'm going for)

kind juniper
restive marten
#

Your absolutly right i didnt think about that, ill look into making my own shader.

outer elbow
#

huh. it looks like if I spit out the generated code, copy it over an older style shader, and edit it so the "BuiltIn Forward" pass has a ColorMask of RGBA instead of RGB that solves my problem.
Is there a way to do this in the UI, or do I have to forego an editable graph to get the results I'm looking for?

#

oh I see. it's just hardcoded into BuiltinTarget.cs

whole estuary
#

Hey everyone, quickie question
I'm working on something for a gamejam, and i have a conveyor belt that uses a shadergraph based shader, that just scrolls the texture, and the player can start and stop this belt, which changes the speed value in the shader
My issue is, that sometimes when the belt stops/starts, the texture jumps (my best guess to why it happens is that since the speed gets set to 0, the offset will be 0 as well, since it's multiplying the time by the speed, which wont match up with the current pos the belt was on)
Is there an easy way to fix this issue? The only idea i have for fixing it is setting the offset each frame from a script, so that it doesn't rely on multiplying the time with something to get the movement, but i feel like rewriting shader parameters each frame would be awful for the performance

whole estuary
shut vigil
#

Is it possible to change a HDRP shader to URP?

#

it turned pink

#

and its a custom shader

#

and when i open it it becomes a script

#

any methods to turn in into urp compatible manually?

peak drum
#

how do i make a custom shader graph node???

dim yoke
peak drum
#

no

dim yoke
#

You can also create a Sub Graph if you prefer to create the node with shader graph nodes (as opposed to HLSL code in case of Custom Function)

peak drum
#

id rather use code

amber saffron
# shut vigil

This is a surface shader, and shouldn't even with with HDRP/URP.
The best way to do it would be to make this shader with shadergraph

dim yoke
peak drum
#

ty

gloomy tendon
#

How do you get the texel size of any texture?

amber saffron
gloomy tendon
#

ah code

#

hlsl

gloomy tendon
#

well I mean .shader Unity!

#

I get mixed up

amber saffron
#

Unity shader can also use the {TextureName}_TexelSize macro :

{TextureName}_TexelSize - a float4 property contains texture size information:

x contains 1.0/width
y contains 1.0/height
z contains width
w contains height

#

(.shader is for the shaderlab language, where you also include CG or HLSL code)

gloomy tendon
#

ah yes - that macro worked before - the only place I was unable to use was in a PostProcess for the _CameraColorTexture_TexelSize, not sure if I missing the macro in includes

earnest minnow
#

Hi guys, i have a custom shader work fine with SRP, but now i've tried to convert it into URP but it's dont work. Can any one help?

slender lichen
#

Hello, I exported a model from blender to unity with my configs that works normally with other models but for this one when a face is deformed by a bone there is a reflexion/shading bug that appear with every materials and only when face is deformed in a certain rotation. I'm in URP and the face is flat shaded, I tried with different geometries technics but same result. Anyone know how to fix this? (please ping me for the answer, thx)

slender lichen
earnest minnow
slender lichen
#

idk any solution to convert but maybe just copy-pasting nodes will work

earnest minnow
slender lichen
#

If it's manually coded I can't help you with it

amber saffron
# earnest minnow we can't convert it?

While it is technically possible to write shader by code for URP, it is not straightforward as with built-in and the surface shader syntax, so it is recommanded to use shadergraph.
If you don't want to redo to full shader with node, you still have to possibility to use a custom function node in the graph to do all the logic.

merry pagoda
#

I tried to make a sun sun that is always in the background no matter where the object actually is by putting it back in the render queue. It works fine without a Skybox but when I add one, the skybox seems to cover it up. Does someone know why that could be and how to change it?

low lichen
merry pagoda
#

2000

low lichen
#

2000 is the default render queue for geometry.

merry pagoda
#

on 2001 its infront of the buildings but is still not showing where the skybox is

low lichen
#

Is it using a custom shader?

merry pagoda
#

yes

#

I also used it for outlines on some objects. It basically makes a bigger copy of the object and renders behind it

merry pagoda
#

I fixed the problem. I changed the Queue Control to auto and the Sorting Priority to -50. Then I changed the Render Queue of the buildings to 3000, since all the other objects seem to be in 3000 on the render queue. It seems to work now.

chilly portal
#

where do i get a render pipeline asset

grizzled bolt
chilly portal
grizzled bolt
chilly portal
grizzled bolt
chilly portal
#

nvm i solved all the things

restive plover
#

i have this graph that spawns one circle that goes from the inward out like a shock wave, is there any way to multiply this circle ?

#

so that there would be multiple rings shooting outwards?

#

im shader graph noob just following tutorials here so help would be appreciated

dusky wedge
#

Hi, Does HLSLPROGRAM support built-in RP? If It does, which file should I include that equivalent to UnityCG.cginc?

visual mesa
#

Anyone know how I can make massive swells using the new HDRP water system? I've messed with the water settings, but I can't seem to make anything really crazy. I'd love to make some massive waves

tacit parcel
dusky wedge
tacit parcel
#

I sure hope not ๐Ÿ˜…

karmic hatch
# restive plover

Put the Length through some function that makes it change sign multiple times (e.g. multiply by twenty, then Sine)

#

And add the time to the length instead of the smoothstep

gloomy tendon
#

anyone done image filters in a shader graph? i.e. reading a 3x3 section of pixels and apply a formula. The graphs seem underdeveloped to do this but I figure a custom node should handle, just have not done much in that area

gloomy tendon
#

also using depth in shader - linear01 or raw? What are benefits or either?

karmic hatch
#

Split node

regal stag
restive plover
#

highly appreciate your help

gloomy tendon
#

with a custom function node how do you access the screen's color or normal buffers?

#

(shadergraph)

smoky widget
#

Tyring to get RenderMeshIndirect working but Im only getting shadows in one of the items? Im not sure why, im using shader graph also

#

But I dont know even what to send here to test

#

here's for example the render params

RenderParams renderParams = new RenderParams(){
    camera = cam,
    material = lod.materials[lm],
    matProps = propertyBlock,
    receiveShadows = true,
    shadowCastingMode = ShadowCastingMode.On,
    worldBounds = terrain.meshResult.mesh.bounds
};
broken sinew
#

how do I use standard unity shading in my custom shader that is NOT a surface shader? I have separate vertex and fragment functions and all required properties of a surface like material properties, normal etc.

alpine igloo
#

someone who knows how i can work around the issue where you can only use 16 texture samplers in 1 shader in hdrp?

frigid jay
regal stag
broken thorn
#

heya, i know its possible to pass a buffer of structs to a compute shader, but is it possible to pass just one?

karmic hatch
alpine igloo
somber wigeon
#

Anyone here know how to animate UV Tile Discard in Unity with poiyomi shaders? I cannot for the life of me remember how I animated the UV tile discard before. : ( When I hit record and try to animate it like how I did for the hat no properties show up at all.

meager pelican
rocky robin
#

Hello I am currently following Japser Flick's compute shaders tutorial(I'm not aware of how well known catlike coding is) and this is my first time writing shaders, I get a Kernal Index (0) out of range error. I looked this up and apparently that means the shader didn't compile. Also in my project the compute shader appears as a text asset with a compute shader inside of it? I haven't seen this anywhere else and am wondering if it is related to my error and for some reason unity isn't recognizing the shader as it is supposed to. When I look at the compiled code, theres not really anything in there it says: *** Platform Direct3D 11: no variants for this platform (no compute support, or no kernels)

kind juniper
rocky robin
kind juniper
steel notch
#

This curved arrow. How do ๐Ÿค”

#

Line renderer + spline or something?

alpine igloo
#

someone who knows why my red mist is making my leafs shader very weird?

grave vortex
grave vortex
alpine igloo
#

hdrp, material is a custom shader and the mist just has a color

#

its a lit shader btw

inland bridge
#

i have a skybox that i'm trying to have a day-night cycle by simply shading from a day cubemap - night cubemap. I want it to also have a sunrise and set. So, i have two add nodes. one does sunrise-day cycle, and the other does night-sunset cycle. how do i add them together?

inland bridge
#

im using shadergraph btw

inland bridge
#

yall plz-

crimson vigil
#

idk if im right heer but my problem is that my road is pink bc of the material and idk how to fix im usung the road from the Easyroads 3D Free v3 asset and its pink. i dont know how to fix

nocturne flint
#

Hi. I'm new to shaders and started out trying to just follow along with a YouTube video creating a toon shader.

For whatever reason there seems to be no effect on my objects when I apply the material to them. They are just one singular opaque color, as if lighting is not being taken into account?

Unsure of where to start with deducing what is wrong. I'm using the built-in pipeline and the attached image is the first few nodes of the graph (I can post more if needed; or link the video I followed). Would appreciate any help on this.

simple yarrow
#

how could i make it so that this transparent image (the word test), so that it inverts against the animated background?

pseudo wagon
#

Alpha = -1

nocturne flint
#

Does Main Light Direction not work with the built-in pipeline?

simple yarrow
daring wind
#

Hey I am having what should be a relatively simple issue, but no matter what I try it's not working.

I simply want to render my mesh behind ALL geometry with my shader. It should always render in the background, right in front of the skybox.
I have tried:

  • Setting the ZTest Mode to Lesser
  • Setting the Render Queue to 0 or 1
  • Messing around with the Stencil Buffer (I could probably test more with this)

No matter what I do I can't get it to work. I am on URP 2022.3.22f1

#

I have literally no issue having the geometry render on top of everything, but having it render behind everything isn't working.

#

Okay Stencil Buffer works if you use Greater or Equal

#

problem solved ๐Ÿ˜…

high matrix
#

Hello everyone ๐Ÿ‘‹

#

I need hep with bliting one render texture's depth buffer onto another render texture's color buffer. Is there anyone who has experience with this and could help, thank you ๐Ÿ˜ƒ.

high matrix
#

โฌ†๏ธ If someone can help me with this, I can pay for your time

high matrix
#

the mentioned post in this post explains why I need it

kind juniper
# high matrix Here is more context: https://discussions.unity.com/t/getting-depth-from-rendert...

So starting from answering your second question on that page:
It probably depends on the graphics API. Assuming we're talking about dx11/12, a depth buffer is basically a separate texture that is bound to the pipeline each time you render something. You can have as many depth textures as you want, but only one can be bound during a draw call.
Now, unity obviously hides all of this low level stuff, so it's hard to say how exactly it coincides with the high level render texture API, but my guess is that internally unity creates an additional texture(depth) for a render texture if the depth is required. Unity doesn't seem to provide direct access to it in the shaders though. However, assuming you have a camera that only renders to that render texture, you can use it's scene depth(a node in shader graph) and it would contain the same data as the rt depth buffer.
Assuming the above is correct, you can use that depth node in your shader to access the depth data and do whatever you want with it, whether it's to render it into into a texture or use directly for whatever logic you need.

teal tendon
#

How do I get outlining work on HDRP? Specially the quick outline asset. I have only focused on programming game mechanics so I have 0 experience with shaders. I want it to hook it to my interaction script where I can give a highlight effect to interactables.

chrome fern
fiery flower
#

Hey Everyone, I'm trying to implement a Pixel Art Shader using an Unlit Shader Graph. Does anyone know where I should start looking into why my output is not showing up?

grizzled bolt
#

Switch the project render pipeline, or switch the graph target

fiery flower
#

Thanks for that.
I have verified the rendering pipeline, now the output is blank? I trully appreciate your help

grizzled bolt
fiery flower
fiery flower
#

๐Ÿคฃ Thanks @grizzled bolt

kind juniper
lucid perch
#

does somebody know why it wont let me convert this to a sub graph?

shadow thistle
#

I'm having a problem with my shader - it doesn't calculate values correctly when Y is below 0. I tried to make the pattern first in desmos becouse i needed to find out what the equation was, and there it looks fine.

shadow thistle
#

Values below 0 just f up the shader

kind juniper
kind juniper
#

If you really need power there

chrome fern
# shadow thistle well that sucks

multiplying number with itself manually is actually faster and fixes that problem :)
(btw, it's actually a limitation of the underlying shader languages rather than the shadergraph itself - they sacrifice support for negative numbers in cases where they would be valid for a slightly faster pow() implementation)

shadow thistle
chrome fern
shadow thistle
#

ok so abs() kinda fixes it...

chrome fern
#

let me launch Unity editor and i'll show an alternative

shadow thistle
chrome fern
shadow thistle
#

i actually figured that the alternate solution would be like this but i waited if you wouldn't present a better one

chrome fern
lone relic
#

is there a plugin or a way to convert shader graph into shaderlab

#

ive already tried pressing view generated shader on the graph inspector but it didnt work

wise delta
#

guys i just started learning shaders and i just created a blank unlit shader in hdrp but for some reason its completely ignoring the z buffer

#

like everything is being rendered in front of it

#

help would be appreciated

#

thx in advance

wise delta
#

the areas where there is another object under that pixel seems to be the only area where it renders correctly

#

the sky where depth=1 kinda renders correctly but the water fails (hdrp water does not write to depth buffer at all so this is probably an issue with the fog)

#

ok no nevermind it never renders correctly anywhere on the screen

wise delta
wise delta
#

ztest is lequal btw

#

alright i found how to solve it, set the renderqueue to transparent

karmic hatch
#

if your clouds are always far away relative to the scene, you could render the background and then render the foreground onto that texture

smoky widget
#

Hi! I'm using Cyan include file to draw instances with gpu instancing. https://www.cyanilux.com/faq/#sg-drawmeshinstancedindirect. The data that is written into the matrix is relative to the world. But the items appear in completely wrong place. Seems to be something related to the bounds, but I can't figure out how to make them right

#

Is there any way to not use the world bounds?

smoky widget
#

this is making me go nuts

#

This piece of code works, put the positions are not in the right place

#if UNITY_ANY_INSTANCING_ENABLED
    // Updates the unity_ObjectToWorld / unity_WorldToObject matrices so our matrix is taken into account

    // Based on : 
    // https://github.com/Unity-Technologies/Graphics/blob/master/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/ParticlesInstancing.hlsl
    // and/or
    // https://github.com/TwoTailsGames/Unity-Built-in-Shaders/blob/master/CGIncludes/UnityStandardParticleInstancing.cginc

    void vertInstancingMatrices(out float4x4 objectToWorld, out float4x4 worldToObject) {
        InstanceData data = _PerInstanceData[unity_InstanceID];

        objectToWorld = mul(objectToWorld, data.m);

        // Transform matrix (override current)
        // I prefer keeping positions relative to the bounds passed into DrawMeshInstancedIndirect so use the above instead
/*         objectToWorld._11_21_31_41 = float4(data.m._11_21_31, 0.0f);
        objectToWorld._12_22_32_42 = float4(data.m._12_22_32, 0.0f);
        objectToWorld._13_23_33_43 = float4(data.m._13_23_33, 0.0f);
        objectToWorld._14_24_34_44 = float4(data.m._14_24_34, 1.0f); */

... Next stuff
    }
#endif
#

However, uncommenting that commented part, makes the unity_InstanceID no longer increase, wtf

#

The data is correct, since manually setting a 5 or 30 i get the expected result, but why does uncommenting that give me weird results?

#

I'm gonna ping @regal stag since they probably know what's going on (because the code is theirs XD)

regal stag
smoky widget
#

that's what I thought too, but it seems that changing that line makes unity_InstanceID always become 0

#

It's super weird. Because manually changing it i can see that the data is setup correctly

smoky widget
# regal stag Perhaps you just want `objectToWorld = data.m;`? I'm not sure

yeah so im still testing this in and out, but setting it manualy for somereason breaks it?? im confused

    void vertInstancingMatrices(inout float4x4 objectToWorld) {
        InstanceData data = _PerInstanceData[unity_InstanceID];
        objectToWorld = mul(objectToWorld, data.m);
        objectToWorld._11_21_31_41 = float4(data.m._11_21_31, 0.0f);
        objectToWorld._12_22_32_42 = float4(data.m._12_22_32, 0.0f);
        objectToWorld._13_23_33_43 = float4(data.m._13_23_33, 0.0f);
        objectToWorld._14_24_34_44 = float4(unity_InstanceID,unity_InstanceID,unity_InstanceID, 1.0f);

this doesn't fill unity_instanceID

#

this ends up flat in the ground

        InstanceData data = _PerInstanceData[unity_InstanceID];
        objectToWorld = mul(objectToWorld, data.m);
        objectToWorld._24 = unity_InstanceID;
#

so it retrieves the data correctly, and at the same time instance id is 0

stiff nexus
#

Hi hol, I have discovered an issue with my outline shader. I am currently attempting to make items in the players hand render in front of objects to avoid wall clipping. I am using the DrawRenderersCustomPass in HDRP to render the objects on top. But I am experiencing an issue where the edge detection is not detecting the objects at all, video here: https://streamable.com/avdvdo.

stiff nexus
#

At first I thought this was mainly caused by the objects being fully rendered in the BeforeTransparency injection point. But, I just checked if rendering outlines AfterPostProcess fixes it and it doesnt, infact the outlines shader acts like the objects arent there, video here: https://streamable.com/4xbq93.

deep moth
#

Are they writing depth? I'm gonna be scarce today

stiff nexus
#

They are writing depth.

stiff nexus
slate jackal
#

Ya'll I got the purple problem >_< I imported the asset from unity asset store and both my project and it are URP I'v reimported it a few times but to no avail any suggestions?

kind juniper
slate jackal
#

I tryed to open the shader and everything went laggy and it said failed to create rendered texture

kind juniper
slate jackal
#

do you have any suggestions?

kind juniper
slate jackal
#

Ok so bellow is what im working with its the material for an explosion all maps such as the normal map and base map are fine its just the material that's bad if you put the prefab in the game you can tell theres an expolation and the explostiongoes off because theres a ball of light but I big purple square blocks most of it.

kind juniper
slate jackal
#

I have alot on this project I wouldn't want to lose and its not reversable

#

I think im going to make a copy and send it

kind juniper
frozen parrot
#

Hey friends! I'm very new to shaders, trying to use an asset I bought for camera-based distance dither fading. It seems to work fine as is, but my character has some alpha on the main texture that i'd like to keep. As I understand, this shader takes over alpha of the material to perform the fade. Is there a way I can still preserve original base map's alpha as well? Left is the original, right is the fade shader, you can see some unclipped textures around the ears.

slate jackal
slate jackal
kind juniper
#

You'll need to go through each material that is pink and make sure they use a shader compatible to your render pipeline.

hybrid carbon
#

trying to remove this effect from objects in my scene so I can dither based on shadows instead of just having it applies everywhere, does anyone have a good grasp of how to do so? cause currently based on where the camera is, it changes colors or adds more layers, but I don't want the color to change, just the amount of dithering based on luminence

#

urp-

#

something more like this, but with color

tacit parcel
tacit parcel
frozen parrot
tulip zealot
#

does anyone know why this imported shader is showing up as white?

kind juniper
grand jolt
#

Does anyone know how to make a waterish shader on a mesh?

#

how would i make something similar to this on a mesh?

#

all the shaders online work on a plane

smoky widget
#

but a plane is a mesh

#

you mean accounting waterfalls?

karmic hatch
grizzled bolt
#

The vertical and horizontal walls don't necessarily have to use the same shader

smoky widget
#

So i guess my problem is how im setting up those matrices. How can I create an object to world matrix, using a position?

#

trying to create it like this

    void vertInstancingMatrices(inout float4x4 objectToWorld, out float4x4 worldToObject) {
        float3 position = _PerInstanceData[unity_InstanceID];


        objectToWorld._11_21_31_41 = float4(1, 0, 0, 0);
        objectToWorld._12_22_32_42 = float4(0, 1, 0, 0);
        objectToWorld._13_23_33_43 = float4(0, 0, 1, 0);
        objectToWorld._14_24_34_44 = float4(position, 1.0f);

        // inverse transform matrix
        float3x3 w2oRotation;
        w2oRotation[0] = objectToWorld[1].yzx * objectToWorld[2].zxy - objectToWorld[1].zxy * objectToWorld[2].yzx;
        w2oRotation[1] = objectToWorld[0].zxy * objectToWorld[2].yzx - objectToWorld[0].yzx * objectToWorld[2].zxy;
        w2oRotation[2] = objectToWorld[0].yzx * objectToWorld[1].zxy - objectToWorld[0].zxy * objectToWorld[1].yzx;

        float det = dot(objectToWorld[0].xyz, w2oRotation[0]);

        w2oRotation = transpose(w2oRotation);

        w2oRotation *= rcp(det);

        float3 w2oPosition = mul(w2oRotation, -objectToWorld._14_24_34);

        worldToObject._11_21_31_41 = float4(w2oRotation._11_21_31, 0.0f);
        worldToObject._12_22_32_42 = float4(w2oRotation._12_22_32, 0.0f);
        worldToObject._13_23_33_43 = float4(w2oRotation._13_23_33, 0.0f);
        worldToObject._14_24_34_44 = float4(w2oPosition, 1.0f);
    }

    void vertInstancingSetup() {
        vertInstancingMatrices(unity_ObjectToWorld, unity_WorldToObject);
    }

and doesn't seem to work

#

Only one tree appears on the corner

grand jolt
#

that's the problem

#

the assets and libraries all use planes but i'm wondering if that's for a reason

grizzled bolt
grand jolt
grizzled bolt
red flint
#

I'm having trouble using vector arrays with urp. Searched a lot online for a solution but it seems that the vector arrays in the shader just aren't being set. Are there any quirks I should be aware of?

#

I've confirmed that the array I'm passing in has values set. I'm not declaring the vector array as a property, but instead declaring it within hlslprogram

#

I've even tested with a smaller simpler shader to confirm, and even that doesn't work.

solid falcon
#

super newbie question, I'm trying to convert a few nodes in urp litshader into a shadersubgraph but it doesn't do anything nor create any files, anyone knows what I'm doing wrong?

grand jolt
#

I'll try to make something and if it doesn't work I'll ask it here.

tacit parcel
regal stag
# red flint I'm having trouble using vector arrays with urp. Searched a lot online for a so...

^ yea to add to this, might be better to test with just return _VectorArray[0]; - and other indices (Index 0 would be black based on your c# script)

Could also try setting with Shader.SetGlobalVectorArray, iirc there is a quirk where the SRP batcher doesn't play nice with per-material arrays iirc, though unsure if that applies here as the shader doesn't look like it's srp-batcher compatible

regal stag
gloomy tendon
#

Hi Shader Graph has a branch node but it is kind of backwards - you pass in 2 alternatives and it gives out one or the other. What if you want to do if, else in the graph? Is that not more optimal or does the shader avoid calculating both alternatives for a branch?

regal stag
gloomy tendon
regal stag
solid falcon
smoky widget
#

Why can't i declare and multiply by a matrix4x4 inside a custom function in a shader graph?

#

Aka, this doesn't work when used on a custom function

float4x4 _ObjectToWorld;
void TransfromPosition_float(in float3 objectPosition, out float3 position){
    position = mul(_ObjectToWorld, objectPosition);
}
#

but declaring the matrix in the blackboard and manually multiplying it does

#

im trying to understand matrices to debug my problem of instance ID and this is making extremely hard to debug and test out. I have no clue why sometimes instanceid has a value diferent than 0 and sometimes it doesn't

low lichen
smoky widget
smoky widget
#

However, overriding the ObjectToWorld matrix to make it happen by default doesn't, any idea why would that be?

    void vertInstancingMatrices(out float4x4 objectToWorld, out float4x4 worldToObject) {
        InstanceData data = _PerInstanceData[unity_InstanceID];
        objectToWorld = data.m;
        
        // Inverse transform matrix
        float3x3 w2oRotation;
        w2oRotation[0] = objectToWorld[1].yzx * objectToWorld[2].zxy - objectToWorld[1].zxy * objectToWorld[2].yzx;
        w2oRotation[1] = objectToWorld[0].zxy * objectToWorld[2].yzx - objectToWorld[0].yzx * objectToWorld[2].zxy;
        w2oRotation[2] = objectToWorld[0].yzx * objectToWorld[1].zxy - objectToWorld[0].zxy * objectToWorld[1].yzx;

        float det = dot(objectToWorld[0].xyz, w2oRotation[0]);
        w2oRotation = transpose(w2oRotation);
        w2oRotation *= rcp(det);
        float3 w2oPosition = mul(w2oRotation, -objectToWorld._14_24_34);

        worldToObject._11_21_31_41 = float4(w2oRotation._11_21_31, 0.0f);
        worldToObject._12_22_32_42 = float4(w2oRotation._12_22_32, 0.0f);
        worldToObject._13_23_33_43 = float4(w2oRotation._13_23_33, 0.0f);
        worldToObject._14_24_34_44 = float4(w2oPosition, 1.0f);
    }

    void vertInstancingSetup() {
        vertInstancingMatrices(unity_ObjectToWorld, unity_WorldToObject);
    }
rose flame
#

Hello, how can I make a zigzag material which I can apply to this line using shadergraph?

wise delta
#

guys i might be dumb because im just starting out with shader programming but i can't for the life of me figure out why this isnt working

#

ive got a very simple shader that just maps the uv's y value to the color in a lit hdrp shadergraph

#

but for some reason the output is only 2 colors

#

how is this possible? shouldnt it be a smooth gradient from white to black?

#

any help would be appreciated

#

also in the material preview it renders how i would expect it to

#

ok so the issue is something with probuilder because i made the plane with it and the shader appears to work as it should on a regular old plane

#

either way imma go to bed (its 22:09 here)

#

if any1 has any solutions pls dm me them thx in advance

wide wren
#

Is there a way to conver the Shader into Shadergraph? without recreating it manually from scratch?

pseudo wagon
drifting salmon
#

I have a shader where I'm taking the result of TransformWorldToHClip and offsetting the Z value, This works perfectly to push a mesh towards or away from the camera without changing it's shape. However, if the near clip plane is modified at all, the offset amount also changes. How can I make this offset be clip plane independent?

#

nvm, figured it out

grand jolt
brazen nimbus
#

Hello there ! Might be a simple thing but I can't figure it out ๐Ÿค”
I've a distortion effect but I can't clamp my UVs. Am I wrong in the approach ?

pseudo wagon
#

Looks good to me, what's on the left ?

#

You can try setting the texture itself to clamp

calm harbor
#

yo need anyone to teach me how i start dm me

#

can u teach me some things? @kind juniper

#

๐Ÿฅบ

kind juniper
calm harbor
#

where can i ask questions

amber saffron
brazen nimbus
calm harbor
amber saffron
calm harbor
#

alr thx

amber saffron
# brazen nimbus

The clamp node (or a saturate node) should have takend rid of this tiling.
It's not easy to notice, but if I squint very hard on the small texture preview on the left of the sample node, I think I can see some white pixels on the right, is the effect maybe offset ?

brazen nimbus
amber saffron
#

Are you using a texture transform on the texture property itself maybe ?

brazen nimbus
regal stag
# brazen nimbus

As Yggdrazyl also mentioned have you tried changing the wrap mode on the texture to Clamp rather than repeat?

#

I'm sure it's possible to clamp uvs manually but if you don't need the texture to repeat it's easiest that way. Or override it with a Sampler State node attached to the Sample

brazen nimbus
#

Is there a reason why it doesnt clamp with the clamp node tho ?

regal stag
#

Since that averages multiple texels

amber saffron
regal stag
#

Clamping to 1-texelSize might avoid that? (not sure if that would work with mipmaps?)
But yeah, much easier to adjust texture wrap mode.

brazen nimbus
#

I'll try to do some researches about Bilinear filtering to understand a bit more the topic :)
Well, thanks for the help ! ๐ŸŒบ

sharp frost
#

Hey all, can any help me to create shader for hairs?

#

as of now I am getting this kind of issue.

amber saffron
# sharp frost as of now I am getting this kind of issue.

This is a common issue with drawing order of hair triangles.
You have basically two options to tackle this :

  1. Carefully edit the triangles order so "deeper" hair strands draw first (not easy at all)
  2. Use some form of depth prepass with alpha clip so the topmost hairs are always drawn over the others
sharp frost
sharp frost
warm pulsar
#

I want to poke at indirect rendering. Is there a good resource I should start with?

sharp frost
warm pulsar
#

as in, a good place to learn how to use it in Unity :p

low lichen
warm pulsar
#

I guess I also don't know much about manually performing instanced draws :p

low lichen
#

Then I'd recommend starting there. Should be easier to find resources on that.

#

Probably most are using the older Graphics.DrawMeshInstanced, instead of the recommended Graphics.RenderMeshInstanced, but they do the same thing, just moving the parameters around.

warm pulsar
#

that's part of the problem haha

#

those are very similarly named!

low lichen
#

What are your goals with this?

warm pulsar
#

Strictly learning right now.

low lichen
#

Any particular render pipeline?

warm pulsar
#

HDRP

#

although I do use URP for side projects

low lichen
#

I can't say I would recommend learning these fundamentals inside HDRP. It's doing a lot complicated things behind the scenes, making debugging more difficult.

warm pulsar
#

inspecting with the Frame Debugger?

low lichen
#

Well, I don't have a ton of experience with it, but I would say you're much more likely to run into issues where you're not doing things quite the way HDRP wants you to, and so it doesn't work. Not because you're doing something wrong, but because you're doing it the wrong way within HDRP.

#

For example, you may need to use Custom Passes to be able to inject your draw calls at the correct time. And Custom Passes are specific to HDRP and so are not useful for learning indirect draw calls, just another obstacle for you to learn to be able to even start learning what you want to learn.

grand jolt
#

@grizzled bolt

#

I'm back with the shader issue

#

I tried developing the water shader

#

But am having some difficulty

#

I'm trying to make the top first, I used a branch node to check if it was top, before using noise maps to create the scrolling texture

#

I just would like to know what I'm lacking in my shader to achieve the look that this game has

#

Pretty much the top left is just 2 scrolling noise texture, going in reverse to each other, and I colour the island with a gradient. I also use those gradient bars on the bottom left for adding a bit of noise extra.

#

One main issue I'm having is with the side areas of my island, since my mesh is curved in blender, adding the shader to the sides is warping it as you can see above.

#

I also don't think it looks very transparent, however can't figure out how to achieve that look.

grizzled bolt
#

The example shader appears to have a parallax-offset texture of the sea floor that's distorted by all the scrolling textures and beach waves
That gives the appearance of transparency

#

And some kind of blend or likely fake fade for the edges

#

Could be distorting a color buffer instead of using a parallax texture, but I can't see any mesh object under the surface so I doubt it

grand jolt
#

Hm yeah

#

That makes sense. Any idea how to fix that bending on my mesh? Make the shader look same regardless of triangle density?

#

Its curved shape is what messes it up

grizzled bolt
#

Also there's something to give intersecting objects a wave or shore effect which kinda looks like it's a depth comparison effect but might be much simpler to add some kind of shore mesh around them

#

Waterfall could be a different shader, or blending to different properties, like scroll direction and texture

grizzled bolt
# grand jolt

This looks like distorted UVs in your mesh, rather than an issue in your shader

grand jolt
grand jolt
#

I'm pretty sure it's because it curves there

#

Let me show you the blender model

grave osprey
#

I m new to Unity
does anyone know how to make this look any better?
Skin, Hair and Fabric textures

grizzled bolt
rose flame
#

How do I make a zigzag shader which I can then apply to a line renderer?

naive elk
#

Hoping someone can help me with this messing w shadergraph for the first time it seems like you can do a lot of cool stuff but im having an issue

steel notch
#

Uuuh are you unable to use the continue keyword in hlsl?

kind juniper
echo moatBOT
steel notch
#

Shader is taken from Unity's 3D texture documentation

#

just wanted to add a cutoff along an axis

steel notch
#

Still I was kinda confused as to why it just... exploded.

#

Unity just got stuck trying to compile the shader.

kind juniper
#

Hmm... Could be unrelated to the shader code at all then. Does it not freeze when compiling any other change?

kind juniper
steel notch
#

Worked fine.

#

Unity froze up on this change mutiple times.

#

I am also using URP.

kind juniper
steel notch
kind juniper
#

I see

pseudo wagon
#

I'd like to create a shader that makes it feel like electricity is running over the mesh. Bolts of lightning constantly zigzaging / scrolling on the mesh.
I'm not sure what would look the best... So far I'm using a scrolling noise texture but it doesn't look great. Any idea ?

delicate pulsar
#

i want to know is there anything impossible in shaders. anyone encountered very hard problem in shader something like impossible.

tacit parcel
# delicate pulsar i want to know is there anything impossible in shaders. anyone encountered very ...

I will talk more about SO many good things that came out of this experiment. Stay tuned!

Passing data between fluidsim and CPU with minimal latency is tricky, but super fun to play with once you made it work. So many possibilities

I'll post a LOT of breakdowns. Meanwhile follow me on

Twitter ๐Ÿ™https://twitter.com/Vuthric
Discord ๐Ÿ™http://discor...

โ–ถ Play video
vital token
#

Hey! Got a small problem lol

As I move the camera, or an object moves too fast, you can see that me shader applies foam where that object is. Even if they aren't touching the water
Like the cannonballs, they are above the water, so there shouldn't be any foam, but as the camera moves, or if they cannonballs move fast enough, you can see the water where the cannonball was the previous frame being white because of the foam.

The second screenshot is the calculate depth difference function.
I'm not sure what I need to do to fix my issue. I feel it's something wrong with the depth but idk

delicate pulsar
#

i think its made in unreal. knowing about unreal engine now how good it is in graphics.

#

i am talking about the walls and other stuff they look so real.

#

to bring such effect in unity thats heavy.

#

but the water blob in this video is possible. will be making it. https://www.youtube.com/watch?v=xOkfTyqDWGE

I will talk more about SO many good things that came out of this experiment. Stay tuned!

Passing data between fluidsim and CPU with minimal latency is tricky, but super fun to play with once you made it work. So many possibilities

I'll post a LOT of breakdowns. Meanwhile follow me on

Twitter ๐Ÿ™https://twitter.com/Vuthric
Discord ๐Ÿ™http://discor...

โ–ถ Play video
#

but can i post the video here after making it.

amber saffron
# naive elk Hoping someone can help me with this messing w shadergraph for the first time it...

This is probably a floating precision issue.
You are drawing grids in the 3 axes, but where you have the vertical walls, I guess the polygons are at the exact position where the grid line should start to be visible. Due to floating point error, some pixels are showing black, and other white.
To avoid this, just offset a bit the mesh, or use some normal based logic in your shader to filter the lines.

smoky widget
gloomy tendon
# steel notch just wanted to add a cutoff along an axis

It does up to 128 texture reads per pixel? That sounds crazy. Also if position.y < 1 does it actually still skip the texture read work or just ignore the result? I don't understand modern gpu branching but it isn't like code

gloomy tendon
#

It seems if one pixel on shader does a large number of iterations on a loop then others in the same tile/group will too. So some performance cost. Shader branching is a pain but better than it was

heavy stirrup
#

does UNITY_EDITOR define work in shaders?

#

I need a way to distinguish between build & editor in shader

flint yew
#

just try it?

astral finch
#

your posts like this. oh sorry it changed chatrooms trying to reply

tight phoenix
#

Let me try to find the project where I used that shader

astral finch
#

is custom shadow values/blending in the shader the solution?

tight phoenix
astral finch
#

i notice it doesn't happen in built-in with the same shadow bias values. So i'm confused what the difference between URP and built-in is

tight phoenix
#

this was the bug I was picturing that was fixed. Ill keep loading the proj with this shader though to check what I ended up doing if I did fix that banding. I think I did fix it/ someone helped me fix it?

toxic flume
#

How can I test the fallback of a shader directly? syntax error works?

#

I want to fallback a shader to hidden/universal render pipeline. I want to hide it if the shader is not supported

tight phoenix
astral finch
#

all good ty for checking

tight phoenix
#

It tends to only really show on steep glancing angles

astral finch
#

damn. It's happening for me at nonsteep angles so i must be doing something wrong. because yea it doesn't happen in built-in with the same values

tight phoenix
#

moving the sun angle around vs the jank emerging

astral finch
#

it only goes away for me if i crank normal bias up to 6, but by doing so it completely ruins shadows in general and causes lightbleed on a ton of geometry

#

i might try to find out how built-in does its shadows and maybe try to copy that in urp, if that's even possible

tight phoenix
#

zooming also causes it to get worse it seems

#

these are my params if that helps

astral finch
#

hmm ya mine look pretty much the same

#

maybe i'll just stick to built-in. it feels like it should be possible though if built-in can do it

#

either that or if i can set a custom bias per object in the shader that might be a workaround

sharp frost
#

How to implement "Transparent Depth Pre-Pass" for hair URP?

grave osprey
#

Anyone know what is happing here?

grizzled bolt
sharp frost
twilit steeple
#

Hello, has anyone tried to make a sobel filter in unity's shader graph? I wanted to make outlines with sobel filter on normal buffer. But I havent managed to do this on unity's built-in rendering pipeline. I was just asking if someone has done this already or there is a way to do this in the built-in pipeline?

#

Im pretty new to shaders and im struggling to make this

amber saffron
# sharp frost any one knows?

With a custom renderer feature, injected before transparents, rendering the hair mesh with a custom shader that only write depth, with alpha clip

amber saffron
twilit steeple
amber saffron
twilit steeple
#

Ok then ill asnwer later ;-; Im doing something else right now, but thank you for help, i will be back.

sharp frost
#

Thanks, I am going to implement the same, if I will face any problem I will ask you.

tidal forge
#

It's works pretty well and pixelperfect. It's just fullscreen renderpass feature. But it's URP

#

I'm back with a question about that outline effect. How can I make it per-material? I can't just use masking or something similar, because I want to have different settings for each object.

twilit steeple
#

Well the thing is that i cant use URP, I really need to use default ๐Ÿ˜…

#

And my game wont be pixel, it will be like this:

#

black outlines, flat colors, lots of details

twilit steeple
#

but ill try, Im trying to make it in shader graph.

tidal forge
tidal forge
twilit steeple
#

Can you please show in shader graph if possible?

#

i mean, how do i put it at the screen (sorry if im asking way too basic things, im pretty new to shaders)

sharp frost
tidal forge
#

But it's for URP fullscreen feature, time ago i maked it without fullscreen feature, just in render feature blit result

sharp frost
tidal forge
twilit steeple
twilit steeple
#

Most videos on youtube were using URP only, and some other only were explaining generally about the filter, and just showing it.

twilit steeple
#
#ifndef SOBELOUTLINES_INCLUDED
#define SOBELOUTLINES_INCLUDED

// The sobel effect runs by sampling the texture around a point to see
// if there are any large changes. Each sample is multiplied by a convolution
// matrix weight for the x and y components seperately. Each value is then
// added together, and the final sobel value is the length of the resulting float2.
// Higher values mean the algorithm detected more of an edge

// These are points to sample relative to the starting point
static float2 sobelSamplePoints[9] = {
    float2(-1, 1), float2(0, 1), float2(1, 1),
    float2(-1, 0), float2(0, 0), float2(1, 0),
    float2(-1, -1), float2(0, -1), float2(1, -1),
};

// Weights for the x component
static float sobelXMatrix[9] = {
    1, 0, -1,
    2, 0, -2,
    1, 0, -1
};

// Weights for the y component
static float sobelYMatrix[9] = {
    1, 2, 1,
    0, 0, 0,
    -1, -2, -1
};

// This function runs the sobel algorithm over the depth texture
void DepthSobel_float(float2 UV, float Thickness, out float Out) {
    float2 sobel = 0;
    // We can unroll this loop to make it more efficient
    // The compiler is also smart enough to remove the i=4 iteration, which is always zero
    [unroll] for (int i = 0; i < 9; i++) {
        float depth = SHADERGRAPH_SAMPLE_SCENE_DEPTH(UV + sobelSamplePoints[i] * Thickness);
        sobel += depth * float2(sobelXMatrix[i], sobelYMatrix[i]);
    }
    // Get the final sobel value
    Out = length(sobel);
}

#endif```
#

I found this

gloomy tendon
#

I did somethinglike this recently - learning you can read the depth map in a custom function node is so much better than the spider-graphs I have seen!

gloomy tendon
gloomy tendon
twilit steeple
#

Oh ok, im trying to use it with built-in renderer so things are a little hard for me

gloomy tendon
twilit steeple
#

Yeah, shader graph is avaible for built-in

gloomy tendon
twilit steeple
#

Hey do you get an error like this?

gloomy tendon
#

It is painful to learn, I got lots of errors. You need to put the function name in the node without the _float bit that you want to use

#

the _float bit is in the code to specify precision but should not be written in the node options when you write the function name

amber saffron
#
  • set the node precision mode to float instead of "inherit"
twilit steeple
#

ah ok

regal stag
gloomy tendon
#

it almost always is float though when inherited - does anything put _half as default any more?

twilit steeple
tidal forge
#

Any ideas why Scene Depth node works, but this code - not (just black)?

gloomy tendon
#

did you specify needing to read from normal buffer somewhere?

#

sorry depth buffer!

tidal forge
#

In URP settings, yes

#

I looked at scene depth node code and just copypaste into custom function, but for some reasons it's not work

regal stag
gloomy tendon
#

are you using FullScreenPassRendererFeature and set requirements?

tidal forge
#

But Scene Depth node it's added, but don't connected to anything

#

In same shadergraph

regal stag
#

If it's not connected the node is ignored, it won't change the compiled result

regal stag
# twilit steeple

If you're using the code you posted above, make sure the inputs/outputs match the function used. float2 UV, float Thickness, out float Out

tidal forge
#

I'm trying to convert a fullscreen shader to a per-object shader. I've changed the type to Unlit, so the dependencies should change as well, right?

gloomy tendon
#

Unity should provide an edge detect example as it was a lot to learn about what you can do in a custom function node and the setup for a FullScreenPassRendererFeature. Would be a great addition. Most examples are out of date with latest LTS

regal stag
#

Not sure if there's a way around it in a custom function. You could try #define REQUIRE_DEPTH_TEXTURE but it probably needs to be before other includes so might not work

#

Easiest way would be to just use the scene depth node at least once

gloomy tendon
tidal forge
#

or a typical material shader that will look at depth

regal stag
#

Make sure it's transparent too

tidal forge
regal stag
#

Yes

gloomy tendon
#

That is the trouble with the shadergraph shaders - what you can do and how is difficult to understand. I had to search the package's (URP) shade code to find the functions to read from depth and normal buffers and then I found out I could not use SHADERGRAPH_SAMPLE_SCENE_COLOR for some reason

tidal forge
#

And it's have a lack of hotkeys, will be cool see something like node wrangler from blender

gloomy tendon
#

SHADERGRAPH_SAMPLE_SCENE_COLOR just comes out black for me for example unless I read from screen in the graph. Where as depth and normal are ok

chrome fern
regal stag
#

But sampling _BlitTexture probably works

gloomy tendon
tidal forge
#

I have troubles with normals btw, just black. What i can do with it?

gloomy tendon
#

ok - that is like what?! though. Like can't Unity provide some reference to these shader oddities! I only know for fullscreen

tidal forge
#

And how i can know, what node defines? In source files nothing as i see

#

Or may be not, because i can't get normal if i just use node

gloomy tendon
#

Is _BlitTexture a special-named texture input for your graph or you can use it as-is in a shader node?

tidal forge
#

Or this, or this

gloomy tendon
#

right

#

but I do not want to sample it in the graph - but in a custom shader node

tidal forge
regal stag
gloomy tendon
#

ah... _BlitTexture is not defined though

regal stag
gloomy tendon
twilit steeple
#

well my material is blank and white but i guess its because of the hlsl is not compatible with built-in renderer

#

but i cant get a way or dont know the way to do this

tidal forge
twilit steeple
#

sorry if im asking too straight questions but i dont really know where to start from ;-;

regal stag
# twilit steeple ``` #ifndef SOBELOUTLINES_INCLUDED #define SOBELOUTLINES_INCLUDED // The sobel ...

I would try

#ifndef SOBELOUTLINES_INCLUDED
#define SOBELOUTLINES_INCLUDED

// The sobel effect runs by sampling the texture around a point to see
// if there are any large changes. Each sample is multiplied by a convolution
// matrix weight for the x and y components seperately. Each value is then
// added together, and the final sobel value is the length of the resulting float2.
// Higher values mean the algorithm detected more of an edge

// These are points to sample relative to the starting point
static float2 sobelSamplePoints[9] = {
    float2(-1, 1), float2(0, 1), float2(1, 1),
    float2(-1, 0), float2(0, 0), float2(1, 0),
    float2(-1, -1), float2(0, -1), float2(1, -1),
};

// Weights for the x component
static float sobelXMatrix[9] = {
    1, 0, -1,
    2, 0, -2,
    1, 0, -1
};

// Weights for the y component
static float sobelYMatrix[9] = {
    1, 2, 1,
    0, 0, 0,
    -1, -2, -1
};

TEXTURE2D(_CameraDepthTexture);
SAMPLER(sampler_PointClamp);

// This function runs the sobel algorithm over the depth texture
void DepthSobel_float(float2 UV, float Thickness, out float Out) {
    float2 sobel = 0;
    // We can unroll this loop to make it more efficient
    // The compiler is also smart enough to remove the i=4 iteration, which is always zero
    [unroll] for (int i = 0; i < 9; i++) {
        float depth = SAMPLE_TEXTURE2D(_CameraDepthTexture, sampler_PointClamp, UV + sobelSamplePoints[i] * Thickness).x;
        sobel += depth * float2(sobelXMatrix[i], sobelYMatrix[i]);
    }
    // Get the final sobel value
    Out = length(sobel);
}

#endif
gloomy tendon
#

ooh how does he write the surface id in to a buffer - that is something I could use

regal stag
twilit steeple
regal stag
gloomy tendon
#

But I already do a custom render for edges, just not to fill out ids first

#

How do you come up with surface ids like that?

twilit steeple
gloomy tendon
twilit steeple
#

yeah, that guy is a genious ๐Ÿ˜‚

#

I played his game, i recommend it

#

very fun game, generally i really like this art style and it suits like space enviroments

#

I will do a very bad idea but i will ask ai to littearly rewrite the hlsl file for me

#

These stuff are really complex, i didnt actually expect it to be hard to make edge detection shaders

#

Or its easy, i just cant find or dont know how to do it

severe imp
#

how do i fix this problem with the material? like the stretching

tidal forge
twilit steeple
#

Oh im getting somewhere slowly

#

the thing is that its just very weird

#

and when you get a little far away the outlines dont appear

broken sinew
#

What does this error even mean:

Property "..." already exists in the property sheet with a different type: 0

low lichen
broken sinew
#

I cut out the property name from the message because it's too long

#

I used Int in shaderlab and int in hlsl

low lichen
broken sinew
#

I once tried using Integer and it didn't work

#

neither with int nor with float in hlsl

#

I'm gonna check it out again, because I understood what my real problem was for now

#

I scaled a concave object, had camera inside it and cull to BACK, so I had no ide why it wasn't rendering ๐Ÿคฆโ€โ™‚๏ธ

narrow current
#

is it possible to set an attribute inside a shader graph? for example, right now I have a Gradient Noise node that offsets with time and I need to be able to access it in code. this means I have to have a Texture2D attribute that I need to set to the gradient noise. is this possible to do?

astral finch
#

@tidal forge in the URP asset you can force depth prepass so both the depth and normal textures required for the outline effect happen before opaques. Then have the fullscreen outline pass's RenderPassEvent be BeforeRenderingOpaques and have it render to a rendertexture, then assign that rendertexture to a global shader variable via cmd.SetGlobalTexture.

This way you can have your individual opaque objects' shader sample the outline rendertexture and blend the outline pixel color with the object's pixel color along with any individual per-material adjustment to the object outline you want.

The caveat though is it would require your outline algorithm using depth/normal maps to be adjusted to only render outlines on the inner edge and never the outer, because the individual object's shader won't sample the outline pixels if it's on the outer edge. I can't tell if the outline algorithm you're using is outlining the outer or inner edges. Is it public? I'm curious how you do yours.

timid sky
#

for some reason when i deleted my render texture my screen went bright white and i dont know how to fix

astral finch
#

@timid sky on the camera in the inspector try clearing the target texture. it says Missing (render texture) because you just deleted it. it should be None. If that doesn't work try hitting play. sometimes unity view doesn't refresh

astral finch
#

is that your only camera

timid sky
#

no i got a second cam for the weapon

astral finch
#

sorry then i don't know. i think it's a minor issue but it's hard to tell without having it in front of me

timid sky
#

oh ok

#

figurd it out

astral finch
#

what was it

timid sky
#

idk

visual mesa
#

If I'm making a game involving a submarine, and the game takes place in an ocean completely covered in ice, does it make sense to use a water system like Crest or Unity's HDRP water system, if I don't need waves? I just need a shader for the underwater visuals and I need to be able to incorporate physics like buoyancy.

kind juniper
visual mesa
kind juniper
analog steppe
#

ive gone thru every shader and mesh adn swear theres nothing with that shader
im making my avi quest compatable and everything else is fie... besdies this one error

#

can someone help with this?

uncut bronze
#

I currently have a script to procedurally generate a mesh, which involves a large number of UVs to obtain a flat shading effect. I'd like to improve performance. Will switching to a "normal" mesh and using flat shading shaders be more optimized?

kind juniper
kind juniper
rapid junco
#
[ExecuteInEditMode, ImageEffectAllowedInSceneView]
public class ComputeShaderTest : MonoBehaviour
{
    [SerializeField] Shader shader;
    [SerializeField] bool renderInSceneView;
    Material mat;

    private void OnRenderImage(RenderTexture src, RenderTexture dest) {
        if(Camera.current.name != "SceneCamera" || renderInSceneView) {
            mat = new Material(shader);
            Graphics.Blit(null, dest, mat);
        } else {
            Graphics.Blit(src, dest);
        }
    }
}

Any idea why this shader isn't rendering in the scene view?

#

OnRenderImage isn't running in scene view to begin with and I have no idea why

#

(I'm using the built in render pipeline)

odd shard
#

Yo! Has anybody used this shader in a mobile environment? I am having difficulties with some of the shader parameters in my apks, they work fine in the editor. The issue is only on sprites that are loaded from a sprite atlas. Here's a link to the shader: https://assetstore.unity.com/packages/vfx/shaders/all-in-1-sprite-shader-156513

Add depth to your next project with All In 1 Sprite Shader from Seaside Studios. Find this & more VFX Shaders on the Unity Asset Store.

tacit parcel
mortal yoke
#

Why can't I select the Red

twilit steeple
#

Hello, does someone have some kind of error like this?

twilit steeple
mortal yoke
twilit steeple
#

You cant select it?

#

Try disconnecting all the nodes from it then change, maybe that works

#

if that doesnt work then turn on the graph again

tacit parcel
mortal yoke
#

How can I select red? In the tutorial video I watched, red is selected.

#

I am about to lose my mind. :'8

regal stag
# mortal yoke

As rakyat mentions, since the input is a Float, there is only one, red component. So Red=Everything. It doesn't really make sense to use it just on a Float really, you'd use Channel Mask on a vector type, what are you actually trying to do?

mortal yoke
#

Isn't this your system?

#

ะกั‚ะฒะพั€ะตะฝะฝั ะตั„ะตะบั‚ัƒ ัะบะฐะฝัƒะฒะฐะฝะฝั ะผั–ัั†ะตะฒะพัั‚ั– ะฒ Shader Graph ั‚ะฐ Amplify ะฝะฐ Universal Render Pipeline ะฒ Unity. Unity Shader Graph tutorial.

Blit script: https://cyangamedev.wordpress.com/2020/06/22/urp-post-processing/
Screen position to World position: https://forum.unity.com/threads/computing-world-position-from-depth.760421/
ะ‘ั–ะปัŒัˆะต ะบะพั€ะธัะฝะพั— ั–ะฝั„ะพั€ะผะฐั†...

โ–ถ Play video
regal stag
mortal yoke
#

I have no idea why everything is white. In the video, it's not white for the person demonstrating.

regal stag
#

Check the name (and reference) of the texture property, you're using "ManText" but should probably be "MainTex" (with reference _MainTex), or _BlitTexture in newer versions (blitter API)

mortal yoke
regal stag
# twilit steeple Hello, does someone have some kind of error like this?

In the include file the function is named LightingCelShaded_float, so shadergraph is expecting "LightingCelShaded" as the custom function name, while you seem to be using "LightingCelShadedNode".

Also unsure if some of the functions used will work in Built-in target, I'v e only use custom lighting stuff in URP

mortal yoke
regal stag
#

No, as long as the reference field of the property is _MainTex it should work

mortal yoke
#

Is there any other setting I need to adjust?

#

Normally, I've been using Unity for years, but since I've never looked into the shader side, I'm so unfamiliar with it that I can't even describe how much difficulty I'm experiencing.

regal stag
twilit steeple
#

Yea i checked and it sadly uses some URP stuff

regal stag
# mortal yoke https://www.youtube.com/watch?v=QAsEkajvwm8&ab_channel=HovlStudio

Also if you happen to be using Unity 2022.2+, URP now includes a Fullscreen Pass Renderer Feature which could replace the blit one.
And a Fullscreen Graph type that goes with it which could simplfy the graph - can replace the "Screen to World Position" group just with a Position node (set to world space) as that graph type does the depth reconstruction for you.
And use URP Sample Buffer node set to "Blit Source" instead of Sample Texture 2D, and remove the MainTex property.

vital token
#

Hey! In the video I show the shader graph I'm using. Which I've also just posted screenshots
It uses the CalculateDepthDifference graph to get a difference I plug into my foam shader logic. The foam is the white texture on my water meshes. I want it to mostly show up around objects that are in my water mesh.

But my problem is, even when an object isn't touching my water, because of the depth, foam is still rendered. At the end of the video, you see me moving around a cannonball in the game view, and you can see a white foam trailing behind it in the water. I don't want that to happen. Because the cannonball isn't even touching the water.
How could I do this?

Sadly this isn't my shadergraph. I want to learn shaders and how to use them but they just feel like a massive feat and with the how much I'm learnin when it comes to just coding in Unity alone, I can't learn shader graphs rn XD

regal stag
mortal yoke
mortal yoke
mortal yoke
# regal stag I'd make sure this is enabled

I don't think the problem is ending anytime soon; this shader seems to be devouring me. Now, for some reason, it's only happening when the game screen comes up with the mouse.

regal stag
#

Hmm, not too sure why that is happening

vital token
regal stag
#

I guess you can also get to it via the Project Settings -> Graphics. Double click the Scriptable Render Pipeline asset assigned at the top, then the Renderer on the list at the top of that

vital token
#

Ahhh thank you. It was set to "After Transparents"

#

Omg that fixed it. My 4 day issue is over

#

I love you โค๏ธ

regal stag
twilit steeple
tidal forge
# astral finch <@261071432220540930> in the URP asset you can force depth prepass so both the d...

I've already done it, everything works, my outline is internal, so I had no doubt that everything would work.
I repeated this implementation:
https://github.com/KodyJKing/three.js/blob/outlined-pixel-example/examples/jsm/postprocessing/RenderPixelatedPass.js

GitHub

JavaScript 3D Library. Contribute to KodyJKing/three.js development by creating an account on GitHub.

#

And now i with new problem.
How i can get random point at mesh and get world pos and normal from this object at this point?

#

I can imagine how to get a random point, but with world position and normals - no idea

steel notch
#

Hey so I have some nodes here that operates as a angle circle mask from the UV center.

#

I want the masking to start from the center right and rotate around the circle (like you're working your way around the unit circle)

#

Right now it expands from the center right in both direcions.

dim yoke
steel notch
#

I know it's probably some atan something or other.

amber saffron
steel notch
#

trying to get a circular gradient around the UV center

amber saffron
#

And change the rotation value of the rotate node

steel notch
# amber saffron Try this :

I imagine that would work, but is there a solution here with arctangent? Like any way to generate a circular gradient with pure math?

amber saffron
#

(it is "pure math" under the hood)

#

Or maybe you got confused because the gradient seems to be "cut" in our both cases ? That's just because the values are out of the (0-1) range, and can't be displayed in previews

twilit steeple
#

Finnaly, i did it at last

#

Outlines

steel notch
# amber saffron

Damn thanks. I think it was the addition of the 0.5 I was missing to pump it up.

steel notch
# amber saffron

Hmm. Any easy way to have it expand from the center left and then around counter clockwise?

#

I could use the rotate node I guess.

steel notch
amber saffron
#

Or maybe you don't care in your material ๐Ÿ˜…

rapid junco
amber saffron
#

Like this ?

rapid junco
#

gonna try using a URP project

#

worth a shot

amber saffron
rapid junco
amber saffron
rapid junco
#

rip

#

what on earth could I be doing wrong then

amber saffron
#

Not sure if related, did you try to enable the image effect here ?

steel notch
amber saffron
rapid junco
#

interestingly enough, my Camera.current is Null in scene view when printing from Update

rapid junco
#

THAT WAS IT

#

TYSM!!!

#

ily remy

#

can't believe that was it
some other guy I was watching do it doesn't have that on either

steel notch
amber saffron
steel notch
#

This is my current graph. I just dont like the rotation node.

amber saffron
#

Oh missed a thing, add a "one minus" node before the top smoothstep to do it counter clockwise

#

@steel notch note that with the polar coordinates node, it makes the graph even tighter :

astral finch
tidal forge
astral finch
#

oh depth in red channel and normal in green channel?

#

i wonder why the threejs guy didn't do that

tidal forge
#

Oh, outline

#

Well

#

float strength = depthDiff == 0 ? 0 : (depthEdge > 0.0 ? (depthEdgeStrength * depthEdge) : (normalEdgeStrength * normalEdge));

#

Color = color * strength;

#

I use this like that

#

color is color that i achieved by shading

#

Or in fullscreen just blit tex

astral finch
#

@tidal forge oh, then how are you achieving the highlight edge? if color * strength can't ever be greater than color since strength is clamped to 0-1?

#

oh the normalEdgeStrength property is > 1

tidal forge
#

in my case strength just not clamped to 0-1 and less then 0 it's dark outline, more then light and 0 it's just nothing

#

You can see demo btw

astral finch
#

oh (1.0 + normalEdgeStrength * nei) that explains it

tidal forge
#

Well, i have some troubles, when trying achive best looking outline. That double-outline looks awfull... How i can remove this?

#

I can share project, if someone interested

astral finch
#

@tidal forge have you seen this guy's outlines? https://www.youtube.com/watch?v=LRDpEnpWohM he shows the code in the video. I think it's also a custom variation of the threejs outlines. It might solve the overlapping outline issue.

tidal forge
#

Forgot about this vid, btw

astral finch
#

@tidal forge also what camera far plane do you use? I've found that the edges degrade unless the camera far plane is within a pretty specific range

narrow current
#

is there a way to keep unity's built in reflection when applying a shader? I want to apply a custom color shader for a rock model I made, however it looks really weird without unity's built in reflection. the first image is before the shader was applied and the second one is after it was applied.

kind juniper
narrow current
#

is it just a setting i need to change or do I need do add more nodes?

kind juniper
kind juniper
# narrow current

Changing the material property to lit is probably gonna bring back the unity lighting.

narrow current
ebon moss
#

is there a way i could traverse around this circle and distort it according to some pattern to try and strecth it like how i drew with the red line

twilit steeple
#

Why am i getting low fps with just nothing? I tried to disable the outline shader but its still the same

kind juniper
kind juniper
karmic hatch
#

(notice that the CPU main thread takes 22ms/frame, while the rendering only takes 2.9ms/frame)

tidal forge
#

@astral finch, i think author just doing something like that, where it's not full outline, but good enought. Hes hase depthDiff < 0 in strength calculations, that cuts off a decent portion of the outline but also fixes the double outline problem

#

He also doesn't show good examples to prove that this isn't the case.

#

Well i fixed that lol

#

Not in good way, but it's possible

#

Basically I just took the abs depthDiff for cases where the outline is normal. If you just take the abs depth difference, but the depth is drawn boldly, in 2 pixels, duplicating itself

#

Like that

uncut bronze
#

I followed a simple tutorial to make a basic procedural skybox but i go an issue along the x axis. Any idea how i can fix this ?

karmic hatch
#

Probably things would be a bit more even if you Swizzled after the Normalize to get the xz component

#

(that way the stretching is on the horizon rather than halfway across the sky)

split tangle
#

I have a camera pointed at a screen/video, and use a Rendertexture to display said view on a seperate object. How can i make it so the rendertexture turns the footage into a "cutout" of sorts, so only a certain color is turned invisible, making the 2nd image a cutout of what the camera is seeing.

grizzled bolt
split tangle
grizzled bolt
split tangle
#

how would i use the alpha channel method? is there a material that can do that? (or does poiyomi contain such feature, as i already have that installed)

grizzled bolt
split tangle
#

Hm... allright ill try that. Thanks for the idea! I'll ask again if i have any questions if that's okay?

grizzled bolt
split tangle
#

I actually managed to get the alpha-map idea to work! Great! Now i just have to sample the background from the feed and it should work! Many thanks for the idea ^^

split tangle
#

but i can elaborate once it's actually working ^^

grizzled bolt
split tangle
#

odd idea, ik, but i got curious to see if it works sooo :P

drifting salmon
#

I want to offset z on verticies in perspective HClip space so that the pixels don't change but the zsorting does. I've got it mostly working, but the offset seems to be changing based on camera distance. I think I'm maybe missing a transformation of my offset from worldspace or viewspace to HClip space, however my attempts to introduce it have all failed to produce a desireable result.

astral finch
# tidal forge Can't see anything like that

What is your camera setup? Orthographic rotated 30 degrees down? Some of my outlines start disappearing if the camera far plane is greater than ~200, and or less than 125. I'm guessing because it affects the quality of the depth and normals textures and thus the edge sensitivity

tidal forge
astral finch
#

i use the dedicated depth texture for depth and the depthnormals texture for normals

tidal forge
#

โœ”๏ธ Works in 2020.1 โž• 2020.2 โž• 2020.3 ๐Ÿฉน Fixes
โ–บ At line 39 in EdgeDetectionOutlinesInclude.hlsl, the sixth entry in sobelSamplePoints should be float2(1, 0), not float2(1, 1)
For 2020.2:
โ–บ When you create a shader graph, set the material setting to "Unlit"
โ–บ The gear menu on Custom Function nodes is now in the graph inspector
โ–บ Editing properties...

โ–ถ Play video
astral finch
#

what textures are you using if you're not using the unity depth and depthnormals textures

#

are you making a custom depth texture?

tidal forge
#

I am using strandart depth and normal (not depthnormal) textures

astral finch
#

Oh _CameraNormalsTexture I believe is the same thing as the depthnormals texture

#

maybe it's the scale of the objects i'm using. how big are your objects? Maybe 1 unity unit isn't large enough making the depth differences quite small relative to camera size and distance

tidal forge
#

Big enought, like normal size

astral finch
#

what are your camera settings

tidal forge
astral finch
#

that video talks about non-linear depth adjustments. that's with a perspective camera. orthographic cameras already use linear depth

tidal forge
#

How do you get the pixelated look? It's important that the depth and normal are pixelated too

astral finch
#

i render the main camera to a 640x360 render texture

tidal forge
#

Show a screenshot of the problems

astral finch
#

i'll make a video one sec

astral finch
#

my outlines separate out the concave and convex and outline edges into the three color channels, but it's still essentially the same way the threejs and that one youtube video does it

tidal forge
#

Btw where did you take this scene?

astral finch
#

i made it in blender, trying to build that one tessel8r scene

tidal forge
#

Something wrong with edge detection

astral finch
#

it happens to me even if i use the raw threejs method or the one in that video instead of this custom variation

#

so what else could it be

tidal forge
#

For me outline stable and doesn't depends at cliping planes at all

astral finch
#

it must break at some point, what's the lowest you can set far plane to before objects start disappearing

tidal forge
#

It's just how clipping works, but even at clipping outline works as you see

astral finch
#

they're really rock solid. that's so strange

#

and you're doing a fullscreen renderer feature pass for the outlines?

tidal forge
astral finch
#

maybe it's only happening because my shapes are more complex and i should try simple shapes

tidal forge
#

Lenins statue don't complex enought?

astral finch
#

good point

royal dove
#

guys can i ask about one problem?

astral finch
royal dove
astral finch
#

@tidal forge sorry i'll stop bothering you but 1 last question. can you add this crate model to your scene at scale = 3 and show me how it looks for you?

civic lantern
ebon moss
kind juniper
ebon moss
#

Ok thanks

ebon moss
kind juniper
ebon moss
kind juniper
ebon moss
kind juniper
# ebon moss

Yeah, I guess it's not that easy to apply the same stuff in a shader graph, but here's an example of how you could do it

ebon moss
kind juniper
ebon moss
ebon moss
kind juniper
ebon moss
kind juniper
royal dove
#

im redownloaded again and again(32bit version and yes i know it doesnt show 32bit versions on archive anymore)

#

im using unity editor 5.6.7 (that version with everything pink)
but before to switch to 5.6.7, that doesnt happened in 4.6.3 version

#

(absolutely everything is pink expect material from assets)

tidal forge
amber saffron
civic lantern
#

That was released in 2019

royal dove
edgy wedge
#

hey people, i am trying to convert a blender shader into unity what is the equivelant of this in untiy shader graph?

civic lantern
civic lantern
edgy wedge
#

URP

civic lantern
#

Alright, I know that HDRP lit shaders have a Metallic and Roughness (or smoothness) output, not sure about URP

royal dove
#

im tried legacy shaders

royal dove
civic lantern
#

Read the forum post I linked. It is related to the error show in the bottom of your screenshot

#

Best thing you can do is try the fixes suggested there, and also look for similiar issues online.
Since you are on such an old version, I dont think anyone here knows how to help

#

And search for the other errors in your console too

royal dove
#

or not?

#

anyways if it will appear again... i will get solutions from link

amber saffron
edgy wedge
#

yes sure but the shader I am trying to convert of is a mixed shader (a cobblestone) and i need to mix those 2 shaders together

#

I am trying a different appraoach now .. I am tyrying to bake the blender shader into a texture instead

royal dove
#

nvm i was stupid

#

@civic lantern it doesnt works like shader model 2 and selection outline disabling