#archived-shaders

1 messages ¡ Page 239 of 1

lethal fern
#

normal asset menu

#

should i use the project button?

knotty juniper
#

use the button in the last image i send

lethal fern
#

okay 1 sec to build

#

now it just shows a crash then exits

#

doesnt even get in

daring dew
#

Shader graph can now let you chose the anisotripy level directly from graph view (Shader Graph 14)

lethal fern
#

fixed the crash, a bad shader wasnt compatible with my gpu but its still rendering black

ember sedge
#

Is there a way to make a shader's parameters change / store separate values per instance of a material?
I noticed an option that looked like it allowed for this Shader Declaration: Per Material but it doesn't do what I thought it would.

Basically I am changing an opacity parameter, but when I change this in the sprite renderer material settings, it affects all of the other GameObjects using that material:

#

Ideally want a separate value for each
I realise the alternative is editing the alpha value of colour of the sprite renderer but wondered if you could do it with the shader instead (as I have other shaders that are more complex that I would also prefer to have separate parameter values)

lyric copper
#

Hey is it possible to use the Fresnel effect on a Quad and have its origin be the center of the quad? I tried taking the UV and subtracting 0.5 but it no emitting from the center

lethal fern
#

im so dumb i have a script setting vital global variables but only did it in onvalidate

lament jolt
#

how would i make the object render different render textures to each eye (urp)

cosmic grove
#

I am not too sure if this is the correct channel for this but I will try it anyways:

I have bought the Zombie Collection Asset in the Asset store. I already have imported it and some of the materials were converted to URP.

Sadly, the majority of the materials CANT be converted to URP and i am not too sure why.

This is the error I get:

Could not create a custom UI for the shader 'Knife/PBR Double Sided'. The shader has the following: 'CustomEditor = ASEMaterialInspector'. Does the custom editor specified include its namespace? And does the class either derive from ShaderGUI or MaterialEditor?
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Can somebody please help me with this? Please ping me on reply

edgy crane
#

Hmmm guys, I designed a 2D Shader for water zones. I designed it for a regular quad. Later I tried to design something for creating dynamic ripple when the player enter the water through a custom mesh. Yet of course the material doesn't act as intended on this mesh. :S Does anyone have experience applying shaders to 2Dmeshes ? :S

little marlin
#

anyone had idea for such error like this ? in short, i've been created my own basic shader, with "basecolor" properties exposed, error warning comes after i created my instanced material. i dont know what to do since, i've changing my variable name into several but warning error still coming out. is this bug or i did it wrong ?

#

btw, even i changed into different name, the error still shown same as on console.

#

but in game scene, when i applied textures, the texture color still show up normally,

primal harness
#

Using shadergraph, is there a way to get a lit transparent object to receive shadows?

fervent tinsel
#

it should be like this by default afaik but maybe yours have it toggled off?

primal harness
fervent tinsel
#

@primal harnessis it really receiving issue then? sounds like you are more of having issue on casting shadows from transparent materials

#

which - if you use URP - is actually only an issue if you use stock URP Lit shaders and not their SGs

primal harness
#

@fervent tinsel Example here, Surface type is Transparent and receive shadows is toggled on, but the blue plane is not receiving shadows from the cube in the middle

fervent tinsel
#

@primal harnessis the cube on the middle using transparent material?

primal harness
#

no

fervent tinsel
#

is the cube in the middle set to cast shadows?

#

does it cast shadows to other objects?

primal harness
#

yes

fervent tinsel
#

no idea then.. works on my end

primal harness
#

Alright well thanks anyways, I'll keep experimenting.

#

@fervent tinsel Could you show me your setup so I can try and replicate it?

fervent tinsel
#

dunno if it makes much sense since it should work out of the box

#

so.. I guess try to repro this on new project if you can't figure it out

primal harness
cosmic grove
#

Hey I have following Shaders from the Zombie Collection Asset by Knife Entertainment: Fire, Fresnel, PBR Double Sided Cutout and PBR Double Sided.

Can someone please help me upgrading them to URP? I just cant because of this:
"Theres no upgrader to convert Knife/PBR Double Sided Cutout shader to selected pipeline.

#

Bruh I seriously need help with this. I would be so grateful if somebody could help me.

amber saffron
cosmic grove
amber saffron
cosmic grove
amber saffron
cosmic grove
warm falcon
#

how do increase the value of a property/float in a shader graph over time in a script

amber saffron
cosmic grove
timber carbon
#

hey is there a way to use urp features in my unlit shader?

amber saffron
rapid acorn
timber carbon
# amber saffron What do you mean ?

well im trying to make it so i can use integers in my vertex data however I can only do that in a custom shader not shader graph but i still want all of the positives of using a lit shaders in my custom shader is there a way to do that?

amber saffron
wide thicket
#

having this weird issue where the alpha on my mesh is culling the rest of the mesh, but only from certain angles

#

it happens when depth write is on

#

without that checked, the whole mesh just overlaps itself

#

any ideas?

#

i just want the transparent part of the texture to act transparent without it doing all this weird stuff

grizzled bolt
grizzled bolt
wide thicket
wide thicket
grizzled bolt
wide thicket
#

no option for cutout

grizzled bolt
grizzled bolt
wide thicket
grizzled bolt
# wide thicket

You may need to enable the option within shader graph to see it

grizzled bolt
#

Hard to guess without knowing the shader graph settings

#

I would use three different materials

#

Considering one part needs transparency, another needs cutout / alpha clipping and the third one needs to be plain opaque

wide thicket
#

seems expensive but so far that's the only working solution

#

thanks for your help

swift yoke
#

Am I setting this struct wrong or something?

struct IntAndFloat
{
  int intDude;
  float3 floatyDude;
};
RWStructuredBuffer<IntAndFloat> myBuffer;
...
//Later in code
...
IntAndFloat myVar;
myVar.intDude = 4;
myVar.floatyDude = float3(1, 1, 1);
myBuffer[id.x] = myVar

I'm trying to get this buffer into another shader but it's not working, all the float3 values are just origin, so I'm not sure if I'm just setting the struct wrong, or if it's something else? But I've looked a lot and can't find any other issue, I'm setting it all correctly and the buffer is the right size etc

#

I feel like the struct should be get with a constructor but compute shader hates that...for reasons

meager pelican
#

One thing you can do (and the optimizer might even re-write that code to do this) is to assign it this way:

