#archived-shaders

1 messages · Page 244 of 1

sage acorn
#

Does anyone have a shader based solution for this?

simple violet
#

Make 2 planes :)

#

Or use a cube

vocal merlin
#

yeah using a cube is definitely the best solution

#

if you are really dead set against that, do this

#

This checks if a face if is front or back, then mirrors the uv's on the x-axis if it is a backface

#

@sage acorn

sage acorn
#

Ya that would be better because the plane has a cloth component to be a flag so it being a cube won't work I think.

steel notch
#

Is there a way to pull a color from a texture at the vertex function in shader graph?

#

Like don't interpolate between the UV values to get the color.

#

Just pull the color at the vertex function, and interpolate that instead, and apply the interpolated color during the frag function.

#

So currently my issue is that I have a model, and I have data associated with every vertex of that model.

#

I'd like to represent this data by coloring the vertices by this value.

#

I'm looking for a way to associate this data to each vertex in a way the GPU will like.

#

I was thinking of creating a texture where every pixel contained the values for one of the vertices.

#

And used the UVs of the mesh to point to where in the texture it should pull the value from.

amber saffron
#

@steel notch Is there a reason to not directly use vertex colors on the mesh ?

#

Else, you can use SampleLOD in the vertex stage and store the value in a custom interpolator, that you can later read in the pixel stage

steel notch
#

I'd rather save all the data onto textures and just swap the textures out.

#

And have the UVs handle where in the texture to pull from.

#

Much faster.

amber saffron
#

My second solution then should suit your need

steel notch
#

Can this be done in shader graph?

amber saffron
steel notch
amber saffron
#

You can add a "color" bloc in the vertex stage

#

Store the sampled color there, and in pixel stage, use the "vertex color" node to grab it

steel notch
#

Oh I wasn't aware you could add more interpolators.

#

"Custom Interpolator"?

#

Would it be possible to show a graph that does that?

steel notch
#

Thanks I'll give it a look.

pastel grail
#

hi, does anyone know if it's possible to declare global variables in a subgraph, or do I have to declare them in all of my shaders and pass them to subgraphs as arguments?

#

also damn never heard about custom interpolators that sounds neat

stray orbit
#

anyone know if there is a tutorial on gestner waves in shader graph somewhere?
I have followed a bit of a tutorial with code but i would like to see someone do it in shader graph to make it more simple

compact pebble
#

turns out making water is just using a shader or at least most of the tutorials I've seen just make a shader, but I wanted to know if I wanted like a large amount of water do I just make a really big plane and put the shader on it? Hmmm

dim yoke
mental bone
#

Most of the ocean size water Ive came across also do distance checks to the camera in order to simplify far away rendering and wave sim

smoky wind
#

reposting

molten shoal
smoky wind
#

mhm

#

i have the actual textures but i'm unsure of how they're formatted (and so how to connect them up to a blender shader)

molten shoal
#

Sorry for no understanding 😕 But, aren't all textures RGBA? What do you mean by formatted?

smoky wind
#

as in
what channels are used for what

#

e.g with how greyscale maps correlate to a value of 0-1 for some value (e.g roughness, metallic) and normals maps use each rgb color to correlate the direction of an angle

molten shoal
smoky wind
#

thanks for the help

#

after some amount of researching i did manage to figure out normal maps too

#

(image input is the normal map color, the g input is the normal map alpha)

molten shoal
#

That's weird .-. Glad it's working for you.
What I know about the normal map is that all we care about is the R and G, B is always 1 and alpha is not needed

smoky wind
#

apparently it's some weird normal map compression

lean lotus
#

Hey so I have a project that works on windows, but when I try to put it on mac, the play screen is black, but there are no errors? I am making heavy use of compute shaders for renderering, but have made sure to not use GetDimensions or atomics on textures, only buffers

crisp compass
#

very new to shaders, but does anyone know why this is in greyscale?

grizzled bolt
prime tusk
#

hey all, I'm working on a mod for Kerbal Space Program that enables some of the unity postprocessing features. One of them simply toggles allowHDR on the camera...but when you turn it on, sometimes you can "see" geometry through the places that should be getting extra light from HDR:

In the image on the left, HDR is enabled and you can see the outline of the flagpole, the horizon, and the objects inside the fairing.

The only difference between these images is the allowHDR setting.

It looks like transparency but I think it's more of a lighting issue...but does anyone have any idea where I should start looking?

#

hmm...a lot of the coloration when this happens looks like it's inverted - the blue sky turns orange, the dark flagpole turns white, the white parts inside turn dark and the dark parts turn light

near current
#

Hi guys. Im having some trouble wrapping my head around some shader graph maths.

#

Im working on a billboard shader for trees. The billboards are always facing the camera, and I want to rotate the normals in a way that corresponds the the original tree's lighting. So, if the camera is looking at a tree that is back-lit, when billboarding the normal should rotate towards the back of the billboard. If the tree is lit from the front, when billboarding the normal should rotate towards the main light, etc.

#

I'm running unity 2022, so I got the Main Light Direction node. But, for the life of me, I can't wrap my head around the maths involved. It must be the friday afternoon 🙂 Can anyone help me out on this?

#

ive been trying to use Dot Product between camera direction and main light direction, normalize that and construct a matrix of of that, and then multiply it by the position (kinda how I'm doing the camera facing rotation of the billboarding), but its not giving me (nearly) the result I'd expect

prime tusk
crisp compass
grizzled bolt
lean lotus
#

Why does this evaluate to true on DX12 but doesnt evaluate to true on opengl core?

  current_group.y = (uint)0x80000000;
}

