#archived-shaders

1 messages · Page 214 of 1

grand jolt
#

even though it mentions _Control1 for the extra layers -.-

regal stag
grand jolt
#

it does say it's built-in

brisk chasm
#

Hi. I have a compute shader i am using for a marching cubes algorithim. i am using the appendbuffers to add verticies and triangles. when i try to use the getdata from the buffers is c# the values are all 0. and the mesh is not rendering. can somebody plz tell me how to get the vertex and triangle info that i appended in the compute shader?

regal stag
brisk chasm
grand jolt
#

hey foalks. i want to scale down a flipbook without tiling it. cant find a solution. pls help

grand jolt
brisk chasm
grand jolt
#

because the tiling happens afterwards

empty grove
#

does anyone know if the built in pipeline Standard (Specular) shader supports single pass instancing or not?
in VR devices, its only rendered in left eye

remote mauve
grand jolt
remote mauve
#

Like Android Studio?

grand jolt
#

no its a feature in unity too

#

but you could also use any other

#

sim

remote mauve
#

No it works perfectly fine in editor/emulator like Nox/95%+ of all Android users/all iOS users

#

It's only problematic for very few people, the only commonality I can find is that they use low end Android devices.

#

Which is why I think maybe I accidentally used some features either in shader code or something that relates to the shader, which are incompatible with those devices, and hoping maybe someone knows.

split onyx
#

is there tutorial for this online? i cant seem to find one

deep prism
#

*Update 25 April 2021: Added Vertex Color, Set Master node surface type to Transparency, and make it two sided. Credits to @ajvark and @OrgadArbel on Twitter for the additions. Recently I came to a typical problem in 2D-3D gameplay: I need my 2D sprite to cast and receive shadow inside 3D world. Well, in this ... Read moreHow To Make 2D Sprite C...

#

I am following this tutorial

#

to make my 2D sprites get give and receive shadows in a 3D world

#

I cant find PBR master albedo

#

I am using unity 2020.3

#

Ping me if you have answers

jolly adder
eager folio
#

@full gazelleCan't you just switch the green and orange when going underwater?

eager folio
jolly adder
#

I don't know in 140 but I think it should be 2D

eager folio
#

I notice that the point doesn't emerge immediately from the top perimeter of the circle, but rather emerges after the circle has shrunk down; definitely makes it look like a cone

#

@deep prismYou probably want ' base color' on the fragment shader if you don't have a pbr master node

jolly adder
eager folio
#

Exactly.

#

@deep prismThough I prefer a different method, just adding a simple 3d object that roughly matches the sprite with it set to only cast shadows in the mesh renderer. This stops the shadows vanishing then the lights are edge-on.

upper sphinx
#

Hey this is the first time I try something with shaders and I just created water and I applied the water material to a plane but this turns it invisible

eager folio
#

Are you missing any render features, maps, etc?

upper sphinx
#

I did what this person said

unreal yacht
#

Is there any way for me to have a raycast detect hitting the drawn shader plane rather than a collider?
Updating colliders each frame is almost impossible to do efficiently in Unity, however, I'm wondering if I could just detect hitting the drawn plane on my dynamic wave shader?
I have been looking for a solution everywhere that doesn't use a complex buoyancy system, and I'm having no such luck.

meager pelican
#

IDK if this will help your use-case, but screen-space effects often "ray cast" against the depth buffer (AKA screen space to world-space conversions). There are inherent limitations of such, because it's not a full 3D object. The "back side that's invisible" doesn't have any shape to "bounce" a ray from. But all the front surfaces are there.

See screen-space anything (AO, shadows, reflections) shaders for examples. You may also want to check out things like how VFX graph does collisions.
2-cents and that's about all it is worth.

shadow locust
#

(normal Physics.Raycast)

meager pelican
#

They want to do it in a shader...I think......there are no colliders, natively.

fluid lion
worthy meadow
#

How to feed shuriken particles' positions into shader graph?
*Instead of PlayerPos

#

at the moment each particle updates PlayerPos but is there a way to add to existing position? to make the effect spread

elfin lion
#