myBuffer[id.x].floatyDude = float3(1., 1., 1.);```
that saves constructing an IntAndFloat and the later assignment. 

But IDK what's giving you zeroes (I think that's what you said you're getting).
lyric oyster
#

I'm trying to get the water to hide in the boat, however in that box collider that i put the shader material on, the water is still visible. When viewing from outside the box collider, it works as intended. Any ideas on how I can make it so that the water is also hidden when inside the box collider? (I'm a little new to shaders generally) I used this script:


    SubShader{
        // Render the mask after regular geometry, but before masked geometry and
        // transparent things.

        Tags {"Queue" = "Geometry+10" }

        // Don't draw in the RGBA channels; just the depth buffer

        ColorMask 0
        ZWrite On

        // Do nothing specific in the pass:

        Pass {}
    }
}
swift yoke
cosmic prairie
fervent tinsel
#

@cosmic prairie how I see it, @lyric oyster is using old unify wiki depth mask example here and it actually works for him on that example. the main issue is that he tries to treat is like a volume instead of material

#

@lyric oyster in other words, when you are inside a cube mesh, your camera will not normally render it, this is why the effect gets lost when you move inside it

#

unity has taken that wiki offline already

tight phoenix
#

I reformatted my PC recently and after reinstalling Unity and reopening my project, one of my shaders is no longer working and I don't remmeber how it was made well enough to debug why it stopped working.

Exact same version of Unity

#

Its really hard to debug shadergraph shaders as well

#

As far as I can tell, the Scene Color node is no longer showing any of the scene

#

The effect used to distort what the scene looked like behind it, but now it just renders nothing

#

Does anyone know possible reasons why this could occur and how I would debug to find out?

#

my entire shader right now is just this, and its still a blank square

#

if I turn off opaque texture, I get a grey square

#

if I turn it on, I get a square of nothingness

sage acorn
#

New to the whole shader game here so please keep this in mind lol. I am creating a hex map and am generating a mesh for each hex that I need to do some highlighting with. I am using URP and want to use shader graph to create a shader that will highlight the edges of the hex plane mesh. Essentially I am trying to figure out the node sequence needed to get the edges of the plane. With how mysterious and powerful shaders are I imagine this is doable. The mesh is generated with triangles from the hex origin to each adjacent set of outer points. Any resources or advice will be greatly appreciated. Thanks all!

shadow locust
dim yoke
#

.

digital relic
#

Hi, I'm creating a scrolling effect and it's working pretty much fine but there's a weird bug. When I'm in the scene view, the picture show up properly, when the game is build too, the picture is nice and transparent ... But on the game view in editor there is a weird background ... Any idea of what I'm doing wrong ? I'm using Unity 2022.1.0b

Nevermind, it's a bug of 2022 version ^^' Work fine on 2021 version

flint geyser
#

Hey, I hope someone here can help me
I have an outline shader (cf: img 1) that heavily rely on DepthBuffer and SepthNormals buffer (like.. 2/3rd of the shader is filtering depth and depth normals)
now to my problem: Transparent objects are not writter in the depth buffer so I have some trees without outline (cf: img 2)
I am using Unity 2021.2.15f1 with URP 12.1.5
thanks in advance

meager pelican
meager pelican
cosmic grove
#

Hey,
I am now testing things with the Camera Filter Pack Asset. Sadly, if I apply any filter to a camera (via AddComponent) the camera does not render the effect at all. Its just displaying the normal camera image.

I have added the script directly to the camera (as I said with AddComponent. Am I missing some options I have to configure first?

(Do you have any clue @amber saffron ? I really appreciated your help yesterday 🙂 )

amber saffron
cosmic grove
amber saffron
cosmic grove
#

Oh no

flint geyser
#

still som adjustment to do but it works

cosmic prairie
#

might need a combined method tho to keep the water in front the volume

#

do pre-pass of outer volume, render inner volume where there is no outer (stencil, depth ignored), then do both depth and stencil check when rendering water?

#

as an extra effect you could even render water to the volume where water isn't but would be by the inverted mesh I think

fervent tinsel
#

stencil mask would probably be most robust solution.. could also just punch a hole to the water shader in place where the ship is. some games do this, or just displace the water so it's always below the ship

heavy panther
#

What is the name of the shader where the material acts as a window to a still, unmoving image?

#

As in, the image looks like it's 2d on the screen, but the material acts as a mask to show parts of the image.

fervent tinsel
#

you are basically looking to sample texture using screen space UVs

heavy panther
#

Alright, perfect.

fervent tinsel
heavy panther
#

i didn't know the terminology 😦

fervent tinsel
#

yeah it wasn't meant to be dismissive comment 🙂 just said that was what I found when looking if there was something already for this

heavy panther
#

oh, fair enough

#

usually when people mention google it's derogatory

#

but cheers for the tutorial

fervent tinsel
#

or I mean meant to say anyway, didn't mean any disrespect 🙂

heavy panther
#

it's all good man, i will get started on this new meme

hushed urchin
#

Is it possible to check if a texture is set in a compute shader?

timber carbon
#

hey i've got a problem where the faces of each of my cubes facing away from the sun are completely black ignoring ambient color i'm using a custom shader that derives from urp

sage acorn
#

@keen sparrow care to share how you got your glow shader to work with planes? I am working on the same thing with a hexagon plane.

cerulean knot
#

sorry iv asked a lot of questions recently. I am applying a grayscale shader to my game during a scene just after disabling a UI panel and I get this horrible visual glitch when I turn the shader on where it seems to keep blocks of the panel back.

cosmic prairie
#

What's the code?

timber carbon
#

` half4 frag (v2f i) : SV_TARGET
{
UNITY_SETUP_INSTANCE_ID(input);

    SurfaceData surfaceData = InitializeSurfaceData(i);
    InputData inputData     = InitializeInputData(i, surfaceData.normalTS);

    half4 color = UniversalFragmentBlinnPhong(inputData, surfaceData);
    color.rgb = MixFog(color.rgb, inputData.fogCoord);

    return color;
}`
cosmic prairie
#

hmm that should have ambient and baked GI, what's your shadow strength on the light?

timber carbon
#

here is more of the code

cosmic prairie
#

it has MixRealtimeAndBakedGI

#

or is ambient light different from GI?

regal stag
# timber carbon

I believe you need to use inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.vertexSH, IN.normalWS).
Even if you don't support bakedGI the same variable & macro is then used for ambient lighting iirc.
(or forget the macro and just use inputData.bakedGI = SampleSHPixel(IN.vertexSH, IN.normalWS))

Also with OUTPUT_SH(OUT.normalWS.xyz, OUT.vertexSH); in the vertex shader (after the normalWS is assigned)

timber carbon
#

is there anything wrong with this?

wicked niche
#

I have such a shader, tell me which way to dig so that you can turn the parameter in the shader settings (slider) and the material becomes flat (just a strip of color without shadows and specular)

#

like this

lyric copper
#

any Shader graph gurus here can answer a simple question?

royal vale
#

I'm trying to put an array of floats in a struct that's being passed as a compute buffer but I keep getting the error
ArgumentException: Array passed to ComputeBuffer.SetData(array) must be blittable

naive coral
#

whats the difference between the interpolator an rasterizor

gleaming slate
#

Does anyone know if Unity 2021.3.0f1 has the shader graph for the built in render pipeline? Im thinking about updating a project so just wanted to check.

azure stag
#

Can someone help me out with this shader bug? I wanted to make a build for MacOS and this error comes. I am using a PSXEffects filter from the asset store and I am really new to shaders.

#

It works normal when I Build to Windows or Linux by the way

meager pelican
# naive coral whats the difference between the interpolator an rasterizor

Rasterization is the process whereby the "pixels" are assigned to the polygon. So the vertex stage outputs clip-space coordinates (google that if you must) in floating point and those flat 2D results are "splatted" to the camera's view in a plane. Then, this plane is mapped to the pixels. The pixel shaders are then called for the pixels, with some exceptions for those that are determined not to be necessary (such as happens with early-Z/depth test failure).

Interpolation can now happen, where groups of the processors are assigned pixels to be shaded. The "v2f" structure contains data for each vertex in the polygon. Rasterization decided where all the pixels fell, including edges, in some rational way. The v2f data is "smeared" across each of those pixels according to the pixel's location within the polygon. That's why when you see a typical example of the RGB triangle having colors smeared across its surface from the 3 verts, the colors blend. Most anything in the v2f structure is interpolated (smeared) across the polygon, unless a nointerpolation attribute is given to it. The structure can contain anything, from worldspace coordinates, to colors, to whatever.

This is also why ddx/ddy functions are not available in the vertex stage, that stage just doesn't have enough information since it doesn't even really know the size of the pixels yet, so it cannot tell how much has changed pixel to pixel. That and the fact that it is only processing the 3 verts, not the entire polygon.

So if you need something "smeared" across the polygon, that's interpolation, and it pretty much comes from the vertex stage output and the smearing that happens during rasterization. You may wish to google "barrycentric coordinates/interpolation" too. There's a limited number of interpolators available to be assigned to do that work, during the process of rasterization.

#

So the two concepts are interrelated and happen between the vertex and the fragment stages.

muted ridge
#

I am using the unity tree instancesI have a material property I'd like to override _ClassColor("Color", Color) = (1,1,1,1) at runtime that exists on the materials used by the prefab in each tree prototype;

Each instance of the same prototype is one color and so on.

Is there a way I can access the renderer for tree instances on a terrain?
and if not is there a workaround that will let me set this value in the shader?

kindred glen
#

what would be the equivalent of a color ramp(blender) in unity shader graph?

native dome
#

Is it possible to set the gradient color here to an image, so the time is spread on the image?

#

for example:

#

(right now, the entire Image is one pure color.
I want to have multiple colors spread on one image like in the arrow above)

simple violet
#

you might have to use the uv node

#

I think there's a way to combine the x variable(right) with the gradient node

#

I'm a beginner so it's hard to describe

floral oar
#

Hi
what do u recommend I use to have some nice shading around my UI ? The shadow component is way too hard for my design

simple violet
#

doesn't seem like a shader question

floral oar
#

oh sry
I though it was

dim yoke
#

no one prevents you from using shaders for ui. not sure what "shading around UI" means exactly tho

floral oar
#

uuh
one sec

#

like
at the edges of the navbar, and around the buttons there is a shading

#

I asked here because I felt that maybe applying a shader could be a simple solution

wheat shuttle
#

Hello there, if I have a shadergraph question does that come here?

wheat shuttle
#

Id like to ask about using the depth shader node on mobile, I'm trying to make an intersection effect however it seems that while the effect works on pc in editor, it doesn't show up right on Android

#

My suspicion is something to do with shader precision? But I'm not sure where to set that

lyric copper
#

Is there a way to smooth out the stepping in a radial mask or soften the edge where it terminates in Shadergraph?

naive coral
#

i dont understand why my shader isnt working, heres a part of the code:

            {
                float4x4 mat;
                mat[0] = float4(cos(rotation), -sin(rotation), 0, 0);
                mat[1] = float4(sin(rotation), cos(rotation), 0, 0);
                mat[2] = float4(0, 0, 0, 0);
                mat[3] = float4(0, 0, 0, 1);
                return mul(mat, float3(0, -1, vertex.z)).xyz;

            }

            v2f vert (appdata v)
            {
                v2f o;
                
                v.vertex.xyz = mul(UNITY_MATRIX_VP, rotationZ(v.vertex, v.vertex.x));
                o.vertex = UnityObjectToClipPos(v.vertex);
                return o;
            }```
it supposed rotate each vertex of the plane around the center of the world given the vertex's x position
thus making the plane into a tube
dim yoke
#

It seems you’re messing with space transformation quite a lot… first you’re doing some rotation matrix magic for local space position, then transforming from view space to clip space and then transforming from object space to clip space… I’m surprised if that works in any reasonable way…

grand jolt
#

is 2450 or 3000 good for a Render Queue on integer on a transparent shader? For some reason, I get some drawing issue where it draws part of the back of an object in the front of the object? What shader do I use to stop parts of the back of the object in the front of the object and add reflection + refraction and transparent?

dim yoke
#

It’s most likely not about render queue but rather transparent object sorting issue. Transparent objects doesn’t (ussually) write to depth buffer so they can’t be ”sorted” by depth value. Maybe if you show image of the model, it would be easier to figure out how to solve the ordering issue in this case

grand jolt
#

@dim yoke posting video

vocal narwhal
#

Why is this even transparent?

#

It doesn't look transparent

grand jolt
fervent tinsel
#

and game engines should be able to render transparents order right but yet here we are 🙂

chrome zinc
#

Is anyone aware of a method to render pixel perfect particles? Currently I using a render texture resized to 320x180 and combining that with my main camera. However, this method hurts performance a bit AND doesn't allow me to control the sorting layer of my particles because they are rendered on a separate camera. I have looked everywhere for some sort of Shader that allows me to render pixel perfect/ grid snapped particles, but have found nothing. https://gyazo.com/a6cc82167dd78cbd6a7904c445213895

lost scarab
#

https://youtu.be/nm3QRLe846M?t=575 how can I achieve this in shadergraph, is there any kind of mapping-node equivalent?

Get my Beginner's Shader Course: https://www.canopy.games/p/procedural-materials-in-blender

Jump on the Discord server for more procedural goodness: https://discord.gg/qEmdVC3

This time we're learning a simple way to create a grid pattern and using randomness in a controlled way with procedural nodes in Blender!

Have you got a favourite node ...

▶ Play video
thorn tapir
#

Hey I'm having a rather odd problem that I dont know how to fix:

Multiple objects that share the same shader material are being affected by the opacity of the sprite renderer on other objects that share the material

#

I have Object(1) and Object(2)
the material parameters are not being touched at all, but when I raise the opacity on Object(1)'s Sprite Renderer component, it doesn't raise the opacity of the other sprite renderers, but the material does become equally visible on all objects that share the material... and if I raise the opacity on another object, its stacks additivley

merry rose
#

Is there a way to modify an Array in Vertex stage and then sample that Array in pixel stage?

lean lotus
#

Hey is there a good way to calculate the tangents and bitangents needed for normal mapping(or any other ways of applying a normal map?) from world space normals and uv's and normals of each triangles vertex in a compute shader?

astral moon
#

I'm currently Unity 2019.3.15f and in the create option I cannot find Shader Graph option in there, I've been searching for solution but can't get to solve it, I've made sure to have the Shader Graph installed in the Package Manager, idk how to get the option to appear

astral moon
#

I'm new to Unity ._.

dim yoke
#

Then you’re most likely using build in render pupeline which doesn’t support shader graph

astral moon
#

oh ok... then I guess I'll leave the shader graph last to check cause this build I'm using is compulsory for what I'm doing

