#archived-shaders

1 messages Β· Page 79 of 1

warm pulsar
#

these all look healthy to me

#

(I'm using the debugger outside of play mode)

#

oh wow

#

as I mouse over different parts of the inspector, the object is flashing

low lichen
#

And this is with an SRP Batch draw call selected?

warm pulsar
#

Yep

#

Also, with the game running, it's fine

#

even if I do not write to the matrices

#

uninitialized memory is part of a complete breakfast

#

(unity 2023.2.20f1, HDRP version 16.0.6, ARM macbook)

low lichen
#

Yeah, I would only trust an external tool like RenderDoc to show the real values.

warm pulsar
#

(it's using row 0 of the transform matrix for the fragment color)

#

so here, it's actually correct most of the time

#

it should be red

warm pulsar
#

although...unity doesn't come back to life after a frame capture

#

so it's a bit awkward

#

(i used this to discover I was doing billions and billions of flops in the fragment stage)

#

too much simplex noise, oops

warm pulsar
#

It only happens when inspecting the object itself. If I inspect something else, it's fine

#

something funny is going on over here

#

...is it getting batched alongside the preview in the inspector?

#

if I put the inspector in Debug mode, it stops flashing. The preview at the bottom is still wrong, but it's not changing as I mouse around the inspector

#

sometimes it get stuck all-white after I deselect, though

#

very weird behavior

#

time to make an example project

warm pulsar
#

oh yeah, it's exhibiting similar behavior in unity 6

tough glade
#

can I pass a list to a shader?

#

like have a property be a list

warm pulsar
#

so that's something i've been looking into a bit..

#

I think that's where you use a structured buffer?

#

but I am also interested in learning about this (:

low lichen
# tough glade can I pass a list to a shader?

Your options are either arrays, which are fixed size and can't be larger than 1023, or graphics buffers. If you're using Shader Graph, I don't think you can define arrays, except maybe in a custom HLSL node?

tough glade
#

not using the shader graph

low lichen
#

Both act like arrays rather than lists. That is you can't resize them after they are created.

#

Arrays are as simple as:

float4 _MyArray[12];

and then Material.SetVectorArray. They can't be defined as properties or be serialized.

#

Buffers have to be created and disposed of by you, either using ComputeBuffer or GraphicsBuffer. The latter is more recent and the recommended option. In most cases, both are accepted in various shader APIs, except in some cases where only GraphicsBuffer is accepted, like in VFX Graph.

#

Buffers work very similarly to textures, in that they are separate objects which can be read from by multiple shaders.

warm pulsar
#

So if I want to use a GraphicsBuffer in a shader graph, I'd need to add a Custom Function node and write some HLSL?

low lichen
warm pulsar
#

i'd love to be able to just run a blob of shader graph once for every item in a buffer

#

but I suspect I'll need to translate this into HLSL...

sterile zinc
#

Using shader graph, how do I get the object's position in screen position? The screen position node is not what I'm looking for, since I want to keep the object's origin in place.

#

desired effect:

regal stag
sterile zinc
#

@regal stag I think that worked, thanks! Didn't know about the swizzle node either

warm pulsar
#

Is setting a keyword (that I've already looked up by name and stored in a variable) every frame a problem?

#

it's easy enough to add some extra code to check if I've already set the keyword to the desired state

#

but it'd be nice to not have that extra clutter

hollow raft
#

I was trying to figure out how to setup my shader to include normals

#

I found something that is called normal from texture and was wondering if that is it

#

this is what I have so far

regal stag
regal stag
#

Then in this case, use Transform to convert from Tangent to World space too. Replace any Normal Vector nodes with that result.

hot cloak
#

I have custom passes that create an outline for objects, however it does so for all objects on this layer. My issue, is that I want only specific objects to "enable" this custom pass once x happens, I have a way of detecting when it should do the custom pass however I am very new to rendering as a whole and don't really know a workaround for making the pass enabled only after this "detection". Any ideas?

#

HDRP ^

hollow raft
#

atm I am trying to connect my models texture and normal into the actual shader

regal stag
quick ibex
#

I wannna learn about shaders

hollow raft
#

when I do it, it changes the colors to green and blue as if it's reading the normal as a texture

#

I used a mutliply to join the texture with the normal map

#

for my texture I used a Multiple that had a remap and a sampletexture 2d connected to the multiple

#

do I attatch to the vertex? it has a object space that leads to a normal

regal stag
daring wind
#

Hey I am looking for some pointers on how to accomplish an effect for this skybox shader I am making.
I want to have a blur/haze around visible geometry. I can think of a way to accomplish this effect, but I don't think it's performance friendly at all. It involves using a render texture with a secondary camera, rendering only visible geometry in the depth buffer, masking it all as white, and then applying a gaussian blur. Is there a better way to accomplish this effect? Thanks

#

To give a simple example of what I am trying to do:

#

Imagine the red circle and cube are geometry, and the black is just a blank skybox

#

I want the skybox shader to recognize the geometry and draw a haze around it, kind of like this:

#

Any help is appreciated ❀️

past root
#

So I'm using a billboard shader. The bottom is a unity cube, the top is a cube I made in blender. Any idea why the blender one is tilting down instead of toward the viewer?

ebon moss
#

does anyone know how I can make all the non black areas white?

amber saffron
hasty breach
#

is it possible to look into shader graph of urp/lit?

regal stag
#

If you're trying to replicate it, the Lit graph does the same kind of shading you mostly just need to provide it the textures & sample them

odd wraith
#

My shader sometimes works sometimes doesn't. How can I fix this.

amber saffron
odd wraith
#

it's part of the shader

#

this is how it should look like

flint yew
#

whats the best way of debugging a render texture in the unity frame debugger?

#

i only seem to be able to debug things rendered directly to the screen

leaden dagger
#

hey can anyone help me add a hue shift to my avatar that i have for vrchat im still pretty new to unity and editing stuff so id appreciate it alot

twilit geyser
leaden dagger
#

is there a way we can vc so i can show you

#

then you can tell me if you can or not

odd wraith
#

it's only affecting the last material

#

how can I make it that it affects all materials

regal stag
odd wraith
#

nope doesn't seem to

#

Btw I'm Using HDRP

#

what do I do in blender?

#

It's in one mesh

regal stag
odd wraith
#

wouldnt it still just do the first one again

#

thats normal for the shader

#

how owuld I use multiple shader passes though

#

how would I implement it to the material

#

I didn't download and drag'n'drop them

#

I made sure to understand. It's just that I never added them to a material before I just made materials out of them

#

So what do I need to do to attach it to the default shader

#

also it's the hdrp unlit which I'm using

#

not default

odd wraith
#

also the error you saw is from adding the outline material

#

cause the shader isn't being acted on the specific material it's just a general shader as it's own material

rustic cove
#

someone know why?

bronze cove
#

@rustic cove What pipeline are you using?

rustic cove
#

URP

grizzled bolt
odd wraith
#

So how would I be able to render all the matetials

#

Would I need to get reference to another material and put the outline on it

#

I was doing some research and someone gets over this probelm by doing a command buffer draw renderer. Any idea what that means?

#

What I need is to get the material values and add the shader into it. Else I'll have to separate everything my material and use the version I currently am doing

grizzled bolt
#

There are many reasons why it might not work, the most common reasons are a missing a step in the guide, and having a mesh with an odd scale or normals so the effect can't appear correctly

past root
#

I'd like to use a shader to display a black rectangle that always covers two empty gameobjects, but I'm not sure where to start

#

any ideas?

#

I currently have a plane that's rigged to follow those two game objects, and I'm trying to apply a billboard shader to it, but it's not working out.

eager folio
#

Just use a line renderer?

#

Or do you mean like a bounding box

shut vigil
#

I made a shader in hdrp before and i switched my project to hdrp, the shader was made with the dissolve shader. It doesnt work in urp, any fixes?

odd wraith
odd wraith
#

So apparently the reverse Hull method I used has a problem cause there should be another one which can render multiple materials ill do some more research but I also would like some guidance into how I can get the material values. I know I can get base model and texture but to make every variable matter from the hdrp settings it would take long

gray hamlet
#

Hey guyssss
I am making a grass shader and I wanted to get the color based on the color map of the whole thing.
But I have no idea how :P

#

got any ideas?
This is the map btw

fallow bolt
ebon basin
#

https://www.stevestreeting.com/2019/02/22/enemy-health-bars-in-1-draw-call-in-unity/
I had a question about this blog post about batching HP enemy bars. It's a little dated, but I've been putting it in my projects without a problem. My question is about these function calls:

UNITY_INSTANCING_BUFFER_START(Props)
UNITY_DEFINE_INSTANCED_PROP(float, _Fill)
UNITY_INSTANCING_BUFFER_END(Props)```
They're used for instancing the HP bars, but are these calls redundant now that you can just select GPU instancing on the material from the editor?
#

GPU instancing in general seems hard to gauge as the batching still seems to show larger numbers than if they were static batched.

low lichen
low lichen
ebon basin
#

So you're telling me I can do both if I do it like this?

#

And, if I weren't using static batching, is there any difference between enabling GPU instancing from the material vs using these shader macros?

ebon basin
#

Yeah, it's interesting but with GPU instancing you still get a large batch count on the statistics, but there is a noticable difference with it on and off.

#

maybe it's time to ditch SpriteRender's dynamic batching and make it all GPU instanced.

hoary merlin
#

Hey all, so i'm working with unlit shader graph in URP and making a toon shader, is there a way for me to make these objects receive shadows? For example, I'd like the plane here to receive object shadows:

#

trying to achieve a style like this with the shadows, but i'm not sure how to approach it as a shader graph/ coding newb

ebon basin
#

https://www.youtube.com/watch?v=GQyCPaThQnA
This may be helpful, but there's some he does outside of the ShaderGraph too

βœ”οΈ Tested in 2020.3 & 2021.1

Do you have a material that doesn't look quite right in Unity's URP lit shader graph? Or would you like to experiment with stylized art styles with the convenience of the shader graph? In this tutorial, I show how to implement custom lighting, allowing you to solve both those problems. Afterwards, you could extend t...

β–Ά Play video
#

Ned in general has a lot of good info on getting that light and shadow data for your shaders

hoary merlin
#

Thank you! Yes, it looks like i'll have to resort to a bit of code, I'll try and get that set up. Thanks for the link! Seems really useful.

low lichen
ebon basin
ebon basin
# low lichen SRP Batcher has nothing to do with static batching.

So I guess the idea here is if you're rendering a lot of a similar object with the same material, GPU instancing may still be suggested, but otherwise leave GPU instancing off? And, Static batching is something that's done additionally after to further reduce drawcallls?

#

There's a lot more to this than I thought.

low lichen
ebon basin
#

I mostly code URP, and I do notice that option on the render's profile.

#

HDRP I don't think it's on by default though

low lichen
#

If you choose to use SRP Batcher, then that changes drastically how you manage batching. In the built-in batcher, you have to minimize unique materials, and a good way to do that is by using GPU instancing.
With SRP Batcher, you need to minimize unique shader variants, but you're encouraged to have many material instances. That's why Unity implement the material variant system, to encourage that workflow further.

#

MaterialPropertyBlocks are very useful in the built-in batcher, but actually break batching with SRP Batcher, so they should never be used.

ebon basin
# low lichen If you choose to use SRP Batcher, then that changes drastically how you manage b...

"If you choose to use SRP Batcher, then that changes drastically how you manage batching. In the built-in batcher, you have to minimize unique materials, and a good way to do that is by using GPU instancing."

I was reading about that earlier from the devs on the forums. Didn't really explain much and basically said don't worry too much about it and it's just an artifact from built-in on the topic of SRP

#

I guess at this point I should just start profiling a bunch of settings with different combinations cause there's a lot more going on than I previously thought.

low lichen
# ebon basin "If you choose to use SRP Batcher, then that changes drastically how you manage ...

GPU instancing is still a powerful feature, but SRP Batcher is much more convenient and I think faster in scene with more diverse meshes. If you have a specific feature where the same exact mesh needs to be rendered many times, then you can see benefits by using GPU instancing. There's a section in the documentation which describes how to do that with SRP Batcher.
https://docs.unity3d.com/Manual/SRPBatcher.html#:~:text=Intentionally removing SRP Batcher compatibility for GameObjects

warm pulsar
#

oh yeah, I found an article that explains why this is necessary

#

and you're right! you can transpose and switch the operands

#

you wind up with transpose(vec) * tranpose(transpose(inverse(matrix)), which is just transpose(vec) * inverse(matrix)

#

the transform matrix is inverted and transposed to flip its scaling without touching its rotation

warm pulsar
#

i can feel the matrix math flowing back into my brain meat

#

(i had a great handle on this...back in 2016)

covert frigate
#

I have tried so many ways to fix this but I couldn't
(The objects are not casting any shadows)

warm pulsar
#

this could be a problem with your renderers, your shaders, your lights...

#

check that you have a directional light and that it's set to cast shadows

grizzled bolt
ebon moss
#

I'm trying to change my shader so that it takes in a grey scale texture to use for shading, but instead of just multiplying the grey by the color it uses the values of the grey to shade by color intensity instead. However, I'm having issues with a mask oriented approach as it is too hard to get an accurate enough result with the blurry shading. Does anyone have any ideas?

warm pulsar
#

I don't understand how that's different from just multiplying the colors

stray moat
#

Yo I just bought the 20$ version of the unity bundle and trying to use the shaders from the bundle. While using the outline shader I want to be able to change the values on the shader for per object. I want to kinda "turn it on and off" when hovered. I can't seem to find a way to do it online

ebon moss
gray hamlet
#

hello ppl
so, I am making a grass shader where I am trying to make the color of my grass based on the basemap of the terrain
Since not everyone uses unity's terrain tool, I decided to allow an map and I have a simple texture.

From what I have learned up until now is that I should somehow get the position of the grass object and map it onto the basemap.

This is my shader up until now:

#

help wud be greatly appreciated

burnt wigeon
#

using a custom shadergraph in Built In, I only get shadows to cast and be visible from one direction of the camera

#

for some reason the other direction doesnt get shadows

#

I switch from my custom shadegraph to the basic specular setup and you can see how the shadows cast properly there

#

I have absolutely no idea why this might be happening

#

my custom shader is a very basic PBR Setup shader

#

I dont think there is anything blatantly wrong with this last one

#

Its just splitting some textures for a classic PBR setup, ported for built in

#

if anyone has a clue of why this is happening it would be incredible helpful, I have been trying to fix this for a while and have no idea whats going on

steel notch
#

Alright found some oddity. I've got some TextMeshPro mesh rendering some text within a collection of sprites using a Sorting Group.
I would like to do some masking on the Text.
With the Sprites I use a Sprite Mask, but the TextMeshPro mesh doesn't seem to have a masking option.
I did however find this 3 year old tweet saying you can.
https://x.com/OndraPaska/status/1407348952446476304

You can use SpriteMask with TextMeshPro!πŸ₯³just change these random params to 1 and 3. Why 3? No idea. Why is it under Debug Settings? No idea. Is going to break in a new version? Probably. 😩#unitytips #madeinunity

#

And it works.
So my question is.

  1. Fucking why does this work?
  2. Is there a better way to do masking with text meshes?
  3. This solution changes the material itself, it would be nice if I could change this property on an object by object basis. Any suggestions?
round plume
#

so, here https://youtu.be/Ic_3p90NdxM?si=fexdS3q79Kxtqs4Y&t=673 it shows custom waterline shader, but i cant find any examples anywhere

Let’s dive into the High Definition Render Pipeline (HDRP) water system! See the steps/workflows for creating realistic bodies of water in your Unity scenes.

The water system allows you to add high-quality oceans, rivers, pools, and lakes to your HDRP environments.

In this video, we’ll cover the basics of setting up a water surface from scra...

β–Ά Play video
#

i guess its just using getcameraheightfromwater to blur the line here?

covert frigate
#

how to make this shader get affected by shadow
( it's applied on the capsule )

tacit parcel
flint yew
round plume
#

yup, found it

regal stag
regal stag
ebon basin
covert frigate
#

Can I remove this layer of pitch black shadows from a lit shader graph to appear like the unlit one ?

smoky widget
#

Hi! I have a custom material that i'm applying some texture arrays in the editor. However everytime something happens it loses reference and i need to update it again. I started checking and subscribing to events that trigger that loss, like before assembly reload, after assembly reload, scene saved, undoredo performed, etcc, but every so often I encounter a new case where it loses and i need to find the new event and subscribe to it

#

Is there a better approach to do that? a global event, or global check to do that

karmic hatch
#

(will need to make a custom node or set through a script)

#

or use emission! that works too

ebon basin
# low lichen GPU instancing is still a powerful feature, but SRP Batcher is much more conveni...

So I have another question relating to batching a specific shader if you mind answering. I have this 2.5D shader such that I can render sprites in a way where they will not clip into geometry using some billboarding techniques. The problem I am having is that if I were to use this shader with the SpriteRender component, I have to explicitly break batching in the shader else SpriteRender will not render them correctly. I believe this is due to the nature of how SpriteRenders do their own dynamic batching.

So my idea is that I should probably forgo SpriteRenders and render it myself using quads, meaning I'll have to probably animate them in code myself by iterating over the sprite atlas. My question is, if I were to do it this way, each individual player/enemy unit will need their own material for me to iterate through. In this case, SRP batching should really help minimize the drawcalls in this case, or is there more I should be aware of?

#

I'm expecting to render maybe hundreds of units at a time to give an idea.

low lichen
# ebon basin So I have another question relating to batching a specific shader if you mind an...

Dynamic batching is ideal for sprites, so if you can find a way to keep that, I would try that. The problem you're facing is likely because the vertices of the mesh are combined with others and get transformed into world space, so you can't rely on the object position to be localized to the sprite.

SpriteRenderers have actually not really been compatible with SRP Batcher until very recently, when SRP Batcher added support in 2023.1, so the version of Unity you're using is very relevant here.

In older version, SpriteRenderer uses MaterialPropertyBlocks to set the sprite texture. This breaks SRP Batcher support, but that's usually fine because dynamic batching can be used instead.
I don't know how 2023.1+ works, other than that SpriteRenderers can be batched with SRP Batcher. A Unity developer says here that SRP Batcher should be faster than dynamic batching for dense sprite meshes (when you have the sprite's Mesh Type set to Tight) and otherwise dynamic batching is preferred.

ebon basin
#

Ah, neat about time. I just think in general that any billboarding done in the shader has in the past not worked with any sprites I worked with. Usually I would billboard via cpu side to avoid it, but this shader I am using is a bit more complicated.

#

Maybe I could make a bit more sense to put it CPU side, but I've also got a bunch of shadow/lighting that would not make sense be easy to implement.

low lichen
#

That way, you can calculate the true local vertex positions, which I'm assuming you need to calculate your billboarded position.

ebon basin
#

Alright let me check about that, but otherwise on the discussion of having multiple materials (100+), that shouldn't be too much of a problem for the batcher?

#

if I need to fallback onto it because I will animate everything in code lol

low lichen
#

If you're using a version older than 2023.1, which you still haven't confirmed yet, then SpriteRenderers are not using SRP Batcher. So then you have to treat it the way you would treat batching in the built-in render pipeline, which is to reduce the number of materials.

ebon basin
#

Oh, I wasn't going to use SpriteRenders, just a texture array for each Unit that I iterate through

#

and instead use quads which I'll iterate over on update

#

I'll have an exposed field for the material for the texture atlas so each enemy will update using that.

low lichen
#

The SRP Batcher will handle that many materials. But it will still take some time to create them initially and you have to ensure you destroy them afterwards, because otherwise they will stay in memory until you load into a new scene.

ebon basin
#

Object pooling the materials is probably fine, and I'll take your word for it if it comes to that. TY for your time ^^

ebon basin
#
void InitalizeSurfaceData(Varyings IN, out SurfaceData surfaceData)
{
   surfaceData = (SurfaceData)0; // avoids "not completely initalized" errors

   half4 baseMap = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, IN.uv);

#ifdef _ALPHATEST_ON
// Alpha Clipping
   clip(baseMap.a - _Cutoff);
#endif

   half4 diffuse = baseMap * _BaseColor * IN.color;

   ...
}```
clip doesn't seem to be working for me in 2023.2.20f1, and this shader was working in most 2021 version and 2022 versions
#

Not too sure if that's the exact issue as I am quite a little rusty with this stuff. I just know that sprite shaders in SRP using HLSL is a pain in the butt.

steel notch
ebon basin
steel notch
# ebon basin Yeah but whatcha doing with billboarding

In my case I knew my camera would always look down at 45 degrees. So I just scaled my units by 1.42 along the Y to "undo" the visual shrinking cause by the angle. They're actually still upright. This made it so I didn't have any issue with the sprites clipping into walls behind them.

#

I had found some other 2.5D games that did this as well. It seems to be a solid solution if you know your camera angle will be mostly static.

ebon basin
#

Ah, ahah. Yeah, sometimes the simplest solutions are just what you need

#

I could probably do that but the only issue I have (beyond clipping not working right now for some reason) is batching

steel notch
#

How many dudes do you even have? Even though the rendering was really inefficient with transparent, I was still getting solid FPS with 100 units.

#

It was only with 200+ that stuff started to go bad.

ebon basin
#

if you make your dudes transparent, that's less fun particles and shaders you can have on the geometry

#

in 2D it doesnt matter too much because sorting order fixes a lot of those issues

steel notch
#

Yep. The worry I had was that my dudes were composed of multiple sprites, and with so many of them moving everywhere, layering would break without a sorting group.

#

But I sort of underestimated how close you could shove planes together.

#

You can have them separated by like 0.001 units and they're fine.

#

To REALLY make sure I didn't get any sorting issues I have a script on my dudes that, when they're created, randomly rotates them along the Y axis between -5 and 5 degrees.

#

It's barely perceivable, adds a bit of visual variation to them which is nice, and makes it pretty much impossible for odd layering.

ebon basin
#

the precision on the z-fighting isn't absolute I've noticed and I would budge it a bit more if you expect to render these planes from afar

steel notch
#

I think the individual layers for the dudes are sitting at a separation of 0.01 at the moment.

#

Should be fine πŸ˜›

#

Pulled in the far clipping plane from the default 1000 to 250 to be extra sure.

fossil flint
#

I always hear a bunch of people experimenting arbitrarily until they find a number similar to 1.4 etc when working with stuff like this

#

Like top down movement multiplying by 1.4

low lichen
#

1.4 is close to the square root of 2.

fossil flint
#

I always use 1.41421356237

#

Idk if that was the intent

#

Or trial and error

steel notch
#

Think I just quickly did the math, saw it was 1.41 and a bit of a remainder and just upped it to 1.42.

ebon basin
#
half4 ShadowPassFragment(Varyings IN) : SV_TARGET
{
  Alpha(SampleAlbedoAlpha(IN.uv, TEXTURE2D_ARGS(_MainTex, sampler_MainTex)).a, _BaseColor, _Cutoff);
  return 0;
}```
I mean that seems right, right?
grand jolt
#

Anyone know of a shader I can quickly use to key things like a green screen?

warm pulsar
#

you can get a very basic effect by adjusting alpha based on the color of a texture

#

something like this

#

it computes how far you are from [0,1,0], which is pure green

#

anything within 0.01 of that color value will wind up getting its alpha reduced

#

I suspect this not going to work that well, though

#

Don't green-screen effects usually look at larger chunks of an image to figure out what's "inside" and what's "outside"?

ebon basin
#

https://hatebin.com/howdeyzjce
Can anyone spot any error or perhaps something deprecated in this code? My console is getting spammed with 'State comes from an incompatible keyword space' and seems to get fixed if I remove the shadow entirely, but there's no actual stacktrace.

#

works in multiple different 2022 and 2021 versions, and now only giving me trouble with 2023.2.20f1

#

#ifdef just seems to be not working at all

ebon basin
#

Tried a basic shadowcaster script from unity's repo and spams me with those same errors

#

guess it's time for blob shadows

severe violet
#

I'm rather new to shader graph, but does anyone know why adding a power node adds random holes sometimes in the terrain? (Its all for the fragment shader)

ebon basin
#

Hey, @steel notch. Whatcha use for your shadows to prevent the shadows from overlapping? Stencil stuff?

regal stag
severe violet
#

Oh yeah I forgot about that. Thanks a lot!

regal stag
grand jolt
ebon basin
grand jolt
#

first time reloading scene

#

every other time it looks like this

#

which is the desired look

#

textures load properly

#

but when I reload the scene this happens

#

anyone has any clues?

warm pulsar
#

Sounds like a problem with the video player

ebon basin
#

And then finally if I can ever figure out how to completely eliminate self-shadowing

#

which can honestly be resolved with some tricks like rendering a silhouette I guess

#

https://hatebin.com/flfzhrrkfd
Shader for those interested. It's based of Bgolus' z-depth billboard shader from the forums and a month of me doing cocaine. Far from perfect but fixes clipping problems and (somewhat) helps at directional shadow intake. Also #archived-shaders message for the shadow caster which does work (not this version apparently) but does have that peter-panning / self-shadowing issue which is pretty hard to solve considering it's a quad we're rendering

#

Without SRP batching though you have to explicitly break the shader batching else Sprite Render's dynamic batching will just not render anything.

covert frigate
#

the image on the left has a lit shader
the image on the right has the same exact shader but unlit
so can I get the same effect of the image on the right while getting the shadow from the lit shader ? ( I want the gradient one not the pitch black )

prime shale
covert frigate
hidden roost
#

Finally got a good result from shader graph:

#

(Note colors and pattern will be procedualy generated)

copper galleon
#

Reposting from #πŸ’»β”ƒunity-talk - How Unity handles compute shaders under the hood? I am wondering after reading this comment:
https://github.com/bevyengine/bevy/issues/5024#issuecomment-1556284646

The current implementation of wgpu only has one interal queue for submit() calls. Therefore, we still have to know where and when to put our compute submit() calls, as they will run sequentially with the render queue. I know that vulkan has a separate compute queue, and I'm hoping that one day, wgpu will too. I just don't know how feasible / mature this multi-queue system is for other backends wgpu implements.


I don't know what Unity does. I'd guess it is some combination of:

  • You are scheduling lots of jobs, but the total time is only a handful of milliseconds so it finishes within a single frame (but may take a few frames to send the results back to the CPU).
  • The compute work takes a few tens to hundreds of milliseconds, causing a minor frame stutter but it isn't that noticeable.
  • Unity itself has some mechanism to throttle the rate of async compute jobs being sent to the GPU. I haven't used Unity, so I don't have more insight here, but it seems kind of hard because you'd presumably have to estimate how long tasks will take.

afaik unity is still mainly a dx11 engine, so it does not have multiple queues... anyone here knows better?

low lichen
#

Otherwise, compute will run in the same queue as graphics calls.
As for the comments in the GitHub issue, there's some misunderstanding about how compute shaders are run. Async or not, a compute shader dispatch will always finish before the GPU finishes the current frame. You can't have a compute shader run asynchronously in the background for as long as it takes to finish, it will stall the frame if it's taking a long time.

#

Getting results back asynchronously is done with AsyncGPUReadback. This is not specific to compute shaders, just any time you want to read data from GPU memory back to CPU memory. Since the CPU is always one frame ahead (e.g. the CPU is working on frame 2 while the GPU is still processing the commands for frame 1), you can't read data back immediately, so you have to get it asynchronously. I don't know the exact process Unity uses to achieve this, it's different for each graphics API, but whatever it is, it usually returns the data 1-2 frames later.

#

I may be wrong about async compute pipeline being tied to the framebuffer swap. But the async compute pipeline can still only do one dispatch at a time, so your async compute would be hogging the pipeline over multiple frames if that is the goal.

frozen jolt
#

Anyone know how to fix that shadow problem?

#
Shader "Custom/Leaves"
{
    Properties
    {
        _Color1 ("Color 1", Color) = (1, 0, 0, 1)
        _Color2 ("Color 2", Color) = (0, 1, 0, 1)
        _RampThreshold ("Ramp Threshold", Range(0, 1)) = 0.5
        _WindStrength ("Wind Strength", Range(0, 1)) = 0.1
        _WindSpeed ("Wind Speed", Range(0, 10)) = 1.0
        _WindFrequency ("Wind Frequency", Range(0, 10)) = 1.0
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        #pragma surface surf Lambert addshadow vertex:vert

        struct Input
        {
            float3 worldNormal;
        };

        float4 _Color1;
        float4 _Color2;
        float _RampThreshold;
        float _WindStrength;
        float _WindSpeed;
        float _WindFrequency;

        void vert (inout appdata_full v)
        {
            // Convertir la posiciΓ³n del vΓ©rtice al espacio mundial
            float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;

            // Calcular el desplazamiento del viento usando una funciΓ³n seno
            float wind = sin(worldPos.x * _WindFrequency + _Time.y * _WindSpeed) * _WindStrength;

            // Limitar el desplazamiento del viento para que sea mΓ‘s sutil
            wind = clamp(wind, -_WindStrength, _WindStrength);

            // Aplicar el desplazamiento al vΓ©rtice
            v.vertex.x += wind;
        }

        void surf (Input IN, inout SurfaceOutput o)
        {
            // Calcular la iluminaciΓ³n basada en la normal
            float ndotl = dot(IN.worldNormal, _WorldSpaceLightPos0);

            // Determinar el color base en funciΓ³n de la intensidad de la iluminaciΓ³n y el umbral
            fixed4 color;
            if (ndotl > _RampThreshold)
            {
                color = _Color2;
            }
            else
            {
                color = _Color1;
            }

            o.Albedo = color.rgb;
            o.Alpha = color.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}
copper galleon
#

But the async compute pipeline can still only do one dispatch at a time, so your async compute would be hogging the pipeline over multiple frames if that is the goal.
However, if I understand correctly this would not be the case anymore when you have multiple queues - like in vulkan's latest apis. (not in unity)
In that case, it would be possible to achieve hardware parallelization across different workloads - right?

low lichen
# copper galleon > But the async compute pipeline can still only do one dispatch at a time, so y...

Vulkan can't guarantee hardware capability. I don't know the state of GPUs today in this regard, but I think it's pretty common for GPUs to only have one graphics queue and one compute queue, if that. The GPU will just handle scheduling for you if you're using more queues than that in Vulkan, like how a CPU scheduler handles running virtual threads on physical cores. So in that case, you won't get parallelization and maybe even worse performance since the GPU would be constantly switching tasks and context.

copper galleon
#

gotcha πŸ‘

low lichen
#

Any task you throw to the compute pipeline or to the graphics pipeline is going to try to use 100% of the available hardware to finish that task. There's not really much compute available to run in the background.

#

But you can definitely have one compute task and one graphics task running side by side, as those are usually pretty separate.

copper galleon
#

πŸ‘ Thanks!

ebon moss
#

can I change hdr color intensity via shadergraph?

odd willow
#

why adding another layer of texture makes the shadows all black , havent even painted the new texture yet

#

see i remove the new layer and my shadows work fine

smoky widget
#

Unity has this and it doesn't matter where the shader is, it always finds that cginc

#

How can I do something similar for my asset? So that it can always be found

#

I have this cginc in my package, but from a custom shader they cant be found

regal stag
smoky widget
#

Mmmm this is problematic

#

I'm following a layout where the package is not in the packaged folder at all

#

It's defined in the manifest.json with the file path

#

(this is so I can work on the same asset from multiple projects)

#

Is there no way to make shaders cginc global?

regal stag
#

Not that I'm aware of

smoky widget
#

How does unity manage to have the gcing accessibles from anywhere

kind juniper
#

The includes path is probably passed into the shader compiler as an argument

smoky widget
chilly robin
#

I could use some help with some shader UV manipulation. I have a shader that is currently tiled and scaled with the object's size. I'd like to extend this to also offset this by the world position:

#

I thought this would be as simple as using an Add node at the end of this and adding the world position, but this just causes the UV to stretch. What am I doing wrong?

#

Can be a bit tricky looking this up as most searches for World Space Position UVs show triplanar solutions. That's not what I want.

regal stag
chilly robin
#

Ah I was using Geometry node. Let me try object

warm pulsar
#

That gives you per-vertex positions

#

which will indeed stretch the UVs

#

(or per-fragment positions)

#

i presume this is in the fragment stage

chilly robin
#

Yeah, that was it @_@

#

My mistake lol. That makes sense

warm pulsar
#

the further you get from the origin, the more the UV gets offset (and thus it's non-uniform)

#

yeah

steel notch
#

Can Shadergraph interactwith the stencil buffer at all?

regal stag
# steel notch Can Shadergraph interactwith the stencil buffer at all?

The canvas and sprite graph probably does stencils behind the scenes to support masking.
iirc URP's Fullscreen graph also has stencil values in graph settings, but the fullscreen feature doesn't actually bind a depth/stencil buffer (might be fixed in Unity 6 tho)
But for other graph types, shader graph doesn't expose any stencil values/ops. Can only use overrides on RenderObjects.

toxic cedar
#

I made a shader for water but it's just white color sphere, there's no transparency or any water type view

steel notch
#

Thanks

toxic cedar
#

@vagrant dagger

vagrant dagger
#

do not ping me, I just pointed you to the correct channel

toxic cedar
#

Nvm

regal stag
daring wind
#

How do you access the depth buffer of a render texture? Really struggling here πŸ˜…

#

I'm using Amplify (although I imagine shader graph will have a similar approach)

warm pulsar
#

it's adding a semantic to the return value from the function

#

SV_Target indicates that it's going to a render target, according to the docs

#

I'm not sure if removing that means the shader program will completely ignore the result from the frag function

#

ah, yes, you'll get an error when compiling it -- complaining about a missing semantic on the return value

#

I can't find any other semantics that are valid for a float4 return value

#

well, the return type is separate

#

fixed4 in your case

#

but the shader program needs to know what to do with that value

#

sure, you just need to pass it in from the vertex stage

#

it'll get interpolated based on the vertices that make up the triangle the fragment is part of

daring wind
strong tinsel
#

I am trying to create the outline around the player I am using spine2d but the outline of the left produces the shader around every body part, and the right is own shader which shades the whole character, I want to create the shader around the outerpart.
I have attached the shader https://pastebin.com/4YnawYgd

burnt wigeon
#

Has anyone around has luck animating material parameters with radial coordinates?

#

I am trying to make a simple pool of blood system, I was successful animating a radial mask that grows from center outwards

#

but trying to animate the UV offset of a radial UV completely breaks them

#

which is insanely

#

it seems everytime I change the offset the sampler "resets"

#

and samples from a compeltely different place

#

which causes that weird artifact where the value is being decreased but it actually looks like its speeding up

#

this happens with both sampled noise and sample textures

#

I am insanely confused by this

dry spire
burnt wigeon
#

when viewed from the side

#

you might try using parallax mapping

#

yeah it really seems like 3 separate layers with their own normals + parallax mapping, give it a shot to that

chilly robin
#

Hiya, I'm working on a rock shader with triplanar detail normals. But why is it when I rotate the object, the shading gets so much darker. I'm doing something wrong with the detail normal, but I'm not sure.

#

Ah I see. It's because I'm using a reconstruct Z node

chilly robin
#

Is it possible to reconstruct the Z value of normal and still use it as triplanar mapping?

karmic hatch
dim yoke
grizzled bolt
chilly robin
trail nymph
#

Heya, is it possible to get the size (width, height) of a picture passed into a compute shader (from inside the shader)? Or is the only option to pass the values with a buffer/cparam?

low lichen
trail nymph
twilit geyser
trail nymph
#

If I wanted to write a compute shader that would calculate the amount of transparent pixels in a texture, how would I go about keeping track of the int?

#

Is it just a RWStructuredBuffer?

low lichen
# trail nymph Is it just a `RWStructuredBuffer`?

But if you want to read this value back to a script, you'll need to write it to a buffer. Perform the atomic operation directly on the buffer element.

RWStructuredBuffer<int> _TransparentPixelCount;

[numthreads(8, 8, 1)]
void CSMain(uint3 id : SV_DispatchThreadID)
{
    ...
    if (pixel.a < 1)
    {
        InterlockedAdd(_TransparentPixelCount[0], 1);
    }
}
trail nymph
#

Oh, that's exactly what I was looking for! I remember using this ages ago, but could not remember how it's called. Would this also work if I had a RWSTructuredBuffer with a struct that contains two ints?

 struct CalculationResult {
    uint totalPixels;
    uint correctPixels;
};

RWStructuredBuffer<CalculationResult> Result;
low lichen
#

I think it should work, yes.

InterlockedAdd(Result[0].correctPixels, 1);
#

It's just important that you don't try to add to a temporary local variable.

trail nymph
#

Wonderful, thank you so much πŸ’œ

past hamlet
#

Why is this doing this instead of just the white ares getting brighter?

#

Here it works (my other project)

regal stag
past hamlet
#

it seems to somewhat work now but I am sure this is not the best solution

#

But thanks for your help! At least its functional now!

regal stag
past hamlet
#

here it looks fine, I basically just add the green "emission" map

#

But in the game its white again for some reason?

regal stag
#

Is the colour green on the Material asset?

past hamlet
#

Oh shit im just stupid xD

#

I thought it would take the default i set in the shader graph

#

my bad

#

Thanks alot!

thick fog
#

i have a shader that does vertex displacement in all axis, but im having trouble on getting the normals, would anyone happen to know the solution?

thick fog
#

but for some reason the normals came out like this

#

i cant tell where its wrong

ebon basin
#

I have a general question on exposing fields of a shader. When we are to edit these fields at runtime, they will affect all other shared instance, correct? So ideally, if I want to make some distorting shader that I lower/increase over some (controlled) time, I would want to make a unique material for each unit that I'd apply this material to. Is this correct and if so, would anyone suggest another way to go about it instead?

I would expect this to be different between SRP and built-in as well, but it seems that making a bunch of materials via SRP would be fine?

#

The way I've been doing dependency injection usually has a single shared material for my object pools, but this kinda makes it tricky.

regal stag
# thick fog ive actually already tried one of those methods

Check your subtract B inputs - you should be using the displaced position, not just the displacement.
Also make sure the spaces match. Perhaps do the displacement in all in World. Then use Transform node to convert to Object before connecting to master stack.

warm pulsar
#

also, a gotcha to watch out for: if you work in Absolute World, make sure to still use World when transforming directions

regal stag
warm pulsar
#

transforming a direction with Absolute World mode causes...weirdness

#

i guess it winds up translating the vector

regal stag
warm pulsar
regal stag
#

I never really work with Absolute World as I don't use HDRP so aren't familiar with how SG acts with it

ebon basin
warm pulsar
#

I think it just adds/subtracts the camera position

#

but this winds up being bogus for non-position vectors

regal stag
#

Hmm yeah I guess

low lichen
warm pulsar
#

(even when you're correctly in Direction/Normal mode)

regal stag
#

Really odd it doesn't just... automatically switch to World if the mode is set

ebon basin
low lichen
#

Ideally you would Destroy the instances instead.

ebon basin
#

Ah, ok. I getcha. Basically stick with DI and when returning to the pool just destroy the material instance.

grizzled bolt
#

To get true sprite emission you'd have to use the sprite custom lit graph and lerp between the glow texture and the main texture multiplied by the light texture
Or use secondary textures to mask in certain parts of sprites with a global light that only targets that mask channel, which can be done without any shaders

past hamlet
past hamlet
warm pulsar
#

I have a shader that displaces vertices using a direction I've baked into UV1. This works great for non-skinned meshes, but it falls part for skinned meshes.

I need to figure out the direction after deformation. Any thoughts on how to do that? A few things have come to mind:

  • Store the displacement in tangent space.
  • Bake the original object-space normal into UV2 so that I know how the skinning rotated the vertex, and use that to rotate the displacement vector.
#

I was trying the latter because I thought of it first, but I am firmly bungling the math

#

and it's kind of icky

#

i'm thinking tangent space is the way to go here

#

If I could get the SkinnedMeshRenderer to deform my vector, that'd be nice!

#

ah, but computing that direction in tangent space might be difficult. i might not even have a UV map

low lichen
warm pulsar
#

maybe i will give that second idea another crack

low lichen
#

You can do skinning directly in the shader, if you pass in the bone matrices

grizzled bolt
warm pulsar
#

The goal is to be able to make a mesh with this sort of profile swell and shrink. If I push vertices out along their normals, all of the crevices wind up overlapping each other

#

I'm currently just projecting their original object-space positions (baked into UV1) onto a plane and then moving the vertex based on that

#

Works great until things start rotating!

low lichen
#

For the matrices, you have to multiply the localToWorldMatrixes from SkinnedMeshRenderer.bones with SkinnedMeshRenderer.sharedMesh.bindPoses.

warm pulsar
#

So I could write my own compute shader that does the exact same transformations as the built-in skinning shader

#

or I could reimplement it in my graphics shader

low lichen
#

No need to do it in a compute shader, you can do it in the vertex shader.

warm pulsar
#

do I want to do it in the shader graph, though? 😁

past hamlet
warm pulsar
#

blendshapes, I mean

#

blender calls 'em shape keys

warm pulsar
low lichen
#

Am I blind? Where did you say shape keys?

warm pulsar
#

Oh wait

#

Brain fart. I had originally mentioned shape keys in my OP, but removed it partway through. So I got that mixed up.

#

I want to be able to adjust the strength of the displacement along the entire mesh.

#

Shape keys can approximate this

#

or just scaling the bones, really!

low lichen
#

Because that is relevant here. Unity will skin blendshapes, and blend shapes are just vertex position offsets + optional normal offsets.

warm pulsar
#

that's actually what I've done previously: make a chain of bones and scale them in the XZ directinos

low lichen
#

Since what you want is an offset that gets skinned, you can just use a blendshape for that.

warm pulsar
#

I can approximate it with blendshapes, but it's chunky

#

using the original object-space position is working fantastically for parts of the mesh that aren't being rotated relative to the root bone (which is why I didn't notice the problem until now)

flint yew
#

does anyone have a good explainer on the .raytracing shaders?

#

just a link or a sample project

#

(compatible with HDRP preferrably)

smoky widget
#

How can I make a shader write to an int texture?

#

I don't know how to transfer shaders into a texture, normally i baked them by using an ortographic camera and taking a picture, but there must be a better way

frozen bluff
#

Does anyone have a clue how you would make a shader/shadergraph so that I can have my cave entrance fade to black the further back it goes? I've been trying things for 2 days now with no success (in URP).

Even the most successful version I had (which still sucked) completely broke when you entered the cube with the material on it.

tulip sundial
#

Hey all! I'm trying to make a cloud shader for my 2D game, and I don't know if this is the right place to post this, but My shader graph is being weird, and I don't know how to fix it. Can anyone help ( URP )

silk grotto
#

Hello one question. I liked this simulation of water. It works on this mesh. I want to use it for a waterfall, it has a curve in which the water moves faster. I tried to edit the mesh in blender, but it causes the texture to stretch, and if I add new vertices, it doesn't render so it needs something called UV.

#

shader is from the garden scene by URP Sample

burnt wigeon
#

I misunderstood what I was doing with the offset

#

Animating the offset linearly would indeed result in the blood flowing with a constant speed

#

And stopping abruptly

#

Solution was to just a different animation curve

leaden zinc
#

Can you use the Decal Render feature with an orthographic camera somehow?

grizzled bolt
past hamlet
urban anchor
#

How can i make it so the Text Underlay (aka shadow) is based on the text color (like example on the right) rather than a fixed color for every piece of text (like on the left example)?

it seems impossible
(not sure if this is the right channel, pls lmk)

strong tinsel
#

@urban anchor maybe create another text that is the child of the current one that would be simplest solution

visual mesa
#

How does the Crest HDRP water system compare to Unity 6's HDRP water system? What are the tradeoffs between the two?

steel notch
#

Hey can someone explain this layering to me?

#

We have that red streak coming through her torso but blocked by her leg and somehow behind the card border?

dim yoke
tacit parcel
grizzled bolt
urban anchor
tranquil wolf
#

I have this fairly big shader controlling leaves for bushes, I'm trying to get a gradient like pictured but for some reason this gradient I set up only shows going to black, even though I tried changing the colors (currently a light blue). Any ideas?

karmic hatch
tranquil wolf
#

hm but if I dont have obj position the gradient won't go over the whole object correctly

steel notch
steel notch
#

The cards are definitely fully 3D models. They even have a little thickness to them.

dim yoke
# steel notch Ya sure, here's the video for both of you. <@338892857995952159> https://youtub...

It looks like the trail goes straight through the card/torso of the character but not the legs. To me it looks like the depth value written to the buffer might be just offset by some height map texture to get other objects to clip with it as if the legs were higher than the rest. This could work for the legs but some other cards seem to have real depth to them as if they were composed of multiple separate layers on top of each other (some closer to the camera)

dim yoke
steel notch
steel notch
dim yoke
steel notch
#

And they don't look alpha clipped.

steel notch
dim yoke
steel notch
mild locust
#

Hi Everyone, Noob here, Lets say i have 100 RawImage components (uGui Canvas) with their own different textures.
now i want to set same instance of Material (which is a shader graph based shader that turns image to grayscale) .
My assumptions are that all the images will turn greyscale and there wont be performance impact?
is that right?

Or is there an another way to reuse same instance of material among multiple canvas components?
Thanks

tight phoenix
#

Im trying to do a simple sine wave deformation in a shader like you'd use on a flag in wind but I cannot find a tutorial on it nor can I figure it out myself. CAn anyone see what I am doing wrong here to fix it?

#

found this which looks like it will push me in the direction I was hoping for. Though I'm a little confused by their use of UV nodes, I thought you couldnt do texture sampling in vertex position deformation

regal stag
tight phoenix
#

Oh right sorry I misspoke, what I meant was that I thought UV's themselves were used for texture sampling and couldnt be involved in vertex displacement at all, that I would have to use object space coordinate position nodes instead of UV

#

I havent done a vertex deformation in a few months so I've forgotten all of what I used to know 🫠

regal stag
regal stag
urban anchor
#

wait no

#

doesn't seem to work on text mesh pro ui

strong tinsel
#

@urban anchor underlay in textmeshpro

urban anchor
strong tinsel
strong tinsel
#

The above will not work as well, i think you can try texture-based shadows instead of creating separate GameObjects for shadows, you can render the text as a texture and apply a shadow effect using image processing techniques basically shaders ( you can ask chatgpt to write the shader for you) . This approach can be more efficient, especially for static text, as it reduces the number of draw calls and meshes.

#

for dynamic text you can explore SDF rendering

gilded herald
#

Lets say I have this quarter rounded rectangle. What is the best way to render a full rectangle using this sprite only?
Any better ways/tools than having 4 different gameobjects rotated & positioned to form a full rectangle?

strong tinsel
#

quarter rounded rectangle sprite an efficient approach is to utilize texture mapping and UV coordinates to create the full rectangle.

gilded herald
twilit geyser
# gilded herald makes sense. does unity have a sprite tool for this? or should I implement it ma...

https://www.youtube.com/watch?v=37q-0oS65LY unless you're not looking to build UI elements with this?

How to use Unity's built-in 9-slice utility via the Sprite Editor, and what this help you accomplish.

9-slicing sprites is used primarily for UIs and 2D games. It allows you to stretch a sprite without deforming the corners, and also allows you to tile the center of a sprite while keeping the outer edges untiled.

For more documentation on 9-...

β–Ά Play video
wet flame
#

I'm working on a decal shadergraph and any time I change (just the connections not the properties) any node anywhere it causes a shader recompile immediately and it's massively slowing down my ability to work on it, is there a way to disable that? I didn't seem to have this problem in other shader graph types...

smoky widget
#

Correct me if I'm wrong, but having my shaders in shader graph should make it easier to transition between render pipelines right?

low lichen
smoky widget
#

Perfect

#

Are compute shaders affected by the different pipelines?

smoky widget
#

Perfect

#

Thank youuu

autumn tulip
#

anyone familiar with the URP PSX Shader?

#

Specifically URP PSX PBR

#

And has anyone experienced issues with baking lighting with it?

glad prairie
#

What are the fastest mobile blurs for UI? I need to make sure that the photo blurs, some testing, it lags and the FPS drops to almost 0

glad prairie
lunar valley
#

I am guessing you wanna blur everything if so, you could blit your render to a smaller texture than your screen size and then present that to the screen.

lunar valley
smoky widget
smoky widget
regal stag
smoky widget
#

Two more questions.
1- Is there an implicity speed loss when using shader graph? I feel like code attached, is faster than the graph attached (feel means looking at it, not testing of course)

#

2- The branch node acts as a literal branch? I used to do this, which was actually a speed boost. Does branch also produce that or should I make a custom node for it?

#

( i use this in very specific cases where it actually makes sense )

low lichen
regal stag
regal stag
karmic hatch
smoky widget
smoky widget
smoky widget
#

How can I make a dynamic input? So like, if I input a vector3 the subgraph treats it as an input3 but If I put a Vector4 it treats as a vector4

smoky widget
#

😦

#

Some nodes do that tho, like the add, there's no way for us to do that?

regal stag
#

Not that I'm aware of, there's no option exposed for it

tight phoenix
#

Every time I try to do a Convert To Subgraph, I get a null ref error in the console πŸ€”

#

but im not using any kind of custom nodes so I am not sure what is proccing it, is there any way to trace it somewhere?

zealous fractal
#

how do i make custom shaders?

grizzled bolt
tight phoenix
#

following a vertex deformation -> recalculate normals shader tutorial I made this, but I have a problem with it

#

The normal recalculation relies on Vec3 object space positions, and I wanted to use this effect on a skinned mesh that deforms to bones on top of also doing this look

#

as soon as the bones move, the whole thing kinda breaks

#

is it physically possible to recalculate normals from just the UV coordinates?

#

I need to use the vec2 uvs for the deformations to make the effect work with the bones but I dont know how to to recalculate the normals from that

#

alternatively is there any way to achieve the above effect without shaders some other way?

smoky widget
#

But thinking about it, if it's fully 3d maybe you cant

#

Why cant you use vector3 positions in object space?

#

The vertices are being displaced right?

tight phoenix
#

Because I want to also deform the plane via bones and when I do that the whole thing breaks visually, Ill take a screenshot 1 sec

smoky widget
#

Mmm i see

#

There must be a way

tight phoenix
#

the only way I can describe what I think I am seeing here is that somehow the bone rotation is causing the mesh itself to rotate it's object space, or something

#

gets really messy real fast

smoky widget
#

Oh I see, that does indeed look weird. Are you calculating the normals in the shader right?

#

But i mean, the animation itself also looks weird

strong tinsel
foggy pulsar
#

yo guys whats that in the background

#

dark red background

#

i changing the alpha but it doesnt effect it

smoky widget
#

More questions!
1- Is there a way to set a category to custom sub graphs? So that they have their own tab?
2- Can I use subgraphs inside compute shaders?. I have some code translated into subgraphs but the same nodes (and previously lines) need to be used inside compute shaders for some precomputinh

#

3- There's no support for multi pass???

#

A wait, with the new RenderGraph it might be πŸ˜΅β€πŸ’«

shadow thistle
#

Hello, im'm trying to make a shader to make nice patterns for my game but i keep running into issues:

#

hold on i might be onto something...

#

nope...

#

Why does it stretch?

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = v.uv;
                return o;
            }

            fixed4 frag (v2f i) : SV_Target
            {
                float offsetX = _Time.y * _Speed;
                float screenX = i.uv.x * _ScreenParams.x + offsetX;
                float screenY = i.uv.y * _ScreenParams.y;

                float new_x = fmod(screenX, _Distance);
                float new_y = fmod(screenY, _Distance);

                if (pow(new_x - (_Distance / 2), 2) + pow(new_y - (_Distance / 2), 2) <= pow(_Radius, 2))
                {
                    return fixed4(1.0, 0.1, 0.1, 1.0);
                }
                else
                {
                    return fixed4(0.0, 0.0, 0.0, 0.0);
                }
            }
karmic hatch
#

so when you're multiplying by uv.x, uv.y in the frag shader you're telling it about how the object is scaled

shadow thistle
#

I'm more confused about why is it than fine at scale [15; 5.5; 1]...
What do i do than?

#

Edit the material? Shader? Object?

shadow thistle
#

"Um, yeah, this is whats wrong, this is how it works, i won't tell you how to fix it tho".
Thanks a lot.... 😐

karmic hatch
shadow thistle
#

The thing is that uv is local, and i wanna keep it local...

#

The UV is just weird and idk why. You can clearly see that it's not square.

#

The only reason i need to solve this is becouse the stretching is not the same between Game and Scene

karmic hatch
karmic hatch
regal stag
# smoky widget More questions! 1- Is there a way to set a category to custom sub graphs? So tha...
  1. There's grey text under the graph name in the Blackboard window. It doesn't look editable - but if you double click it is...
  2. compute shaders are code only, no graphs
  3. no, sg generates multiple passes behind the scenes based on graph type (i.e. forward, deferred, shadowcaster, depthonly, depthnormalsonly, meta) but you can't specify passes with custom lightmodes or add extra unlit/forward passes. That breaks the SRP Batcher anyways.
    (Also RenderGraph is a scripting API, not another visual editor just in case that's unclear based on the naming. It's not a replacement for shadergraphs. But renderer features are meant to use it. But yes, you may be able to use a custom feature or RenderObjects to re-render objects with another material/shader)
regal stag
uncut whale
#

Hello πŸ™‚ I'm using Unity 2022.3.24f1 and URP
I have a really critical problem with building time. On I9-14900k and 4090rtx it takes 6hours. There were around 1.000.000 shader variants compile.

I read this topic: https://forum.unity.com/threads/extremely-slow-shader-compiling-for-builds.1342220/
but there are so much words, so little actions and clear instructions.

Is this variant prefiltering something I need to turn on? Put some codes, if yes then where? I'm confused about this one
The second time I tried to build without ANY changes in project also took 6 hours.

smoky widget
regal stag
smoky widget
#

I see yeah, but wanted to use a subgraph and make use of the input/output part, but otherwise i will just make the hlsl and use it in shader graph as custom nodes

#

Not great (because i prefer everything being easily readable by the user) but at least a workaround

warm pulsar
#

that might be relevant (:

thick fog
#

i have my spaces and maths on world and for some reason my normals still look odd

#

it seems like my normals are completely fine when the object is in +x and -z

#

but its flipped on hte opposite side

#

im so confused as to why this is happening

smoky widget
#

So I need to use floats always? I cannot use int4 as input?

west flame
#

General question - Why are shaders in Unity predominantly written with visual scripting as far as I can tell?

kind juniper
tacit parcel
burnt wigeon
mossy crane
#

Hello! This is my first time here, and I'm very new to unity as a whole. I'm working in Unity 2019.4.26f1 for modding, and I'm trying to make a shader graph for a particle effect. It works so long as the object is at world origin. I'll share videos of it working as intended and then what it's doing off of world position. And I'll share my node graph (it's messy, apologies). I've been looking through some forums and tried multiple variations but no luck yet. Thanks for the help! edit the graph shows only the parts that are in question, there is a little bit more to the shader that I left out. **Edit 2, didn't realize clips had irrelevant sound, got rid of them

#

Aaaand the videos are a bit scuffed, first starts 3 seconds in, the second starts 16 seconds in. Sorry about that

dusky wedge
#

Hi, I'd like to ask, when It comes to apply multiple effects on a single mesh, should I use multiple passes in a shader, or should I seperate it to multiple shaders/materials?

smoky widget
smoky widget
#

Like, my only option would be a node that has all the code of that branch inside, but I cant make a node where the subsquenet nodes are inside a branch right?

#

I can't insert that piece of code

#

or can I

regal stag
#

That said not sure how useful branches are for just an on/off state. I think usually the cost of both sides of the branch needs to be roughly the same?

smoky widget
smoky widget
#

So avoiding one branch definetly saves a lot of time

regal stag
smoky widget
#

Would you be able to help me out were on the compiled code the branch might be happening? I have no clue on how to understand/find if there's an actual branch or not

#

The unlit shader is arond 1701 lines

#

ah wait, i can find it with ctrl+f, i forgot to save it

#

Yeah no, it looks like it's sampling any way before going into the node

regal stag
smoky widget
#

but there's no [branch] tag, I doubt it will create a branch

#

(plus, im not sure how to check if there's an actual branch in the compiled code)

#

oh

#

It creates branches, okay that's good. Now i need to know tho if the actual branches are correct

smoky widget
#

OH

#

it does the branch? since the sample is inside, im guessing it's actually doing it

hushed silo
#

Hi. I have a shader that has red green and blue channels being driven by stuff.

I put this through a saturation node with the expectation that when desaturated the red green and blue would become monochrome and of the same intensity. However, what I wind up with is this , where you can see clearly that the G comes out strongest with blue the weakest. Any idea what's going on here?

low lichen
hushed silo
#

Right, I was wondering if it was something like that, thanks

#

what would be the alternative method here? essentially I want to mathematically 'desaturate' it... so that I can use them each as an opacity and when I add them together get 1, ie RGB 0.33,33,33 adds up to A 1, but that each 0.33 looks the same.. I'm probably explaining that terribly

low lichen
hushed silo
#

hmm yeah, I was trying that somewhere else in this

low lichen
#

Or the max value.

hushed silo
#

ok, I'll keep poking at it, thanks

low lichen
#

Do you want (0, 1, 0) (fully green) to be as bright as (1, 1, 1) (white)? If so, then you need to use max.

hushed silo
#

no, I want it only to be white when the 3 channels combine

#

so 3 equal greys that total to white

karmic hatch
hushed silo
#

funny that I was using that maths elsewhere in the shader already

#

thanks πŸ™‚

#

stupid human eye functions

#

πŸ˜›

low lichen
#

These two colors have the same average brightness. (0.33, 0.33, 0.33) vs (0, 1, 0).

#

Generally.

smoky widget
#

Can I input/output a custom struct in shader graph?

dim yoke
#

Shader graphs compile back to shader code so the performance is comparable to each other as mentioned. If I had to guess, shader graph could be bit slower but the difference doesn't generally matter anyway

west flame
#

Is learning shader graph good for long-term learning, or is there a case for learning the code?

snow forge
#

Hey all,

Soooooo, I'm trying to make a 'scrolling' noise shader, but seem to have forgotten how to do it properly.

Image attached of what I have so far but the noise is scrolling sideways no matter what I do. Lil bit confused. lol.

Can anyone see where I'm going wrong please?

karmic hatch
#

(if you just add the time directly it'll get swizzled to vec2(time,time) so if you're happy with it scrolling diagonally then just go for that)

snow forge
#

Ah got it, thanks πŸ™‚

zenith sentinel
#

how do i fix this?

clear veldt
#

I have a render texture with a fake light with a fake image glow so I used the additive shader on it. For some reason it looks like this in the render texture and it is not transparent.

#

The camera is rendering it and it has a solid color black background, I made it transparent and it works fine, but not with something with an additive material

dim yoke
#

May become and issue with regular shader code as well. The compiler will optimize the code as much as it can so the performance isn’t in our hands for most parts (you can’t even do proper branches and loops with shader graph anyway which can become heavy). You can even insert shader code in your graphs with the Custom Function node as well but often times that is not done to improve performance either but rather do things that can’t be acccessed with the available nodes (like loops)

last vault
#

Any idea why this works in the editor, but not in a WebGL build? (Using URP)

half SamplePCSS(TEXTURE2D(ShadowMap), SAMPLER(sampler_ShadowMap), float4 shadowCoord, float3 radius, half4 shadowParams, bool isPerspectiveProjection = true) {
    if (isPerspectiveProjection)
        shadowCoord.xyz /= shadowCoord.w;
    if (shadowCoord.z <= 0.0 || shadowCoord.z >= 1.0) return 1.0;
    real attenuation = 0;
    return SAMPLE_TEXTURE2D(ShadowMap, sampler_ShadowMap, shadowCoord.xy).x <= shadowCoord.z ? 1.0 : 0.25;
}

called by SamplePCSS(TEXTURE2D_ARGS(_MainLightShadowmapTexture, sampler_LinearClamp), shadowCoord, radius3d, shadowParams, false)

lyric copper
#

Hey folks, I am creating a series of full screen shaders using shader graph but for whatever reason they do not show up in my Quest builds. I added them to the render settings. Not sure what I need to do

shell star
#

My shader varients are HUGE and it takes forever to build my game. It seems to be one shader, which is the gradient shader, can someone help me with this? Everything above the red line in the picture builds super fast and normally, but the one below the red line is EXTREMELY SLOW, someone please help me with my hours long build times! Here is also the shader graph, it's very simple.

kind juniper
shell star
#

A long list of keywords thats over 3600 lines

#

Each line completely full

#

A shader graph with 6 NODES, followed from a popular tutorial.

peak drum
#

how do i rotate the red part that i circled its in a shader graph

zenith gyro
#

Hi everyone, I'm still a beginner at shaders and I've found the guassian post processing shader online, but how do I make it so that I can use a mask texture to affect the strength of the blur through transparency?

kind juniper
#

Anyone knows if the these 2 values are supposed to match? When I click the "compile and show code", it starts compiling way more variants than it shows in the first screenshot. Or are these not variants?
It's also weirds that some keywords like Fog ones are included despite me turning them off in the Graphics settings

dim yoke
# peak drum how do i rotate the red part that i circled its in a shader graph

Rotating things is quite easy but separating the red part can be bit tricky. You could use distance from the center to approximately figure out the size but that would leave hard edge where the rotation starts, that may not be an issue for this specific image (because the grey thing around the red thing seems radially symmetric if that's even a word) but if you need this to work for any image, it may look quite harsh. In that sense it would be easier if the thing to be rotated was an separate texture

smoky widget
#

Is there any way to create internal variables in shader graph, so that I reduce the amount of lines crossing the diferent nodes?

regal stag
smoky widget
#

Ah good stuff!

#

What's this btw?

smoky widget
regal stag
regal stag
smoky widget
smoky widget
#

Now another problem, can I copy a blackboard entirely?

#

So I can copy all of these variables from the subgraph

regal stag
#

Can you highlight them in blackboard and Ctrl+C, Ctrl+V in other? I'm really not sure

peak drum
#

how do i take away the white background?

kind juniper
#

Or just use an if node

flint yew
#

ive never used shadergraph, but surely theres a way to encapsulate a bunch of nodes as a single function?

#

(to reduce spaghetti)

regal stag
kind juniper
peak drum
#

i kinda do know how to use shader graphs though

#

ik what lerp is

regal stag
flint yew
#

aha, i see this issue is slightly distant

#

different *

dry spire
#

anyone know how to fix this error ?

regal stag
smoky widget
#

I just ended up manually copyinh them

cunning robin
karmic hatch
cunning robin
#

Yeah it fixed it. thanks

foggy pulsar
#

does anyone know why this is happening

foggy pulsar
foggy pulsar
smoky widget
#

Hi

#

I have this piece of code

        public RenderTexture Bake(Mesh mesh, Material targetMaterial, LocalObjectPool pool)
        {
            RenderTexture rt = pool.GetGroundRenderTexture();
            Mesh M = mesh;
            Graphics.SetRenderTarget(rt);
            GL.Clear(true, true, Color.black);
            GL.PushMatrix();
            GL.LoadOrtho();
            targetMaterial.SetPass(0);
            targetMaterial.EnableKeyword("_BAKE");
            Graphics.DrawMeshNow(M, Matrix4x4.identity);
            Graphics.SetRenderTarget(null);
            GL.PopMatrix();
            targetMaterial.DisableKeyword("_BAKE");
            return rt;
        }

That helps me bake a shader into a texture

#

Previously I just did that and it worked, because my shader had two passes, the first one being the required to bake

#

However now with shader graph i have no clue on how to get the correct pass. I made it all into one shader pass (because afaik you cant do multiple passes) but its saying that there are 8 passes (probably related to lighting) so I dont know which one to target

slow cloak
#

Is anyone able to help me with this? It's been over 1 year since I'm trying to find a solution.. I started developing my game on Unity 2019.something.something when LightweightRenderPipeline was still around and was working. Now I updated it to 2022.3.19f1 and if I try to make a new shader graph for a sprite sheet, it makes it a square, stretching the texture.. so it looks like this for example

#

when it should've looked something like this

grizzled bolt
smoky widget
#

Is there any way to run a lit shader without any lighting effects?

#

Trying to bake it into a texture but light effects are in my way

kind juniper
#

A lit shader without any lighting is an unlit shaderthinksmart

lyric copper
#

Does anyone here know if Shadergraph Fullscreen shaders work on mobile/VR? Can't seem to get the one I made to show up in build

kind juniper
#

Hmm. There appears to be something similar in urp as well

lyric copper
kind juniper
lyric copper
#

It does.

#

Just not on Quest 3

#

I tried adding it to the includes just in case it got stripped out but that was a no go as well

kind juniper
#

Are you using the same urp settings/quality levels for both of the builds?

lyric copper
#

Yea same URP asset. No changes outside of the obvious platform relevant ones

kind juniper
#

Open project settings - quality and take a screenshot

lyric copper
#

All my other shadergraphs work on Q3 just not fullscreen

kind juniper
#

How are you applying that shader though? Post processing?

lyric copper
#

The shader is visible once you add it to the Render Features without even applying it to anything

kind juniper
lyric copper
#

correct

kind juniper
#

I don't think it would work correctly without a camera

lyric copper
#

oh no this is just a empty I just started to work on some other shaders

kind juniper
#

Does any other full screen render feature work?
I don't see anything about it not working on mobile.

#

Can you take a screenshot that I asked earlier?

lyric copper
kind juniper
# lyric copper

Do you see that android and standalone builds have different quality level set as default level?

#

Try using the same quality level for Android and test again.

lyric copper
#

Switched Android to Balanced for performance reasons

hot cloak
#

Hey, I'm still new to shader graph and can't really figure this out. My issue is that I'm trying to blend between two textures but I'm not sure how to supply the right value to the inverselerp. Any ideas?

#

you can ignore the comparison - just for test

lyric copper
#

building now

kind juniper
#

These 2 quality levels probably use a different urp asset

#

I don't know what settings exactly affects it(possibly the post processing), but it's possibly disabled in the urp setting used in the balanced quality level.

lyric copper
#

Ah I get what u mean

#

I almost wonder if the fullscreen effect counts as post proc

hot cloak
lyric copper
#

Doing another build target for High Quality

hot cloak
lyric copper
#

I can see it in High Fidelity but the performance is pretty bad. Adding the shader to the Balanced Asset

#

Yea its disabled in Balanced. Need to figure out what affects it

desert crater
#

Why my outline shader is like this, the black outline is coming out from the gameobject. I want it to be something like the red one.

lyric copper
#

So, disabling HDR and Anti Aliasing shows it but now my UI Quality it aliased and jagged

kind juniper
desert crater
#

Sorry, i'm unfamilar with Shadergraph, what node do i need to add?

lyric copper
#

Tweaked a bunch of settings and its passable for now but it draws in a vignette in each eye instead of one vignette drawing across both eyes.

desert crater
kind juniper
#

outlines is actually a pretty complicated topic. Might want to research it a bit

desert crater
#

Dame, thanks for your help.

lyric copper
#

I feel like the last thing I cant figure out is why the full screen shaders draw a single instance in each eye vs a shared render across both eyes

lyric copper
#

the top is how it is showing up[ now and the bottom is the desired

steady carbon
#

Hello, where am i supposed to assign the roughness textures on the material?

kind juniper
steady carbon
kind juniper
#

Because what properies/texture the material takes depends on the shader

steady carbon
#

it's URP. Does that help?

kind juniper
#

URP is a render pipeline, not a shader

steady carbon
#

ok lit shader

#

URP-lit. This is what it says on the shader settings

kind juniper
#

In a URP-lit shader metallic/specular maps perform the same function as the roughness map, although they require the values inversed afaik.

steady carbon
#

So i assign it to metallic? But there's also a metallic texture which came with the model. Does that mean that i have to choose between metallic and rougness textures?

kind juniper
#

It depends on what purpose these textures served in whatever software the model was made in

#

In unity a metallic map uses 2 channels for different information:

With a texture assigned to the Metallic Property, both the Metallic and Smoothness sliders disappear. Instead, the Metallic levels for the material are controlled by the values in the Red channel of the texture, and the Smoothness levels for the material are controlled by the Alpha channel of the texture.

https://docs.unity3d.com/Manual/StandardShaderMaterialParameterMetallic.html
It's possible that your riughness and metallic textures just represent these 2 channels.

steady carbon
#

it doesn't say anything about roughness

kind juniper
#

roughness determines how rough a surface is

#

In other words, it's the opposite of smoothness

#

So they are basically the same property, just inversed in value

steady carbon
#

Roughness field appears on material settings when i swtich the shader to Autodesk interactive but that shader is not compatible with URP. There's no field for roughness map when i choose URP - lit

kind juniper
#

Did you even read what I said?

steady carbon
#

I read all of it. Do you mean your previous comment?

kind juniper
#

Yes

#

roughness is the same as smoothness, just opposite in value (1 - x). You can inverse the texture and use it as smoothness.

#

Or create a custom shader that inverts the value

civic lantern
smoky widget
#

I cannot transform it to unlit on runtime

kind juniper
steady carbon
#

I got it. Select URP-Autodesk interactive in the shader settings. There's a slot for both metallic and roughness map, you can assign them both. That's it. This is the answer i was looking for

smoky widget
#

But i cannot make vertex shaders with the shader graph, without modifying the generated code

#

(and I'm not sure if even modifying it)

kind juniper
smoky widget
#

Indeed but I would need also a different fragment shader, basically a different pass

vast bone
#

Hi, someone can help me with the Alpha Clipping option in shader graph ? Cause idk how that works.. :c
I've the same result all the time xd

regal stag
vast bone
#

On the material.. hmm, i've no material for this mesh
So just need to disable it ?

#

Oh y that work.. lol
Ty xd

regal stag
vast bone
#

Okay,
So where's my material options ? I must add it on my graph ?
i'm lost xd

#

Idk how control it :x

grizzled bolt
broken thorn
#

heya, im just getting started with shaders, and im just trying to make a simple sahder where a pixel is rendered by its WS position, but its just throwing a bunch of errors about missing semantics, and i looked at the docs and its still not mkaing quite sense, so any explanation would be appreciated!`

#

this is the code rn:

{
    float3 positionOS : POSITION; // Position in object space
    float2 uv : TEXCOORD0;
};
struct Interpolators
{
    float3 positionWS;
};


Interpolators Vertex(Attributes input)
{
    Interpolators output;

    VertexPositionInputs posnInputs = GetVertexPositionInputs(input.positionOS);
    
    output.positionWS = posnInputs.positionWS;

    return output;
}

float4 Fragment(Interpolators input) : SV_TARGET
{
    
    return float4(input.positionWS, 1);

}```
regal stag
warm pulsar
#

yeah, most of them are just informational

broken thorn
#

like they get automaticaaly assigned by the shader

broken thorn
#

oh cool

regal stag
#

In interpolators, TEXCOORD can be anything you want it to be. But really you can just use INTERP0 etc if you want. I think that's what shader graph generates.

broken thorn
#

and say i wanted to have a bunch of different data passed, how would i do that?

#

becuase i tried marking both the CS and WS positions with VS_POSITION and it yelled iat me

regal stag
#

Between the vert & frag? You add more interpolators, e.g. with : TEXCOORD1, : TEXCOORD2 etc.
You only want the CS output marked as SV_POSITION

broken thorn
#

oooooh okie got it

#

and is there any limit to how many you can have?\

regal stag
#

There is, it depends on the target platform

broken thorn
#

okie tysm!

wispy elbow
#

Hey, guys.
I know everyone here asks about the little things, and unfortunately I will be no exception. I need some advice, I need to use the PSX Shader and I have a problem with the night where I need the trees to not "glow" so much and just reflect the light from my flashlight.

If there is anyone here who can help me, I will be grateful for the rest of my life. CS_HeartRed

#

Screenshot would be better i guess

lyric copper
#

I am still trying to figure out why my full screen render feature effect renders per eye and not per frame. I can't seem to set it to single instance

regal stag
#

If you're looking to work with texture arrays there is a Texture2DArray property type and Sample Texture 2D Array node
Can maybe try set index port based on height of fragment. And another two samples for neighbouring height values (-1 and +1 to index) and blend between those

smoky widget
#

Si I made a shader in builtin using shader graph and it works perfectly in built-in (obs) and URP

#

Howeveer Im getting an error in HDRP

#
        void SG_SampleTextureAssetFull_02270f3fc2b8e1a4180f553e9571cfbb_float(float _Index, float2 _UV, bool _UV_0ab1ea7c094346929806292a904bf9d3_IsConnected, float _Weight, UnityTexture2DArray _AlbedoArray, UnitySamplerState AlbedoSampler, UnityTexture2DArray _OcclusionArray, UnitySamplerState OcclusionSampler, UnityTexture2DArray _NormalArray, UnitySamplerState NormalSampler, Bindings_SampleTextureAssetFull_02270f3fc2b8e1a4180f553e9571cfbb_float IN, out float4 Albedo_1, out float4 Occlusion_2, out float3 Normal_3)
        {
        float _Property_52579ffba1bc4d86b11f13f3b8f20138_Out_0_Float = _Weight;
        float _Comparison_80c3934b99594784bd37bc66f02e073d_Out_2_Boolean;
        Unity_Comparison_GreaterOrEqual_float(_Property_52579ffba1bc4d86b11f13f3b8f20138_Out_0_Float, 0, _Comparison_80c3934b99594784bd37bc66f02e073d_Out_2_Boolean);
        UnityTexture2DArray _Property_545f9984588b4a889dbd00f6c03dae13_Out_0_Texture2DArray = _AlbedoArray;

these are the lines affected by that, the first one is the 16059 and the last one 16064

#

I don't understand what could be the issue?

regal stag
gray hamlet
#

hellooo

#

I want to offset this twirl:

#

how can I do that?

honest bison
#

Why does the time node appear to speed up when I move the camera?

dusky wedge
#

Hi, I'd like to ask what's so special about the MainTexture attribute? When I set the the property to MainTexture, the object will be affected by Special Texture properties and can't be selected in Editor until pointing its current shape. Is that feature a pros or a cons?

civic lantern
honest bison
peak drum
#

i can dm u the shader if you want

karmic hatch
vast bone
steady carbon
#

Hello, why does the albedo transperency texture look like this ? It looks like they're painted on a paper and glued to the model's head

grizzled bolt
steady carbon
#

i selected autodesk interactive transparent shader

#

ok, i got it. It is fixed when i check the UseOpacityMap box

smoky widget
#

Hello, In HDRP, a custom node with a texture2darray sample doesn't work, anyone knows what's going on?

#

The custom Node

#

The final HDRP shader

#

The error

#

Im in HDRP 14.0.10, unity 2022.3.20f1

#

(im not sure if i can send files like that)

smoky widget
#

It seems that there's the BareTexture2darray and the Texture2DArray variables? How are they diferent? And why two? if I change to a bare textuyre2d array the shader gets compiled, but the subgraph appears as error

regal stag
smoky widget
#

So how should I handle this. Because HDRP doesnt support UnityTexture2DArray, but it doesn't even support its own node of texture2d array

regal stag
#

Sounds like it could be a bug? I'm not sure, I don't use HDRP

regal stag
#

Or is it just the built-in one in a subgraph?

smoky widget
#

I had previously a custom funciton, and moved into the built one because i supposed that maybe what you mentioned was the case, and assumed that the built-in would take that into consideration

regal stag
#

I'd maybe try a custom function instead of sg's node. I think this should work,

void SampleArray_float(UnityTexture2DArray Texture, float2 UV, float Index, out float4 Out){
   Out = SAMPLE_TEXTURE2D_ARRAY(Texture, Texture.samplerstate, UV, Index);
}
smoky widget
#

That's what I thought too, but for HDRP it should be using the Texture2DArray<float4> instead of the Unity ONe

#

I think

#

But im gonna make a bug report and see, because HDRP is not a must rn

#

Can i make node variations between target pipelines in a single asset?

#

So i dont hve two shaders for URP and HDRP that are completely the same but with one node difference

broken thorn
#

probably stupid question, but do semantics need to be all caps?

#

it doesnt seem to be throwing any errors yet but ive always seen people using all caps so i was wondering

regal stag
broken thorn
#

okie cool thx!

past hamlet
#

I have this shader that does the white outline. Each body part (head, body, hands, legs) is an individual spriterenderer.

Ideally I would want the outline to be only around on the sides and not over where it covers other body parts. Is there a way to do this in the shadergraph or would I use a different approach alltogether?

#

Maybe this shows it better; I wnat these parts in red to not show the outline but the actual bodyparts behind it. The outline should only appear on the outer edge

#

Seems difficult because each Bodypart is its own SpriteRenderer.

#

Here is my current shader

#

Not sure if what I want is possible at all but it would look much better, I appreciate any help!

karmic hatch
brazen nimbus
#

(I can't use main light direction as I'll have multiple lights)

dim yoke
#

It's because the Base color is a float3 meaning it does not have an alpha component in it. That's why you should add Alpha block for the Fragment segment and drag the alpha from the texture there

steady carbon
#

why does it look like this when i apply the metallic-roughness texture on it?

#

It is supposed to look like this

steady carbon
#

i drag the metallic-rougness texture to metallic slot. It's URP-Lit shader

amber saffron
steady carbon
#

how do i do that?

#

i change smoothness value, nothing happens

#

it looks bettter when there is a light source around it, but there are still those black parts which are annoying

amber saffron
grizzled bolt
#

Scene lighting also affects the appearance of lit materials
You might have black ambient lighting but sky in the reflection probe, or vice versa

steady carbon
#

yes it's about the light

grizzled bolt
#

It looks like your flesh tone there is partially metallic
Materials in real world are either metal or not, mixing it up haphazardly will give you weird results in many situations

blazing cosmos
#

hi, can somebody tell me why is that when i move closer to a tree, it turns magenta like this?

grizzled bolt
blazing cosmos
#

and how can i change the shader?

grizzled bolt
steady carbon
grizzled bolt
# steady carbon i want it to look glossy, not metallic. If i turn off metallic map, it becomes ...

If it's not metal, keep metallic at 0
Glossiness comes from low roughness / high smoothness
To get a more vibrant color, use a more vibrant color on the color texture
Many graphical software implement a bright HDRi along with filmic tonemapping so that can give the impression that colors are "washed out", but that will change when you bring into an engine where you control the tonemapping and environmental lighting

cosmic prairie
blazing cosmos
#

yep, university project haha

indigo ginkgo
#

i posted it already i dont wanna repost but i rlly wan help

kind juniper
echo moatBOT
indigo ginkgo
#

i rlly wanna know wha is wrong

#

cuz idk anything abt shader

kind juniper
#

That being said. There's some very weird bullshit in the code.

#

Where did you get these shaders from?

#

Like wtf is this supposed to be?

indigo ginkgo
indigo ginkgo
indigo ginkgo
kind juniper
#

It looks like a precompiled shader, not the initial source code. Perhaps that's why it doesn't work outside of the specific version where it was precompiled. You'll need to find the original shader source code.