Trying to apply a shader to a tilemap. 2D, URP, lighting works. When I apply the simplest shader possible (_MainTex -> Sample Texture2D (RGBA) -> Color. My tilemap just turns white. I've seen a few tutorials doing exactly what I'm doing and they don't get this issue so it must be something with my URP setup that I messed with

elfin lion
#

still need some help

meager pelican
#

You sure the texture is set properly on the material? The default you have is white. Try setting it to black and see if it turns black. If so, you're not setting the texture property properly.

#

@elfin lion

elfin lion
#

@meager pelican thanks for the help, that is a step in the right direction. My material says it is using the Lit shader i've provided it. But it doesn't update to black

meager pelican
#

And in URP, it's usually called "BaseColor" maybe with a "_".
Hmmm....

I don't do URP sprite shaders much, but I'd be wary of copying standard-pipleline shaders since things "may have changed". Only thing I can think of. Sorry can't help more without messing with it, and I don't have time right now.

elfin lion
#

thanks for the info. There may be an even more simple solution. I tried relaunching unity if there was some weird bug. When I came back my shader graph was completely empty. I tried adding something, hitting Ctrl + S and relaunching and again its completely empty.

meager pelican
#

Don't use ctrl-s. Click the save button. 😉
Don't ask me why ctrl-s may not work.

elfin lion
#

and Now I hit save asset... and it works

#

thats so dumb i've been on this for hours lol.

meager pelican
#

lol

#

Yeah.

tacit parcel
remote mauve
tacit parcel
#

I ended up using the distance from camera position to worldspace position
float z = saturate(1 - distance(IN.worldPos, _WorldSpaceCameraPos));
It's not really far from accurate but it works in my case...

remote mauve
tacit parcel
# remote mauve Hmm so I guess the issue for my shader would be the `UnityObjectToClipPos` call?...

I asked the question about 2 years ago in the forum. There might be a hint on how to change your shader, it's not working properly in mine
https://forum.unity.com/threads/z-buffer-in-opengl-es-2-vs-opengl-es-3.689242/#post-4613755

remote mauve
#

I’m looking at this and it says something about using VPOS instead for ES 2.

#

This is made incredibly more difficult as I don’t have a device myself to test with, and all recent released devices support ES 3.

tacit parcel
#

you can try to build apk with only opengl es 2 enabled and remove anything else. It should force the game running on opengl es 2

remote mauve
#

I recall doing that and it still worked on my phone, but could be bad memory and I’ll try it again later.

#

Yep forcing it to ES 2 still works for my device.

tacit parcel
#

Thats strange... It works on my device (the screenshot in the forum above was taken from the same device, with different build)

#

Maybe the problem lies somewhere else. like reversed z (UNITY_REVERSED_Z)?

remote mauve
#

That's the strange part, now that I think about it, if I force ES 2 in editor it still works, and on a real device it works as well.

#

As a sanity check, I tried forcing ES 2 and using a feature ES 2 doesn't support, I correctly got black in editor, so that must mean the shader does work with ES 2.

#

So the problem is specific to a very small selection of devices.

#

Honestly at this point it feels like throwing spaghetti on the wall and see what sticks, very frustrating.

#

It doesn't help that I'm not sure how long the people with those problematic devices are going to keep up with helping me testing it, I feel like the interest in helping is slowly fading away.

karmic hatch
#

i'm trying to use vertex color on a mesh and i made a material for it and gave it this shader graph but it's just grey:

#

can someone help?

amber saffron
karmic hatch
#

Thanks, I hadn't saved it and then it worked :)

cosmic glacier
wintry valley
#

So I'm trying to a shader. I need to make a replacement shader on a camera so that the camera only renders objects with a specific RenderType.

I have this code

    public Shader replacementShader;

    private void OnEnable()
    {
        if (replacementShader != null)
        {
            GetComponent<Camera>().SetReplacementShader(replacementShader, "RenderType");
        }
    }

    private void OnDisable()
    {
        GetComponent<Camera>().ResetReplacementShader();
    }

But for some reason it appears if nothing is happening
In my shader I have this code too,
SubShader{ Pass { Tags { "RenderType" = "Transparent" "Queue" = "Transparent" }

noble tree
#

im using compute shaders solely for vertex deformation. i'm sure to dispose of any compute buffers in OnDisable() in C#, is there a reason it'd affect the editor so horribly? it's normally fine and goes back to normal if i change something and save the scene, but sometimes it makes the editor unusable and i have to restart it. any ideas on what might be causing this?

#

for reference, this is how it's supposed to look when in Edit mode

meager pelican
grand jolt
#

The semi-transparent section of alpha channel on my game's HUD does not draw over transparent materials like glass correctly. Would anyone know the shader issues that'd cause this?

onyx jungle
#

Hey I am trying to setup a sun effect like this

#

Just the surface texturing here

#

But its not going so well and I am stuck, I have tried using a shader to generate some noise and lerp between two colour values using the noise as the third value in the lerp

#

But I cant get it looking quite like the first picture

#

Any help would be appreciated!

fervent flare
#

Vector3 does not go into Vector3 sometimes? Having a hard time making sense of this

regal stag
fervent flare
#

@regal stag Thank you! Also your channel and your content are freaking amazing! 🙏

#

Btw anyone know if I can safely ignore the ever present 'Implicit truncation of vector type' error that basically appears on every single shadergraph ?

fluid lion
#

I have a problem with updating a RenderTexture being used in combination with a shader.

I just can't seem to figure out why I can't save the image I've drawn onto an orthographic RenderTexture.

Here's how my scene works: https://i.imgur.com/jAWO2V8.gif

Basically, it's a painting effect using a ParticleSystem that draws a trail based on where I click and hold my mouse. As soon as I let go of my mouse, it saves the current RenderTexture into a cached Texture2D reference which is clearly shown here: https://i.imgur.com/rDMJ3Xa.png

The problem here is that the main RenderTexture (BrushRT) is not taking the saved Texture2D data and keeping it. The intended effect is to have the RenderTexture save everything I've drawn so far. It doesn't do so and the ParticleSystem just disappears as shown here: https://i.imgur.com/ucNs3tV.gif

Here's the code to the TextureSaver script I'm using: https://hatebin.com/wtfyhjcqst

Here's the ShaderGraph: https://i.imgur.com/cIAXEKb.png

Any help would be appreciated. I've been stuck on this for weeks!

amber saffron
#

@fluid lion I'm still trying to understand why your issue is happening, but I wanted to ask : why are you not simply using the RT as input for the shader and target for the ortho camera, and set the camera to not clear depth & color ?

#

Or set the RT to be drawn as "background" of the ortho camera

amber saffron
#

If the camera is set to clear color & depth, no matter if you blit the saved texture back to the RT, it would be instantly overriden by what the camera is seeing

grand jolt
#

Is it possible to render first person hands on top with depth testing turned on against itself but overwrite the depth for everything else using stencil somehow?

#

I feel like there is a setup that would work but the idea escapes me.

#

Nvm, I found a post where they solve it by overwriting the depth in Always mode and then doing a 2nd pass with LEqual mode.

fluid lion
amber saffron
#

Looks like that what you actually want based in this drawing is two render textures + one texture 2D?
One RT that handles drawing the current brush stroke, the cached texture for the previous strokes, and an additional RT that combines both of them ?

#

and at the end of the stroke, it is that final RT that is saved to the cached texture

eager folio
#

@onyx jungleuse a gradient or curve instead of a lerp, and adjust the values to increase the contrast

onyx jungle
#

I have used gradients/curves before but unsure how to apply it for this application

eager folio
onyx jungle
#

I think I would like to use a curve for more control but again unsure how to apply it to a shader

fluid lion
onyx jungle
# eager folio

I am also using the lerp with perlin noise as the third parameter

#

But a curve I think would provide better control over the colour distribution

amber saffron
eager folio
onyx jungle
#

Oh I am not using shader graph

#

I am writing the shader

eager folio
#

Oh. In that case you could still use that tool but import the texture as a parameter into your shader, use it as a lookup

onyx jungle
#

and then how could I use this in conjunction with the noise to create the random type shading effect?

eager folio
#

The tool just takes a curve and converts it into a lookup texture you can feed a float into

#

Though if you're writing the noise yourself you can just increase the contrast

onyx jungle
#

contrast? I did write the noise myself using some online resources but didnt include a contrast option

eager folio
#

you could also fiddle with the weighting of the octaves to give more weight to the bigger chunkier shapes

onyx jungle
#

I suppose

#

This is where I am at right now

#

but I need more of the yellowy base colour to come through

#

However when I try that the lerp between the colours no longer works

#

because its still lerping based on the noise

#

Which is good for patterns

#

But means that I cant smooth the values that easily

eager folio
#

I mean, not knowing the code your noise is using it is hard to give detailed advice. What did you actually change between those pictures, and why can't you do it half as much?

onyx jungle
#

This is essentially where I bring it all together

#

And I generate that noise value above in another part of the shader

#

When I change the value of colour influence I can control the 'height' of the orangy colour underneath

#

If I leave colour influence at 0 then it will just show the pure noise lerped colouring

eager folio
#

Ah, you are clipping it

#

Can you just remap it?

onyx jungle
#

forgive me with some terms, I am relatively new to shaders

#

but I dont know what remap is

eager folio
#
#

I have to go for a bit

onyx jungle
#

Ok cool, can I pm you questions? if not ill just continue posting here

#

I just hate to fill up the channel

#

ill try this stuff out, appreciate the help

trail marsh
#

Does anyone knows a good tutorial to learn shaders

#

And for shader graph

desert orbit
#

@trail marsh It's a huge topic. You want something like this to at least familiarize yourself with different nodes. And when you lookup solutions to specific effects online, you would have some idea how to improvise with it and build on it.
https://youtu.be/9aOtie1DKCc

I like to make videos, i would like to see out there. But there is no video out there yet, that gives a brief overview over ALL shader graph nodes and how to use them. This is the tl:dl episode for everyone who's got their first tutorial behind them and have already set up their first shader. The main question you might ask yourself is: "What ha...

▶ Play video
trail marsh
#

Ok, thanks

floral cloud
#

Why am I getting this banding / artifacting?

#

Unity 2020 LTS / URP.

slim parcel
#

anyone know of a good free toon water shader

floral cloud
#

Will take you 15 min to build.

#

@slim parcel

#

A quick google..

slim parcel
#

must have used different keywords than i did

slim parcel
#

so im using a geometric grass shader to generate blades of grass, but the ground itself is transparent, so i want to add a standard surface shader pass to the custom shader so that it applies a texture to the ground. how can i go about combining two shaders into one material?

vivid valley
#

Hi, I made a grid shader with tiling, and tried to apply it to an object. That works fine, until I got an object with an irregular scale. Im guessing it has to do with UV's, but I dont really know what is happening here or how to modify them

#

this is a mesh generated by code btw, it works fine when deforming standard cubes

slim parcel
#

here is a diagram that illustrates this

vivid valley
#

ah so its like the relative position of a vertex within a mesh, mapped to 0-1?

slim parcel
#

correct

#

well, no

#

but i think you have the understanding of it

#

a UV coordinate is a coordinate on the texture

#

each vertex renders what is on the texture at it's assigned UV coordinate

#

and in between each vertex is calculated by the UVs of those two vertices

vivid valley
#

allright, thanks a lot!

slim parcel
#

no problem

slim parcel
#

i would like to write a shader that changes the alpha value of the pixel based on the distance to the pixel behind it. does anyone know of a tutorial or keyword i could search to help me?

meager pelican
#

"Unity Depth Buffer"
But also, if you want to track the distance to a TRANSPARENT pixel, it will get more complicated fast, since they don't write to the depth buffer so they'd be invisible/unknown to your method.
And the shader you're writing will only work in the transparent queue, since the opaque queue will have an alpha of 1.

#

@slim parcel

slim parcel
#

i'd wanna set some kind of threshold for where it becomes opaque

#

and then just interpolate between 0 and that threshold by whatever value that distance is

wraith bison
#

alright I'm stumped. Why can't I connect these two nodes over the "v3" spot? I'm probably not even doing this right. I just have a black and white texture that I want to use the white as vertex position displacement

#

I'm using Unity 2020.3.15f2, it won't let me connect those two nodes at those points

eager folio
#

That's weird. Can you connect other v3s to that?

wraith bison
#

yes, only if they come from some other uv-related data if that makes sense. For example, I could plug in another position node

vocal narwhal
#

sometimes you cannot connect things because one is a part of the vertex stage network and another is a part of the fragment

#

other times it's because shader graph is broken 😛

eager folio
#

Works for me

wraith bison
#

;_;

vocal narwhal
#

the vector3 node should even be irrelevant

eager folio
#

So yeah, like vertx said

#

Yeah, it should be

#

But I recreated it exactly just in case

wraith bison
#

I was just trying to get it to connect, so I was throwing in all sorts of things that I thought might work... weird

eager folio
#

Having been working with experimental.nodegraph I know that there are sooooooo many ways for it to go wrong >.>

wraith bison
#

what version of unity are you using?

eager folio
#

2020.2

#

Disconnect the multiply node's outgoing connection?

wraith bison
#

yeah that worked... but now I can't plug it into the vertex position

#

I think what vertx mentioned is correct - I just need to learn what this means now. Thanks

eager folio
#

ahaha, there we go

#

Yes, vertex shaders can't access everything that fragment shaders can

vocal narwhal
#

is there a SampleTexture2D LOD node?

eager folio
#

there is

vocal narwhal
#

you have to use that

eager folio
#

...oh, you meant in their graph

wraith bison
vocal narwhal
#

Sample Texture 2D is fragment only

eager folio
#

right

wraith bison
#

oooooh okay, gotchya. Thanks guys

#

yeup, that worked

sturdy nymph
#

i have a shader file dump and theres something in it that causes part of mesh to not render based on distance from the camera

#

but im not sure what im looking for

#

any guesses?

#

i can send the shader dump if that helps

#

i believe this is it, but im unsure what to change.

#

i also have a material file with the same variables

sturdy nymph
#

changing _Cutoff in the material to 0 seemed to fix my problem, but it left a large outline from where it used to be, and im not sure how to remove it

shadow palm
#

hey all, would anyone be able to help me figure out why my camera isn't rendering my shader?

feral mist
#

Would anybody know why a shader graph generated shader (URP), renders black in reflection probes?
While I can see the probe capturing objects present in scene in editor ( or even in game mode if they exist before the scene starts), I am currently streaming meshes, textures and materials at runtime, and anything streaming in with shader graph authored materials are captured black :/
Edit: Something was going on in my metallic branch. Nevermind

lyric crescent
#

Hey there, does anyone know how I can calculate depth in Unity's compute shader by _CameraDepthTexture uniform and LinearEyeDepth function? I keep getting : cannot map expression to cs_5_0 instruction set at kernel CSMain at ....

slim parcel
#

i'm trying learn more about shaders. i understand that a "fragment" is essentially a pixel within the boundaries of the object on screen, but i'm kind of stuck on what exactly a "vertex" means in the context of a shader. could anyone help me understand or refer me to some documentation that explains it well?

slim parcel
lyric crescent
#

aaaah i didn't remember that, it thanks buddy that video has some explanation

slim parcel
#

did you figure it out? i was basically trying to get to what is shown in that video at https://youtu.be/vTMEdHcKgM4?t=75

I got a bit tired of my simple heightmap-based planets and decided to experiment with generating them using the Marching Cubes algorithm instead, so that I could add a 'terraforming' ability for shaping the world with caves and tunnels and so on. I hope you enjoy!

If you'd like to get early access to the project files (they'll be made freely av...

▶ Play video
lyric crescent
#

i actually have been doing the same btw, it was just different naming i guess, i.screenPos i think is equivalent to uv.r, but still i'm getting the above error...

slim parcel
#

i have next to zero knowledge about shaders, so i don't know if i'll be of any help

lyric crescent
#

thanks, i have seen that one too. I think the problem i need to pass an extra param or smth like that to get the sampler correctly, they might have changed the api on latest unity versions

#

i'll figure it out, but thanks to you i now know there's a macro for that on unity too, it helped a lot

slim parcel
#

it appears to me that you need to assign the depth texture from outside the shader

#

because based on the naming convention, _CameraDepthTexture is a property, which has to be assigned just like _MainTexture or _Color, right?

#

We get access to the depth texture by creating a new texture sampler which we call _CameraDepthTexture. We can read from the sampler like any other texture, so we can just do that and look at how the depth texture looks like. Because the depth is just a single value, it’s only saved in the red value of the texture and the other color channels are empty so we just take the red value.

#

is he doing that in postprocessing? it would only make sense that way because idk how the camera would know the depth of a given pixel unless it had already rendered that pixel

#

@lyric crescent probably is what you're looking for

lyric crescent
slim parcel
#

i see

#

didn't know that

lyric crescent
#

i just need to get it as a sampler uniform in the shader, at least it is the case for fragment, but i don't think there should be any difference in other shaders

slim parcel
#

i believe that last article i sent does it

#

yep

#

bingo

#

oh man that looks so nice

#

@lyric crescent

lyric crescent
slim parcel
#

yes

#

i believe

lyric crescent
#

i have no problem with fragment shader, it doesn't work in my compute shader

slim parcel
#

oh

#

well perhaps that stuff i linked can help you figure it out

grand crown
#

JB Rider shows errors all throughout hlsl file provided via Custom Lighting github found via Unity (https://github.com/Unity-Technologies/ShaderGraph-Custom-Lighting/blob/master/Assets/Includes/CustomLighting.hlsl)

Did I do something wrong or is it just the IDE not having syntax or intellisense for Unity's hlsl files?

GitHub

A sample project showcasing a simple method to calculate custom lighting inside of Shader Graph for the Lightweight Render Pipeline. Includes a sample toon shaded scene and example assets. Built fo...

grand crown
#

Does shader graph even work? I can't even tell what the issue is.

vocal narwhal
#

What's the context? Are you saying you've pulled this random include into your project and Rider can't highlight it? The functions referenced are a part of a whole set of includes

grand crown
#

I'm just trying to follow along some tutorials and they all say the exact same thing. Use the functions from this github in a custom function node that has Type set to file. But Rider seems to give errors and Unity gives errors and none of them tell me anything

vocal narwhal
#

That project is intended to work in 2019.2, so I'm not sure if it's at all going to work with URP in any other version

grand crown
#

Is there an updated version somewhere or somewhere I can try to learn what I'm supposed to be doing for 2020.3?

vocal narwhal
coarse rover
#

Hey! Does anyone know how to revert an object's rotation back to 0, 0, 0 in shader graph? I've done some research, and found that it's perhaps related to the Transform Matrix (Inverse Model) node, but I can't quite seem to achieve the desired effect. Any help would be much appreciated :D

#

Or using some custom function in shader graph

calm rock
#

Hey people, I have a normal map problem. I'm writing a shader that can take normals that are encoded as unity normalmaps (with whatever 2-channel encoding that uses) but sometimes can take generated normal maps that might not look like this (e.g. 3 channel tangent space normalmaps) .
Is there a way, from within a shadergraph shader, to determine if a given texture is encoded as a unity flagged normal map or not?
Also, coming at the problem from another angle, is there a way to encode a texture at run-time as a unity-friendly normal map?

still dune
#

I have been working on a CRT TV script to get my Emulation project going with a authentic looking screen. Unfortunately I have met some crazy issues that you get with recording a display using a camera.
anyway GLSL code is here, https://glslsandbox.com/e#74365.0. And here's also a Unity Shader Graph version, https://img.bogaardryan.com/CRT-TV ShaderGraph.png. (to avoid data compression on Discord)
Maybe useful for others as either research material or for something in the background. Also this is running in URP.

calm rock
#

Are the crazy issues that pattern you're seeing?

still dune
#

yeah, so it's like a camera recording a tv or display.

#

but from reading online it might be because of refresh rate.

#

doe, my solution will be to add black lines in between the 3 primaries and add scan lines that will match the refresh rate. like a real crt tv would.

#

this in code however is not that easy, and idk how it works with the staggered subpixels.

#

I will also try to add a blur to it, but I read that it will cause major performance issues. so I backed away from that for now.

calm rock
#

I don't think it's refresh rate, it looks like a 'moire' pattern or interference pattern: the tiny subpixel elements you're using in your shader are smaller than a pixel when viewed at a distance, so it kind of flickers between different ones and when taken as a whole, produces those characteristic patterns. This is one reason why we use mip maps - they're pre-filtered so that at greater distances, you draw an average of several pixels, rather than shimering between one or the other as the camera moves.

#

One fix might be to do something equivalent in your shader - at greater distances (perhaps you could use ddx/ddy for this in the shader) you could fade out the use of the individual sub-pixels, only using them when you zoom in.

brittle owl
#

in games that i’ve seen that have used that effect, that’s exactly how it’s done

#

fade it out by distance

crystal ocean
#

hey folks, a while back I asked about offsetting the color of a material on an object and got that aspect working but I was wondering if there's also a way to increase the "scale" of the material as well using shader graph

#

My offset material effect I was working on. Now wondering if there's a way I can "expand" the material to be larger than the object it is referencing

floral cloud
#

Why am I getting this banding / artifacting?

#

Unity 2020 LTS / URP

prisma fox
#

Is there a bug in Unity 2020.3 / URP 10.5.0 that causes Depth Texture to render empty / black when Camera's Anti Aliasing is set to None or FXAA? Or does Unity discard the _CameraDepthTexture after a certain point in the render pipeline? Using the Scene Depth node from ShaderGraph.

prisma fox
#

Nevermind 🙂 Had to tick enable Depth Texture in the URP Asset. Thought I had done but double-checked, and I had incorrectly ticked it on the Medium Quality URP Asset, but I was using the "High Quality" URP Asset. SMAA must turn it on automatically when enabled.

grand crown
#

How do I get the main light in an hlsl file for Unity 2020.3?

prisma fox
#

float4 shadowCoord = TransformWorldToShadowCoord(WorldPos);
Light mainLight = GetMainLight(shadowCoord);

coral otter
#

Is that 0 left eye, 1 right eye ? or 1 - 2 ?

#

Found out it return 0 and 1 thanks

grand crown
#

What is the difference of a MainLight and MainLight_half functions?

slim parcel
brittle owl
#

i think half has less precision but it’s better for performance

#

that’s what i’ve heard

#

it’s better for mobile

prisma fox
#

Docs recommend defaulting to Half and switching to Float if you run into precision issues.
Quote from the docs: "A general rule of thumb is to start with half precision for everything except positions and texture coordinates. Only increase precision if half precision is not enough for some parts of the computation."

grizzled token
#

Hello, I'm a beginner with shaders and I can't figure out how to have more than one light/one shadow on a BOTW-like shader. I tried a posterize node instead of a smoothstep node with X steps but the black adds one more step to it and it is also way too big for me, i don't know how to reduce it/change it's color/remove it so if anyone can help please

prisma fox
#

Dot product there ranges from -1 to 1. Try first Remapping the result of the dot product from -1 -> 1 in, convert to 0 -> 1 out.

#

At that point you can sample with either gradient node with fixed or blend gradient, or you can just pass through posterize

#

You can also pass through smoothstep or other nonlinear one dimensional transformation e.g. pow

#

Examples

#

banding is due to gif compression but here's an example in motion

noble tree
grizzled token
# prisma fox Examples

thank you! one last question, sorry, how can I make it so that the shades size are not even, like the darkest one takes 10%, the base one 70% and the brightest 20% ?

high hemlock
#

Does anyone have an idea as to why 3 out of the 6 faces on each cube would be overlapping other faces within a mesh? What would most likely be the main issue? Thank you!

meager pelican
#

Uh, UV mapping?
Besides, with that pic, I have no idea what is "overlapping" on your cube.
Make a texture with 6 different colors, do the UV mapping to it, and show us a cube with "overlaps". Maybe others see it and I'm just missing it.
But UV mapping is UV mapping unless you're doing weird calcs in your shader.

#

The other things to check are texture sampler settings, and texture import settings.

#

P.S. And you probably don't want to share verts. So you should have 24 verts per cube.

noble tree
#

looks like a depth sorting issue

#

it's especially common when using older versions of URP with transparent shaders

#

in my experience, at least

feral mist
#

shader graphs ( URP, lit) do not reflect the scene skybox unless there's a reflection probe in scene? Does anyone know how to make it reflect the skybox by default?

still dune
#

here i'll just set a minimal distance that doesn't affect the result on close range.

still dune
#
CalculatedResolution = Resolution;

float dist = distance(CameraPosition, ObjectPosition);

if(dist > any(MinDistance)){
  if(IsStep) CalculatedResolution /= pow(2.0, floor(log(dist/MinDistance)/ScalingMultiplier));
  else CalculatedResolution /= pow(2.0, log(dist/MinDistance)/ScalingMultiplier);
}

if(CalculatedResolution.x < 1.0) CalculatedResolution = float2(1.0, CalculatedResolution.y);
if(CalculatedResolution.y < 1.0) CalculatedResolution = float2(CalculatedResolution.x, 1.0);
#

either stepped or dynamic scaling.

prisma fox
# grizzled token thank you! one last question, sorry, how can I make it so that the shades size a...

Try connecting the remapped output to the Sample Gradient node like I have coming out of the middle there. Then open up the gradient connected to the Sample Gradient node, change the mode to Fixed, and then set up 3 groups, one black, one medium grey, one white. Then try playing with how much space each color occupies along the gradient. Kinda tricky to explain. But just sort of shift your thinking so that you re-imagine the question to be: "What math can I apply to a function within the 0 -> 1 range that would cause the result to map to what I am looking for?" bad explanation kinda

prisma fox
# still dune

They have this same effect in Valorant, on the "Split" map on a billboard on "A" site. The approach they take there actually fades OUT the pixels so that they appear to "merge together" sort of how it would look in real life. food for thought.

#

@grizzled token this is an example of a 1-dimensional nonlinear transformation, here is an example of a constant / step function (y) applied to a linear input result from dot product (x) (we will call it linear for the example, though I don't believe it is, but it is sufficient that it maps to 0->1 range). Long story short, you can use gradient node or you can use math if you want to be exact, if you want to use math I would recommend looking into one dimensional nonlinear transforms.

still dune
#

and mix that with the image output. ain't the prettiest solution but the best I got.

merry rose
#

Is there a way to "Rotate" normal map based on other normal map? Basically I reset normals and tangent at vertex stage but save the old Normals, so then I can blend between them, this works nicely but when introducing normal map in fragment the lighting does not move as the vertex normals and tangets is reset. Can I rotate fragment normal map with the original normals I have from vertex stage?

shadow palm
#

Would anyone be able to assist me in "attaching" a shader to the main camera? I have tried several things and none of them have worked

sturdy otter
#

how to achieve this glowing projectile bullet glow in URP

#

💬 How to make a Third Person Shooter Controller in Unity!
✅ Get the Project Files https://unitycodemonkey.com/video.php?v=FbM4CkqtOuA
🌍 Get my Complete Courses! ✅ https://unitycodemonkey.com/courses
👍 Learn to make awesome games step-by-step from start to finish.
🎮 Get my Steam Games https://unitycodemonkey.com/gamebundle

00:00 Third Person Sho...

▶ Play video
grand jolt
#

how can I make two terrain layers not fade between them

#

I want something like this

blissful marlin
#

I've got a weird issue with my shader graph. It's supposed to take the object position and assign a gradient mask, so each object samples from a different position and shows as a different color. This works as intended in the viewport. However, when I hit play, all the objects are the same color. Any idea as to why?

tacit parcel
#

Are the objects static? maybe they get batched and counted as one object, thus having the same color

sturdy nymph
#

hey, im modding a game and im trying to remove a _Cutoff mask because it hides part of my model

#

setting it to 0 in the material makes most of it disappear, but leaves a large line on the edge that i'd like to get rid of but have no idea how

#

what would be causing this in the shader?

#

the _Cutoff description is "Mask Clip Value"

#

just putting that there for context

amber saffron
#

@sturdy nymph if possible, you could modify the shader to not do cutoff at all.
Else, maybe you can try to set the _Cutoff value to a stupidly low negative number 🙂

sturdy nymph
#

unsure if negative numbers would work, im assuming the it just has a range from 0 to 1

#

modifying the shader seems like a good idea, although difficult as i dont have full access to the shader file

#

ill try setting _Cutoff to a 'stupidly low negative number' just in case it works

#

ill send a pic to describe my issue

amber saffron
sturdy nymph
#

ah alr

#

yeah setting _Cutoff to -9999 seemed to have no affect

#

same as 0

#

the first image is when _Cutoff was set to 0.5 (what it was without tampering)

#

the second image was after it was set to 0, but left that line

#

im honestly not sure what is causing it other than _Cutoff, I don't see anything else in the material that could be causing it

#

there doesnt seem to be anything at all in the material that relates to this other than the _Cutoff

sturdy otter
sturdy nymph
#

i have no idea

#

im trying to get rid of it lol

amber saffron
sturdy otter
#

what shader is it making it glow

sturdy nymph
#

hm

#

well i couldnt really figure out what part of the shader made it glow

#

but changing to a regular lit shader worked fine

#

no more line

#

although for some reason that back part of the mesh is still dark? unsure why

#

either way it works for me for now

sturdy otter
#

whats wrong with unity 2020

#

cant even splice sprites

#

says in need sprite editor package

#

what package am i missing

#

to slice sprites

grizzled bolt
sturdy otter
#

It says 2D sprite package

#

Not in asset store

grizzled bolt
#

If you don't pick 2D project template, the 2D packages don't come preinstalled

#

Are you looking for a shader graph implementation?

#

Then mix that with your gradient using lighten blend mode or something similar

#

Well, there is the Color Mask Node, which I suppose you could set to black and add enough fuzziness that it affects non-black colors too, then blend with that
Or maybe Comparison node with Greater, to compare the pixels to a preset brightness, though I'm not sure at all what values Comparison node accepts

split onyx
#

is
'float _array[3 * 32]'
same thing as
'float _array[96]'
in shader code?

low lichen
split onyx
#

do u guys think its good habit to make all ur numbers decimal when writing shader code? my friend told me to do this when writing shaders

hushed depot
#

I'm trying to make the depth of field post-process effect work correctly with spriterenderers, and I was able to modify the sprite shader to correctly render to the depth buffer. When I make another variant of this shader that adds some sway, it screws up the rendering to the depth buffer, and it seems to render the incorrect geometry. in the screenshot above, the top row is how everything looks with the shader that doesn't have sway, and the bottom row is the one with the sway. the sway shader is the exact same except it has a modified vertex function.

#

anyone have a clue or direction to look into that might fix this issue?

#

any help is much appreciated 🙂

calm rock
#

Hi there,
If I add a property to a sub-graph, why would that property then not appear on instances using that sub graph? If I delete a property, the parent instance removes it but if I add one, nothing. Any ideas?

mystic dagger
#

Compute shader (baker): Property (_PositionCBuffer) at kernel index (0) is not set
UnityEngine.ComputeShader:Dispatch(Int32, Int32, Int32, Int32)
GenerateMesh:LateUpdate() (at Assets/Scripts/GenerateMesh.cs:145)

I get this error about 2/3rds of the time I open my project. None of the answers I can find from searching apply to me. It goes away after I delete my game object and add the scripts back. I'm just uploading data from a script into a compute shader. Anyone know?

prisma fox
brittle owl
brittle owl
# hushed depot

well, i think the geometry being rendered is the problem in the second picture, looks like that’s the generated polygon that unity makes based on 2d sprites, instead of the actual sprite

hushed depot
#

yes, it was

#

the issue was the shadow caster pass

#

for anyone wondering/having the same issue, for me:
TRANSFER_SHADOW_CASTER(o) needed to be called after i modified the position of the vertices in the shadowcaster pass

grand jolt
#

help with shaders please ... is there a fill shader?? ... I made a 3d model and i gave it a transparent material.. i want to fill it with another material (another color) is that possible and how.. thank you

grand jolt
#

i need help making a dissolve shader for my game so i can make an object fade in and out simmilar to how the tardis fades in and out

sturdy otter
#

what is the tool that distribute trees on textures and not just paint

#

i saw a youtube tutorial

#

forgot what it was

mighty roost
#

The water shader I'm working on is making the plane that uses it appear larger than it actually is. Is this normal? Can I fix it, and should I?

velvet lion
#

guys can anyone help me with this error im getting?

#

that error also results in pink textures

coarse orbit
#

my materials dont work

grand jolt
#

i need help making a dissolve shader for my game so i can make an object fade in and out simmilar to how the tardis fades in and out

sudden parcel
#

How do I get the Depth option on a urp shader material? I enabled depth in the urp settings

merry rose
#

So I am raytracing my scene in URP, and I am using compute shaders everything works, but I see that it halts the CPU for 60ms and then shows the frame... How can I put it in async and grab the frame when its done computing?

mighty roost
sudden parcel
crude nexus
#

anyone kmnow of any open source github (kino ftw) or etc assets that give a 'on drugs' feel? note: answers to this require active or recent drug use

wide violet
#

How would i go about making a noise shader material with no seams. As it shows in the preview window there is an ugly seam

grizzled bolt
#

Triplanar might be overkill but it will take care of the problem

wide violet
#

@grizzled bolt Thank you for your response, i got it working how a wanted it to

leaden radish
#

hey is it possible to cast 3D model shadows on 2D sprites and if yes how?

meager pelican
#

You mean like for something that is billboarded?

leaden radish
#

i want to cast shadows of this mesh to 2D sprites

#

2D png image that gets imported to unity as sprites f or 2D project

fossil copper
#

I'm attempting to make a simple gradient skybox using an RGB gradient. This is the best way I could find to get a customizable 3-way gradient

Thing is, this setup just results in a solid grey-ish color. Does anyone know how to fix that?

#

If I directly connect the Sample Gradient to the base color, it works perfectly, but I can't change the colors from the inspector so it's not very usable for me

regal stag
# fossil copper I'm attempting to make a simple gradient skybox using an RGB gradient. This is t...

A few things :
You're putting the colour properties (which are Vector4) into Vector1 ports, which truncates them down to only using the first channel (red). Since R, G and B is filled with the same red amount, it would result in some greyscale value. If you want to take specific channels from a vector you need to use a Split.

But also, the alpha (fourth component) of the final Vector4 result isn't even being used by the master stack. The skybox is opaque and the Base Color is a Vector3 port.

You likely want to just Multiply each of the channels from your current Split node directly with the colour properties (so like R * Atmosphere Color, G * Sky Color, B * Fog Color) then Add the results together like you have currently, but without averaging with the divide.

You could also skip the Sample Gradient by chaining Lerp nodes together, similar to this :

fossil copper
# regal stag A few things : You're putting the colour properties (which are Vector4) into Vec...

So, I've already went to just a simple gradient. I've actually found it more convenient to be able to edit the location of each color than it is inconvenient to not be able to edit the color from the inspector

But I believe your first point is what caused my issue. That makes a lot of sense. Also I didn't want to use the final alpha. I used the alpha to control how much each color is blended at each point

regal stag
fossil copper
teal breach
teal breach
golden heart
#

Could you guys help me with speculars?

#

this is how I want it to look

#

This is how it looks

#

Top image is with ALL speculars disabled in the HDRP

#

I want the lights to not affect the 3D grass shader in a specular way

tight saffron
#

Does anyone know how to get a shader to pay attention to the position and rotation of an object?

basically to do this

fossil copper
#

I copied a bunch of code from a blog post, but I'm getting an error with literally a single result

#

After looking at that forum post and figuring out which file was causing their issue, the blog post I used ripped off that file, with some very minor changes

Both versions of the file have this error

#

Well, I changed nothing and it fixed itself.

#

Made a change. Had a new error. Undid change. Both errors gone.

karmic hatch
#

any ideas what might be going wrong here?

#

i am using shadergraph to sample from a normal map texture and then supplying that to the normal fragment node

meager pelican
#

What's "wrong" about it? It looks like you have normals and lighting. The light is coming from above/top-right-ish, the "lower left" left sides are shaded.

#

And you're doing some kind of height-mapping or maybe voxel space setups.

karmic hatch
#

There is no specular reflection and the reflection there looks like it's from the sky near the horizon when i was looking at it practically vertically

#

i have been messing around with rotating the normals but so far i have not gotten it to put the specular highlight where it's 'supposed' to be

meager pelican
#

OK, that's a bit more specific. 🙂
Let's see.
Specular is one thing, it's self-coloring.
Reflections are another thing, sort of, in that they come from the environment external to the object.

#

So you're using a lit shader graph, and you have a normal node in the frag. So the only thing I can think of is that your environmental settings aren't what you need them to be if you've messed with the normals and doing that didn't change anything.
You have reflection probes set up?

#

Maybe show your graph.

karmic hatch
meager pelican
#

OK, not a reflection, but specular from the light-color.
Are you using the specular workflow then? (I think that's in SG).

#

The metallic workflow and specular workflow don't necessarily produce the same results. The specular workflow has more...uh...gloss to it, whereas the metallic has more...metal...to it. I know that's obvious, but I'm typing it anyway because I'm an idiot sometimes. :p

#

So you can set the glossiness of materials in the specular workflow and it reacts a bit more like you sound like you're expecting.

#

ANd with specular you have a specular-color (often set from the light color, but not always if the material tints it).

karmic hatch
#

i just changed it to the specular one but it still isn't working properly :(

weak stone
#

Has anyone needed to make custom shaders to improve performance? I'm confused (unless ur trying to do a very specific job) why anyone would make there own shader

karmic hatch
#

it refuses to line up with the sun

meager pelican
karmic hatch
#

no i am not

meager pelican
#

Also check your lighting tab, and make sure your sun object is set to be the main light. (Probably is).

#

That looks a lot like a water shader, eh?

meager pelican
#

Well, you can draw the normals, but IDK if it will help you.
Try taking the normal, and output it as the color.

karmic hatch
#

this is the top of the cube

meager pelican
#

You should be using world normals BTW. Not object normals.

#

Oh, that's not it. We have determined that normals are an issue still.

#

Green should be on top, because a horizontal plane has a normal of (0, 1, 0) which is green.

#

Of course, it will be varied due to "bumps" but it should be green-ish.

karmic hatch
#

i set them to world space and it's still very off

#

looks the same actually

meager pelican
#

Show your normal map. Is it the usual purple?

karmic hatch
#

it looks fairly normal

meager pelican
#

Yep. Normal normals. lol

#

What the frack?

#

Gonna have to show the graph I guess.

karmic hatch
#

here's the bulk of it

#

it then feeds into the normal tab

#

(the two textures are the same because i accidentally uploaded the same texture twice)

meager pelican
#

OK, so you're taking WS x and z, and making a UV out of it, basically, multiplying by time to move it, and then reading your textures.
And then what? That preview looks OK, but it's not giving you a surface normal unless water1 and water2 are your normal map? Are they?

karmic hatch
#

yes water1 and water2 are my normal map

#

at the point where it's sampling the map, it just samples it and adds them

meager pelican
#

OK, I think you have to have it be type NORMAL.

#

Normals have to be unpacked.

karmic hatch
#

I set it to type 'normal map'

meager pelican
#

save it by clicking on the save button. Did it change?

#

Or still red?

karmic hatch
#

Save the scene or the shader?

meager pelican
#

shader. Your graph shows the texture2D sampler as default and not "normal". It needs to have type normal. Change that if you haven't already, and save the shader.

karmic hatch
#

The top of the cube is now blue

meager pelican
#

Well, OK. At least it changed. lololol

#

I see some red in there too.

#

But dang.

karmic hatch
#

I changed the normal map so it's in tangent space and now it looks like it works :)

meager pelican
#

Yeah, it should be tangent space.

#

It was in your pic.

karmic hatch
#

Thanks so much

meager pelican
#

Oh, you mean the texture. Sure.

#

Cool.

karmic hatch
#

:)

worldly steppe
#

Hi everyone, I have a question regarding sprite shaders for Unity 2020.3.1f1. I have a 2D sprite that has a shader material in a 3D environment and I want it to receive lighting. I tried changing the material to Sprite Lit but it didn't work. I found a tutorial here: https://www.febucci.com/2018/07/sprite-diffuse-shader/ but it's using the old version of Unity and it's unfortunately outdated. Does anyone know how to translate it to the current shadergraph?

Febucci

You can use a Sprite Diffuse Shader in Unity to let your 2d sprites be affected by a light. Learn how to create it via Shader Graph, SRP/URP and more!

shadow locust
worldly steppe
fossil copper
#

So.. is there seriously no way to add headers to the inspector with shader graph? I really need to organize this thing. I found an asset for it, but I'm not paying $35 for a basic feature

I'm open to editing the compiled shader code, but that seems to reset every time I open it

mental bone
fossil copper
#

I found that, which is what led me to the $35 asset. I honestly completely forgot you can build from source using Github

mental bone
#

I.. did not know the license changed.

clever laurel
#

Hello! I'm helping my friend figuring out how to use Unity. We came across this interface online and we're curious where does this menu come from?

mental bone
#

Looks like a custom toon shader

grand jolt
#

How could I make an animated water surface shader for unity

#

Realistic

#

Not Toby

#

Tong

#

Jesus

#

toony

meager pelican
toxic flume
#

Is it more efficient not to use int?

#

for example I have row/col index. They are int definitely. I calculate division somewhere. Because they are int I do not need floor after that

#
index/row_count
fmod(index,row_count)
meager pelican
#

"More efficient" depends on your needs, and the implementations vary at the microcode level.
But for things like you say, indexes, you must have int values anyway. I think (don't quote me) that they use the same 32-bit registers for both ints and floats. It's how the compiler deals with them when it generates the actual shader code at the device level that counts. So 32 bits are 32 bits.
It's all YMMV. What you want to avoid is too many conversions between the types.
https://stackoverflow.com/questions/64870103/do-gpus-separate-integer-and-floating-point-vector-registers

So use ints where you should use ints, and floats where you should use floats, and let the compiler deal with it from there. 2-cents.

#

If you can avoid a conversion by "not using ints" then fine. But watch out for floating point inaccuracies.

#

If you're accessing things with an array index, it's probably implementing an implicit conversion anyway.

brisk chasm
#

Hi, would it be possible to acsess the vertex positions of a object that has a vertex displacement shader graph on it?

#

i want to use it for boyancy on a water shader

meager pelican
#

Directly, only in the shader for the object in question.
Indirectly, IDK, you can rig something up in that shader to stash the info somewhere (texture) and then read it back later. But I don't think you want that, exactly. You need to do heavy research on intersections/physic on the shader side to pull off what you're asking about.
Others will comment more, I'm sure. But once an object is "done" it's done. You can't get the info from another object's shader, unless you stashed it somewhere.

#

Although you can recreate the worldspace position of a pixel using the depth buffer.

brisk chasm
#

k thanks!

grand jolt
#

Is someone familiar with PBR Workflows? I'm stuck with multichanneling greyscales into a mask and detail map... If someone could clear some things up for me that would be great : )

karmic hatch
#

I want to add the color my shader outputs onto the background, is there any way of doing that?

twin rose
#

The depth buffer isn't available until after opaques, right? My scene only uses opaque materials and I want to do z-culling

karmic hatch
#

idk

worldly steppe
leaden radish
#

3D models in a 2D environment

#

making darn characters and animation in 2D is PAIN!

echo solstice
#

Hello

#

Can someone help me

karmic hatch
#

i have a transparent surface for water and i want another shader to take this into account in the scene depth variable - how would i do that?

charred granite
#

greetings yall

karmic hatch
#

greetings

charred granite
#

in this case _Albedo

#

but im no expert

#

could be 100% wrong

#

im trying to use this cluster of nodes to move the vertex of my object and its working, BUT its effecting the entire model and i would like it to affect the top half of the model only

#

with some type of gradient

#

how would i go about doing this?

karmic hatch
#

could you multiply the shift by the vertex position?

meager pelican
#

Often done with things like grass or trees.

charred granite
#

right 🤔

meager pelican
#

So if the pivot is at the base, use the Y value of the model-space (object space) position to tell how far "up" the model you are at that vertex.

charred granite
#

all the wind shaders i have found were using World position, but it does not respond well with several models, thats why i thought of doing it the way i mentioned. um ill try to wrap my head around this

meager pelican
#

Well, you can use WP, but you need some base-value and then subtract the base from the WPos of the vertex. That will tell you the height, scaled properly.

#

One method is object relative, the other is world-relative. So scale of the "moving" would be different.

#

You can always add a per-object scalar factor to scale the movement, per instance/material.

raw canyon
#

When I add a texture with transparency to a texture node, it gets stretched out when I'm using shader graph. Can anyone help?

charred granite
#

is it scaled correctly

meager pelican
# raw canyon When I add a texture with transparency to a texture node, it gets stretched out ...

There's the scale of the object, the tiling and offset of the texturing ^^ like oops said, and also the native size of it...because texturing "stretches" things by default. In other words if you have a square texture and put in on a rectangular object, it will "stretch" to fit the rectangle, assuming the model has UV mappings in the corners from 0 to 1.

So it all depends. There's other ways to compute UV mappings. For example, you can use world-space tiling and tri-planar tiling to project a texture onto an object using worldspace coordinates mapped to some UVs.

#

Or you can compute the tiling and offsets based on the object's size in worldspace.

#

Transparency or not shouldn't matter.

charred granite
#

cant get it to work

#

fml

sinful veldt
#

does anyone use urp vertical fog

charred granite
#

im using this [screen position] water refraction effect. anyone know how i can like fade the refraction so its not 1:1 with the actual objects appearance ?

#

trying some random nodes here and there but im still new to this

meager pelican
#

Well, you could blend with the object color if opaque, or use transparency fractions.

#

Looks nice

charred granite
#

transparency fractions hmm

#

oh that was easy

#

thanks

#

👻

fluid lion
#

is this the right place to post this? im trying to map a heatmap material onto a generative 3D mesh but im getting weird seams...how do i fix this? how do you properly map something like this through code? https://i.imgur.com/znvb0DQ.gif

charred granite
#

theres a quick shortcut if you want to make a sphere in blender

#

it wont be perfect though

#

the heatmap will skew on your sphere but it wont have hard edges like your gif unless you click the very bottom

#

it will skew more on the lower half

#

but like i said its more of a quick fix

#

atleast i think so🤔

earnest skiff
#

guys, how can I update the shader sebastian lague used in his proc gen series

#

the materials stay pink even after updating them because basically it's custom material
from the shader

fluid lion
charred granite
#

no sorry

#

do you need to be able to heat map the entire sphere? maybe you can rotate them if you only need the top of the sphere

coral horizon
#

yo, im tryna make vertex snapping shaders like the ps1 style graphics can anyone give me any pointers? idk where to start

meager pelican
# fluid lion thanks for the post but unfortunately the mesh spheres im using are self-generat...

There basically IS NO DIRECT MAPPING of a rectangular texture to a sphere of any type. Unfortunately. Map makers have this same problem all the time.

Some types of spheres are better than others, though. Since you seem to be doing it in "chunks" maybe you can use an icosphere in blender. Or at least decompose one and convert to C#. Or google for an algorithm.
https://en.wikipedia.org/wiki/Geodesic_polyhedron

A geodesic polyhedron is a convex polyhedron made from triangles. They usually have icosahedral symmetry, such that they have 6 triangles at a vertex, except 12 vertices which have 5 triangles. They are the dual of corresponding Goldberg polyhedra with mostly hexagonal faces.
Geodesic polyhedra are a good approximation to a sphere for many purpo...

#

See also:

fluid lion
full sentinel
#

Is there a way to modify the default shader in URP to prevent things from being all glossy by default?

charred granite
karmic hatch
#

I'm trying to modify my fog shader so it stops when it hits the water (i'm trying to make it so it stops at a constant height) but rather than working as intended it makes this clearer circle that follows around roughly where i'm looking

#

Here's the working one that samples the scene depth (but then it goes through the water and looks a bit weird)

#

here's the one that doesn't work

#

basically I'm trying to calculate the height from the camera to the water, then divide that by cosine of the angle to the vertical (so it's thicker near the horizon, z of the normalised vector should just be the cosine); this would then give me the distance to the surface of the water, and then i subtract the alpha of the screen position which should be the distance to the fog

high hemlock
worldly steppe
#

Hi everyone, I have a question regarding sprite shaders for Unity 2020.3.1f1. I have a 2D sprite that has a shader material in a 3D environment and I want it to receive lighting. I tried changing the material to Sprite Lit but it didn't work. I found a tutorial here: https://www.febucci.com/2018/07/sprite-diffuse-shader/ but it's using the old version of Unity and it's unfortunately outdated. Does anyone know how to translate it to the current shadergraph?

Febucci

You can use a Sprite Diffuse Shader in Unity to let your 2d sprites be affected by a light. Learn how to create it via Shader Graph, SRP/URP and more!

glacial river
#

With my project, the who thing should be the same brightness but it's not. At the bottom left it says Baking? Would that fix it?

glacial river
round nova
#

hi, why is my shader for the terrain going sideways instead of vertically

astral pecan
#

Anyone know how to do fog and ambient light on shader graph? I need to know how to make custom lighting affected by fog and ambient light (Sky)

twin rose
astral pecan
#

When I multiply color, density, and multiply to diffuse its black

#

Nvm I figured they're simply lerped

#

Ugh

#

What about ambient light though

oblique field
#

anyone know how i can fix the pink thingy?

#

i got URP installed

#

and i tried this solution but it didn't work

fallow ice
white cypress
fallow ice
#

Also question - if that's not true, and Surface Shaders are OK, and have no optimization problems, then why they have no support (according to docs) in URP/HDPR ?

earnest skiff
#

I think converting the code to shader graph is better but

#

idk how to do it

oblique field
#

like without me changing anything

gray harness
#

i have a problem where shaders dont work in WebGL

#

or the problem can be elsewhere but idk where it could be

#

it works in unity editor and PC build

#

heres code that doesnt seem to work

echo solstice
#

Can someone help me

eager folio
#

@gray harness webgl just doesn't support all functions.

amber saffron
gray harness
#

is there really no way of running compute shader in WebGL?

rustic talon
#

do u know any video about how to do a chromatic aberration shader?

echo solstice
#

Tell me why matcap shader used object blinks in scenes

#

I mean reflection breaks

#

And blinks

#

It glitches

amber saffron
#

@echo solstice Shader issue ? Missing reflection probes ? Lighting ?
There is a lot a things that could cause this.
Describe your setup : which render pipeline ? What shader ? How is the scene setup ?
Show us some screenshots / video captures 🙂

prisma fox
#

I identified an issue in one of my shaders that (I believe) is caused by a bug in URP 7.4.1 that was fixed in later versions. Is there a way to branch against URP versions from HLSL to conditionally solve for this bug in the versions of URP that have it?

amber saffron
echo solstice
#

Normal 3D project

#

Look

#

At

#

Waterfall

#

It's not full gold

#

Some parts glitched

amber saffron
#

This look like some good old z-fighting issue. Is the golden surface a separate mesh that is over the dark brown one ?

fathom kiln
#

why is this transparency blue in the scene preview but in the game preview completely transparent?

#

has to do something with the uv node in shader graph

#

on top i used my own texture and on the bottom i created the gradient with unity

regal stag
echo solstice
#

Lines

#

Golden lines

#

Like edges

amber saffron
# echo solstice Yes

So, not a shader issue : zfighting. Try to put the polygons a bit further away of the underlying surface, or incread the depth precision : reduce the depth range on the camera, ie. if you're not seeing further away than 150m, put 150 in the far plane

fathom kiln
noble olive
#

how does shadow casting work in unity shaders?
more specifically i am wondering how the absence of light onto an object is calculated when there are other objects infront. can someone answer this question or knows a good resource for me to read on?
edit: especially with multiple light sources and global illumination i find it very interesting to understand how that works

amber saffron
noble olive
#

oooooh remy

#

thats smart

regal stag
amber saffron
#

For multiple light sources, you "simply" do that multiple times 🙂

noble olive
#

shadow mapping...

#

is that done in realtime?

amber saffron
#

Yes

noble olive
#

i need to render the scene multiple times then, right?

#

for each light source once + the final render with the shadow maps?

amber saffron
noble olive
#

do you have a code reference for that by any chance?

amber saffron
#

I can only suggest to look into the URP source code if you're brave enough

noble olive
#

yeah imma take a look

amber saffron
noble olive
#

thanks! ill definitely take a look at that one!

vernal pewter
#

Anyone have an idea how I can get a tiles layer depth in a tilemap using a shader?

#

I can get the x and y position from the global position, but it seems all layers are at z=0

noble olive
#

maybe there is some sort of sorting layer?

vernal pewter
#

A simple sprite lit shader works and renders the sorting of tiles correctly, so it can't be too complicated...

noble olive
#

@amber saffron i like that

#

why would you need multiple shader passes btw?

amber saffron
#

So, for a single shader, you can have multiple passes, that are a way render the data you need, depending on the context.

noble olive
#

oh i see

#

how does the pass know to render "from the lights" perspective @amber saffron ?

#

can i have different view matrices for multiple passes?

amber saffron
#

It's simply an other camera projection matrix 🙂

#

So yes, you can have difference matrices for multiple passes, it's the render loop that handles setting the projection matrix before calling a render of the objects, and specifying which pass to use

calm rock
#

Unfortunately, my screen capture didn't include the environmental dialog

#

I'd expect the scene to go entirely black when I set the environmental map contribution to '0' but that doesn't seem to happen.

amber saffron
#

Isn't this caused by auto exposure ?

calm rock
#

one sec, is that a camera or a effects pipeline setting?

amber saffron
calm rock
#

it doesn't appear to have any exposure compentation

#

I don't think we're using any volumetric lighting

amber saffron
#

Nothing to do with that

#

Oh, maybe URP doesn't have auto exposure yet

#

So, the issue is, if I understood correctly, you increase the environment intensity, and the whole environment seems to go white, not only the bright spots in the map, right ?

calm rock
#

It's more that when I set it to 0, the scene doesn't go black

amber saffron
#

I see that you do have some directional light and light probes in the scenes, so only setting environment to 0 will not be enough

calm rock
#

here's the values at zero. There is a directional light but I've turned it off.

#

ah, yes.

#

that's right - the light probes are what were doing it.

amber saffron
#

also, you have a reflection probe

#

if it was baked before you change the environment intensity, it keeps the previous "sky"

calm rock
#

It was the probes - I expected the environment light settings to have a global effect, I know better now 🙂

#

thank you!

noble olive
#

@amber saffron what about soft shadows in shadow mapping? and.. FOV?

#

i mean for sunlight it should be almost orthographic

amber saffron
floral imp
#

how can i do changing color material

#

Like LineRender have

amber saffron
noble olive
#

i see

noble olive
#

if a variable was called g_mLightsWorldViewProjection, what would you expect to be in it?

#

the light local transform matrix multiplied by view matrix multiplied by projection matrix i'd guess?

#

the view matrix defines the view frustum.. am i right?
the projection matrix takes care of znear and zfar clipping into a homogeneous space..
does that make any sense what im saying?

#

what is the mathematics of sampling scene depth from the orthogonal light view projection in perspective model view projection?

round sinew
#

Hi guys, is there any way to disable a shader from rendering in the inspector ?

I have a BLUR shader to have blurry backgrounds on my UI but it renders in the inspector with the game view and it flickers a LOT

eager folio
#

@floral imp I believe the trail renderer just uses vertex colors, right?

noble olive
round sinew
#

Well i have a blur shader on a material and this material on a UI image
And the blur effects appears in the Canvas in the Editor

#

And it flickers a lot like when i click in the game view, move elements etc

#

Ok, nevermind, the shader i was using was broken, just switched to a different one

hoary umbra
#

Hoi

#

I made via a dissolve note shader in graph shader a texture transition shader, but now I tested it with a character that is animated and found out that the shader has a bit of trouble with the. Imagine the head switched already to texture 2, than the character crouched and suddenly the characters is back to texture 1.

pliant falcon
#

hi there
does anybody know a way to crop out a transparent outer area of a texture at runtime?

eager folio
#

@hoary umbra can you rephrase that?

hoary umbra
eager folio
#

@pliant falcon I believe you would need to make a new texture of the correct size, then use getpixels and setpixeks to copy the area yiu want from the old texture to the new one.

#

@hoary umbraNo, I mean your post looks like phone predictive text gone wild. It is really hard to even tell what your problem is.

hoary umbra
hoary umbra
eager folio
#

Clove?

hoary umbra
#

glove/hand

eager folio
#

You are using a position node, so as you move parts of the object it will change based on distance from the origin.

hoary umbra
#

yeah. this is the problem. but I dunno what the solution is.

eager folio
#

Use vertex colors or UV position?

hoary umbra
#

I can test the note vertex colors.
what do I use for UV position?

hoary umbra
#

how it is suppose to look.

eager folio
#

Neat effect

karmic hatch
#

i'm trying to make a fog shader, i have a working version that only takes the distance to the terrain but since there's also water (using a transparent shader) it goes through that and ends up looking a bit weird; I am trying to make it so it cuts off at a certain distance corresponding to the distance to the surface of the water but at the moment it just makes a see-through region roughly where i am looking at that particular moment
(I have the working and not-yet-working versions if anyone wants to see them)

eager folio
#

And for uv position, I'd probably just paint a texture map

karmic hatch
#

here is my working part for the transparency (it samples distance to terrain and then calculates the distance through the fog)

#

here's the one that doesn't yet work
it calculates the height above water level, divides it by the z component of the vector you're looking along (which should stretch the distance into the distance to water level along the line of sight) and then subtracts the distance to the fog, which should yield the distance along the line of sight through the fog to water level, but it doesn't for some reason.

hoary umbra
tidal wraith
#

Where can I find the struct appdata in a shader like this?

    Properties {
        [NoScaleOffset] _MainTex ("Base (RGB)", 2D) = "white" {}
        _LineWidth ("Line Width", Range(0.01, 100)) = 1.0
        _LineScale ("Line Scale", Float) = 1.0
        _LightSaberFactor ("LightSaberFactor", Range(0.0, 1.0)) = 0.9
        [MaterialToggle] _UvBasedLightSaberFactor("UV-Based Light Saber Calculation (Anti-Aliased)", Int) = 0
        _Color ("Main Color", Color) = (1,1,1,1)
    }
    SubShader {
        // batching is forcefully disabled here because the shader simply won't work with it:
        Tags {
            "DisableBatching"="True"
            "RenderType"="Transparent"
            "Queue"="Transparent"
            "IgnoreProjector"="True"
            "ForceNoShadowCasting"="True"
            "PreviewType"="Plane"
        }
        LOD 200
        
        Pass {
            
            Cull Off
            ZWrite Off
            ZTest LEqual
            Blend One One
            Lighting Off
            
            CGPROGRAM
                #pragma glsl_no_auto_normalization
                #pragma vertex vert
                #pragma fragment frag
                
                // tell the cginc file that this is a simplified version of the shader:
                #define LIGHT_SABER_MODE_ON

                #include "_SingleLineShader.cginc"
            ENDCG
        }
    }
    FallBack "Diffuse"
}```
eager folio
#

@hoary umbra if you use a gradient texture map applied to the uvs it should work

hoary umbra
#

I don't think I use that.

hoary umbra
eager folio
#

Yes

karmic hatch
#

i have a mesh i am using a shader on, how do I get the distance to that mesh in the shader?

#

i was using the alpha component of screen position but it seems that depends at least somewhat on where the camera is pointing

carmine jolt
#

Is there any consideration for webGL that should be made when choosing a render pipeline? Currently my project is using default, but I'm considering changing to URP so I can learn ShaderGraph.

timid minnow
#

https://forum.unity.com/threads/trying-to-replicate-the-hdrp-lit-shader-i-need-help-with-the-detail-input-part.660538/#post-6294112

A user said this in regards to a shader graph version of the HDRP/Lit shader:

One question: Do you know if there is a big performance/efficiency difference between your SG version of the Lit shader, and the normal HDRP Lit shader that comes with HDRP? I'm curious is there are optimizations in the Lit shader that can't be replicated in a Shadergraph. For example, in a normal Lit shader, it recompiles the shader whenever I enable/disable certain features. I assume that the more features enabled, the more "expensive" the shader gets. But with this Shadergraph, does it incur the cost of all of those things, even if no maps are provided to certain inputs?

For example, does the full Lit shader know not to bother sampling certain maps if there's no map assigned? Do Shadergraphs know to do the same thing?

I am curious about this as well. Does anyone have any insight?

icy spindle
merry rose
#

If I have multiple same subgraphs in shader that provide additional data, will it generate multiple times or does it take it as one node in the end? just asking if I can make shader graph clearer without hurting performance

cursive girder
#

Hi all, I'm looking for a shader which will render only an AO texture as an overlay

#

So I have a textured asset, but want to have a second material which handles just the AO

#

Is this possible?

pliant pond
#

is it possible for semantics passed to in a particle's custom vertex stream (for instance, texcoord<x>) to be changed or must the shader comply with the default one that unity packs the data into?

floral imp
#

How can i do post procesing for specific object

#

Like this game have

meager pelican
meager pelican
# floral imp

"for [a] specific object"....
You'd probably use a stencil when drawing the object, and then have the PP shader use the stencil mask to select what pixels to process.

prime pasture
#

Hey, I have a simple shader where I send a texture and set:

Properties
{
    // ...
    _AnimationTexture ("Animation Texture", 2D) = "white" {}
}
//....
Texture2D _AnimationTexture;
sampler2D sampler_AnimationTexture;

the sampler doesn't seem to get the right texture, where the Texture2D does.

Basically I want to access the size of the texture in the vertex shader so I do this:

uint width;
uint height;
_AnimationTexture.GetDimensions(width, height);

And right after that I try to access the texture like this (in the same shader):

tex2Dlod(sampler_AnimationTexture, float4(vid / width, _Frame, 0,0)

It doesn't seem to return the right values.

The weird thing is, if I only use sampler2D _AnimationTexture I get the right values but I need to set the width and height some other way (hard-coded or sent to the shader).

Any idea how can I make the sampler_AnimationTexture sample correctly? or connected(?) to the right texture?

(Btw, I tried UNITY_DECLARE_TEX2D which translate to essentially the same thing I did)

regal stag
regal stag
# merry rose If I have multiple same subgraphs in shader that provide additional data, will i...

If you use a SubGraph node multiple times, it will generate as separate code and run multiple times. If it uses the same inputs, it's usually better to only use it once. But whether using it multiple times will hurt performance depends on what the SubGraph is doing though. If it's just accessing/returning values without doing any calculations it's probably fine. e.g. obtaining the Main Light Direction & Color. (Assuming it doesn't also sample the shadowmap)
I've also made this which might help, https://github.com/Cyanilux/ShaderGraphVariables

prime pasture
#

@regal stag Tried what you said I get the same result (the SampleLevel return wrong values)

regal stag
# icy spindle Does anyone know the purpose to predefined keyword def in shader graph? I've tr...

As Carpe already mentioned above it doesn't create a #define (or #pragma shader_feature/multi_compile). It's used to allow the graph to check if a keyword is already defined (e.g. by the generated code or ShaderLibrary). Prior to v10 for example, it was possible to use a Predefined keyword with SHADERPASS_SHADOWCASTER to allow the graph to output different values for the shadow casting pass.

But in v10 this was changed and now you need a custom function... (More info mentioned here if interested https://www.cyanilux.com/tutorials/intro-to-shader-graph/#shader-pass-defines). I'm sure there's other uses for the Predefined option still but don't see it used very often.
It might also be used by the Material Quality option (under Built-in Keywords) iirc.

regal stag
# prime pasture <@!357936113983291393> Tried what you said I get the same result (the `SampleLev...

Is it the right texture though? Could try sampling at (0,0) or some other hardcoded location and see if that pixel's colour matches what you expect. Also check filtering settings (linear/point) on the texture to make sure that isn't affecting what you expect. If that's fine then there must be something wrong with the UV calculation.

Maybe check if the width/height is the values you expect, could send them through to the fragment and return them. Maybe you need to cast to float, like vid / (float) width? (or just use float instead of uint, I think GetDimensions can return either type). It's also possible that to use GetDimensions you need to specify #pragma target 4.0 since this page (https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-to-getdimensions) mentions it's supported in shader model 4. Not sure if unity would automatically handle that.
An alternative might be to use the float4 texture_TexelSize instead, which would also store the width/height in z and w components (or 1/width in x, so you could then just multiply instead of divide).

past wedge
regal stag
#

Since it's a surface shader, I think you might be able to specify addshadow on the surface pragma and it'll generate one with the vertex modification.

past wedge
#

wow ok, I think it's coming from the AO of the post processing stack v2... 😢

quick vessel
#

hi, im trying to figure out how to have the sprite diffuse shader have the sprite be affected by fog as well, anybody know how that can be done?

past wedge
sinful veldt
#

anyone uses urp vertical fog
it doesnt work in perspective for me

merry rose
karmic hatch
#

is there any way to pass an array to a shader? i am using a voxel map and it would make it much easier for coloring for example

coral horizon
#

this is a long shot but, what node is this?

trail marsh
#

The quality of the picture is not very good, so you can’t Read it

coral horizon
#

yeah i know

#

thats why i said its a long shot

#

but maybe someone would be able to recognize it base of how it looks

trail marsh
regal stag
#

Given the length of the port names, I'd assume it's a SubGraph

trail marsh
coral horizon
#

picture

trail marsh
#

From a tutorial?

coral horizon
#

no

#

there is no sub graph when i search

trail marsh
#

The second word could be Color

#

But I’m not sure

trail marsh
safe gate
#

unity does not use snake_case either in their nodes

meager pelican
undone kiln
#

I've been tinkering with the render pipeline and unity2d lighting. I'm trying to get shadows to cast on objects behind them, but not themselves.

What I'm trying to do is make objects cast shadows, but not cast them on themselves.

Here's a pic of what I'd like it to look like:

undone kiln
grand jolt
#

I have a outline shader but it gets cut off at the edges of the texture, what can I do to fix this?

meager pelican
#

Outlines are more complicated than people realize, and there's several methods. But basically, you need to make your object that you're drawing BIGGER by some means such that you have room to draw the outline around it.

Depending on what pipeline you're using, and what method you select, the implementation varies.

undone kiln
karmic hatch
#

is it possible to copy from one shader graph to another or do i have to remake the graph?

#

i have just found out about sub graphs

#

how do i remove an output from the outputs tab in a shader sub graph?

#

unlike on the <old> unity website about it, it no longer has the helpful gear icon to let you change that:

cedar shore
#

I'm trying to follow a shader tutorial and everything keeps opening in the shader graph

#

do I have to remove URP / shader graph so it'll open in VS?

#

I just removed the packages. F

coral horizon
#

can someone explain what transformation matrix node does

shadow locust
#

just like Matrix4x4 in C#

fathom kiln
#

how can i make the shader start from the objects center point

karmic hatch
karmic hatch
#

The UVs on the standard sphere aren't nice and symmetric

fathom kiln
#

and the object is just invisible now

karmic hatch
# fathom kiln its hard to control it now

I think you should probably be using two coordinates, also you'll need to rescale your other vector since the UVs go between 0 and 1 while the position goes between different values

karmic hatch
#

how do I remove outputs from a sub graph; the documentation is old and does not correspond to the version I have

#

(2020.3.6f1)

#

ok i figured it out

#

[you have to select the output node, go to the graph inspector, select the output you want to remove, then hit the minus button]

meager pelican
# coral horizon can someone explain what transformation matrix node does

Primer: A transformation matrix "moves" a point according to some space-conversion. It transforms (moves), rotates, and scales a set of points using magic 4D math. So once you get it set up, it's a "space transformation factory" where you can take any set of coordinates in, say, object space, and then multiply by that matrix (the GPU has hardware to do that) and and come out with a new coordinate that is magically moved, scaled and rotated.

That's why in C#, unity has a object "transform"...with location, scale, and rotation in it. It ends up making a 4x4 matrix behind the scenes (and there's variants where it's really 3x3 or something, but never mind that now).

So when you take an object-space model, that is only defined relative it itself, and you pass it a C# Unity transform (or 1 object/model using 100 of their own transforms)...you get 100 instances of the "prefab" projected into your 3D world-space. Each with its own location, rotation, and size/scale.

The shader gets passed the model in object space, and the transform for each C# instance. And magic happens....

#

Answer: With all that out of the way, the SG node let's you select various matrix versions and gives you that magic matrix to multiply by. So it operates on object-space to whatever-space by giving you the matrix to multiply by. Or potentially the other way around, converting a word-pos into an object-pos.

turbid night
#

I am trying to use as little shaders as i can

#

usually just sticking to hdrp lit

#

and giving my characters a shader graph one

#

anyone have any experience with having too many shaders

#

are they doing it again

#

i already got it 2 months ago

tacit parcel
turbid night
#

was that steam free discord link a scame

#

ffs

#

😐

#

luckily i have 2fa

brittle thistle
amber saffron
brittle thistle
amber saffron
#

I don't remember the whole videos (and am a bit lazy to scrub through to find this particular part), but if you change your script to :
planetMeshRenderer.GetComponent<MeshRenderer>().sharedMaterial = (Material) Instanciate( colourSettings.planetMaterial );
The newly generated planet will have a copy of the material assigned, and will not change the original (unless it is changed before, then you just have to instanciate the material at an other place)

brittle thistle
#

hmmmm

#

okay i'll try that

round nova
#

Hi, I'm trying this grass shader:
https://www.patreon.com/posts/urp-compute-54164790

And for some weird reason, the grass applying only works on my player capsule. I made a new capsule and plane and checked all the settings and components and they're same as the other player capsule. But for some reason it still doesn't work. Any idea why?

brittle thistle
amber saffron
brittle thistle
#

this is the texture appearing on the right material

#

and this one on the left material

#

for some reason when i add the png tecture to the material looks like this idkw

amber saffron
#

This looks like compression artifacts

#

Change the texture compression to uncompressed, disable power of two size (if it's not a power of two sized texture), disable mip maps, and set the wrap to clamp

teal breach
#

Is it possible to sample the DepthNormals texture from the fragment shader in Unity?

#

I know for performance reasons it should be created after all fragments are drawn - but the truth is unity uses it's own internal pass to mock the depth/normals buffer in forward rendering mode, so in principle the information could exist before the fragment shader

brittle thistle
keen sparrow
#

Heya,
I wanted to try and add a Stencil buffer to an already existing Unity URP shader (I have little to no experience with shaders). After a lot of googling I was told that #include effecively adds the content of a different shader to the file, creating a form of inheritance in shaders. This is the result I ended up with:

    Properties { }
    SubShader
    {
        Stencil 
        {
            Ref 1
            Comp NotEqual
        }

        Pass {
            #include "Universal Render Pipeline/Lit.cginc" 
        }
    }
    FallBack "Diffuse"
}```
This is thowing the following error: `Shader error in 'FadableObstruction': Parse error: syntax error, unexpected TVAL_ID, expecting TOK_SETTEXTURE or '}' at line 16`.

a) What is this error, and how to fix it? 
b) The goal is an obstruction fader using stencils. The default shader is fine, I just need to add the stencil to it. Would this approach work or am I wasting my time (again)?
teal breach
amber saffron
teal breach
#

eg under Tags in your subshader,

        UsePass "Shadername/UNIVERSAL FORWARD"
        UsePass "Shadername/SHADOWCASTER"
        UsePass "Shadername/DEPTHONLY"

where Shadername is the name of the shader you want to take passes from

keen sparrow
keen sparrow
amber saffron
toxic flume
#

What is your idea to implement dead zone effect something like it? (COD mobile)

distortion + animated wave effect
Also, I can see a glow effect when there is an intersection between dead zone and objects. If it uses depth map, is it efficient for android devices?

rare charm
lavish oasis
#

Any free shaders that mimic a decal and the only thing they do is distort the object/texture behind it to look as if it was "bent" inwards?

#

Something like a hole, but not see-through

undone kiln
shadow locust
#

not sure 100% how to go from that to a similar image to what you shared but it's probably a good starting point

rare charm
#

Yeah that's where I'm stuck... I might be able to achieve a similar enough effect with a colored noise texture.

granite violet
#

Hi! I'm trying to make water for a prject im working on!

#

I use unity 2021.3.1f and don't know what to do to make water

#

Can someone help I haven't been able to find a non-outdated tutorial

#

all of them use a "PBR" file i think it was

#

which I cant find.

rare charm
#

@granite violet Are you using URP? The equivalent is a lit graph.

#

pbr = physically based renderer

#

which basically means it works with lights

granite violet
#

alright, then... how would I do that... sorry I don't get this!

rare charm
#

If you are using URP you Create>Shader>UniversalRenderPipeline>Lit Graph in your project window

#

You'll need to create a material as well and drag the shader graph onto it

granite violet
#

ok...

#

one second...

rare charm
#

The graph nodes will have slightly different names, but its basically the same as a pbr

granite violet
#

What would be the equivalent of...

#

PBR master?

#

Node?

rare charm
#

The Vertex and Fragment are what PBR calls the Master node

#

Names will be a little different, like Albedo is now Color

#

But once you use it for a few minutes it will all make sense

granite violet
#

Ok! That is JUST what i needed Thank you! So much!

rare charm
#

There's a steep learning curve to shaders, but once it starts to make sense you can really have fun with it

granite violet
#

What would be the same thing as "alpha"?

rare charm
#

@granite violet In your Graph Inspector change the Graph Settings>Surface to Transparent

#

Then you'll have an alpha input on the fragment

granite violet
#

Ok Great Thanks!

fathom kiln
#

i want to reproduce this and make the dark parabola inside the shader move upwards

#

any ideas how i could start?

tacit parcel
mental bone
wanton saddle
#

how can I make gradient noise smoothly change over time at a small scale in shader graph

onyx jungle
#

Hey guys, I have a problem right now in my shader where I am trying to have two normal maps scroll across my ocean surface here (the surface is transparent and has a ferensel effect with depth).

#

I am calculating the wave normals using triplanar mapping so that I do not get pinching/warping of the textures, the result of the calculations gives me the overlapping normals nicely, however I get this unwanted colour from the triplanar normal function (This function is part of an include file I got off the internet).

#

Any help would be greatly appreciated, thanks 🙂

cerulean dune
#

Hey !
I got an unlit transparent shader and, even when the material's Render Queue is at 5000, sprites keep getting over it
I found that I need to change Simple Lit to Lit, but for Sprite Renderers I have no clue of what to do :s

olive brook
#

Hey, ho can I quickly learn shader writing ? In shaderlab or gnerally glsl

#

I'm a fast learner sand know some basics from some tutorials online , but i wanna dive deep

mighty roost
onyx jungle
#

Hey does anyone know how I could create this water effect shown here

#

I just want the normal map scrolling + transparency

olive brook
#

hey guys, quick quesiton... what was the function that cuts the pixel out ?

#

something like cut or cull or sth

#

oh , it was clip , thanks

rare charm
#

Surely I'm missing something obvious here. Why can't I connect Normal From Texture to the Vertex Normal?

regal stag
twilit stratus
#

how do i make a shader like this

olive brook
final hollow
#

anyone know offhand: is object space in range [-1,1], or [-.5,.5]?

midnight mortar
#

Hey guys!

#

I am creating this shader and fades the edges of a texture2d. When I test this out, it looks weird...

rustic dagger
# olive brook Healthbar

Are you using lerp() for the colors? I recommend using different color space for interpolating colors (like HSV)

midnight mortar
#

What exactly is it doing here? It does fade on the left side but I don't understand why the colors are getting inverted?

regal stag
midnight mortar
#

Nvm, i tested a Saturate node and it fixes the issue...

final hollow
#

ahhh, interesting

#

I thought object space would be normalized

#

that explains some things

raven jasper
rustic dagger
#

saturate() is like Mathf.Clamp01()

final hollow
#

so I made this neat custom node to get my plane into the shape of an airplane wing, right? and it works, but planes are one sided, and I'm trying to think of how to make this work on another plane facing in the opposite direction...

#

would scale be what I want here? set the backface plane to have a y scale of -1, and then multiply the output y value by the y scale?

#

no, thats not right, that doesnt make a backface, it mirrors it symmetrically below (which is what youd think i want because I said im making an airplane wing. but im not, im making a sailboat sail, which has the same shape)

#

so I dont want that, I want the other plane to be the back side of the first plane...

#

uuugh, wtf does the object node even do? it doesn't seem to be using this y scale of negative 1 at all

twilit stratus
raven jasper
#

I dont know sry

#

search for these terms and maybe youre lucky

regal stag
final hollow
#

uhm. oh

#

ha