#

but it has vfx shader graph?

#

idk this is here but all I want a blank shader graph

dim yoke
#

If you want to check your render pipeline, you can go to Edit > Project Settings > Graphics > Scriptable Render Pipeline Settings. It says None if you’re using built-in render pipeline

astral moon
#

let me see

#

yeah it's saying none

dim yoke
# astral moon but it has vfx shader graph?

Atleast vfx graph is not meant to work on birp. According to some unity dev:

Just to clarify things out, VFX Graph is not officially supported and there are no plans to support it with Built-in pipeline. Hence, we greatly recommend using VFX Graph with rendering pipelines.

astral moon
#

oh

#

so is there anything I can do to get those blank shader graph?

fallow linden
#

You would have to add a rendering pipeline

dim yoke
#

In order to use vfx graph and shader graph, you have to use scriptable render pipeline. Urp is very similiar with built in pipeline

astral moon
#

I cannot find it in package manager

#

nvm I think I have to download lightweight rp?

#

or any of those

dim yoke
astral moon
#

oh

#

aight I'll see

#

wait, an error while resolving the package...

dim yoke
#

Maybe try again. I haven’t tried lwrp myself (only urp) so can’t really help much

astral moon
#

I think I have to get rid of the universal?

#

well, get rid of it before installing the lightweight

#

wait... it's required

#

I guess it has to be the same version

#

well it gets a little bit frustrating because after installing the LWRP I can't even get it in the rendering

#

no error this time

#

just straight up nothing

white cypress
astral moon
#

oh

white cypress
#

LWRP is just the legacy version of URP

astral moon
#

ok then

#

but when I use it it just... break my vfx

white cypress
astral moon
#

...

#

well that's why I need a lwrp

white cypress
#

you'll have the same issue

astral moon
#

hm...

wicked niche
#

How can I fix this artefacts on outline?

white cypress
astral moon
white cypress
#

are you using anything special for the material or is it just the default shader?

wicked niche
astral moon
fallow linden
# astral moon I made a mesh with vfx on it, that's it

https://youtu.be/12gkcdLc77s
This is for hdrp but the concept can be extrapolated to udrp or lwrp aswell. The main portion about converting textures is the biggest thing youll have to focus on by the sounds of it

Upgrade to HDRP and take your graphics to the next level!

This video is sponsored by Unity

👕 LINE OF CODE: https://lineofcode.io/discount/SHIRTMEUP

● Temple asset: http://devassets.com/assets/mayan-temple/

● HDRP Documentation: https://bit.ly/2tyBHyz

● More about HDRP: https://bit.ly/2BOBvPZ

● Upgrading to HDRP: https://bit.ly/2VjfMr1

● ...

▶ Play video
astral moon
#

ok

#

... it's just a mesh with no material though

meager pelican
# lean lotus Hey is there a good way to calculate the tangents and bitangents needed for norm...

Yes, in fact that's a good "trick". But it only works at certain hardware levels, and maybe on certain devices. Like Direct X 10.1 or higher or whatever the requirement is. "They" allowed the vertex stage to bind UAVs and such and modify them. So you can create a compute buffer/Structured-Buffer and use it as an array for example and modify it in the vert stage, read it at the pixel stage.

BUT...make sure that you can't just pass whatever to the pixel stage directly, that you have to do what you asked about, as it's more efficient to just pass it in the v2f.

(Sorry @lean lotus , I quoted the wrong post)

white cypress
#

And you wouldn't be able to see it

tribal bramble
#

for the love of everything holy, why can I not edit the colour node

#

Im going insane

charred crystal
#

Hi there, I am working with URP and Core RP librarires and was using unity 2020.3 and upgraded to unity 2021.3. That however seems to have broken some dependencies and is now asaying that stuff was not defined. Currently learning HLSL shaders/compute shaders. Reimporting everything, reinstalling core RP, even just moving the files to a new project/rewriting just didn't work. Anyone came across this issue or knows how to solve something like this?

latent thistle
#

is it possible to modify the surface options during runtime ?

rustic ferry
#

Hello I'm a poor 3D Artist trying to implement shaders, I'm using Shader Graph and would make a texture scale within the objects, it doesn't work beacause I used a Position World node to achieve the effect I was looking for. I broke the internet looking for a solution, any ideas?

amber saffron
amber saffron
amber saffron
#

It might still be valid 😅
But furthermore, URP doesn't implemet (yet) surface options on the material level when you're using a shadergraph. The best thing you can do is to have variants of your materials with the surface options you want at hand, and swap them

rustic ferry
#

Basically I want the tiling of this texture to scale accordingly to object scale instead of remaining the same

amber saffron
rustic ferry
#

It doesn't work

amber saffron
rustic ferry
#

No at all

latent thistle
amber saffron
amber saffron
rustic ferry
#

I know I don't like it too XD

latent thistle
rustic ferry
#

But I'm almost a beginner so probably I'm forgetting something but I dunno what

amber saffron
latent thistle
# amber saffron And what is the problem ?

mybad i thought i posted it in this channel but it was in urp one.

hoy, i want to do turn objects between player and camera transparent. But, we are using decals so, we can't turn surface type from opaque to transparent. So I thought of doing a render pass feature but i don't know if it's a good idea and also if eys, how to do it well.. Any help ?

amber saffron
latent thistle
amber saffron
latent thistle
#

everything is a problem lmao i need to choose the best solution 😂

rustic ferry
amber saffron
latent thistle
open dirge
#

How can I get the light effect of the shader from directional light?

#
Shader "CustomShaders/ThreeColorsGradientShader" {
    Properties{
        [PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
        _ColorTop("Top Color", Color) = (1,1,1,1)
        _ColorMid("Mid Color", Color) = (1,1,1,1)
        _ColorBot("Bot Color", Color) = (1,1,1,1)
        _Middle("Middle", Range(0.001, 0.999)) = 1 
    }

        SubShader{
            Tags {  "Queue" = "Transparent" "RenderType" = "Transparent"} 

     LOD 100
     Blend SrcAlpha OneMinusSrcAlpha

            
            ZWrite On
            Lighting On
            Pass {
            CGPROGRAM
            #pragma vertex vert  
            #pragma fragment frag
            #include "UnityCG.cginc"
            #include "UnityLightingCommon.cginc" // for _LightColor0

            fixed4 _ColorTop;
            fixed4 _ColorMid;
            fixed4 _ColorBot;
            float  _Middle; 

            struct v2f {
                float4 pos : SV_POSITION;
                float4 texcoord : TEXCOORD0;
            };

            v2f vert(appdata_full v) {
                v2f o;
                o.pos = UnityObjectToClipPos(v.vertex);
                o.texcoord = v.texcoord;
                return o;
            }

            fixed4 frag(v2f i) : COLOR{ 
                fixed4 c = lerp(_ColorBot, _ColorMid, i.texcoord.y / _Middle) * step(i.texcoord.y, _Middle);
                c += lerp(_ColorMid, _ColorTop, (i.texcoord.y - _Middle) / (1 - _Middle)) * (1 - step(i.texcoord.y, _Middle));
                c.a = 1;   

                return c * _WorldSpaceLightPos0;
                return c * _LightColor0;
            }
            ENDCG
            }
        } 
}
amber saffron
latent thistle
merry rose
# meager pelican ^^ See above

Thanks, I'll look into that, but figured I probably will calculate the thing on CPU as it does not need constant updates.

digital flame
#

Hello, i am a shadergraph newbie and i am trying to make a Shader in shadergraph that automatically tiles a Texture for differently sized cubes.
I need to be able to scale the cube in all directions while the Texture automatically repeats and sits correctly on the cube. already found a way to do this by feeding a world Position node multiplied by prefered texture scale into the uv of the Texture sampler. Howeveri need to be able to move the cube, and still have the texture sitting on it. With this solution however, when i move the cube, the texture moves along the cube into the opposite direction.... The other thing i tried was multipliying the tiling by the object size. This however only worked as long as the cube had all 3 axis the same size. As soon as scaled it to Something like (3;2;3) the Texture was stretched in an ugly way.. cannot think of any other solution, tried everything i can and googled a lot.. Please help me, i have no idea how to get this done..thanks a lot!!

amber saffron
digital flame
#

@amber saffron okay thank you, i will try this!

#

@amber saffron it's working, substracting did it, thanks a lot!!!!
But if i rotate the cube the texture rotates in the opposite direction, how do i fix this?

amber saffron
#

And instead of world space position, I think that object space position, scaled by the object scale, should work

digital flame
#

@amber saffron unfortunately this does not Work

#

@amber saffron you mean multiplying object scale by object space position and feeding this into the uv?

amber saffron
#

Into the position input of the triplanar node

digital flame
#

@amber saffron unfortunately this is not working

amber saffron
#

There's something to do with this, or play with the transform node, but I'm to busy to try it out myself right now

digital flame
#

Is there a way to make a "6 planar" shader, so the backside is textured too?

graceful forge
#

https://www.youtube.com/watch?v=dFDAwT5iozo following the first part of this tutorial, i have made a shockwave shader for 2d. does anyone know how i could make the sprite it is on transparent but keep the shockwave effect? and even further, does anyone know how i can add more than 1 ring?

A shockwave shader graph (or shock wave shader graph) is a relatively simple effect, that can add a lot of pop to actions in your game.

Shockwave updated for 3D in my timeline video here: https://youtu.be/A5jl5RVEjqE

The reason I'm doing this tutorial at all is because someone commented on one of my YouTube videos requesting it. I bring this...

▶ Play video
fallow linden
wooden kite
#

does someone know if i can develop a shader for textmeshpro using shader graph ? (urp)

lone cave
#

does anyone know why this error is poppping up?
Texture 'lut' is not readable, the texture memory can not be accessed from scripts. You can make the texture readable in the Texture Import Settings.
I'm trying to use a texture as a LUT for my shader

tame topaz
lone cave
#

I now have a different issue though, it is not scaling with screen size properly

inner dune
#

is there a way i could input materials into properties of a shader?

basically what im trying to do is have a cool transition between 2 materials

(also i cant use scripts)

knotty juniper
arctic flame
#

hey everyone

#

in the standard shader if I set o.Emission to 1 on every pixel it sets the emission to white across the whole object

#

which probably sounds like what you expect except that o.Alpha is being controlled by the texture

#

is there no interaction between the alpha and the emission values?

#

in other words: it's multiplying pixels by the emission color even when their alpha is zero and that seems like something that the standard shader would have accounted for no?

#

im curious if o.Emission has 4 channels or only 3

fiery pike
#

Hello everyone. I am completely new to Unity and have been having the same problem with each new project I make. My material colors are severely off and I have no clue how to fix them.

#

this is supposed to be gray

fallow linden
rain bay
#

looks like your texture has color

fiery pike
#

I found that when I untick the reflection box the colors return to normal.

#

I don't know how to permanently fix them though

arctic flame
#

why doesn't HLSL have a pi keyword 🤔

hoary merlin
#

How do i go about connecting these two to the base colour?

#

Most examples I see online show the bottom part connecting to the uv of a texture 2d node.

#

So i'm unable to find examples of how this setup would work

arctic flame
#

different results in game and editor view

#

what's with this 🤔

#

oh i fixed it

#

wrong render queue

vocal narwhal
arctic flame
#

real quick

#

in a shader is it faster to use UNITY_ACCESS_INSTANCED_PROP at every use or only once and save it to a variable for the otherss?

arctic flame
hoary merlin
meager pelican
# arctic flame in a shader is it faster to use `UNITY_ACCESS_INSTANCED_PROP` at every use or on...

Probably better to put it in a local variable rather than used an indexed memory lookup each time. That said, there's a limit to local variable storage, and also the optimizer may just hoist that usage out and make an internal local for you anyway...so you may not see a performance difference if it realizes that it can do that for you. Depends on how smart it is, I mean, if you have a lot of expressions around it confusing it it may decide that the local resource usage is better off another way...or whatever. Not really a compiler expert, but yeah.

static hemlock
#

Hey all, Is there a shader node that measures the depth of a line going through the object from the camera and a certain pixel?
I want to make sort of a foggy effect

lime dawn
#

Hey, I'm trying to publish my still life tutorial build but it's throwing an Internal Server Error while processing. Any tips?

lean lotus
#

hey so im getting desperate here, does anyone know whats wrong with my normal map application? to the left of the line is the world space normals, and to the right is supposed to be the world space normals after applying the normal map(after multiplying by 0.5, and adding 0.5 to convert it to [0,1])
As you can see, for some parts, the overall normal gets changed in some places and I have no clue why...

#

this is what its supposed to look like

lean lotus
#

ok
im even closer
but there seems to be like a constant direction offset...

lean lotus
#

Yeah ok I do not know
The calculated normals in places go screwy as soon as I try to apply the normal maps(again, left of line is world normals, right of line is world normals with the normal maps), you can see things that I’m talking about in places like the arch of the 2nd pillar on the left, world normal is one color, but the normal map turns it yellow

river seal
#

is there an outline shader that doesn't require that I put an object on a specific layer named "Outline"
I use layers for raycasting in my game and need the Player to be on the "Player" layer.

lone cave
#

does anyone know why my shader only updates whenever I move?

dim yoke
dim yoke
lone cave
#

ah

#

do you know what to do cause an error keeps popping up telling me to remove
UNITY_MATRIX_MV from my code

#

also for some reason I'm unable to edit the texture ?

#

it's grayed out

dim yoke
#

It would help if you showed the whole shader code and the error message

lone cave
#

sure

#

here, I'm getting two warnings
Use of UNITY_MATRIX_MV is detected. To transform a vertex into view space, consider using UnityObjectToViewPos for better performance. and [Worker0] Performance warning: There are more than 100 preview scenes. There might be code not releasing the preview scene after creating it. plus I can't edit the texture because it seems grayed out. @dim yoke

#

hello?

dim yoke
# lone cave hello?

Hello 👀. [PerRendererData] makes you unable to edit the texture. Just remove that. The first warning have spotted you use UNITY_MATRIX_MV even though unity provides a function to do the transformation from local to viewspace for you. In this case you’re not simply transforming between coordinate spaces so I don’t think you can use that, just ignore the message. I don’t know what that second warning means, maybe google would know

lone cave
#

ah, thanks a lot!

#

could you link me any tutorials for implementing normals maps for shaders? 🙂

#

I couldn't find anything online for HDRP specifically

#

also tiling does not appear to work, is this something you have to do yourself? I'm a complete newbie when it comes to shaders

dim yoke
lone cave
#

also about tiling...

dim yoke
lone cave
#

though do you know how to fix the texture not tiling? it staus the same even after increasing it

dim yoke
lone cave
#

got this error Shader error in 'Sprites/Glitch': redefinition of 'vert' at line 211 (on d3d11) but I am 100% sure it's somehow my fault

#

actually yeah it is give me a second

#

fixed the other one but now getting this Shader error in 'Sprites/Glitch': undeclared identifier '_MainTex_ST' at line 191 (on d3d11)

dim yoke
lone cave
#
            v2f vert(appdata_t IN) {
                v2f OUT;

                UNITY_SETUP_INSTANCE_ID(IN);
                UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);

                OUT.vertex = UnityObjectToClipPos(IN.vertex);
                //OUT.texcoord = IN.texcoord;
                OUT.texcoord = TRANSFORM_TEX(IN.texcoord, _MainTex);
                
                OUT.color = IN.color * _Color;
                #ifdef PIXELSNAP_ON
                OUT.vertex = UnityPixelSnap (OUT.vertex);
                #endif
                return OUT;
            }