while(true) {   
  if(current_group.y & 0xff000000) {
#

this is in a compute shader btw

#

well correction, it does evaluate to true, it just doesnt evaluate to true if its in that if statemtn

nova kindle
#

Has any one got any suggestions for this ??

crisp compass
dark forge
#

hey so I'm building a color quantization post processing shader in unity, and it's working great, but I'm getting this issue. So, when unity shades a flat surface, it sometimes creates a very subtle noise pattern at certain angles. It looks like this in context

#

but when I apply my filter this happens:

#

normally it's not this egregious since I'm working at very low resolutions

#

but I'm not sure if there's a way to fix this?

#

I'm almost certain it's not my shader bugging out, because without the filter applied you can see the noise in the dark part of this cube

#

if you look closely

shadow locust
#

I mean yeah it looks like your filter is working perfectly

#

Is this a shadow bias thing?

#

Not sure why it does that in the first place

#

Can you just reduce the sensitivity of your filter?

#

increase the color band widths?

dark forge
#

I tried adjusting these settings on the light source, but that really just "moved" it so it happens at a different angle

dark forge
#

reducing the sensitivity would only move the problem

dark forge
#

If i want to stick to the colors

shadow locust
#

tricky

stray orbit
#

anyone have tips on how to blend 2 textures in a way that it looks less tiled?

#

mostly how to make it less visible

meager pelican
# dark forge hey so I'm building a color quantization post processing shader in unity, and it...

Quantizing...similar to toon shading?
Here's an interesting thread, mostly about the impact of shadow maps, but it could get you thinking about other NdotL things too.
https://forum.unity.com/threads/toon-lit-shadow-stripes-artifacts.487561/

dark forge
prime tusk
#

I'm working on a mod, and I need to replace one of the base game's shaders. The game uses Shader.Find to get shaders from its assetbundles...is there any way to change the shader of a given name after it's been loaded? What happens if I load a new assetbundle that contains shaders with the same name as the old ones?

fossil cloak
tough island
echo flare
magic star
#

Hey, I'm new to unity and am just trying around a bit with shader graph atm. Noise seems to be much darker for me than I have seen it be in all videos / screenshots I have seen from other people. Does anyone have an idea what could be causing that?

heavy sinew
#

is that supposed to be a comparison? Like Up is the video and down is your version?

#

this noise looks normal to me
you could control how dark it looks with a power node

magic star
#

example of how it looks in a video i was watching

#

i'm using the same values

magic star
#

okay, i just tried making a new project but with the URP template instead (in the other one, i downloaded it afterwards to use it). i have honestly no idea what's going on with all these different URP files, but i assume that they're making the difference

#

much brighter

magic star
#

Version 2021.3.3f1 LTS

desert orbit
#

It's hard to say what's happening with this information, it could depend on color space settings. Also older URP / Shader Graph examples/tutorials could've displayed linear color space with correction, there were changes.

#

Correct for your own settings

magic star
#

new URP project

#

the other one

desert orbit
#

Use a node to correct brightness

magic star
desert orbit
#

Global color space settings

magic star
#

thanks:)

spring night
#

I was wondering if there was a way to apply a shader to shadows?

heavy sinew
lean lotus
#

Any tips for moving a compute shader from windows/DX12 to iOS? It’s producing really really weird behavior on iOS despite there being no reported errors

spring night
dim yoke
#

you can change the shaders that casts and receives the shadows but you can't just add single shader to the scene that would magically change all the shadow casters/receivers on the scene

timid dagger
#

Help, I have a really cool grow shader from a tutorial, but it looks like it changes everything at the same time that has the shader. What if I want it to be local to the current object the material is on?

spring night
dim yoke
#

assuming you use forward rendering, afaik youd have to change every shader that receives shadows to manipulate the appearance of shadows. I don't know how that works with deferred

heavy sinew
#

Aleksih is right, you would need to have every single material in your scene use a specific shader that applies said texture to the shadows. You can get light information in shader to apply your effect

naive shuttle
#

Hey, I want to create foam for a water shader, and I want to do this through collision with the terrain. So basically, the shader should create foam at places where the terrain intersects the water plane. I don't want to do it using depth nodes because that glitches when the player moves: the foam gets bigger when the player is closer to the depth, and it's smaller when they're further. It's really weird I can't explain it.

heavy sinew
#

It's usually most often done with depth my man.the easier solution would be to find what's wrong with your implementation rather than going for a completely different one.

#

Can you share images of your shader and/or the problem you encounter so that we may help?

grizzled bolt
naive shuttle
#

Alright

grizzled bolt
#

The distance map can then be used to draw the foam and waves
I don't have any tutorial at hand, but these may be the keywords for you to search

lavish stream
#

hello! i'm trying to pass the scene index into a shader for a debugging tool. I would usually do this using material property blocks, but the tool uses Camera.RenderWithShader()
does anyone know how to use material property blocks with Camera.RenderWithShader()? otherwise, i'm not too sure how to pass in the scene index

lavish stream
#

ok nvm! turns out RenderWithShader just references the mesh render's material properties so it kinda just works

weak condor
#

anyone know if there's a way to get shadergraph warnings for a given shader without doing a full build?

#

i am hoping to fix this error like...

#

hoping to find where my graph is div0ing

#

(potentially)

dim yoke
weak condor
#

yeah... it just dont line up so well in reality

#

i kinda got it sorted but i didnt know if there was a trick to all of it.

lean lotus
#

I cant find many resources on this but it seems really powerful, are there any reasources on temporal upscaling?

timid dagger
#

Why is there no option for vector1 as the output?

simple violet
#

Float

timid dagger
#

Thanks

lean lotus
#

How do I get the albedo from the camera of what the camera sees?

#

is there a global texture thats albedo?

simple violet
#

I think theres a node called scene color in shadergraph

#

@lean lotus

lean lotus
#

I need to end up accessing it in a compute shader

neat hamlet
#

"_CameraOpaqueTexture" ?

sly breach
#

anyone knows what's the performance impact difference when sampling the same texture twice VS sampling two different textures ?

silk sky
#

I've followed this tutorial for achieve a simple flag wave effect but doesnt seems working in 2021.3

Did Unity changed something?

https://www.youtube.com/watch?v=pzo4mitkY8k

In this video, learn how to create a shader to make a flag wave utilizing the Time, Sine, and UV nodes to give the flag a wave effect.

Speaker:
Andrew Jevsevar

Did you find this video useful? Room for improvement? Let us know: https://on.unity.com/2W0uLZr

Check out the Unite Now page to be among the first to watch upcoming sessions: https://o...

▶ Play video
grizzled bolt
silk sky
#

it just doesnt wave

#

nvm fixed

high ice
#

How can I apply fog on sprites via shaders?

naive shuttle
#

It's a water shader

#

The first 16 variables are just normal variables I'm guessing, so that's not hard to implement in a shader graph. The next 9 variables with 3 cascades however, I have no clue how to convert

#

If you're interested in helping me out, please dm me because I think this will take a bit of time

grizzled bolt
high ice
grizzled bolt
#

Shader graph has the fog node for URP which uses scene fog settings

naive shuttle
#

Converting Water shader to Shader Graph

grand jolt
#

I made custom shader graphs and now my light sources light up as if there aren't any objects. My shadows are gone

#

It was coming through the door windows like squares but I had to make custom shaders for my hw and it's gone

grizzled bolt
grand jolt
#

all of them do

#

they have seperate textured shadergraphs

#

lemme get a screenshot on one of them

grizzled bolt
# grand jolt

What do you see if you scroll this menu down
Is shadow casting enabled?

grand jolt
#

don't have shadow casting

karmic delta
#

Has anyone encountered this error when trying to use the GetMainLight_float custom function in Shader Graph?

All I can find online is a similar error for 'vert' but that was apparently a bug that Unity had to fix (which they claim to have done at this point)

#

I've set up the custom function exactly as displayed in other online resources as far as I'm aware

grizzled bolt
# grand jolt

Did you say you were on LWRP?
I'm a little lost which render pipeline and shader graph versions are being used here
The cast / receive shadow options were absent in really old versions, so you may need to force them on using debug inspector or something like that

karmic delta
#

Using built in atm

#

Woops

#

Nvm, wasnt to me

grand jolt
# grizzled bolt Did you say you were on LWRP? I'm a little lost which render pipeline and shader...

https://youtu.be/UxmIC92BqfA was following this tutorial

This is a beginner tutorial for Unity 2019 and the Shader Graph that I use in this example with the Light Weight Render Pipeline (LWRP).

When you have this temlate for your Unity projects the Shader Graph package is already contained and you can use it out of the box.

The shader that I create in this video uses a Simple Noise node and combine ...

▶ Play video
#

now I updated the project to a higher one

#

2020 lts

#

updated package,

grizzled bolt
#

Do you have some reason to stick to the ancient versions?

naive shuttle
#

Does tesselation exist in URP shaders? I've heard in many tutorials that it doesn't, though I'm not sure if there has been an update or not

grizzled bolt
naive shuttle
#

👍

#

I'll just add some more vertices to my plane

#

I think it will be best to create a few lod's for it

magic star
#

the preview for this specific shader is completely empty, there are no errors and it's working fine only thing not working is the preview. does anyone know the solution?

#

copied the shader and removed everything, still the same

grizzled bolt
magic star
#

🗿

grizzled bolt
#

Some suspicion that grouping / framing nodes may cause it

magic star
#

Alright thanks, I'll look out for that

grizzled bolt
# magic star Alright thanks, I'll look out for that

If you really need it fixed, I expect that deleting Library folder and letting unity regenerate it would fix it
Though usually it's much more effective to preview shaders using an object in the scene so it didn't seem like a terrible loss

magic star
#

True but the animations are very low fps in the scene viewer

#

and it doesn't move at all while out of focus

#

can i change that somehow?

magic star
grand jolt
#
  • some other convertors since I don't know how to model properly and need them to upload avatars
naive shuttle
#

Im trying to add a refraction in my water shader, though I get this weird refraction on the edge of the screen. the second pic shows a more amplified version

knotty juniper
naive shuttle
#

Hmm I see

knotty juniper
magic star
#

does anyone have an explanation for this?

naive shuttle
lean lotus
#

How do I stop compiling compute shaders for dx11?

#

also how do I use texture2darrays in compute shaders?

naive shuttle
#

How should I add more vertices, properly?

grizzled bolt
naive shuttle
#

I have around 15000x15000m of land to cover with water, so it should still work at a high performance btw.

naive shuttle
#

That's it

#

And that's the low poly version @grizzled bolt

#

My guess is that the uv is completely wrong

grizzled bolt
naive shuttle
#

though I don't know how to fix it

naive shuttle
grizzled bolt
#

Look up some basic UV mapping tutorial in blender

#

At a world size of 15 kilometers you may run into floating point errors, usually some kind of chunking and recentering system is used to avoid that problem in very large worlds

naive shuttle
#

I know how uv mapping works, though I think the vertices are just in the wrong position

naive shuttle
#

It's actually 25000 by 25000m

#

But the island takes up space which is why I said 15km

naive shuttle
#

What's wrong with it?

grizzled bolt
#

You may have more success and need less help if you practice with simpler and easier projects
Diving into the deep end when you don't know to swim is rather exhausting and unrewarding

naive shuttle
#

I've done so many things with shaders, and have watched around 10 tutorials on how to make water, and I need water. So I'm not giving up

#

And the problem I'm having here is that the uv is just messed up and all

#

I'm not guessing that's such a big problem right? There should be an easy fix that I just don't know about yet, because I haven't done it yet

#

And saying that I need to start with something easier is the same as telling a mathematics professor to go back to the basics because he forgot one equation

#

And fiy, here's the uv

grizzled bolt
#

I don't see anything wrong just by looking at it so maybe the problem is somewhere else in the dozen places it could be

grizzled bolt
naive shuttle
#

Yeah but the problem is, I always do things I haven't done before, so I just have to deal with it. I don't mind the challenges and setbacks, as I can only learn from them

grizzled bolt
#

As long as you don't get stuck

naive shuttle
#

Oh I do

#

I get stuck and waste 48 hours

#

but that's part of it

grizzled bolt
naive shuttle
#

Yeah but there's nothing I can do about it

#

I just get stuck untill I find an answer

#

it's not like I can force myself to find an answer faster

fair crest
#

In the shader graph, the time node outputs what time ? cuz i'm tryna sync it up with some script but I Think i'm having trouble

grizzled bolt
grizzled bolt
naive shuttle
#

Yeah well I've already done enough easy projects

#

And just because I don't know exactly 100% how everything is going to work, doesn't mean I shouldn't do it. I learn whilst doing it

#

So just leave me be

plucky hazel
#

Yeah, Uh, how can I create pseudo window holes like this, using shaders?(URP)

#

Would it be possible with stencil buffer 🤔

grizzled bolt
fair crest
plucky hazel
#

I don't think Oskar Stallberg is editing meshes to generate these. So I thought it might be a stencil magic 🤔 I don't really know any other approaches.

grizzled bolt
plucky hazel
fair crest
#

is the position given by URP target in shader graph in world coordinates ?

grizzled bolt
grizzled bolt
fair crest
#

I meant the position node

#

it says world space but i'm trying to understand why something aint working

#

so exploring every possible issue

plucky hazel
grizzled bolt
brazen mica
#

Hey, I'm still having trouble on this line glitch. does anyone know what it could be?

craggy jay
#

Does anyone how how I could go about preventing the overlap of semi transparent objects?

#

as an example, i don't want the semi transparent white square to be darkened by the black square underneath it

grizzled bolt
brazen mica
#

I tested it with a normal map both converted online and one converted in the engine.

#

alright, it's the normal map that's the issue.

#

idk why, when I go to convert it to normal map it sort of just turns yellow

grizzled bolt
brazen mica
grizzled bolt
# brazen mica

What does the texture look like before you set its type to normal map?

brazen mica
#

like this

#

it's in the top diffuse

craggy jay
#

still same result, even tried doing a 3d rect mesh to see if it was just the canvas being the issue

#

but it's the same thing

#

i used this shader as the base

#

ofc, changeing it to have ZWrite On

craggy jay
#

yeah, that's exactly what i'm trying to do

grizzled bolt
# brazen mica like this

Changing texture type to normal map doesn't "convert" it into a normal map
It still needs valid normal data to function as a normal map

brazen mica
#

Normal VS one without normal.

#

nvm, they look the same.

simple violet
#

I think normalmaps need an artist

brazen mica
#

Really? Couldn't there just be like a converter online or something?

grizzled bolt
brazen mica
#

I'm going to give it the same texture as the floor to see if that's the issue

#

so it was the normal map. but whenever I change the normal map, it goes dark brown and stuff.

grizzled bolt
#

@brazen mica It'll really help you to study what normal maps actually are and how they should be used

brazen mica
#

the light works now, but it's just like stupidly dark on the bottom and it makes no sense.

brazen mica
#

it worked and all but it was really dark.

grizzled bolt
#

Are those marked "normal map" in import settings?

brazen mica
#

yes

#

I believe it has to do with the triplanar

grizzled bolt
#

Could be, if it expects object normals instead of tangent normals, for example

#

iirc when sampling a normal texture in SG that also needs to be set to type normal in the node

brazen mica
#

normal = space tangent.
base = space object.

craggy jay
#

whoops, sorry about that

#

this is the shader i'm using, it's nothing complicated, just a simple unlit shader with a main texture and base color value

#

turning on z test does nothing for some reason?

#

the planes i have set up in my scene are just the default planes, nothing special or different about them

grizzled bolt
craggy jay
#

ZWrite

#

mistyped

brazen mica
#

Ok, so I found that the shader graph I made just doesn't work on the bottom for some reason.

#

it renders everything very dark for some reason. As you can see I used it on the wall, ceiling, and floor and all have a very dark bottom. I used a tutorial for this shadergraph, so I'm kinda screwed on how I should fix this.

meager pelican
# craggy jay as an example, i don't want the semi transparent white square to be darkened by ...

What color should the semi-transparent white square be in the overlap area? Same purple as the grid? Same white as the rest of the square?

And assuming the 2nd one, then that white square is not transparent except maybe to the opaque background, but not to any other transparent objects.

If so, what @grizzled bolt said is correct, except you have to draw in the opaque queue and somehow blend. Because in the opaque queue, objects are drawn front to back. But in the transparent queue, they're drawn back to front specifically to allow blending of transparent effects that are "stacked" on each other like your squares.

craggy jay
meager pelican
#

The problem is that you'll lose the background in opaque unless you use something like layers or cameras.

craggy jay
#

so, with the white square above the black one, it should just have a semi transparent white color instead of the grey color it is now

meager pelican
#

heh.

grizzled bolt
#

I think ZWrite should do that without any extra tricks, assuming the background isn't transparent
No idea why it isn't doing anything

#

I used to have trouble getting it to be enabled but now that I use SG for everything it hasn't been a problem

craggy jay
#

can you enable zwrite with shader graph?

#

i read somewhere that you couldn't

meager pelican
# grizzled bolt I think ZWrite should do that without any extra tricks, assuming the background ...

If you enable z-write (opaque queue has it on by default)...you'd get the white square, but no background and no grey square wherever the white is. So you'd use layers to draw the background first, and any other opaque stuff, and THEN use another layer or maybe camera and render the semi transparent stuff in the opaque queue (if you can get that to blend in SG, idk). Since it is drawn front to back, the closest square will write the depth and the other squares will fail the depth test, but there will still be a background behind it. Otherwise you'd get the clear color blended with the white square...I think.

In the transparent queue, you get the blending he's seeing now due to back-to-front sort, deeper objects are written first.

You could use a stencil operation if ALL your squares are stencil aware, but that won't work on SG because SG doesn't support stencils.

craggy jay
#

funny enough, setting to opaque queue does this

meager pelican
#

lol, that's shadow I think. Right?

craggy jay
#

I've set lighting off, and theres no shadow renderer in the shader

meager pelican
#

what's the black from then?

craggy jay
craggy jay
meager pelican
#

Try it from more-above, looking down.

#

both have to be in the opaque queue

craggy jay
#

yes, they're both using the same shader

#

and from below

meager pelican
#

No way that's doing z-testing.
What's the purple? Clear color or some opaque plane or what?

craggy jay
#

it's a standard lit material, completely opaque

#

it's a one sided quad mesh

meager pelican
#

OK

#

That's either a shadow somehow, or you're not z-testing, or something. Because the grey plane should be closer to the camera (like when you viewed it from above) and it should write z that is closer, and the black plane should fail the z-test where there's visual overlap. Like all opaque queue objects. Otherwise you could see through trees in opaque scenes if you turned blending on. So IDK.

#

Unless that white-ish color IS the right color.

#

without the black.

grizzled bolt
craggy jay
#

It's gotta be something with ztesting then? It impossible that it would be a shadow, since theres zero code for a shadow caster

#

i had ZTest Always set on

meager pelican
#

OH!
That basically means don't z-test. 😉

#

Always pass the z-test. It's awkward phrasing.

craggy jay
#

removing that line doesn't do change anything though

craggy jay
fair crest
#

Does the Position node take in account scale rotation etc ot the object the vertice is a part of ?

meager pelican
craggy jay
#

ah okay, figured out what z write does

#

without zwrite

#

with zwrite

#

seems to only be affected by the object's own faces instead

meager pelican
# craggy jay removing that line doesn't do change anything though

The zwrite command turns writing the depth to the depth buffer on or off. That's for the object being rendered, per pixel.
BUT...the ztest command is what decides if the pixel shader will even be called for any pixel, by comparing to the depth buffer BEFORE calling the pixel shader. So you won't write depth info for a pixel that is clipped due to failing the z-test. In fact it's called an "early z test" in most cases since the GPU can tell during rasterization that the pixel will be discarded because it fails the z-test.

grizzled bolt
#

I thought that enabling ZWrite for transparents would simply make them obscure each other by depth, but now I'm not seeing that happening

meager pelican
meager pelican
craggy jay
#

so I've got a result that's kinda in the right direction, using stencils

#

still messing with it and figuring it all out, but i'll post if i get it

meager pelican
#

You still have to deal with draw order, since transparent queue draws in the exact opposite way you want. You want front objects to obscure back-objects for your special transparent ones.

grizzled bolt
#

Seems a bit hard to search info for
If it'll be enough to use the opaques queue then I'm on the right track

meager pelican
#

Which is why I said you were right, but just use the opaque queue (and the right settings).

craggy jay
#

figured it out

#

just added stencil id to the shader and then added this code

#
        {
            Ref [_StencilID]
            Comp Greater
            Pass Replace
        }```
#

objects that are being masked out need to be above the one that's going to replace them

meager pelican
#

does it work if you look at it from the other side?

craggy jay
#

nope, but that's not needed for my specific case

#

thank you for all of the help though!! I really appreciate it

lean lotus
#

How can I send an unknown amount of textures to a compute shader at once, of varying sizes?

knotty juniper
lean lotus
#

doesnt support different sized textures

#

just spent around 5 hours trying to work around that

knotty juniper
#

either you need one array per texture size (if there is a limited ammout of predefined sizes) or padd the textures so they all fit in the same array
then you would need to send over a the the dimensions to use out of the textures into the compute shader

lean lotus
#

I was trying to do padding but resizing textures wasnt working

plain urchin
#

Hi all
Is amplify editor and shadergraph interchangeable?
Like vfx can accept shadergraph, can it also accept ase? Or theyre all just .shader in the end?

Can ase be converted to SG and vice versa?

kind juniper
clever swallow
#

Hi ! I want to create a mask for my objects to only show what is inside a sprite. I saw that you can create a sprite mask but it doesn’t work for text mesh… is there something I can do with shaders (I am new to it but feels like learning about it however)! Thanks for your help !

glass finch
#

I need to use the standarf surface shader so I can use the addative rendering mode

#

but when I change the shader it just turns pink

#

ofc has smth to do with the urp, but cant you use other shaders anymore when using the urp?

slate scroll
#

its because theyre made for the built in render pipeline so they dont work with urp

glass finch
#

so how can i apply this png as a map on the material D:

#

want to make an orb

fair crest
#

I have this vertex shader graph that makes waves out of a plane by putting the x axis of the vertices into the sin function

#

but for some reason when I scale the object the waves dont just expand but they change shape

#

like it stretches the ocean when it should only make it larger of the same thing

slate scroll
#

thats because youre working in local space, so you need to scale the waves down based your objects scale

scarlet crater
#

im having a bit of a dilemma here but im not really sure if theres anything i can do about it

#

and it works fine

#

but the problem i am having stems from how beat saber handles post processing, where the alpha channel is used to control bloom and transparency.

#

Basically, i'd like to blend out the black edges to make the transition between edge and background less jarring, but I can't do that without making the actual black hole part transparent as well

#

Would it be possible to, maybe put the black hole part into a seperate pass with different blending or something? idk what to do here lol

#

i hope that made any shred of sense

stark canopy
#

For some reason the Mask and the RectMask2D components are making my UI completely invisible on a Screen Space Camera Canvas. Anyone know of masking components that work with a Screen Space Camera Canvas?

weary nacelle
#

Does anyone know how to calculate the potential max radius value for Sphere Mask node?

drowsy fiber
latent mesa
#

why does it look like this when i put the material on a sprite?

echo flare
weary nacelle
naive shuttle
#

How would I make a shader follow the shape of a plane?

#

If I have a curving plane, or a road, how would I make a shader follow that curve

dim yoke
naive shuttle
#

Making a river

#

I know flowmaps, though I dont think theyre suited for a very long river

#

Look at this mesh for example

#

I want the water to flow in the right direction

mental bone
#

For this effect in particular you would create a flow map based on the uvs of the mesh

#

If your river is very long in the first place you should split up the mesh

#

And hide the seams with little waterfalls or rocks and stuff

frigid ether
#

One really easy way dor that is just to have straigth UV for the river

near current
#

Hya. Got a shader graph / optimization question; how are the shaders or materials compiled?

#

Lets say I have a shader with 2 texture maps, albedo and normal. If I dont assign a normal map to the material, will the Normal map things in the shadergraph be compiled out of the material so to speak?

#

Or do I have to use a shadergraph without any normal mapping?

shadow locust
near current
#

so the Normal map and all its connected nodes are being compiled and used in every material using that shader, correct?

#

So to optimize I'd have to use a seperate shader without any normal mapping etc for the materials where I dont want to use a normal map, correct?

shadow locust
#

The textures themselves are not compiled

#

any nodes you use in the graph are, yes

#

if you're not using them, theoretically you could save performance by using a different shader without them, but it's probably not worth your time unless you detect an actual performance issue.

near current
#

Ah ok thanks.

#

Well, it's about billboard shaders, for 1000's of trees. It might have a (slight) impact, but I'll test it out

#

thanks for the info!

wheat hill
#

You could also calculate it from the UV if you want (basically the position on the wire)
Not sure what that means (this is my first time using unity). Would that be any better for performance?

#

@shadow locust

shadow locust
#

it's just easier - doesn't require an additional texture on the material that you need to create

#

your wire mesh needs to be UV mapped properly though for it to work

wheat hill
#

How would I go about checking that?

shadow locust
#

well how are you creating the wire?

wheat hill
#

I'm not lol, it's part of an asset

#

I'm just repurposing it from the blood pressure machine it was originally on

shadow locust
#

right well, you'll need to start understanding the 3d model a little bit to get this working properly

meager pelican
near current
meager pelican
#

IDK where SG is on things like shader features and conditional compilation.

haughty tendon
#

so i have a screen full of little spheres. i need to make a shader which displays an image on all of them, displaying the image based on their direction from the camera so that when you look at the balls as a whole you can see the picture being displayed. i made something like this in blender but i dont know how to make it in unity

stark canopy
lapis ingot
#

Excuse the very basic question that I somehow can't find in google, how do I add a smoothness slider into the a new PBR shader/material? If i create a new material and assign it the default Lit shader all of this is there by default including the slider, but by creating a new PBR shader by Right Click>Create>Shader> PBR Graph i then have to manualy add things as properties but I cannot find how to add a Smoothness slider 🤔

modest zealot
#

I really need help...I need a way to render a 3d object in the background always—i.e., make sure everything else always renders over the object. I have tried sorting layers, I have tried z-test, and it is not working. I just need to render background objects first, and everything else overtop.

grand jolt
#

Please ping me if anyone answers, but how would I go about making a camera effect shader? For example, my player, story wise, is schizophrenic and he puts pills in his coffee that he drinks, and there's a guy in his mind chasing him. Basically after he drinks the coffee, I want an effect where the screen glitches out, then the guy is gone

amber saffron
amber saffron
lapis ingot
amber saffron
lapis ingot
#

Hmm, seems I cannot select a texture from the Inspector as its grayed out, the documentation mentions grayed out elements but seems irrelevant?

#

Also, the Enum on the material inspector seems to have the C option, even though i got rid of it on the shader graph (and saved)

amber saffron
amber saffron
lapis ingot
lapis ingot
#

One last thing, I notice that some Shaders have the icon on the left which will open the Graph Editor if i Right Click>Open, and some Shaders with the icon on the left that when i Open will prompt me to open its code in a text editor instead, what do you call this distinction? I'd like to know to be able to google them. Seems like if i had access to the graph and text editor for both types it'd be useful but that probably beats the point of a distinction

amber saffron
#

On the left it is a shaderGraph, that you can edit with the nodal editor, and on the right it is a "code shader", that is written with HLSL/CG and the shaderLab syntax

#

Note that under the hood, shadergraph is generating a shaderlab code file that is hidden 🙂

lapis ingot
#

Oh! I remember the shaderLab part from Freya's video that im watching right now

amber saffron
#

You can look at the generated code when inspecting the shadergraph file "View Generated Shader" button

lapis ingot
#

Oh sweet! Im glad its actually accesible

#

Thanks again for all the help, vague ideas were in my head but i couldnt wrap my head arround what to google to achieve simple tasks 😅

vast sail
#

is there a way to make vector2 properties plugged into scale and offset for textures not display as being vector4s? Not game ending they still work its just gunk in the editor

hexed surge
#

hey guys, I paint my generated terrain mesh with a texture atlas (uvs point to tiles)
now I want to add texture blending on the borders of different types of tiles and have no idea how to make that
all I can think of for now is marking the seams in a special map, but don't know how to later sample 2 different set of uvs to blend them
any tips ?

serene creek
#

Hello, anybody knows why some materials only look right after you open them in the inspector? For example this material will only look correct if I expand the material section in the inspector:

near current
#

Hya. In shadergraph Im trying to rotate the normal of a billboard so that the lighting is accurate. I got the main light direction and the camera direction, and want to rotate the normal using Rotate about Axis (i want to rotate about the Y axis). For the life of me I can't figure out how to get there

#

The Billboarding part in this graph works, but Rotating the normal doesnt

#

actually, the normal doesnt seem to be rotating at all, not even when I move the camera. I wasnt expecting this to give the exact result I wanted, but i was expecting some normal rotation, based off of where I am looking at the billboard from

#

anybody any ideas?

lone cave
#

does anyone know how to achieve an underwater effect?

blissful marlin
#

Does anyone know how I can strip the built in/legacy shaders while keeping the URP shaders?

simple violet
lone cave
merry oak
#

Hi, sry I'm very new to shaders and I don't really understand them, but whenever I try to make a shader in unity besides an unlit one, it just appears as pink, even if I don't make any changes to the code. If this is very basic but will take a while I would appreciate if someone could show me just a good tutorial for this.

shadow locust
#

you need to make a shader that's compatible with your render pipeline

#

If you're using URP - the basic "Shader" things from Unity's menus won't work with it - those are for the builtin render pipeline

merry oak
#

Oh

merry oak
shadow locust
#

you can still write them by hand but they work differently

merry oak
#

Ok thank you, I guess I'll try to find a tutorial for the shader graph.

shadow locust
#

Shader graph is generally easier to work with.

merry oak
#

ok ty I'll be sure to read this

languid mortar
#

Is there any way to detect the light levels on an object to use as a texture mask?

#

Let's say I'm shining a flashlight on an object, and I wanted to get the areas that the flashlight is hitting, and the intensity of the flashlight at each point on the object

#

(Flashlight/Spot)

grand jolt
#

I'm trying to add the oval of shine into the Eyes of Sonic's Forces model to use as a placeholder for my PRIVATE prototype of a Sonic 3D Collect-a-thon Platformer
But I don't see another way I could add that map on. does anyone know how to do so?

foggy delta
#

my reddot shader doesnt want to stand in place, anyway to fix it?

#

In this video I show how I've created realistic reflex sight in URP Shader Graph. It's also working with VR!!! :3 It probably do the job in HDRP but I haven't test it.

[PL]
Krótkie ogłoszenie - Prawdopodobnie nie będę już nagrywać tego co wcześniej, no sorki scrap mi się znudził ;_; na razie nie mam w planach usuwać starych filmików

#unity #...

▶ Play video
pine lily
#

I've followed this tutorial: https://www.youtube.com/watch?v=-a7n-4gILC8

How to control shader properties by script in Unity plus a simple and quick Shader Graph tutorial.
Shader not changing? Fix it: Make sure you change the Reference!
CHAPTERS :
0:00 - Getting started
1:27 - Shader Graph - Make a new shader from scratch
4:27 - Adding an editable property to the shader
6:10 - Set the reference value SUPER IMP...

▶ Play video
#

it's about changing color in a material via c# but the color change doesn't show at runtime only after I end runtime it happens in the scene view

#

it also happens for all objects that have that material I was trying to create a highlight shader that works per object

amber saffron
pine lily
#

@amber saffron I dropped in the material component from the GO but that didn't fix it

#

found how to fix it: private void Start() { usedMat = GetComponent<Renderer>().material; }

amber saffron
#

This should work.
Could it be that you have multiple scripts trying to edit the same material ?

pine lily
#

The script is on the GOs

#

I drag and dropped in the mat file

#

I think that was what caused it

amber saffron
# pine lily I drag and dropped in the mat file

This is maybe the issue. If you reference the material from the assets, it will edit the asset and keep the changes while exiting play mode.
But when you do Renderer.material, a copy of the material is done on the fly at runtime to avoid changing other objects

pine lily
#

yea I've realized

amber saffron
#

Whereas Renderer.sharedMaterial will directly return the asset, like if you referenced it.

pine lily
#

so if I wanted to change the material itself at runtime I'd use Renderer.sharedMaterial?

amber saffron
#

IF you want to change the material and see the change affect all objects that also use this material, yes

pine lily
#

nice thx that is good to know

pale nest
#

Hihi, I've been struggling a while now trying to add a sparkle effect to an non-shadergraph shader I have for a personal project, and I'm wondering if someone could help me out on it T_T

clever lynx
#

Hey, I'm using a Reflection Probe node in Shadergraph, when I display the reflection onto the model it does not take into account the normal map texture, how can I do this?

grizzled bolt
sick oasis
#

Hi, I got a bit stuck creating a shader. I have a .psb character imported - in photoshop I have a layer with the character clothes and another layer with the same clothes with different effects. When I put inside unity I'm assigning the material to the "main" layer clothes and I'm struggling to find the uv coordinates of the second layer of clothes. I hope that make sense

clever lynx
regal stag
clever lynx
regal stag
sick oasis
elfin mesa
#

Hi all! Is this the right channel to ask for help with trying to convert a standard surf shader into a URP compatible one?

simple violet
#

there's no easy way to do it

#

you have to do research into the libraries URP uses and see which functions are similar to the standard ones

amber saffron
#

Or remake it in shadergraph

hardy socket
#

do i have to do something with the shader graph to make it work in WEBGL Build ? i have "Invalid subscript vec","Undeclared identifier (SAMPLE_DEPTH_TEXTURE_PROJ)" & "SAMPLE_DEPTH_TEXTURE: too few arguments to a macro call.

stone tiger
#

Does anyone have any thoughts/pointers on creating the white outline grid as seen in this image: https://i.imgur.com/9nWrSUV.png - I can of course just create the texture but I'm wondering if it would be able to get procedurally generated via a shader?

zenith aspen
#

Idk if this is something that involves a shader or not but dose anyone know a way to create a form of halo around a planet for an atmosphere

dim yoke
zenith aspen
#

ill check it out thx

languid mortar
#

Why is it that when I select "alpha is transparency", my texture completely flips out, but only in Shader Graph?

regal stag
# languid mortar Why is it that when I select "alpha is transparency", my texture completely flip...

Shadergraph node previews show the RGB data without any transparency/alpha. It's common for colours to bleed out like this in transparent areas to avoid artifacts (like the colour darkening at the edges). Might also save space in the file format, not sure.
But the final shader result will still look correct as long as it's set to Transparent type (in Graph Settings tab of Graph Inspector window) and the A channel is connected to the Alpha port of the master stack.

near current
#

Hya, I'm struggling with my billboard shader for a while now. It's a lit shader (for trees), and I want the normals to rotate in such a way that the lighting represents the lighting of the 3D model it's billboarding; so when the 3d model of the tree is backlit, the billboard will be backlit, etc.

#

I'm having trouble with the normal rotation part. Its just not behaving as how I think it would behave

#

For example, the way I have it rigged now, I would think it would always rotate towards the main light, so all the trees should always be lit. But they are not.

#

Gives this effect

#

Does Anyone see where I'm going wrong with my thinking? And, how would I fix this?

#

Initially I thought: "if i rotate the normal the same way I'm rotating the position, it should accurately light the tree depending on the cameras position / main light" but that also gives the above example. Lighting on the trees doesnt change at all then

#

when moving around

regal stag
near current
#

like so?

#

Seems to give the same result as above, so not consistent lighting. But, the normals do seem to move based on camera rotation

#

it almost seems like the original rotation of the GameObject has something to do with it. If the original rotation is 0 (in this case) the billboard child objects seem to have the correct lighting when rotating the normals this way.

regal stag
#

I meant using the output of the Transform node directly into the Normal port on the master stack. Not sure if taking the mesh Normal Vector into account is important here.

near current
#

where everything goes awry in my brain is multiplying the position of the object with the constructed Vector3 direction, vs multiplying the constructed Vector3 direction with the directional normal vector

regal stag
#

In the above though you're using World space instead of Object for the Normal Vector.
The A & B order is also important when dealing with matrix multiplication so may need to be switched. Typically it's matrix first, but might be the other way if the matrix is transposed (built using Rows vs Columns)

near current
#

ahh ok thanks

#

Switched A&B and set normal vector to object

#

behaviour is nearly the same as earlier

#

Lighting does change upon rotating camera, but not uniformly. Setting parents objects rotation to 0 seems to get the correct lighting (based upon the main light)

#

Yeab B for the matrix seems to be the right way for the Position calculation like this

regal stag
#

Did you try putting the Transform output directly into the master stack too?

near current
#

Directly into the normal Master stack?

#

Same kind of behaviour

#

its hard to tell wether its Exactly the same (too many trees, to many variations)

#

but the lighting changes, but is not uniform. Just like multiplying the matrix out with the normal vertex (world or object)

#

Granted, I've never fully understood how rotation (of the billboard) translates into a position on the Vertex Master stack. But if multiplying the objects position with the constructed directional vector3 gives the desired position, wouldnt that mean that multiplying that directinoal vec3 with the normal vector (direction) is not the (direct) way to go?

rugged tide
#

Hello, I'm working with this cross-section shader that I found somewhere else. It shows only the slice of objects that is on a given plane.
I'm running into an issue where if there's any object with the same shader jutted into another, that small part where they're crossed isn't shown even when looking at a cross section of a different part of the object (so, if there's a sphere jutted into the bottom of a cube, the top crossection of it will still have that "hole" where they intersect, even if the intersection is on the bottom face)

#

here is an example, the white is the crossection of a cube, once the sphere intersects the cube (but not the square-crossection), it gets messed up with that hole

blissful marlin
#

Does anyone know where I can find info on only building manually specified shader variants for a project?

regal stag
# rugged tide Hello, I'm working with this cross-section shader that I found somewhere else. I...

You'd likely need to override the depth of the back-faces so it's at the cross-section plane, rather than the cube. Then the depth testing will be correct.
Can override the depth value via a fragment output with the SV_Depth semantic (or SV_DepthGreaterEqual).
Not entirely sure how to calculate the depth value off the top of my head though. I guess a ray-plane intersection with the view dir.

fair crest
#

So i've made this wave shader that simply displaces the vertex by a sin wave of time + its x position, it works fine but the problem is when I scale the plane it's on the waves gets stretched instead of keeping their shape.
How can I adress this, I'm sure its an easy fix

regal stag
fair crest
#

It's a shader graph

blissful marlin
#

I've seen docs and examples on shader stripping where you define which shaders you don't need. I'm curious as to how to do the opposite, where all shaders are stripped except for a defined list. Sorry if it's a trivial question I'm just a little new to how shader variants are built

fair crest
#

this is the end of my graph

#

and I use an absolute world position for input

regal stag
fair crest
#

Yes thank you

#

Why was my setup not working ?

burnt wigeon
#

same reason of why a cube gets distorted into a rectangle if its parented to an object with a different scale

rugged tide
vast sail
#

is there a way to make vector2 properties plugged into scale and offset for textures not display as being vector4s? Not game ending they still work its just gunk in the editor\

fossil cloak
#

Nope

#

Only with 2 Floats

vast sail
fossil cloak
#

Yeah, its jsut dumb, that a vector 2 looks like a vector 4 in the inspector 😄

elfin mesa
regal stag
#

@vast sail @fossil cloak In Unity 2021.2+ this has been changed, and Vector2 fields now show with only X & Y boxes. Also Vector3 shows as XYZ.

fossil cloak
#

😮 nice

north thorn
#

I'm honestly torn about where I should be asking, but I'm working on a mixed reality project and I have a point cloud associated with some intensity values at each point

My goal is to visibly display regions with high intensity values as... clouds colored based on the intensity values, since the readings may not be 100% locationally accurate I wanted them to show a general area rather than a point

My initial experiments with particles didn't meet my expectations, and a shader approach fell short in my own capabilities

I feel like shader might be my best approach for efficiency on the MR hardware but I'm unsure of my approach

I ran into some articles describing ray marching for fog-like effects, but I'm not really sure what I'm doing at this point

broken sinew
#

how do I get distance from near plane from depth texture?

#

I tried LinearEyeDepth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture), i.vertex.xy)

#

I need it to limit my raymarching distance, to make it blend with other unity objects

north thorn
#

... I think I want to have volumetric particles
I'm not a fan of my particle system or my shader billboards clipping into the spatial mesh

merry oak
#

how do I find the angle between two directions in degrees inside the shader graph?

merry oak
#

I'm trying to see a plane representing where the camera can see, so I tried to set up a shader where it is invisible if it can't be seen by the camera. However it isn't seeming to do anything.

#

the alpha clip threshold is set to .389 because I'm pretty sure that's what it needs to be with a camera fov of 35 degrees

burnt wigeon
#

try using the camera node

#

I had the same issue yesterday

#

for some reason the camera node's direction worked for me

#

I would suggest connecting it to the base color node to debug it, makes it a bit easier to see if it's working

north thorn
#

I... just can't Z buffer.
Trying to copy some soft particle code into my point cloud shader and the z buffer is all 0
Perhaps because I tried doing it in the geometry shader? Idk.

#

Gave up after a few hours of debugging.

grand jolt
#

Hello?

#

I want help Importing ALL textures of a Sonic Forces FBX model PROPERLY

graceful yoke
merry oak
#

I tried this, but it's doing the same thing.

burnt wigeon
#

let me open the project and see what i did exactly

#

wait, no i meant replace view direction with camera direction , you gotta use the normals

burnt wigeon
#

@merry oak

#

Absolute world worked for me

#

and view space for view direction

merry oak
#

oh alright I'll give it a try

#

I closed unity a bit ago and it usually takes a couple minutes to open, but I'll let you know when it's done.

#

hmm, that gave an interesting effect, I'm not sure if I did it right, but it's fine. I'm guessing I can find a tutorial on it tomorrow.

mossy moth
#

Is it possible to like make shaders in normal 3d pipeline after importing shader graph

burnt wigeon
rough haven
#

so i know invlerp gives you a fraction based on the value you input between a range but i dont understand what that means when the value is uv.y, eg: float t = InvLerp( _Value1, _Value2, uv.y );

#

so if its 0-1 and your value is 0.5, it gives you 50%

#

but what is the value for uv.y

amber saffron
rough haven
#

hmm

meager pelican
#

uv.y would be the value that you're trying to find out "how far along it is".

#

So a inverse lerp between color 1 and color2 for a pixel P is InvLerp(_Color1, _Color2, p) it could be .369322 of the way through the range.

#

That's the inverse of lerp, where you would say color3 = lerp(_Color1, _Color2, .369322) and get your color result as a little over a 3rd of the way through the gradient between the two colors.

rough haven
#

i think it clicked

mental bone
#

I'm trying to scale each vertex , or triangle, of a mesh to achieve a sort of digital "appear effect". I'm struggling to make in shader graph.

#

all I'm achieving is uniformly scaling the object

amber saffron
#

You could proportionally move the vertices downward to fake it.
Else, you need to find a way to "roll" the vertices around the perpendicular axis of the movement.

amber saffron
mental bone
amber saffron
vocal narwhal
#

You also need a hard-edged mesh otherwise the triangles will be joined to each other

amber saffron
#

Also this yes 😄

#

sin/cos and rotation matrices :/

vocal narwhal
#

It might be something that's easier to emulate with VFX graph—with a similar-looking effect that's not the triangles explicitly

lucid current
#

How can I make transparency T 1 of a face looking forward or backward the camera and T of zero when face is looking right or leftward the camera?

#

i tried this, but it works 50% of the time

#

i need smth like fresnel effect here

mental bone
#

ok I thought I could make it but I'm stumped again @amber saffron ``` [maxvertexcount(21)]
void GeometryPass(triangle Varyings IN[3],inout TriangleStream<Varyings> triStream)
{

        float4 center = (IN[0].positionWSAndFogFactor + IN[1].positionWSAndFogFactor+ IN[2].positionWSAndFogFactor) / 3;
        
            Varyings o;
            for(int i =0; i<3;i++)
            {
               o = IN[i];
               o.positionWSAndFogFactor = (IN[i].positionWSAndFogFactor*_Scale) - center;
               triStream.Append(o);
              
            }
            
           
        }``` as far as I can tell this should result in at least some sort of scaling but all it does is change the way the light reacts to the object
regal stag
#

The result will be -1 in the opposite direction so can Absolute it to get 1 in both

mental bone
rough haven
#

how do i get rid of these, is this a mesh thing (default unity sphere)

#

edges i mean

mental bone
white marsh
#

Would antialiasing post processing make it look rounder? I can imagine it could help but not sure if it would really be noticable or not

mental bone
#

not at that scale no

#

when it comes to spheres the build in sphere is rather low-polly

rough haven
#

thats what i figured

white marsh
#

Yeah, well you are lucky spheres are easy to model catnod

grand jolt
#

and this is just for a Private Proof Of concept for a 3D Sonic Collectathon Platformer

amber saffron
#

If you want sonic models for a PoC, I'm pretty sure you can find some free already on the net.

rough haven
#

i have a shader with diffuse lighting and takes light and changes based on the direction

#

however it doesnt change when i rotate the object itself

#

how can i amend this Think_Eyes

#

this is what it looks like rn

rough haven
#

ah nevermind

#

had to translate my normals into worldspace

#

with this o.normal = UnityObjectToWorldNormal(v.normal);

grand jolt
#

I will make sure it never happens again

white marsh
#

I don't know the actual rules for this but ive heard some very well known games that started as gamejams used sprites from old zelda games. But ofc they didn't keep it when it was going to be a commercial product.

#

Either way when i think about it this isnt the place for this conversation

elfin mesa
#

hey again all, hit another bump in the road. I've got my colour restoration shader graph working so it restores colour as a mask passes over the objects in world space, but it only works when all objects share the same texture (left group in image). I want this to be able to work with any texture on any object, so I tried assigning the texture via script (right group) but the slider for controlling the mask becomes unique to the object instead of being applied to all objects despite the objects in the right group sharing the same material. Any ideas on how I can overcome this?

tropic field
#

I have a confusion regarding a particular thing I want to achieve in shadergraphs

#

I have this group, which gives me a sort of "mask" or black and white gradient of where the object is intersecting with other objects

#

I want to use this as an opacity mask

#

to combine with this

#

I have the Waves&Ripples group, which outputs this texture.
I have a "FoamColor" node which is just a flat colour.

I want to combine them both, using the "Intersection Foam" output as a mask

#

in blender I would have simply plugged in the "Intersection Foam" into the Factor in a Mix Node

#

Is there an equivalent in unity

amber saffron
tropic field
#

Works as expected! Thank you so much

elfin mesa
amber saffron
elfin mesa
dapper pollen
#

im a bit confused by deferred in universal, for changing the lambert lighting model in forward all I did was modify the Lighting.hlsl but in deferred is it the StencilDeferred.shader?

devout fulcrum
#

One question

#

How can i change the surface type to make it transparent?

#

Cuz i saw some videos of it and it doesn’t seems to still be in the latest version

#

That little gear on the corner to change the surface type

#

Is there another way to change it?

#

Oh wait nvm

#

Found it

#

I need actual help with something else

#

So, I basically just finished doing a shader on shader graph

#

And

#

I’m trying to apply it to the model

#

But the thing is, that it doesn’t appears

#

I already converted it to material

#

Assigned it to the model

#

And it doesn’t shows up on game view

amber saffron
devout fulcrum
#

Yes

amber saffron
#

Mais some compilation issue ?
It should show up

#

Maybe share some screens ? The shader, the material, the scene

devout fulcrum
#

Ok

#

Let me share it

#

the shader in general is basically like this

#

it's the ripples shader graph

#

i saved it as a material

#

and i assigned it to a copy of this street

#

in the game view it's like it's not even there

#

well, i added a transparency but even without transparency it doesn't loads

restive radish
#

Is there a way to change the lighting model of a shader graph without remaking it as an unlit shader?

pine lily
#

how do I make a color tint on a texture with shader graph? I've tried multiplay but that won't let me change the intesity on 3D objects like it does with sprites: https://www.youtube.com/watch?v=93jnsgD-8Wo I'm guessing it's because it is color 3 and not 4.

✅ Get the Project files and Utilities at https://unitycodemonkey.com/video.php?v=93jnsgD-8Wo
Let's make a cool Sprite Tint using Shader Graph. This is excellent for Heal and Damage effects.

Check out the entire Shader Graph Tutorials Playlist
https://www.youtube.com/playlist?list=PLzDRvYVwl53tpvp6CP6e-Mrl6dmxs9uhx

If you have any questions pos...

▶ Play video
amber saffron
# devout fulcrum the shader in general is basically like this

Meh, no easy to understand what is happening :/
But if the shadergraph is properly saved and compiled, assigned to the material that is itself assigned to the mesh, it should work.
Double check if there is no compilation error in the console, and that all the settings have the proper values on the material.

amber saffron
restive radish
#

thanks

amber saffron
#

Unless you feel adventurous and want to implement an additional target for shadergraph.

restive radish
#

I'm using urp

pine lily
#

Managed to get it to work with blend and opacity

elfin mesa
# amber saffron Yes. Also enable "Override Property Declaration" and set to "Global"

sorry Remy, it doesn't seem to be working as intended. after updating the script and trying to adjust the the sphere mask from the script's slider, the mask disappears entirely. I tried turning off the "Exposed" element for the variables I want to have the global control over but it doesn't seem to change the result. I've double checked the reference names in the script and they are exact matches. could it be the way I've set up the script that's causing this problem?

amber saffron
elfin mesa
amber saffron
#

Would space should be the good way to do it.

elfin mesa
#

hmm not seeing any changes

amber saffron
#

Let me try it out quickly, to check that I didn't say nonsense 🤔

elfin mesa
#

incidentally, should I be seeing the slider from the shader graph update to match the slider value from my script if it was working correctly?

#

if I should be able to see it update, then its likely that I messed up my code 😅

amber saffron
#

So, property need to be hidden, but it works

fair crest
#

Anyone know of a shader to hide a water mesh inside of a boat ?
I've tried this but it doesnt do what I want and just acts odd
https://www.youtube.com/watch?v=z2uFaBoYhaY

How to Use Depth Mask to Hide Water in Boats in Unity

1:06 to skip Intro
5:14 to jump to Blender Instructions

Have you been trying to figure out how to put your boats in the water, but not let the water seep in? Then this tutorial is for you!

Here is the Unity Wiki on the depth mask:
http://wiki.unity3d.com/index.php/DepthMask

Last I checked...

▶ Play video
amber saffron
#

@elfin mesa Did you disable "exposed" on the global property ?

elfin mesa
#

I did yeah, but no success

#

is it alright if I share the script? just to be sure I definitely didn't forget to do something

amber saffron
#

Go on

elfin mesa
#

this is it, did I stupidly forget anything?

amber saffron
#

You could just do Shader.SetGlobalVector("xxx", transform.position); (and not local position, if you want to be sure to have world space positions)

elfin mesa
amber saffron
#

You've initialized the variables in the start function, but don't update them.

elfin mesa
amber saffron
#

Nope, not related

amber saffron
#

So, it's working now ? 🙂

elfin mesa
# amber saffron Nope, not related

I apologise for the incoming basic programming question, but since I've muddled myself up thinking that I was updating it correctly, how should I be writing out the code? 😓

#

I'd come across a couple examples online that had done it this way so thought I was on the right path

amber saffron
#

Well, you did it correctly, taking your code you only need to add sphereCentre = transform.position; at the beginning of the update loop, and it should work (typo in the variable name btw I think 🙂 )

#

This will update the variable with the current position of the object before sending it to the shader the lines after.

#

You only need to do this IF you want to use the position of the object as center of the mask, but if you just want to use the variable itself, you should see it update directly if you change the value in the inspector

elfin mesa
#

ohh I see, okay that's good to hear the code wasn't too far off from being on the money!

elfin mesa
amber saffron
elfin mesa
#

sad news unfortunately, it still does not appear to be applying the mask despite everything

amber saffron
#

Here's the shadergraph :

#

And the code :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[ExecuteAlways]
public class GlobalShaderPropertySetter : MonoBehaviour
{
    private void Update()
    {
        Shader.SetGlobalVector("_Pos", new Vector4(transform.position.x, transform.position.y, transform.position.z, transform.lossyScale.x*0.5f));
    }
}
elfin mesa
#

huh, perhaps my shader graph is incorrect 😵‍💫 this is my shader graph:

#

the texture that I've applied was just added for some clarity, its still set correctly via script

amber saffron
#

Should be good

#

Once again, check that the 3 properties in the graph for the sphere mask are set to global and not exposed

elfin mesa
#

I believe they are all set up correctly

amber saffron
#

Yes...
And it's still not working ? 🤔

elfin mesa
#

sorry for taking up your time Remy, I'm just so stumped by this

#

from what I can see, it still does not work 😣

amber saffron
#

Shouuuuld 🤔

#

Do you mind moving into pm to avoid continuing to take all the space here, and maybe do a screen share ?

elfin mesa
#

yeah, of course!

fair crest
# amber saffron Search for stencil masking

I messed around with some example projects but havn't been able to reproduce it.

On the one you sent I cant seem to open the zip and I wouldn't understand the graph anyways if I had to guess (cant even find the one that does the water hiding thing)

#

Any more straightforward stuff ? Stencils are confusing

#

I just need a shader that if a pixel renders a stencil then the pixels under it will not render another particular set of object

gray harness
#

what object do i pass to compute shader so on the other end it recieves as texture3D?

#

pls ping me if you answer

grizzled bolt
#

if I need to make some animated grass in a pinch, what options should I consider? I'm dizzied by the number of them

#

And sometimes the information seems conflicting

mental bone
#

In a pinch ? Go for the tried and tested vertex weight paint on a simple mesh and move the gras based on that

white marsh
#

Isnt there some free ones on the asset store or built in to unity?

meager pelican
grizzled bolt
candid nimbus
#

Hey, i am using a URP Unlit Shader graph here, but i cant get any image to fit the geometry, is their a way to no matter what picture i have on the card face, fit within the geometry ? or without telling me point me in the right direction ?

fossil cloak
worthy verge
#

anyoen have any idea how to make a billboard shader that only rotates on the y axis?

#

i've been looking for one and the ones i find online all show up invisible

fossil cloak
#

You can do it via script

hard estuary
#

i'm having a really big problem can u help me

fossil cloak
hard estuary
#

so every time i try to make a new project it gives me an erro and tells me to check the logs
like so

worthy verge
fossil cloak
#

maybe a little less performant, but not that much i think

magic star
#

any fix for the preview in shader graph not showing anything at all?

#

it's broken for me on most shaders

#

okay it seems to only be broken when i change them material to "lit"

#

and decal*

restive radish
fossil cloak
mystic sable
#

Or does anyone have any ideas on how to replicate it?

fossil cloak
mystic sable
#

thanks

grizzled bolt
mystic sable
grizzled bolt
mystic sable
#

yeah the way the light reflections work on the water feels very "static" if that makes any sense

elfin mesa
#

hey again all, I'm trying to figure out the best way to create an emissive coloured edge around the rim of my sphere mask - something similar to the attached image. I've come across a couple examples online written as standard surf shaders that use clip() to achieve this effect, what would be the right way of rewriting this function in shader graph? I couldn't find a node that performs this calculation so I assume I need a few nodes to perform this calculation, or if there's a simpler way to get a glowing rim then I am open to suggestions! 🙂

upper stump
#

hello i am a sttudent in a coding school and for my project i want to make a simple one level game with ray tracing i have the system reqirment but i dont know how to do it does anyone know a tutoriel or anythung elese

grizzled bolt
#

Though you may need to invert the logic in some way if you specifically want the glow rim to happen on the ground rather than the sphere's surface

elfin mesa
elfin mesa
#

could someone confirm for me if the Fraction node in shader graph is the same as the frac() function in CG?

dim yoke
#

what kind of bending you mean?

#

I don't think single matrix alone can do that. afaik matrices can only represent linear transformations (translate, rotate, scale, stretch, combination of those etc.)

#

matrices can do rotations but you can't have matrix that rotates differenty on different parts of the model, rotation matrix would rotate all the vertices same way (unless you change the matrix per vertex according to y position for example)

lean lotus
#

is there a way to do "bindless textures" on gpu compute shaders in unity?

wary horizon
#

this is very simple i imagine, how do i scroll this noise map?

#

I basically just want to make a slightly oscillating lava shader

dim yoke
wary horizon
#

that just makes it a solid colour, and flashing immensely fast

dim yoke
wary horizon
dim yoke
wary horizon
#

your initial reponse said Change the UV value

#

offset works, thank you

dim yoke
tiny gust
#

Question: Does doing something like this (stopping animations at a certain distance from the screen) help with performance, or is this method useless?

dim yoke
tiny gust
#

aww dang :/

#

i wanna have animated foliage but i would like the far away ones to choose performance over quality

#

idk if swapping materials would be the right path for that or something else

remote light
#

Hey folks, I'm getting an issue which I assume is shader related but not sure as the logs aren't reporting any errors. In a nutshell it only happens in Standalone PC builds, not in the editor, and only after the game has been running for around 30mins or more. And it only happens when a scene has just been loaded (either when exit a scene and enter a new one, or re-load the same scene)
The screenshots here show what it should look like compared to what it looks like when it glitches out
I suspect it's a problem with an Amplify shader or maybe some custom post processing effects, but because the issue is hard to recreate I just want to get some opinions before I pour too many hours into it
I'm using Unity 2019 SRP, and OSX 10.15

topaz root
#

Hey y'all. Basically, I'm working on a system to procedurally generate planet models using Shader Graph. The issue is that whatever I'm using to generate continents is looking absolutely abysmal, basically. I'd like some advice on how I could get noise with higher "roughness" without using the current system which gives me super messed up continents. Thank you!

shadow locust
#

oh wait are you doing that already? 😛

topaz root
#

Yep! Was about to say lol.

shadow locust
#

your bottom noise looks very fuzzy still though

#

I'd do some hard cutoff to make clear continents before applying the roughness patch to it

topaz root
#

That's like the base of the planet, crude pass

#

Oh okay, that's a good idea. Thanks!

topaz root
regal gorge
#

Do I need also make custom shader for my materials and "render" fog on top of them to avoid things like this when sunrise?

#

Right now fog is enabled in lighting settings in URP.

grizzled bolt
#

I believe a common way is to reduce grass height over distance to zero and cull the mesh at that distance entirely, among other optimizations

meager pelican
# tiny gust i wanna have animated foliage but i would like the far away ones to choose perfo...

If you have to ADD logic to calc distance and branch for a particular frame of animation, you're ADDING cycles to the total time it takes. That might not be too bad in a vertex shader stage, but it's still MORE time than it takes to just calc the frame.

As you say, and as others have said, swapping out the material for one with NO calcs might make it faster. But now you have to analyze everything per-frame to decide if you want to swap it out or not, and that will cause time delays. Or maybe you can "just" do it based on camera position (with a distance calc) and not screen position.

It's a catch 22.

Here's how it works. If all gpu cores in a thread group take the same branch of an if-else, you can skip the other not-used one. But if even one core of the, say, 64 cores in the wave takes the other branch, they all take it but most are masked off. So you'd incur the cost of both sides of a branch.

So if you think about it like ^^, you'll find that the trees in the distance might all take the "off" branch, and the ones close will all take the "on" branch, and then there will be some in the middle that are processing things that could be in middle ground and take a two-way hit. But the only way to tell if you're gaining anything at all is to actually run some benchmarks and find out, for your calcs in your scene, how it all shakes out each way.

dim yoke
#

What is the correct way to get the actual time (in c# script) value used in shader graphs Time node. neither Shader.GetGlobalVector("_Time").y nor Time.timeSinceLevelLoad seems to be it

meager pelican
#

Did you try Unity's Time class? IDK for sure but I'd assume they're synced with what they past to the shader variables.

So Time.deltaTime and such.

grizzled bolt
#

I told someone to use Time.time as an equivalent of node time, and they said it worked so I guess it does

regal stag
#

The best way is to just make your own time variable

tropic field
#

sloowly..

grizzled bolt
#

Strange but not unexpected
Cyan's suggestion is the way to go then

meager pelican
#

Then do what Cyan said and pass your own so you know what it is and both sides agree. But you'll still get it from the Time class.

tropic field
#

I see... so basically pass Time.time into the shader, and in c# both

#

so they are both on the same page

meager pelican
#

P.S. I have no idea how shader-time gets out of sync in that node, since shaders don't retain values between frames unless you work at it really really hard.

dim yoke
#

I don't think this is the actual issue because the difference in times is so small but still I'm wondering why _Time doesn't get reseted when loading a scene even though the docs says that _Time is:

Time since level load (t/20, t, t2, t3), use to animate things inside the shaders

steady pike
#

is it possible to morph from one ·3D model to another 3D model through a shader? cuz for now the only good solution I found is done with mesh scripting

dim yoke
#

you can't really change the vertex count or anything like that but you can move the vertices around in a way you want

regal stag
dim yoke
steady pike
dim yoke
#

ray marching could do that very easily but in that case youd need to define both models as a mathematical distance function and not 3d mesh with vertices etc.

steady pike
#

u talking to me? XD

meager pelican
# steady pike is it possible to morph from one ·3D model to another 3D model through a shader?...

It's theoretically possible, but likely impractical. With a shader, AS A GENERALIZATION, you get ONE mesh that you're processing...not two meshes.

However, you can pull a lot of fancy tricks and a special setup where the two meshes have the same number of verticies. So you could be processing some "base" mesh, and have a buffer for a 2nd mesh's vertex data (maybe a structured buffer), and use SV_VertexID info and then lerp between the two verts for MeshA and MeshB.

But you're biting off a lot if you even have to ask the question, you might want to be careful of what you're getting into.

steady pike
#

okay okay, I mean I have a way of doing it already, I wanted to check if it was more powerful though a shader

dim yoke
steady pike
#

I use this if u r interested but not a shader

steady pike
dim yoke
#

if the mesh is not super complex, implementing that in a shader may not be worth the effort (and even then using compute shader would be better than vertex/fragment shader)

meager pelican
#

Assuming it's even possible to represent the mesh with an SDF...raymarching is also pretty slow over all.

dim yoke
#

that's also true

steady pike
#

the meshes are usually a bit complex and I'm supposed to do it with meshes they give me, not meshes I edit (if possible), so I'm looking for ways to morph models with a different number of vertices

#

which is of course (from what I've found for now IN UNITY) not feasible

meager pelican
#

lol, sucks to be you.

#

😉

steady pike
#

but even if it's not feasible I have to explain it in my project

#

I know I know hahaha

#

no worries

#

just checking, it is also interesting

meager pelican
#

Let's go back to what @dim yoke is saying then.

#

So you can morph a cube with N verts into a sphere really really easily. Because a sphere calc is just a distance from center, regardless of how many verts there are.

#

You don't even need ray marching.

#

But if you want complex meshes and to morph, you'd have to pass in one model, and then the other model...and somehow calc for each vertex of Mesh1 how close it is to the nearest vert AFTER the morph is complete, and then decide how far to go between Mesh1 (start) and mesh2(final) and lerp that distance.

So you'd have to iterate through Mesh2's data, projecting Mesh1's vert onto it.

steady pike
#

I think I use something similar in the script I shared before

#

but yeah, same vertex number tho

#

I will send screenshots of the code if u guys are curious but feel free to send me to another channel if I've gone off topic already

meager pelican
#

This kind of thing is done with blendshapes, but it's not for the faint of heart. Might be worth the research to figure out how that's done for things like complex facial expressions.

grizzled bolt
#

@steady pike If the meshes have the same topology and you know how to use modeling software, shape keys would be a very simple way to go about it, I think

meager pelican
#

Yeah, push it all back onto the modelers. 😉

tropic field
#

it still goes off sync..

#

using a float instead of the Time node

#

and incrementing it in script by 0.001f

#

in void Update(){}

meager pelican
#

Set it from Time.delta time, or or some other time variable.

tropic field
#

Im not using Time.whatever at all

meager pelican
#

That's your problem. How are you determining it is "out of sync"? out of sync with what?

tropic field
#
WaveTimer += 0.005f;
rend.material.SetFloat("_Wave_Timer", WaveTimer);
#

I manage my own time variable

#

then pass that into the shader to be used in place of the Time Node

#

so that

meager pelican
#

So how is it "out of sync"? It's SET.

#

it's a float passed.

#

The shader and the CPU are using the same floating point value.

tropic field
#

I use the same time variable below in the C# script

#
    Vector3 GetPosition(Vector2 posXZ)
    {
        float waveSpeed = rend.material.GetFloat("_Wave_Speed");
        float turbulence = rend.material.GetFloat("_Turbulence");

        float time = WaveTimer * waveSpeed; /*Time.timeSinceLevelLoad //Shader.GetGlobalVector("_Time").y*/
        Vector2 addNode = posXZ + Vector2.one * time;
        float gradientNode = Unity_GradientNoise_float(addNode, turbulence);
        Vector3 multiplyNode = new Vector3(0f, gradientNode, 0f);
        Vector3 objectSpacePosition = plane.InverseTransformPoint(new Vector3(posXZ.x, 0f, posXZ.y));
        objectSpacePosition.y = 0f;
        Vector3 finalAddNode = multiplyNode + objectSpacePosition;
        return plane.TransformPoint(finalAddNode);
    }

These calculations that I do in

tropic field
#

im trying to replicate the exact same stuff my ShaderGraph does in C# instead

regal stag
#

Maybe there is something else in the calculation that is different

tropic field
tropic field
#

im not sure though

regal stag
#

Probably in the Gradient Noise calc then

meager pelican
tropic field
#

When I look at generated code of the shadergraph

#

this is what it returns

#
    Vector2 unity_gradientNoise_dir(Vector2 p)
    {
        p = new Vector2(p.x % 289, p.y % 289);
        float x = (34 * p.x + 1) * p.x % 289 + p.y;
        x = (34 * x + 1) * x % 289;
        x = ((x / 41) % 1f) * 2 - 1;
        return (new Vector2(x - Mathf.Floor(x + 0.5f), Mathf.Abs(x) - 0.5f)).normalized;
    }

    float unity_gradientNoise(Vector2 p)
    {
        Vector2 ip = floor(p);
        Vector2 fp = frac(p);
        float d00 = Vector2.Dot(unity_gradientNoise_dir(ip), fp);
        float d01 = Vector2.Dot(unity_gradientNoise_dir(ip + new Vector2(0, 1)), fp - new Vector2(0, 1));
        float d10 = Vector2.Dot(unity_gradientNoise_dir(ip + new Vector2(1, 0)), fp - new Vector2(1, 0));
        float d11 = Vector2.Dot(unity_gradientNoise_dir(ip + new Vector2(1, 1)), fp - new Vector2(1, 1));
        fp = fp * fp * fp * (fp * (fp * 6 - Vector2.one * 15) + Vector2.one * 10);

        //Vector2 fp_1 = new Vector2((fp.x * 6) - 15, (fp.y * 6) - 15);
        //Vector2 fp_2 = new Vector2((fp_1.x * fp.x) + 10, (fp_1.y * fp.y) + 10); //Print and check output for Vec2 * Vec2
        //fp = fp * fp * fp * fp_2;

        return Mathf.Lerp(Mathf.Lerp(d00, d01, fp.y), Mathf.Lerp(d10, d11, fp.y), fp.x);
    }

This is converted to C# by AleksiH

#

the original was in HLSL, slightly different in terms of syntax

steady pike
grizzled bolt
tropic field
#

could some explain what these comments mean exactly?

#

this is in hlsl

#
float2 Unity_GradientNoise_Dir_float(float2 p)
{
    // Permutation and hashing used in webgl-nosie goo.gl/pX7HtC
    p = p % 289;
    // need full precision, otherwise half overflows when p > 1
    float x = float(34 * p.x + 1) * p.x % 289 + p.y;
    x = (34 * x + 1) * x % 289;
    x = frac(x / 41) * 2 - 1;
    return normalize(float2(x - floor(x + 0.5), abs(x) - 0.5));
}
tropic field
meager pelican
#

I'm just saying that in the shader, make sure you use floats (float, float2, float4, etc) and not fixed types (fixed, fixed2...) or half types (half, half2...) . Looks like you are using floats. 🙂 Your comment agrees ("need full precision").

elfin mesa
#

back again with more questions! so I successfully got my custom node to perform the same behaviour as the clip() function in CG, but it discards all pixels from the input which have a value < 0 (second image) which I don't want. I've edited the custom node so that it instead turns all pixels into greyscale but it applies the emission colour on top of them. I want to be able to set the intensity of the Emission Colour property to -10 so that it no longer shows on top of the pixels which have an input value of < 0.

I think I found the correct code on the Unity docs and online, and found the values I need to set the emission intensity to -10, but it doesn't appear to have any effect. Can anyone tell what I need to change to correctly change the intensity?

neat wyvern
#

Hi all, quick question I can't seem to answer on Google - possibly just bad choice of words.
If I'm using Shader Graph, do I have to manually re-implement all the base functionality of the specific pre-provided shaders? e.g. if I just want to "extend" standard HDRP Lit do I basically have to recreate the whole shader myself in a graph and then add my extra functionality?

mental bone
#

The empy graph is the base lit or unlit shader. You have to hook in the inputs tonit

#

Anything you do is extra functionality

neat wyvern
#

So I simply have to expose a load of properties and hook them up to the right things?

grizzled bolt
#

I think that's the way
Would be nice to have a graph with properties and texture samplers all set up for quick modification
But I guess you can make one yourself and use that as a base

crisp oracle
open quarry
#

hey guys, is there either a c# or shader line along the lines of #if SINGLE_PASS_INSTANCED_RENDERING

pseudo sentinel
#

Hi folks, I needed a shader that adds a pixel outline to sprites with a thickness of one pixel. I was able to find a shader suitable for me, but above all I would like the outlines between the sprites to be combined and not displayed at the intersection points. I rewrote the shader into two passes by dividing the outline and sprite display, but I don't get to display the outline behind everything at all. Now everything works, but only when the sprites are on the same coordinate on the Z axis

I attached the shader itself to the message and an example of how the shader works now (left side) and what I need (right side)

fair crest
#

Hey, I want to make it so a specific mesh isnt rendered behind another specific transparent mesh

pale python
#

hey,
I don't know much about shaders.

I'm using this asset https://assetstore.unity.com/packages/vfx/shaders/character-shader-pack-2-0-urp-lwrp-199155 on an android project.

it says it is compatible with Universal RP which I have installed on the project, but when I tried to apply one of the shaders on the default robot_prefab, it looked like this

I think I need to setup something for the URP to work!, could someone help?

Add depth to your next project with Character Shader Pack 2.0 (URP & LWRP) from Easy Game Studio. Find this & more VFX Shaders on the Unity Asset Store.

grizzled bolt
#

@pale python Are you sure your URP is set up all the way? There are some steps to it

pale python
grizzled bolt
tiny gust
#

Yeah I'll run some tests and see how it improves! My levels are mostly linear, so if the camera culling makes it so the unseen trees don't have their shaders processed, then it should be okay without much optimization

fair crest
#

Hey, I want to make it so a specific mesh isnt rendered behind another specific transparent mesh

knotty juniper
toxic peak
#

can someone tell me what does CameraClipping thingy in ShaderGraphs do? For the love of god I can't find anything about it and I fail to understand what exactly it does by experimenting.

regal stag
toxic peak
#

Holy hell, you're right! Thank you very much!

fair crest
#

I looked into it to no avail

sacred saffron
#

trying to create a particle material that is additive, but the black channel isn't transparent

#

I tried putting the result into the alpha channel which makes the black part transparent in preview mode but when I try to change the color in the particle system it has no effect. it remains white and very dim

pale python
#

quick noobie question in Shader Graph

If I want to change the value of a node via script, how should I reference that node? ( by it's Name:string , or by its Reference:string ) ?

knotty juniper
pale python
knotty juniper
#

for the name use use the "Reference" name

pale python