lone cave
dim yoke
#

You could share link to paste site because it’s quite long code

lone cave
#

sure

#

I managed to fix it!!!!

dim yoke
lone cave
#

I'm sorry to keep asking you questions, but do you have any idea why making my code try to react to light makes it purple?

dim yoke
#

I don’t know. I don’t really understand most of that code. I gotta go bed now

lone cave
#

since you see it looks nothing like the other material using standard HDRP lit around it

#

good night

weak lantern
#

hey - would anyone with experience with Unity Graphics Programming and compute buffers be interested in helping me out with a very simple job (paid) job. As mentioned it's very simple and is for an art project, so doesn't need to be professional level. The job would involve simply porting over a shader from unity into unreal and slightly modifying it for unreal.

If you are interested - DM me! Thanks~

lone cave
#

Shader error in 'spriteGlitch': CGPROGRAM cannot contain #pragma surface as well as other programs at line 35 how come it had that same thing in the literal docs wtf

balmy fulcrum
#

Would anyone know why VFX Graph would not display any particles (imported the package, added to scene, no luck).

I am using URP and when I re-create my steps in a new blank 3D URP project it appears to work just fine...

burnt wigeon
#

uhhh built in shadergraph can receive shadows, right??

#

but my materials arent receiving shadows

#

okay nvm material override was set to transparent

#

got really worried for a sec there

fresh dirge
#

Would anyone know how to make a shader so that each triangle has its own color for all vertices?

teal breach
teal breach
#

Unity seems really bad when it comes to importing shaders into projects. Often, importing a package results in half the shaders being incorrectly imported and objects simply appear invisible (2021 LTS). Worst is that all this is silent and no errors are thrown. The fix is to literally right click and reimport the package a few times until Unity eventually figures it out. What's going on here? Is there anything I can do to make unity import shaders to the project more reliably?

#

Usually it occurs for shaders that UsePass, I assume it's something like the other shaders are not yet imported so the passes are missing. Is there a way to declare some order of import?

naive shuttle
#

If you know how to fix this please tell me

grizzled bolt
naive shuttle
#

Is there a good way to share it? Or do I just make a few screenshots of it

#

It's kinda big

grizzled bolt
#

There's no one super practical way but screeshots can work if they're readable

naive shuttle
#

The top part doesn't really matter because the bug started before I added that

grizzled bolt
naive shuttle
#

My foam is also broken

#

It doesn't show

#

I'll just finish the tutorial, and see if it's still broken

naive shuttle
#

Maybe it's not the shader, but a property of the material or camera that's breaking it?

white marsh
#

im getting a syntax error at line 28 and i cant really se anything thats wrong here

#

o wait the line numbers arent visible.. line 28 is the 2nd to last line

#

o wait am i missing the pragma?

naive shuttle
grizzled bolt
#

If the scene lighting doesn't exactly match, the appearance of albedo/basecolor texture won't match either

naive shuttle
#

Alright

meager pelican
white marsh
#

it just says unexpected '}' i think, let me check again

#

yeah its unexpected '}'

meager pelican
#

Uh.
Try adding the pragmas like you suggested to yourself.

            #pragma fragment frag```
Add a space after SV_Target (shouldn't matter but we're spitballing here).
white marsh
#

nothin

meager pelican
#

Try changing CGINCLUDE to CGPROGRAM

white marsh
#

still nothing

#

its not too big of an issue, i found a different example that works the same way and has no issues

#

tho, it brings up a new question, i posted it earlier in the wrong channel so i just took a screenshot of it

meager pelican
#

nm, if you have another answer.

white marsh
#

adding it seems to change nothing still

#

the other example was using standard surface shader, but it still "creates" an error, but the error doesnt stop the shader from working

#

which is annoying

#

but it works

naive shuttle
#

38:53 gives a good view

naive shuttle
naive shuttle
#

Here's the material inspector

#

I'm using HDRP version 12.1.6

grizzled bolt
#

Doesn't have the same issues in an URP project

grizzled bolt
naive shuttle
#

Does foam work with objects in the water?

#

Your normals look different than mine though

#

Are you using the same ones?

grizzled bolt
#

No, I don't have the same textures obviously

naive shuttle
#

Ah, could you send those to me if possible? Maybe that's a problem which causes it to look weird

grizzled bolt
#

You're using a height map as a normal map so that causes some weirdness for sure

#

You can fix that by using Normal From Texture node to generate one

#

But it doesn't explain why your whole sea is dependent on on camera position

naive shuttle
#

yeah...

grizzled bolt
#

You could using Position world in "absolute world" to see if that makes a difference

naive shuttle
grizzled bolt
#

Either that or use a proper normal map texture

#

I'm not super familiar with it but I believe HDRP uses camera relative rendering which is probably sticking your world position to camera, so try the absolute world

naive shuttle
#

I think it looks better now

#

Though it's still dependent on cam position

naive shuttle
#

I changed that to absolute position

#

absolute world*

grizzled bolt
#

Still, if you don't know exactly how to set up normal maps or what are the implications of things like camera relative rendering, it's better to avoid HDRP in favor of built-in RP and URP

naive shuttle
#

yeah

grizzled bolt
#

because HDRP expects you to know these things and it'll be a pain if you don't

naive shuttle
#

I mainly chose HDRP because most of the terrain building tutorials were using it...

#

Someone else told me the same thing

#

I'll change to urp when things go badly wrong, but I really just want to try it

grizzled bolt
#

I do encourange trying out stuff

naive shuttle
#

There's also nothing I can find online about shaders following camera

grizzled bolt
naive shuttle
#

It just turns invisible

#

Is it because I turned it to transparent?

grizzled bolt
#

It likely offsets the vertices way off somewhere

#

Considering world and absolute world space use wildly different values

naive shuttle
#

Look

#

That tiny distortion...

#

That's the ocean plane....

grizzled bolt
#

Quite so!

naive shuttle
#

But I can't reach it?

#

Okay so uhmmm how do I fix this?

#

It appears they only show up when they're far away from me

#

If I get close, they become invisible

#

ohhhh wait

#

Got it

#

Nope I don't

grizzled bolt
#

The object goes outside of the camera and gets culled
The wave values (or nodes) are wrong so the vertices get offset too much

naive shuttle
#

Yeah....

#

Ok and now it gets super bright when I go further away

#

this is sooo weird

grizzled bolt
#

You should probably practice more with simpler shaders

naive shuttle
#

Yeahhh

grizzled bolt
#

This stuff will become clearer in time

naive shuttle
#

but it's a tutorial, and so many people say it works so I expect it to work....

#

But of course, these weird things happen to me like always 😐

#

And it also turns out it created 53 ocean planes out of thin air

#

WTFFF

grizzled bolt
#

There are many complex things going on in the shader, and there's always unkown variables across unity versions and render pipelines

naive shuttle
#

Ok now it looks good, though it's culling in weird ways

#

And I should probably get my eyes fixed. The second comment pointed this out

white marsh
#

why is it that when these images dont have a source image they show up with the stencil, but once they have a sprite they disappear?

#

what im trying to do is to make a stencil for a linerenderer to reveal the jam on the bread, but i can only get it to work and it hides the bread and everything behind the stencil once it unhides the jam

#

the linerenderer position seem to matter but im not too sure how that works because its supposed to be 2d, but unity 2d is wack

devout imp
#

Hey, I really need help with my shader

#

I'm using hull outlines and I want the outline to be the inverse color of what's in the background/surrounding it

#

as in, white when it's in the dark

#

but black when light surrounds it

#

how would I go around this? I'm using shadergraph on unity 2020.3.26

#

the final effect would look something like this

simple violet
#

if the backround is handled by the camera component you can just pass that value in and do a one minus

simple violet
#

what don't you get

devout imp
#

what value should I pass?

simple violet
#

the color

devout imp
#

what color??

simple violet
#

of the backround

devout imp
#

huh? hold on, let me try

#

how do i get the background color?

simple violet
#

camera.main.backroundcolor

devout imp
#

how do i do that in shadergraph?

simple violet
#

you pass it in as a property

devout imp
#

aaah, thanks!

#

how would i go around passing that color via property, exactly?

#

like this?

vernal glen
#

I have a plant prefab that has a shader on it that makes the plant sway (like wind) and shadows are impacted as well, should this prefab still be marked as static?

devout imp
#

i dont think it would interfere with the shader

#

mark it as static and check

simple violet
vernal glen
naive shuttle
#

Hey, what's wrong with this?

#

"Colour Close" is a float

#

ohh nvm Im stupid

#

It's supposed to be a colour, not a float

meager pelican
# vernal glen I have a plant prefab that has a shader on it that makes the plant sway (like wi...

If it is a lit shader, it might cause problems as you don't want a static shadow map to shade a moving object. There's other systems as well that could be impacted. See the documentation: https://docs.unity3d.com/Manual/StaticObjects.html
Look at the systems and decide which ones should be static or not.
@devout impis correct that the shader itself won't give a rip, but it WILL move the resulting polygons possibly causing an issue.

devout imp
#

almost got happy for a moment thought someone replied to my post 😭

#

but i see

meager pelican
#

@devout imp...@simple violetreplied to your post already.

devout imp
#

oh no i know i didn't mean it ina rude way

#

just, more feedback is always better yknow

grand jolt
#

can someone help me with a, presumably real easy question? I'm trying to calculate the normal for a 2d sprite from a height map. I've used the wikipedia page to look at the conventional encoding. In the fragment shader I'm using the following trivial logic:

float3 res = tex2D(_NormalMap, i.uv);
i.normal.xy = res.xy * 2 - 1;
i.normal.z = (res.z - 0.5f) * -2;
i.normal = normalize(i.normal);```. Unfortunately the normals are all wrong and seem to interact with light at the wrong angle. The only axis that seems to be correct is the Z axis (as setting both x and y to zero results in the normal being similar to a quad's)
#

oh I can upload images on this server, nice. Well the left image is the quad with the shader and normal map applied, but it should be black at this angle, similar to the right quad which is using a default shader

grand jolt
#

there's something really fucky going on with the way the files are stored isn't it? The normals work fine if the asset is labeled an image, but when as a normal map everything becomes seemingly arbitrary

simple violet
#

@grand jolt

grand jolt
# simple violet https://youtu.be/6_-NNKc4lrk

the "problem" I ran into was that the source I was using for the normalmap wasn't encoded the way I thought it would be (I was expecting rgba, but apparently Unity uses the "DXT5" encoding). But this channel is pretty awesome regardless, so thanks. Definitely some things in there I want to watch

naive shuttle
simple violet
#

Unity had a pretty good water shader tutorial in their main channel for urp

naive shuttle
#

this is hdrp

simple violet
#

For the boat game

naive shuttle
#

And I didn't like that one

#

It was too simple

#

لآخاخا ىخ صاشف اشححثىثي

#

×أ آ×ً×÷×ِ×ٌلآ[×َِ

#

Whoops

#

changed my keyboard language

naive shuttle
#

There's only 2 things broken with is so far. But those are minor things which can surely be fixed.

#

Tomorrow I want to add swimming and effects, but that will be hard I think

naive shuttle
knotty juniper
lean lotus
#

Hey does anyone know why my normals after applying a normal map are so wrong?
For reference, left side is world space normals, right side is world space normals after applying normal map(all in custom shader)
And at the end is unitys normal draw mode in scene(so what it should look like)
This has been driving me insane for several days now, and im out of ideas for what I could be doing wrong

grand jolt
lean lotus
#

heck ok so I think I did figure it out
I am using linear space
But turns out when I do packtextures with the normal maps
it puts the normal map into a different format, and thus one that is not going to return the same data?
When I changed to gamma it was perfect
Testing now with explicit formats for atlas's

#

oh packtextures keeps forcing it into rgba32

meager pelican
#

The texture importer should be set to texture type normal map.
Just use compression format. (Image from Unity docs).

There are macros for decoding them that you should be using if making hand-written shaders.

lean lotus
#

ah ok
thx
Realized that the packtextures keeps making my dxt5 texture an rgba32 texture even though the format of every input texture IS dxt5
Still havent found why

worthy verge
#

looking for a shader that wobbles the texture a little bit

#

like an underwater looking thing

#

and code, not shaderr graph. anyone know of one?

burnt wigeon
meager pelican
#

wobbling the texture is just applying offsets of various types to the uv coordinates. There's 1000 ways to do it.
You could use another "wavy" texture, grayscale, and sample that moving over time if you want. Then take that sample, scale it to whatever amount, and apply it to your uv reads. That's slower than "pure math" though, since it is a dependent texture read.
YMMV.

If you want to find one, look for "distortion effect" or some such.

burnt wigeon
#

any reason for not using a shadergraph? those are supported even in built in nowadays

worthy verge
#

i tried but i couldnt get lwrp to work with the written shaders i already have

#

eh, i guess i could just try remaking them with the graph. it would save me a lot of headache

worthy verge
#

orr just cause another headache

lean lotus
remote pike
#

Hey guys, so im trying to make a a material transparent during runtime and this is what I got so far. I've noticed that it update the material but not until i click on the material dropdown in the inspector. How should i implement it?

uneven token
#

When I try and open up a Shader, it just opens up in my code editor? Anyone know why this is happening?

uneven token
grand jolt
mossy ledge
#

you have associated .shader with whatever code editor you use

#

or, a program other than Unity has done that for you

#

It's just a text file so you could have it open in basically any text editor.

lean lotus
worthy verge
#

so im looking at a tutorial to make a shadow matte in shader graph but my settings looks different

#

i dont have that option

#

I imagine because im using LWRP instead of HDRP.

#

anyone know of a workaround? i just need a shader that shows only the shadows on it, not the mesh itself

#

and if not, is switching to HDRP worth it? i just dont want anything too high-pperformance if i dont need it, and so far ive only been using really simple shaders

uneven token
knotty juniper
mossy ledge
#

"code" shaders have the extension .shader which is just a text file. I'm guessing you're referring to this one because opening a shadergraph shader will automatically open the graph editor inside unity

normal rose
#

Hi, I have this problem, does anyone know how to solve it?

knotty juniper
# normal rose

switching to a cutout shader for the hair should fix it

shadow locust
normal rose
#

in blender it is normal only in unity it is like this

shadow locust
#

Your normals are inverted

normal rose
#

I understood

#

thank you so much

cerulean dagger
#

i have a question about shaders, i feel like this should be simple to pull off but i am missing something. i've created a shader with a dither fade based off of the distance to the camera. i would like to now basically mask that fade so that it only occurs in the center of the screen. is there a simple way to access the fragment screen space to see the fragment's distance to the center? i though i could simply use positionNDC to grab the distance but i'm doing something wrong

cerulean dagger
#

i am trying to do this through hlsl

#

😬

shadow locust
#

make a quick shadergraph shader with those nodes and check the generated HLSL 😛

cerulean dagger
#

haha not a bad idea

naive shuttle
agile spade
#

Hi

#

Need a one 3d shader:

#

Idea? (I pay)

naive shuttle
#

What?

naive shuttle
#

I have the orthographic camera setup, though am not sure how to select it in the shader graph

#

Or should I edit the screen position node instead?

meager pelican
# cerulean dagger i have a question about shaders, i feel like this should be simple to pull off b...

You may be better off using clip space. So in the vert() function, it outputs clip space results. Clip space is similar to NDC space...but you may have to divide by the .w component.

Anyway, google it. (0,0) is the center of the screen. That's the point. Once you get there you can do a distance() calc from whatever result to (0,0). The ranges IIRC are from -1 to +1 in both X and Y for the camera's frustum, so regardless of distance. It ends up as a 2D kind of "splat" on the surface of the video screen.

You'd pass that value in your v2f structure. The one you got out after using UnityObjectToClipPos (and maybe divide it by .w, which is a perceptive divide, but don't output/return that divided result in the vert function, just stash it into the v2f member variable).

#

So off the top of my head I'd do something like

o.distToCenter = distance(float2(0,0), o.pos.xy/o.pos.w);```
Haven't tried that in the editor/code, but yeah.  Maybe you want a float3 instead of a float2.
And calcing it in the vert() is the fastest way, it will be interpolated across the polygon for you, less work in the frag().
cerulean dagger
#

that looks really close to what i tried, i'll give it another shot 🙂 thanks

#

it works 😄

#

i was doing the calc in the frag shader, must of did something wrong there

naive shuttle
#

Hey, my water shader has these weird greyish spots... I'm guessing it's because of reflections, though how do I fix this?

cosmic prairie
#

@naive shuttle if you post the code people can look at it

naive shuttle
#

👍

naive shuttle
#

The depth should be in the bottom right

#

Under section "Don't ask me what this is"

cosmic prairie
#

I'll look at it when I get home, can't open the graph rn

graceful pecan
#

Hey, i'm trying to make an 2D dissolve shader but i'd like the red outline to be fully red instead of additive. Any tips?

grizzled bolt
#

I would use Outline Color in the blend node as Blend input, and the uncolored outline as Opacity input

#

If blending to solid color I mean

graceful pecan
#

Ohh! cool! exactly what i was looking for

#

Thanks you!

dim yoke
#

I managed to make this little black (shouldn't black never illuminate light?) dot that is so bright that it makes the whole screen white. Guess what I did... I added single elbow node to my shader graph and that happened, lul. Maybe I should report for a bug 😄

dim yoke
#

elbow, redirect. yes

#

before 🔽 after ⏬

low lichen
#

Oh okay. I've only heard it called a relay node.

#

Black pixels causing bloom to kick in sounds like NaN

dim yoke
#

nan/infinity or something like that

sly dew
#

Why is unity viewport so low quality in general?

#

Like the shadows are all pixelated and my game view is low res

dim yoke
sly dew
#

ok

dim yoke
#

Someone please explain how can this (those weird colorful rings) 🔽 be result of using custom interpolator?

#

Am I misunderstanding something really badly or is it just unity being mad at me today?

waxen citrus
#

Hi ! 👋
I would like to know how I could go from a transparent color (a bit like a ghost) to an opaque texture in shader graph ? 🤔

grizzled bolt
#

Nope
"Make it look like foam" is quite nonspecific
There are many different ways to go about it and I'm sure tutorials for it too

#

The type you have there is limited by the submerged object's shape so it's not easy to add texture to it

#

The "foam" cuts off where the object's silhouette ends

#

So any texturing or line shape will cut off likewise

#

Your closest option is to have a texture on the plane surface and mask it based on the foam

fossil wharf
#

Erm need some help

#

it should look like this

#

Sooo how 2 fix?

regal stag
#

You need to connect the A output to the Alpha port

fossil wharf
#

erm@regal stag

grizzled bolt
#

Doesn't look like it's using the A output

fossil wharf
#

oooo

#

fuck

#

im stupid

fossil wharf
fossil wharf
faint socket
#

this might be a stupid question but does anyone know why my graph shader only results in this missing-texture pink color? no matter what I do with it the result is just pink

shadow locust
faint socket
#

I guess it's because I made a universal RP pipeline material? does that mean my project is using a different one?

#

until now i've just been using the automatic materials imported with my .fbx files.

shadow locust
#

you have to use materials compatible with whatever render pipeline you're using.

simple violet
#

I have a mesh quad that I want to place a texture on
but I don't want the texture to change when the meshquad's scale changes
what do I do?

fossil cloak
dim yoke
# fossil cloak I think you use it not correct

I don’t know what is correct then. I don’t see what could go wrong if I just put object space position in and interpolate it to fragment shader. I have read the documentation you linked (multiple times) but I don’t still get what’s wrong

#

That works exactly as I expect it to works despite those weird rings

fossil cloak
#

Sadly I never used this node

dim yoke
#

It’s relatively new feature (added on 2021.2) which means there’s very small amount of information and tutorials about it

lean lotus
#

Is there a way yet to get access to the wave functions that come with shader model 6 in a compute shader in unity?

meager pelican
# dim yoke Am I misunderstanding something really badly or is it just unity being mad at me...

What makes you think it's the result of using a custom interpolator? Maybe check that assumption.

The dark colors are negative numbers. You're outputting local position, so you'll get negatives/black.

As far as the rings go, are you sure you don't have two different materials on the object? Or maybe they're the result of overflow or underflow (wrapping around) on the value. What is the precision of your floats? What size are they? How are you stuffing the value into the interpolator? Etc.
Just examples of how/why it may not be the fact that you have custom interpolators. Then again, maybe it IS a bug and you could report it.
It looks a lot like you have two materials to me, but if not, IDK.

In a hand-written shader, nearly all interpolated values are basically "custom". So that in and of itself isn't really a thing to me. I realize that it's a new feature in the shader graph system, allowing you to assign values to the "v2f" interpolated data. If you don't accidentally have multiple materials or something, maybe look at the generated code for some insights.

dim yoke
# meager pelican What makes you think it's the result of using a custom interpolator? Maybe chec...

Thanks for reply. None of these seemed to be the issue but that actually made me realize the actual issue. It wasn't interpolators at all, it was because I put negative numbers to base color node. I have had any problems with that earlier but why it happened now was because I'm first time using URP 3D Core template which applies some post processing effects automatically. It seems Neutral tonemapping seems to be messed up when trying to apply it to negative numbers. ACES on the other hand doesn't seem to have any problems with negative numbers. Because the rings seemed to move relative to the model when I watched it from different angle, I was pretty sure it can't be because of negative numbers/wrapping around. That was actually because the vignette effect (and bloom) is applied before tonemapping and it made the rings move when the object was close to the edges of the screen. That was really dumb issue, sorry for bothering and thanks for helping 🙏

rough cairn
#

how can i blend two textures based on a world height value?

#

ok so now i select texture based on height, but cant figure out how to blend between the two where they meet

dim yoke
naive shuttle
# grizzled bolt

Hey again. I just imported the shaders to a urp project though I'm having some problems. I thought you might know how to help me as it does work for you. First of all, my planes aren't moving, they are just flat. Secondly, the colours are weird. The ocean colour doesn't change properly when I alter the colours. The opacity isn't working either....

#

Could you please tell/show me how you imported it and changed it so that it works with urp?

#

Oh and I'm using unity 2020.3 with urp. Maybe that's relevant

grizzled bolt
#

I cannot tell you how it's supposed to work because I really don't know the tutorial you're following

#

Try making easier shaders

naive shuttle
#

I first had to change the shader hdrp to urp, then change it from opaque to transparent and stuff....

naive shuttle
grizzled bolt
#

Right, had to change the build target but that's the only alteriation I made

lusty badger
#

Hi. Is there a way to add motion vectors to UI Canvases?
World-space UI is unusable when working with HDRP + VR + TAA/DLSS due to the temporal effects making the text and images blurry because they don't have any motion information.
I managed to use custom shaders on UI images, texts to move them to After Post-process pass but now they lack antialiasing so when I move the UI in an way the edges are very noisy.
I tried enabling Transparent writes motion vectors on the shader and material and also in the camera custom frame settings with no luck.

rough cairn
dim yoke
# rough cairn

Now I have no idea what you have done 😅. first of all lerp has nothing to do with time, but yes ig, you should put the world height (you mean y position?) in remap node and then put the output of remap to the T parameter of lerp node to blend between A and B

#

actually I think you could use inverse lerp like this. is this what you want? (this blends from red to green based on world y position)

rough cairn
#

should i also clamp values?

#

with inverse lerp one side is super bright and the other super light

#

@dim yoke

dim yoke
#

you can put saturate node (same as clamp between 0 and 1, no idea why it's named like that) between inverse lerp and lerp because inverse lerp (neither is lerp) isn't clamped by default

rough cairn
#

thanks @dim yoke last thing, what would you suggest to make the transition colors look more natural?

#

right now too much yellow is passing over grass

#

maybe i should lerp only alpha value?

dim yoke
soft flume
#

Is there any way to blend a PBR Metalic shader with an SSS effect? I have a scanned ring with some pearls inside. Can't find any solution so far...

simple violet
#

Unity provides some matrix variables to the shader like projection matrix
I see code sometimes multuply these matrix variables with vectors
But i have no idea whats going on
Is there a resource that shows what i can use these matrix variables for?

low lichen
simple violet
#

Anything else?

shadow locust
#

(vectors are just "skinny" matrices, e.g. a Vector3/float3 is a 3x1 matrix)

lean lotus
#

Hey so Nvidia just released a new blog on nsight profiler, and im wondering if its possible to do this with unity compute shaders? The main bit I wanna know specifically is if I can compile shaders with options, specifically enabling this functionality?
for the blog itself, here it is
https://developer.nvidia.com/blog/identifying-shader-limiters-with-the-shader-profiler-in-nvidia-nsight-graphics/

This is a deep dive into the Shader Profiler feature of NVIDIA Nsight Graphics. The Shader Profiler allows you to find hotspots in your shaders and why they're hot.

arctic flame
#

what's the PBR heightmap neutral value?

naive shuttle
#

Hey. It's possible to get the normal from a texture 2d in a shader graph, though is also possible to get the ambient occlusion map from a texture 2d via the shader graph?

grand jolt
grand jolt
naive shuttle
#

....

#

Ok so that's a no

naive shuttle
#

Hey, what is the Alpha in the newer shader graph version? The image below shows what the tutorial sees, and the lowest image shows what I see.

#

ohh wait, that's only visible when selecting the transparent surface...

naive shuttle
#

Ok back with another question lol. I just made a dissolve shader, though obviously, when you put it on a prefab its previous material gets erased, so you don't see it anymore. Is it possible to make a shader that alters some parts but not everything, like the albedo/diffuse ?

#

And second question: Can you let players decide if they want it 2-sided or not? Or is that a variable you can only change in the shader graph itself, and not in the inspector?

hoary merlin
naive shuttle
#

No, the reverse

#

I want the base colour to stay whatever it was, and alter the emission

#

and alpha

#

and alpha clipping

#

These are the only variables my shaders change

hoary merlin
#

I think you'll have to create a new shader for it at the moment

naive shuttle
#

I want the rest to stay the same

#

Oh alright

#

So you mean, I'd have to manually input the normal map, smoothness, metallic, and albedo whenever I apply it to a prefab?

hoary merlin
#

if im understanding you correctly, the prefab currently has a non-editable material/ shader?

#

does it use an in-built shader or something?

naive shuttle
#

No

#

It is editable

#

Hold on let me ss

#

Ok so this is the current rock which I want to dissolve...

naive shuttle
#

Is that possible in a not too complicated way?

hoary merlin
#

ah, i dont know the answer to this Q - i think it should be possible, but idk. sorry for confusing you

naive shuttle
hoary merlin
#

but assuming you can edit the shader in the graph, can't you simply add the nodes that change emission and alpha?

#

and leave the other inputs be

naive shuttle
#

Yeah true, but then I'd have to do that for every prefab

#

That's... a lot

#

And the dissolve should be able to be enabled via a script.

#

So that the material stays the same until you activate the dissolve, which then adds the dissolve shader without altering the current texture

rustic talon
#

Im doing a mobile game. The post process is working on the editor but when I build for andorid the post process disapears

#

This is the custom shader i made for the bullets, as u can see they glow in editor but not in mobile

#

is there any setting i should change?

naive shuttle
#

Maybe it's a quality setting in project settings. Not sure though

grizzled bolt
#

@naive shuttle The shader code that executes the dissolve has to exist on the shader that you're dissolving

#

I don't know of any reasonable way to hack around this limitation

#

Normally I suppose you would make a dissolvable variant of the Lit shader that your objects use and use that for all of them

#

If the property references are identical you can switch shaders in editor without losing the assigned textures and values

naive shuttle
#

I managed to fix being able to add a texture to it, though it's just a bit annoying that these things don't work automatically, like the "Convert to URP" button which you can use with standard shader materials

grizzled bolt
#

Materials are stored sets of properties for shaders, it's not possible for a material to exist with two shaders

naive shuttle
grizzled bolt
naive shuttle
#

Ohh alright

#

I'll have to change the property references then

regal yoke
#

I wonder if Unity’s ever gonna add a node for custom lighting in shader graph- apparently the only way to do it right now is to make a custom function that calculates it, and i haven’t really been having much luck with that approach

dense ice
#

Hello everyone. Does anyone know how I would achieve an effect like this using shader graph? I am new to the subject and I'm just trying to understand how to affect a specific range of pixels on a texture to change the color. This range would change based on an input

floral pivot
#

Bloom + Transparent Shader =

#

Amazing right?

floral pivot
#

But do what you want ig lol

toxic fable
#

I'm trying to figure out a way to force Unity's URP Projector to also influence transparent objects. As you can see in the screenshot, opaque geometry is "dimmed" by the projector (basically a Fog of War). Map edge geometry, on the other hand, is not dimmed as it is transparent (fading alpha).

Now, I do know that URP Decal system does not support transparency, most likely due to transparent geometry not being in depth buffer. However, URP Shade Graph provides a way to force transparent materials to write into depth buffer (checked with Frame Debugger, it works). In the latest URP (14.0), there's also an option in the renderer asset to copy scene depth after transparents (instead of opaques).

My question is - isn't there a hacky way to overcome this limitation of the URP Decals? What am I missing? And if there is none, is there a way to write custom projector that would allow me to project a texture over the environment while influencing both opaque and transparent geometry?

azure hatch
#

Has anyone ever had any luck toggling the ShadowCaster pass in a surface shader on and off using
r.sharedMaterial.SetShaderPassEnabled( "ShadowCaster", enabled );
I've tried nearly everything.. including "SHADOWCASTER". Using Unity 2020.3.33f1

#

I only need to add this pass to write to the camera depth texture.. If there's another way to write to the camera depth texture that I can toggle on and off, I'd be open to that.
Thanks

naive shuttle
#

Hey, back with another shader problem. I have a capsule of which the material gets dissolved when a target gets close. The problem is, the base colour (albedo/diffuse) which I assigned as red doesn't get shown, though the edge colour (purple) takes over. I can't seem to find what's wrong and I've tried soooo many things. Please help!

#

I hope these are enough images lol

ornate crypt
#

My URP shader doesn't work, i tried to do this:

#

i'm a beginner at shadering with unity

#

But i don't know why the preview is pink

ornate crypt
#

I have now this problem: I have a gradient which has to change color my renderer to be like the gradient

#

But however, it doesn't change anyway

#

This is my code to do the change color

#

But all colors i can put on gradient, it doesn't change anyway

dim yoke
# ornate crypt

Are you sure a material with the correct shader is applied to the mesh?

ornate crypt
#

yes, but i think it's due to my calculation of my octaves

#

i'm trying something

#

Okay the color is well, but the octaves aren't working anyway, i don't know how it is working now, i didn't even change something

noble rapids
#

Does anyone having any good extensions, or tools that'd help VS understand HLSL, or the unity technologies library to make intellisense more functional for it? It'd be nice not having to navigate HLSL and the unity technologies shader library through search functions and google

regal yoke
#

Does anyone know of a good custom lighting setup for shader graph? I've been using the one showcased in Unity's 2019 blog on the matter, but it has a few major issues, such as it only accounting for a few lights in a scene, and it generally just... not being very good, as shown here

#

afaik this is one of the only ways to implement cel shading per-object in unity, so any help would be welcome

rustic ferry
#

Hello, I made a shader with shadergraph but it doesn't work on mobile because generated code is too heavy, most of the code I think is unused, someone could have a look? I'm going to attach the code here below

rain zenith
#

Hi everyone, i need help on my project 😬
I have a transparent material using a graphs shader to make a crystal. But one probleme, object inner my object are visible. I wan't to keep my transparancy but hide every part of objects in my other object. How could i do this with my graphs shader please ? 😄

grizzled bolt
rain zenith
#

It look working !!! Nice thanks 😍

quaint coyote
#

Hey guys, I created a Tessellation shader in a game environment to enhance the details. Here is a quick look how the render looks on right side vs how the #tessellation is done in real-time in left side.

https://youtu.be/9CPe3oN4PfY

This video demonstrates how you can use the Tessellation shader to subdivide a specific mesh. To show detail, we need high mesh, but we can use this concept and leave it upto the GPU to tessellate the mesh at runtime so that we can have low poly mesh in the game.
Runtime tessellation helps in transferring the load to the GPU and reduces the work...

▶ Play video
muted lava
#

Hi everyone!

I'm trying to complete Catlike Coding's "Compute Shaders" tutorial (https://catlikecoding.com/unity/tutorials/basics/compute-shaders/ ) but I have some issues with scaling. It's part "2.5 URP" in the tutorial where a HLSL script computes a scale and a position of an element. The two issues I have are (I'm pretty sure they are interconnected):

  1. The CPU-based version of the "Point URP" shader generates much bigger objects then the GPU-based "Point URP GPU" shader, and
  2. When I use the GPU version of a shader the objects are so small that they don't even get rendered if the amount of objects is high.

The code to control an object size is the following. On the .cs side:

float step = 2f / resolution; computeShader.SetFloat(stepId, step);

And in the shader:

float _Step; ... unity_ObjectToWorld = 0.0; unity_ObjectToWorld._m00_m11_m22 = _Step;

If I use some large fixed value instead of _Step, e.g. 0.2 or 0.5, everything is really great (except of objects not scaling obviously but that doesn't really concern me atm).

Could someone please help me to understand the reason of such behaviour? I spent ~5 hours trying to fix it but now I have no ideas at all.

My code and shader settings are literally as in the tutorial and I'm using Unity 2021.3.1f1 with URP.

Also, feel free to share if you know some nice tools to painlessly debug a hlsl.

naive shuttle
#

Hey, is it possible to add an if statement or a check in a shader graph? I want to check if the user has inputted a normal map, and then use that. But If they haven't I don't want to apply anything

#

I want to do this, because even when I haven't inputted a normal texture, the material still gets altered. The above image shows how it looks without anything in the normal map input.

#

The image below shows when I input a sample texture with no normal map into the normal texture

naive shuttle
#

Dissolve Shader

grizzled bolt
naive shuttle
#

That's how it looks when I set Normal Map(T2) to nothing

naive shuttle
grizzled bolt
#

"mode", it's called by the settings

naive shuttle
#

nothing

grizzled bolt
#

... it can't be nothing

naive shuttle
#

Oh wait

#

wrong one

grizzled bolt
naive shuttle
#

Im on unity 2020.3

grizzled bolt
#

Bump should be the same as normal map

naive shuttle
#

Alright

#

Looks better now, thanks!

naive shuttle
#

Hey again...
I'm trying to publish a shader on the asset store, though it's asking for texture size. What do I fill in here? Do shaders/shader materials even have a texture size?

mighty grail
#

Hi, I am trying to add bloom effect to this 2D sprite with lit sprite graph, but as I connect the sprite emission, it turns gray and has no effect. Is there a way to add emission or bloom to 2D sprite? Any help is appreciated!

smoky void
# mighty grail Hi, I am trying to add bloom effect to this 2D sprite with lit sprite graph, but...

In this video we create an awesome Glow effect for extra flare!

► Check out Popcore! https://popcore.com/career

● Download the project: https://github.com/Brackeys/2D-Glow

● Get Gothicvania Church Pack: https://assetstore.unity.com/packages/2d/characters/gothicvania-church-pack-147117?aid=1101lPGj

● Learn more about 2D Shader Graph: https:/...

▶ Play video
grizzled bolt
naive shuttle
#

Hey, I made a dissolve shader though I want it to go up and down, instead of just in random spots. I've already spent 2+ hours trying to get this to work, though it just won't work...
Can anyone please help me?
This is what I have so far

peak echo
#

I am watching a tutorial, but when i change the color in the shader as base color, the material dont change

shadow locust
#

show screenshots?

peak echo
#

But now everything is pink

#

i have to create new materials for everything

#

i guess

peak echo
shadow locust
peak echo
#

I did

#

I didnt found it

#

anyhting about the default ones

shadow locust
#

then you didn't read the whole page

peak echo
#

So to create a simple shadder i have to change the hole project

#

What if i only want to have a shader graph material for one object and the normal ones for others? Because i like the default materials

shadow locust
rustic adder
#

Does anyone know why the normal node makes everything grainy?

#

Im still new to shader graphs btw so i dont know much on these things

#

all im trying to do is i have a lava shader thats currently working fine and i just want to make it look a bit 3d by adding a normal map to it thats all

knotty juniper
rustic adder
#

It’s just grainy by default idk why

little marlin
naive shuttle
naive shuttle
tacit parcel
#

Or, if your model is unwrapped with head up layout, you can use a gradient look up texture to add to the threshold calculation

tacit parcel
dim yoke
simple violet
tall mantle
#

Trying to do a color swap shader, but the shader is only accepting my entire spritesheet which looks horrible in the shadergraph. How do I fix this?

shadow locust
quaint coyote
worldly drift
#

Is there any shader macro I can use to check if any kind of VR rendering is active? I need sth like UNITY_SINGLE_PASS_STEREO which also works for multipass

tall mantle
#

I need the spritesheet for animations, but well... putting the entire spritesheet in looks terrible

#

this is what the main preview looks like

marble plover
#

hey, i'm ne wto unity and i wanted to know why i have this error in the shading ? i can't find the packages in all the packagings

quaint coyote
quaint coyote
worldly drift
quaint coyote
quaint coyote
marble plover
tall mantle
#

So, I'm making a shader to replace certain colors from the sprite with a different color. This is the graph I got going, when i put the spritesheet into the texture2D field, it looks like this

quaint coyote
quaint coyote
#

That’s why earlier sprites had a sprite renderer with a material assigned to it. The renderer used to handle the uv tiling and offset

#

Let me see how it’s in urp, I mostly write ✍️

quaint coyote
tall mantle
tall mantle
shadow locust
tall mantle
quaint coyote
brave sable
#

Hi, i'm trying to pass a Texture3D to a compute shader but its not working and giving an error saying that i have to set the UAV flag. I don't see an option to set it on a texture3D, so i was wondering if anyone knows how to fix this error?

quaint coyote
brave sable
quaint coyote
#

Texture3d must be a rendertexture with depth, I remember passing render tex as 3d tex

#

There I had the read/write flag. Tex3d might also have something similar

brave sable
#

Yeah i think im stuck using a rendertexture with depth since i did that before and that did work. Because i cant find anything on enabling read/write for tex3d

quaint coyote
#

There’s only isReadable

#

But does compute read n write textures well? I complete forgot what I wrote about years back now 🤣

dim yoke
#

That doesn’t seem like same shader at all… I have no idea how you could get that result with the give nodes… only way I can imagine is if vertex colors are like that or if Width is 0 and Rectangle node doesn’t work as intended because of that

hot garden
#

I have a leave cutout texture on a triangle mesh, but when I apply a shader to that material, I lose the cutout shape of the leaf and just have a square. I want to have the shape of the leave but the color of the shader. Is this possible?

calm rock
#

Hey there, does anybody know how to do 'SceneColour' in a custom function? I want to do multi-tap sampling of the backbuffer without driving myself nuts with node hell

#

I've tried 'shadergraph_SampleSceneColor' but it doesn't seem to work

#

but then sampling textures doesn't seem to work either... unity makes easy things hard

lean lotus
#

So I want to compile a compute shader to be able to be debugged by the nvidia shader profiler thats part of Nvidia Nsight, but they say that you need to basically compile shaders with arguments, such as "dxc -Zi [..] -Fo shader.bin shader.hlsl"
How do I achieve this through unity for my compute shader so I still get access to debug info?

delicate bison
#

my current shader are super pale by now, coz it's generated from blender
I'm using blender coz Unity doesn't have material ID for a single mesh selected.

#

now I'm considering to switched to URP.

#

it's not described if Amplify Shader Pack are a URP kind of thing or not

cold robin
#

Good morning everybody!
Sorry for popping in here with a question, I kind of have an annoying problem that just randomly popped up while adjusting my model's rig (shoulder position) recently and I was wondering if anyone knew what was up.
There's a strange gloss and darkness, on the arms (left image), that is unconnected to shadows, metalness or roughness.
I believe it to be some kind of basic fresnel effect around the edges that vrchat standard shader has and that behaves... irregularly.

Anyone know what could cause this and how it could be fixed?
I use the Standard shader with Normal, AO, Metal+Smoothness & Emission. However it seems that they are not involved, because just choosing any of the "Default" Materials also produces this line. :<

grizzled bolt
#

Or something else is wrong with it, but I'm fairly sure that's a normal map problem

cold robin
grizzled bolt
cold robin
#

Thanks for helping btw, it's very appreciated!

grizzled bolt
#

Oh, check for inverted normals

#

The fresnel works correctly in the body but seems to invert at the elbow

#

That's definitely a clue

cold robin
#

In Blender at least all the faces are facing the right way

cold robin
grizzled bolt
cold robin
#

Hah oof. It's a mystery

cold robin
grizzled bolt
#

I'm quite sure the arm is inside out
Maybe the bones got a negative scale somehow

cold robin
#

Hm, scale is below 1 but positive. But overrotating does seem to cause this effect, even in the recalculated version

#

ALRIGHT, recalculating Normals in Blender and re-exporting did it!
Thaaaank you so much for the help @grizzled bolt

remote light
#

Hey folks, this isn't exactly a shader question, but might be shader-related. Is there a way, from within Unity, to paint/define areas of a mesh so they can use different material-slots. For example a tree mesh that has one material slot, I instead want to be able to assign one material to the wood and another to the leaves. I know this would usually be done at the model-creation stage, but this is more for prototyping where I'm working with pre-made models and trying to achieve a certain art-style.
Polybrush is not exactly the solution I'm looking for because I want to retain the flexibility of using whatever different shaders I want on the different materials/slots

polar garnet
#

Hey guys, need some help with a unity shader issue which I am unable to figure out from a while.
It's regarding lighting of the world reflecting onto my character. Is it possible to have independent shadow casting and lighting built within my own shader? This is so the external light does not have much impact onto the skin tone of my character.

polar garnet
#

Here's a little demonstration of what i mean, i want the same lighting on the back as on the front, but currently the world light is impacting it.

meager pelican
# remote light Hey folks, this isn't exactly a shader question, but might be shader-related. Is...

Let's define some terms. 🙂
A material, in unity, is a shader plus the unique instance of the settings for a particular material...like textures, colors, any passed values.

So you cannot have multiple shaders in one "material", because a material IS ONE shader.

BUT, there are ways to map multiple, different, textures based on settings for each polygon in a mesh, for example. This is commonly done in terrains for example. Unity's terrain system uses a map to decide what texture to draw where. So your shader logic could say something along the lines of "if polygon type is a 0, use the leaf texture, if a 1 use the bark texture" etc. In your shader logic. You could pass an array of textures and stuff a texture index into a vertex color value, for example (and don't combine verts in the model). That would still require you to pass the info in the model, though. Otherwise, from the shader's view, it's shading some polygon somewhere, without any information as to what "type" of polygon it is. Somehow there would have to be a map or an attribute to differentiate each polygon type.

When we put multiple materials on an object, it draws that same object multiple times, once for each material. Often to be avoided as duplicating draw calls is inefficient. But you could have one shader draw the bark, and another draw the leaves, and each would discard what it wouldn't want to draw. That requires 2 passes, and still requires you to indicate in the model or in some external map what type each polygon is, so you may as well draw them all at once in one pass.

remote light
# meager pelican Let's define some terms. 🙂 A material, in unity, **is a shader** plus the uniqu...

Thanks for your reply. Yes I can see some of my wording was a bit confusing, but yes I do understand the basics, I've been doing this stuff for years 🙂
I just meant I want to retain the flexibility that comes with multiple material slots on a single mesh. Draw calls aren't really a problem in this project since I'm using all unlit shaders with no textures. So while I know how trees for example are traditionally done, this is a non-traditional use-case
Basically in most instances I can apply an unlit single-colour material to an object, say a rock or a wall, but for a tree this doesn't work because I need a colour for the trunk and another for the leaves - so that's my use-case that I'm aiming to solve without needing to prepare or alter any models in 3D software

naive shuttle
split helm
#

i can make a shade like this on my 2d game?

naive shuttle
#

That doesnt have anything to do with shaders... that's just a 2d texture

meager pelican
naive shuttle
#

it cant

#

afaik

meager pelican
#

Basically, IDK of a way to not UV model, or otherwise map/attribute it so you can tell leaf from trunk. Somehow, that has to happen.

#

If the tree is already UV mapped, you should be able to "just" substitute a new texture, or in the case of multiple materials, textures. Depending on what the UV model is. You'd probably want some of the texture areas transparent and make sure the material is in the transparent queue and with the proper blend.

mental bone
#

Just paint vertex colors on the model with polybrush or something and have the shader either sample the color directly or use it to lerp between the desired trunk and leaves color

meager pelican
#

He doesn't want to touch the model, though. And that's the problem, and we don't know how the model is set up.

#

I mean, if he just wants solid colors he can (maybe) swap out the texture. Maybe for a color map. But the question indicates otherwise.

mental bone
#

His initial question is "is there a way to paint the model within unity so that..."

#

He also said he is going unlit with no textures

#

So a simple vertex color is the way to go imho

meager pelican
#

"Is there a way, from within Unity, to paint/define areas of a mesh so they can use different material-slots. " Sounds like he wants a color index.
But sure, vert colors might work too if he wants to define them, but he'd have to do that in the model, and he doesn't want modelling software used.

mental bone
#

Polybrush can paint vert colors right in unity

#

We use vert colors for all our material variation

#

But we have a custom paint tool cause polybrush sucks

meager pelican
#

Sure, I mean, if he wants a custom shader/material instance, he can paint leaves with one index, and trunk with another index, and then assign two colors in the shader, and have room left over for other stuff.
It would work.

mental bone
#

For his Im guessing flat color look sampling the vertex color to push to the frag will be exactly what he wants

#

Hope he reads this convo hah

balmy fulcrum
#

Hey everyone, new to Unity/Shaders - is there a way to make a UI panel have a 2d shader? Trying to combine a holographic shader with UI elements to make a "Holographic Inventory"

winged kernel
#

Hi all. Wrestling with a problem that I just can't solve no matter what I try, and was wondering if anyone would be willing to help. My knowledge level in shader writing is novice; I think this is a shader problem, though maybe I'm wrong?
I have this HLSL shader with one pass, vertex and fragment programs. This shader is meant to render a minimap on a HUD; it does this by displaying a simple render texture that a camera draws onto. It's on the overlay queue, rendertype transparent.
This mostly works, with one exception: I can't get it to draw anything that's behind a transparent material. Instead, all transparent materials blend into the skybox. I've been fiddling with this for hours, and nothing helped.
Any pointers? (Or questions?)

winged kernel
#

Ok, I figured it out. The alpha channel from the render texture had to be cleared by the shader when appropriate, otherwise it would make this material itself transparent. Thanks anyway!

glad heath
#

So I have this asset Ive made in blender and I want to import it to blender with the cycles render engine. Is it possible?

dim yoke
balmy fulcrum
teal breach
#

has there been any more detail recently on what the shader foundry layer will look like, or other SRP changes?

teal breach
sacred minnow
#

I have no clue where to send this so I'll put it here. The model looks fine on blender but in unity, The textures go haywire and backface culling gets turned on for some reason.