#archived-shaders

1 messages ยท Page 74 of 1

kind juniper
#

You would need to #include the files where these types are defined explicitly. Unity includes them when compiling the shader, but the ide doesn't know that.

#

That being said, it's a pain in the ass to get the ide working with shaders, so maybe just ignore it.

#

As long as it compiles in unity, there's no problem.

sterile zinc
#

well shoot, I'll let you know if I ever find a way

kind juniper
#

I told you the way. You just need to include the correct files.

#

You can find the unity shaders source code on GitHub, it's in open access. Import it into your project and provide and #include directive in your shader with a correct path to the correct file.

sterile zinc
#

alright, thanks!

kind juniper
#

Though I wonder if it's gonna make unity complain if you put it in the project

sterile zinc
#

I'm guessing it's in another file but I'm having trouble finding it

kind juniper
#

Yep. It's defined somewhere else. That's why I said that you better forget about intellisense with shaders.

#

Maybe in Core.hlsl

hushed silo
#

thank you this is an option I can look into

#

Add depth to your project with Fast Depth of Field ( Mobile , URP , VR , AR , LWRP, Default Pipeline ) asset from Rufat's ShaderLab. Find this & more VFX options on the Unity Asset Store.

desert crater
#

Is it possible for two materials on a gameobject not collide with one another.

#

The element 0 is the top material and when the dissolve is done, the "Element 1" is th cloaking shader.

#

It turns out like this.

kind juniper
deft frost
#

Anyone know how to make a projector that makes a material's smoothness go up? I'm kinda struggling here

hollow wolf
dusty creek
#

I'm making a fullscreen shader that turns everything grayscale except the color red (I want to control the color that doesn't get filtered but only red should be fine for now. I found something to make everything grayscale but I don't know how to bring back the red. does anyone know?

hollow wolf
dusty creek
#

thanks

deft frost
hollow wolf
marble narwhal
#

Hey guys how are you ? I have a question a don't know why my shader light is bug can you gelp me ?

lilac oracle
#

Hello, I am trying to apply a texture to my procedural generated worlds and I am having trouble. I would like to paint the top of the world green and the bottom gray. In the transition from green to gray I would like to create a line of a darker green.
In the 1st pic I was trying to check where the color is 50% green and %50 gray and paint it a darker green, but since it does the coloring per triangle instead of per pixel, if you zoom in it looks weird.
In the 2nd pic I tried to solve it by lerping from green to dark green, and from dark green to gray depending on the normal, but i get a dark green-gray for the rocks.
How could I do so I get a distinct dark-green line with a certain width from where it goes from green to gray?

karmic hatch
#

Oh actually I see what you mean

lilac oracle
#

Yes, it is what I did in the first picture, and it does the painting per triangle

karmic hatch
#

I think if you're doing flat shading, then it will be per triangle if you're working based on the normals

#

You could create a smooth-shaded mesh, then calculate the flat shaded normals and use the smooth shaded ones for colouring

lilac oracle
karmic hatch
#

If the vertices are all unique, then it would be smooth shaded

lilac oracle
low lichen
runic swallow
#

since it's used in a loop

woeful breach
#

how can i add fog to my sprite unlit shader ? ive tried it like this but it doesnt work

warm pulsar
#

I'm noticing an error in my development build:

<i>OSXPlayer "fens-mbp-2.lan"</i> Material 'Waveform(Clone)' with Shader 'Unlit/Waveform' doesn't have a texture property '_MainTex'

#

I do not need any textures for this shader.

#

Does Unity just try to cram one into it anyway? I guess I can add a property..

#

I don't attempt to set the _MainTex property; I'm only setting four properties that all do exist

#

ooh, I'm using it on an Image

#

and I bet it's trying to set _MainTex

regal stag
warm pulsar
#

whoops, and that, itself, had a broken reference

#

I don't see any completely generic graphic component that doesn't even try to set a texture

#

so I guess I'll just give it a _MainTex property

#

good job fen

#

i am very bad at adding properties to shaderlab code on the first try ๐Ÿ˜ญ

regal stag
#

I mostly use shadergraph, but if I do code manually I tend to just copy the property declaration from the docs ๐Ÿ˜…
The texture one has that extra {} too which I know others sometimes forget

meager pelican
lilac oracle
# meager pelican I'm unsure of your desired result. That said, once you've created the mesh, you...

I wanted to smooth the mesh and the guy who mentioned that i had duplicated vertices was right. Unity smooths lighting and coloring if vertices arent duplicated, if they are each one is colored and lighted independently giving that low-polyish style. I just modified the code that builds the mesh to delete the duplicated ones and worked fine, plus fixed a bug where if i was generating chunks with very different frequency in the noise, it would crash all the meshes and draw them incorrectly.

steel notch
#

Hey so I've got a performance related question. In this image I have about 500 goobers. The entities are constructed from ~10ish different sprites all in a sorting group. Some of the sprites are lit (mostly the body) and others are unlit (the screen). The framerate is unfortunately pretty terrible. The profiler is telling me this is mostly a rendering issue, and the Frame Debugger is saying that I'm making about 2500 draw calls for transparent objects.

#

That's a lot of draw calls I'm pretty sure.

#

Realistically I don't expect to have 500 entities, more than likely about 200 as a max.

#

But I want to use this sprite shader for many props.

#

And I think it had broken batching.

#

How do I... unfuck the batching?

crude totem
#

how do i split the scaling to x and y

tacit parcel
steel notch
#

If I make all the materials unlit, then the draw call number goes way down.

steel notch
#

Alright maybe I'm wrong.

tacit parcel
tacit parcel
#

URP forces everything into one batch... not sure why batching breaks ๐Ÿค”
Do the goobers change their scale (has different scale)? Iirc, that could also break dynamic batching

steel notch
#

I thought it was maybe my custom lighting script, but I set them all back to the default sprite renderer and it's still behaving like this.

steel notch
#

Animators off.

#

It's effectively just a collection of sprites.

#

13 frames, built.

steel notch
#

Only ~22 draw calls?

#

Bro what is going on.

tacit parcel
steel notch
#

With the animator on it goes down to 30 fps.

#

But It's still only 22 draw calls.

steel notch
#

It's definitely rendering many at once.

#

And this is over 4000 draw calls.

steel notch
kind juniper
#

Use the profiler first to see what the bottleneck is

steel notch
#

It's definitely rendering last time I checked

kind juniper
#

rendering is a complex system with many layers. Saying that it's rendering doesn't tell anything

kind juniper
#

Would need to expand it quite a bit more

steel notch
#

Alright we're going deeper.

#

@kind juniper

kind juniper
#

Hmmm... I think transparent materials are really contributing to the issue. Did you try making them opaque or cutout just for testing purposes?

#

I think it's also an issue that every draw call it sets up a rendering pass? This shouldn't happen with one shader normally.๐Ÿค”

#

Can you share your shader?

kind juniper
#

Also, does the frame debugger tell you why the draw calls are not batched?

steel notch
kind juniper
#

In your screenshots I don't see anything that should be transparent. Cutout should do the job

steel notch
#

Also all the sprite sorting features break when the sprite is opaque.

#

Are you suggesting I separate the components slightly on the z?

kind juniper
#

Yet, the profiler data is for these sprites? And it clearly says that they're transparent.

steel notch
#

I'm worried about parts improperly sorting in that case.

kind juniper
kind juniper
#

So I don't really understand the concern

steel notch
#

If I set the shader to opaque.

#

Order in layer doesn't work. Sorting layers don't work. Sorting Groups do not work.

kind juniper
steel notch
#

yes

kind juniper
#

Then it should work.

#

Perhaps there's something wrong with your shader if it doesnt.

steel notch
#

I... I fucking swear to god I tried this.

#

Ok 1 sec.

kind juniper
#

try a standard shader with the sprite renderer. Sorting order should definitely work. Otherwise there wouldn't be a need in it.

steel notch
#

I am in URP, just for clarity.

#

Don't think that affects anything here, just saying.

kind juniper
#

Yeah, it should work in urp the same way

steel notch
#

I have 2 circles at equivalent Z positions.

#

They are Z fighting.

#

they are in a sorting group

kind juniper
#

Are they on the same sorting layer and have the same order?

steel notch
#

Green and yellow are transparent.

#

They sort correctly, and if you dont touch their sorting layer or order, they sort by order in the hierarchy.

#

Different order, different sorting.

kind juniper
#

take a screenshot of the red and blue circle inspectors

steel notch
kind juniper
#

So they have the same sorting settings. Obviously they're gonna z fight

#

decide which one should be above and bump it's order in layer

steel notch
#

Both circles have 0 in this picture.

kind juniper
#

that's the problem

steel notch
#

Behold, the blue with a value of 1.

kind juniper
#

and red is 0?

steel notch
kind juniper
#

Hmm... Then I'd assume that your shader does not respect these settings

#

Use the standard shader and see if it works

steel notch
#

kk

#

If it does, I guess the question is how to allow shader graph to do it.

kind juniper
#

Also, it seems like you're not using a 2d Renderer in your urp settings

steel notch
#

Nope. We're doing a combo of 2D sprites in a 3D world.

steel notch
#

I'm pretty sure the entire Unity sprite sorting feature set is dependent on transparent materials.

kind juniper
#

I'm pretty sure it's not. There's no reason for it to depend on it.

steel notch
#

Well, then surely I'm missing something?

kind juniper
#

Take a screenshot of your camera inspector

kind juniper
#

Does anything change if you change it to orthographic?

steel notch
kind juniper
#

? It's rotated?

#

So the issue does not occur when it's not rotated?

steel notch
#

No no like the camera does settle on someone winning out.

kind juniper
#

Yes, so that's the correct behavior

steel notch
#

but if I rotate just a bit...

kind juniper
#

That's the issue. You're not expected to rotate it

#

You need to decide which workflow is gonna be the main one: 2d or 3d

steel notch
kind juniper
#

if it's the former, then the sprites need to stay orthogonal to the camera.

kind juniper
kind juniper
#

If it's 3d, you can't rely on the sorting settings for sorting

#

Because that's how the rendering system works. In 3d it sorts by position

#

In 2d layers and order take precedence

steel notch
#

Okay but if the sprite is opaque it's writing to the depth buffer, no? We know the depth of the frag.

#

Can we not just go "this is a higher priority"?

kind juniper
kind juniper
steel notch
#

I mean if I slap these on quads instead, surely I'll get the same issue.

kind juniper
#

wdym?

#

Sprite renderes are basically quads. With some extra features

#

You can use them both for 2d and 3d, but the ordering would change depending on your camera settings and orientation.

steel notch
#

Give me a sec.

steel notch
#

Here's what happens if their shader is set to opaque.

kind juniper
kind juniper
steel notch
#

But it's not. The goobers ARE sorting correctly within their sorting group.

steel notch
kind juniper
#

Make them orthogonal

#

and make sure their parts have proper ordering within the group

steel notch
#

Goobers are now orthogoal, ignore the big guy.

#

Eyes are gone, and their arms and legs still flicker (bit hard to make out).

kind juniper
#

I don't see arms and legs at all.

#

As for the eyes, share their settings.

steel notch
kind juniper
steel notch
kind juniper
#

Is the sprite orthogonal to the camera? Does it have a correct sorting order?

gilded sand
#

I have a simple test scene with a few objects and a directional light. If an item isn't too close to the ground or the directional light is fairly parallel with the ground then the shadows look good. If an item is close to the ground or the directional light is fairly vertical then the shadows look very bad. So, it seems that as the length of the projection increases the quality improves. Can anyone explain what's actually happening? Also, what can be done to remedy the issue? I've played around with a number of the shadow settings but thus far haven't found one to mitigate the issue.

steel notch
#

I guess if I manually define values for each sprites sort order, it probably would work.

kind juniper
#

Ok so it looks correct now?

steel notch
#

This isn't how the transparent sprites behave.

#

They care about order in hierarchy.

kind juniper
#

I really doubt that. Even if they do, it's probably just an undocumented behavior that you shouldn't rely on.

#

The only thing that relies on hierarchy order is UI.

steel notch
#

Alright I appreciate the deep dive here but this isn't... optimal really.

#

No camera rotation? Ever? Not going to happen.

#

So either A) I work with transparency.

#

Or B) I somehow build these creates in a way where they become some type of opaque mesh?

#

And all their animations are built in?

#

And forgo the Unity sprite system.

#

Plus rotating the sprites back is going to be terrible for sorting with 3D objects behind them.

kind juniper
steel notch
#

Or B) I somehow build these creates in a way where they become some type of opaque mesh?
Is this a viable option?

kind juniper
#

Not quite sure what you mean by that or why you would need that

#

Meshes can't be opaque or transparent. They're just an array of vertices and triangles

steel notch
#

A lot of these types of 2D sprite/3D world games I see forgo using transparent sprites. They usually have just 1 quad displaying the whole sprite. (Also a lot of them tend to be pixel art).

#

Plus alpha cutoff.

kind juniper
#

There're only 2 explanations:

  1. They're following the rules that unity renderer defines, like you did now.
  2. They have a custom renderer with their own sorting logic.
steel notch
#

Wait roll it back. Why are we even trying to make these opaque again?

#

Batching?

#

Overdraw?

kind juniper
#

Yeah, batching, performance, overdraw. All those things. It's probably only one of the issues though.

steel notch
#

But these sorting issues with Opaque are... rough.

kind juniper
#

It's not sorting issues with opaques.

steel notch
#

I'm planning to have many goobers, so the chance they start Z fighting with each other (when rubbing against a wall for example) is actually quite high.

kind juniper
#

If anything there are more sorting issues with transparent usually

steel notch
kind juniper
#

If water is gonna be a 3d plain, it should be fine imho

steel notch
#

I'll get back to this tomorrow. It's late and I'm dead.

#

Thanks for the help regardless. @kind juniper

#

I'll find a way out of the rendering hellhole, eventually.

fickle parcel
#

Im using this hdrp/speedtree8 shader and enabled wind but it changes nothing, any idea why?

snow forge
#

Mornin' all, Playing around with something kinda fun, but struggling to figure out something.

I'm trying to create a shader for Graphic Equaliser bars.

I have the equaliser side working great by simply moving the bars up and down between a value of 0 and 0.75 based on 'GetSpectrumData' and it works great.

What I'm trying for the shader is for the bars to 'pass through' a triplanar mapped Gradient image (Green to Red (Attached for clarity)). The thing I'm struggling with a little is 'clamping' the top and bottom of the image to world space values of 0 and 0.75. Would anyone have any ideas? Not sure I explained it very well if honest.

regal stag
snow forge
snow forge
#

Ah nm, got it. Works with Lerp node ๐Ÿ™‚

#

Ah dang it. Doesn't look like Triplanar is the way to go. The 'tops' of my bars are a bit messed up colour wise. ๐Ÿ˜ฆ

regal stag
snow forge
snow forge
dusty creek
#

a tutorial told me to use this but I have no idea what it actually is. I thought it was just the screen as a texture but I'm not sure, anyone able to explain?

#

doesn't seem to be on unity documentation for some reason so..

regal stag
dusty creek
#

UnityChanThink then why is it a vector4 and not a vector3

#

screen can't rly be transparent right?

regal stag
#

I'm not too sure what format URP uses for it's color target, but in general they can have an alpha channel

dusty creek
#

huh

#

thanks for the info

subtle arrow
#

I flipped the entire internet and asset store and couldn't find a terrain shader to achieve the same effect in Short Hike (left). I'm willing to pay someone to write me a custom shader that will achieve the exact same effect.

My game (right) has 2 issues:

1- Texture isn't blending sharply on terrain

2- The triplanar shader I'm using won't allow me to paint routes (or any texture in general) on the terrain (I think because it's forcing the Top/Side texture based on direction).

warm grotto
#

Hi!
Anyone maybe could advise whay 'Blank Shader Graph' is missing in my Unity 2023.2.12.f1 ?
Some tutorial on Youtube (probably older version of Unity):

regal stag
warm grotto
#

Just found it on Unity official website. Will check things there next time first. Thank you very much!

dim yoke
subtle arrow
native yarrow
#

Learn how to create colors depending on the layout of your terrain!

Jason no longer offers the course mentioned in the video.

โ™ฅ Support Brackeys on Patreon: http://patreon.com/brackeys/

ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท

โ™ฅ Subscribe: http://bit.ly/1kMekJV

โ— Website: http://brackeys.com/
โ— Tw...

โ–ถ Play video
#

I've been following this tutorial (Time stamped video)

#

I would like some help, I don't find the PBR shader + everything I try comes as bright purple

Using unity 2022.3.22f1 dx11

raw cliff
#

Sup. How to... instantiate shader? I've made a master shader that will be used for many-many objects, but, naturally, i will use different textures for each object. Copy-pasting doesn't sound like a proper solution.

grizzled bolt
raw cliff
swift vine
#

Hello there !
I'm a beginner in shaders, I wanted to use this effect for my Unity project : https://www.youtube.com/watch?v=cWpFZbjtSQg&list=PL_en-DE69hRwEq9gPAHls3A_ttWWMomXB&index=3&t=620s
but this have been created using built-in render pipeline and I personally use the URP so the problem is simple how can I convert these two shaders from the video to URP

Experimenting with portals, for science.

The project is available here: https://github.com/SebLague/Portals/tree/master
If you'd like to get early access to new projects, or simply want to support me in creating more videos, please visit https://www.patreon.com/SebastianLague

Resources I used:
http://tomhulton.blogspot.com/2015/08/portal-rende...

โ–ถ Play video
tacit parcel
swift vine
#

I've tried but with not concluant results

strong tinsel
#

I have around 50 planes with different colors, 25 of each color, now I am trying to achieve a color blend behavior where teh two planes meet each other , can someone point me in the right direction I have been trying for over a week now and nothing seems to work. I am no shader expert I use google and chatgpt for most of the shader work, I am even willing to pay for somone to create and explain the shader to me

#

Each plane is a separate game object

#

this is the effect I am looking to achieve

fickle parcel
shy sage
fickle parcel
shy sage
#

like fx?

fickle parcel
#

in shader graph i see some branch (?) I've never used shader graph only code

fickle parcel
shy sage
#

add the waving vertices if there isnt

#

and if that is not the solution

fickle parcel
#

can i somehow compile shader graph and edit code? i dont understand shit from this

shy sage
#

try decreasing the wind quality

#

from best to lower

shy sage
fickle parcel
#

yeah sure

#

come dm

lime lava
#

hey, im trying to set the normal from a ray marching shader but the result is incorrect. currently the normal is in world space and im guessing that might be the problem, but im not sure what to convert it to (or if theres some setting i can use to get the light to work with world space normals)
code here, just gotta add it to a default sphere or cube if you wanna test it
https://pastebin.com/jBxmuMk8

sweet granite
#

Weird that my highlight shader isnt working like how i want it to work

flint bison
grizzled bolt
sweet granite
#

Ive tried using raycast and that didnt work and i tried the simple outline from the asset store which also did not work and now i tried this tutorial which also isnt working

grizzled bolt
grizzled bolt
grizzled bolt
sweet granite
#

And u would think that the video that used the quick outline asset should work but nope

#

idk if its bc of my camera or smth else but its getting to the point i wanna cry

tacit parcel
grizzled bolt
fickle parcel
#

float4 worldOrigin = mul(UNITY_MATRIX_M, float4(0, 0, 0, 1));

````Shader error in 'HDRP/Nature/SpeedTree8New': 'ApplyWind_float': cannot implicitly convert from 'float3' to 'float4' at line 18916 (on d3d11)```

#

any idea? i can't fix it at all

#

it's hdrp

#

on srp it works with unity_ObjectToWorld but on hdrp it says to use UNITY_MATRIX_M, but when I do this error occurs

#

and yes with float3 worldOrigin its the same

tacit parcel
#

Line 18916? ๐Ÿ˜ฑ
Btw, are you sure the error is in the worldOrigin calculation?
Your code looks fine to me, maybe the error is in another place?

fickle parcel
#

hmm wait

#

oh im stupid

#

I didnt delete unused input variable

#

sorry for taking your time

#

one more thing, I need in my function float4 rotation (quaternion) but i can't find it in shader graph, what's it's name?

regal stag
fickle parcel
fickle grail
#

Do you know why I might be getting this error? I don't understand, HLSL has fixed data type right?

#

Also, now that I'm here, I wanted to ask too if this in shadergraph is normal:

#

I have over 81K variants!

low lichen
fickle grail
#

Mhhh interesting

#

I guess that if I'm using URP i shouldn't be declaring any shader as CGPROGRAM

onyx osprey
#

Could anyone Point me in the right direction on how to setup an image shadergraph so that transparency can be applied along a circle? I have a circle of runic text and i'd like to fade one letter in at the time, figured i'd ask here as a starting point instead of messing around with the wrong UV nodes for hours

regal stag
# onyx osprey Could anyone Point me in the right direction on how to setup an image shadergrap...

If by image you're referring to the UI Image component, you ideally want to use the "Canvas Graph" in 2023.2. For older versions sg didn't properly support UI, though the Unlit may work but only for a Screenspace-Camera canvas, not Screenspace-Overlay.

As for the nodes, Polar Coordinates -> Split G output, may be a good starting point. That should give you a value between -0.5 and 0.5 around the circle. Can then remap with Inverse Lerp (and Saturate to clamp betwen 0 and 1) or Smoothstep.
https://www.cyanilux.com/tutorials/polar-coordinates/

onyx osprey
#

yeah litterally as you answered i dug deep enough into the youtube rabbithole to find a video which included it lol

#

Might be a good idea to make a specific tut vid on this just so its easier to find, since the solution was so simple..

#

thanks homie ๐Ÿ‘

hushed silo
#

So I've got this situation where I'm trying to apply noise to world position coordinates and then feeding that into a sphere mask, and it's all working nicely at origin, but when I rotate it it all goes wrong. What I don't get though, is that it should just be using UV space?

regal stag
hushed silo
#

literally just figured the root of it, as always, I'll struggle with something for hours post a question then finally get there. I'm pretty sure it's ADDing to the world space instead of multiplying

regal stag
#

Add makes more sense to me. I think multiply would mean the noise strength is lower near the world origin and higher as you get further away.
Guess it depends what effect you're after.

#

If you want the noise "aligned" to the sphere, could add the noise to the Radius instead of Position

alpine igloo
#

Hey guys I was working on some LODs and shaders when I ran into an issue, I made trees which use LODs for the stem and leafs. each LOD uses the same mesh for the leafs. For some reason when I use the LODs my shader doesn't seem to be working correct on the leafs, for example: there is no wind, the gradient isnt correct etc. When not using LODs it works just fine

#

this is the difference, the right one is without LODs and the left one is with LODs. Someone who might know how this is possible?

regal stag
alpine igloo
#

hmm would be pretty weird but ill check

#

but the leafs are the same on the one without and the one with LOD, they should both be UV mapped the exact same way

full void
#

hey guys, so this question may be a bit too specific, but ... I'm trying to implement a custom post process pass, and in my SetupRenderPasses I set the renderer.cameraColorTargetHandle as a field on the pass, but then when Execute runs, the field ends up being null ... but seems only for one frame?

I tried logging this, I see both calls happen in sequence, but when I recompile I will get this to log once

public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) {
    if (_cameraColorTarget == null) {
        Debug.LogError("Camera target is not set");
        return;
    }
    // ...
}

but it only when I have the shader graph window open ... if I recompile with just the scene view open I don't get this to trigger, but if I have shader graph open it does trigger exactly once on each recompile

sounds like a unity bug?

regal stag
alpine igloo
full void
regal stag
alpine igloo
umbral musk
#

I'm using URP and tried to bake the lightning from this sphere, but no light bounces or bloom is coming out.
Both objects are set to static, and added post processing on the camera, but no changes.

ancient oriole
#

check if the material is emissive

umbral musk
snow forge
#

Hi all, so playing a bit more with my graphic equalizer shader, but running into a snag that I can't seem to fix/figure out.

https://streamable.com/1uwvjf

The issue is at the beginning where the platform raises up. As you can see, because I have the green/red gradient texture 'fixed' in world space, it repeats.

Is there a way to fix this? I'm a little stumped ๐Ÿ˜•

Watch "2024-04-01 18-40-49" on Streamable.

โ–ถ Play video
regal stag
snow forge
regal stag
snow forge
snow forge
regal stag
#

You still have the texture set to Repeat

#

Should also make sure your properties are set to the world Y values that the gradient should start/end at

snow forge
ocean garnet
dense bane
#

i just learned that shader graph supports built in!

dense bane
ocean garnet
dense bane
#

who did the art direction?

ocean garnet
dense bane
#

anything else you've done?

ocean garnet
#

older project

tacit parcel
#

btw, is it possible to get vertex direction or normal from a trail renderer vertices? I keep having 0 even with Generate Lighting Data checked ON

silk sky
#

Im trying to putting an HDR into a shadergraph to have better control on its rotation and its effects, I tried some suggestions written here but is not working, any help?
@amber saffron (sorry for ping, you were kind enough to answer me last time)

silk sky
#

I've replaced the "Sample Cubemap" node with the "Sample Reflected Cubemap", now I can at least somewhat see the skybox, still need a way to turn the colors to normal and a system to rorate it on the 3 axis

runic swallow
snow forge
#

Mornin' all, I'm working on a simple 'ground displacement' Shader but I'm getting weird results and I can't for the life of me figure out where I'm going wrong.

Could anyone point me in the right direction please?

grizzled bolt
snow forge
grizzled bolt
silk sky
#

I'm trying to render this static field of flowers with just an ambient light that is around 45* Degrees towards the ground, any Idea why I get this shadow spots? I've already set the flower themsleves to cast no shadow

silk sky
#

I tried to rotate the ambient in way it was more perpendicular to the flower, at start it seemed working but then after another bake these soft shadows returned

alpine igloo
#

is it possible to scale objects through the shader graph?

grizzled bolt
alpine igloo
#

hmm kk ty

torpid hull
#

I have a custom shader (vertex snapping) graph. However, when applied the selection outline of the object changes.. why would this be happening?

#

The object is in the correct/original position but its just annoying, as I can't click on the game object in the scene

amber saffron
silk sky
amber saffron
silk sky
amber saffron
# silk sky

You need to input the view direction (world space) in the "In" connection

silk sky
#

Oh yeah I now can rotate it

#

got this btw

#

At the end I found a coded shader to rotate the skybox on the 3 axis, I guess will use that and avoid all this struggle, maybe skybox arent meant to be played with like other materials

silk sky
#

still there is the color issue that isnt solved yet

ruby sonnet
#

when unity crosscompiles the HLSL shaders to OpenGL shaders does it leave the plain GLSL code in the asset files or compiles it to something like SPIR-V?

low lichen
steady dew
#

ive been researching for days and haven't been able to figure anything out. i am currently using SetTexture and SetColor and a bunch of materials in my game. This works perfectly fine in the editor, but just does nothing in a window build. how do i fix this?

These shaders are all custom shaders. I've been trying a bunch of stuff with keywords, but im not even sure I'm on the right track.

cerulean nebula
#

hi i have snow texture and i have some rocks. im trying to add the snow texture(paint it) ontop of the rocks. any idea how?
(does this concern shaders? i basically dont know what it is [still new])

wraith gulch
#

Hello Everyone! I'm running into a problem where my shader is working at ground level (near zero on the global y-axis) but breaks at higher elevations. It slides around as shown in the gif (grass made orange to see better) but for some reason, it functions as expected when I get the camera close to it. I have no idea why it is sliding around at all to begin with - I am reletivly new to shaders, but I don't think I referenced anything related to global positioning at all in the code, so I'm not sure why it is doing that. I had a similar problem to this in the past, and managed to fix it by disabling "Static" for the objects, but that isn't working here. As an aditional note, the shader for some reason works perfectly on defered rendering, but breaks on forward rendering... I'm not sure if it is a problem with the shader itself, or some unity settings, so I'm not going to post the shader code now (to avoid cluttering up chat) but will post it if requested. Help would be extreamly appreciated, I am totally stuck due to this. Thanks!

lyric copper
#

Does anyone know of a method for blurred UI that works with the Quest?

twin moss
#

question. I'm trying to make the aplha clip so only some parts of the material is shown is there a way to do this because I been trying for a while a seem not to get it

#

its using the black for the color but I want the black to be transparent

#

never mind got it

twin moss
#

actually I don't got it

eager folio
twin moss
#

I got it fixed

#

it was a issue with my noice texture

topaz lance
#

Hey so i'm trying to use this shader https://assetstore.unity.com/packages/tools/particles-effects/quick-outline-115488#reviews to outline objects but I noticed that when 2 objects are overlaping each other there onlines collide. I don't want this to happen but I'm compelty new to shaders and have no idea how to make it so that the outline always fullys shows. Any help would be greatly appreciated!

Use the Quick Outline tool for your next project. Find this and more particle & effect tools on the Unity Asset Store.

brazen nimbus
#

Greetings ! In shader graph, is there a way to grab every output (or input) in order to plug them somewhere else ? Kinda like the same system as unreal ? Thanks in advance !

regal stag
#

Could also add reroute nodes (by double clicking on a wire). If the outputs come from one of those it's easier to swap the input.

brazen nimbus
cerulean nebula
#

Hello, i'm trying to cover a rock asset i found with snow ontop of it using shaders since i haven't found any other easier way. but all the tutorials use PBR shader and i cant find it. I know now its named Lit shader but when i try to work with it, it just turns the asset purple and nothing happens. anyone know an efficient way to do this?

grizzled bolt
cerulean nebula
#

for the tutorial i dont think they said which render pipleline they are using

grizzled bolt
cerulean nebula
#

oh

#

how do i check?

grizzled bolt
cerulean nebula
#

None

#

isn't that universal

grizzled bolt
#

No
It's the built-in render pipeline

cerulean nebula
#

oh

#

i see

grizzled bolt
#

Shader Graph still works with BiRP but you'll have to add it as an Active Target

twin dust
#

I'm trying to render particles on a "render texture" and I want to make it transparent.

How can I make this texture transparent?
I want to change the alpha value but I can't find it.

#

This is how the render texture is with my camera set to alpha 255.
The other picture is how the render texture is with my camera set to alpha 0.
The material of the particles isnt transparent so it isnt rendering.

nova needle
#

I am missing "Override Property Declaration" in unity shader graph in 2023.2

#

has anyone had the same problem?

cerulean nebula
grizzled bolt
alpine igloo
#

Im trying to make a fresnel for my tree, but I can't seem to get a good looking fresnel. Im doing this in HDRP. Someone who knows what I could try to make it look better?

#

the red glowing thing is the fresnel as it is now

#

and the normals of my leafs are all sticking up, so it probably has something to do with that, but idk how I can use a fresnel with that

low lichen
regal stag
nova needle
regal stag
#

Probably different in 6000/2023.3 yeah. You mentioned 2023.2 in your question but I guess that was a typo.

broken sinew
#

Is there any doc or an example of a custom scene picking pass from shader?

#

I don't see it documented anywhere however shaders generated by shadergraph include appropriate code on several occasions:

Pass {
  Name "ScenePickingPass"
  Tags {
    "LightMode" = "Picking"
  }
// ...
}
#define SHADERPASS ScenePickingPass
  #define BUILTIN_TARGET_API 1
  #define SCENEPICKINGPASS 1
// -- Property used by ScenePickingPass
#ifdef SCENEPICKINGPASS
float4 _SelectionID;
#endif

// -- Properties used by SceneSelectionPass
#ifdef SCENESELECTIONPASS
int _ObjectId;
int _PassValue;
#endif

Or here: https://github.com/TwoTailsGames/Unity-Built-in-Shaders/blob/master/CGIncludes/UnityStandardParticleEditor.cginc

flint wasp
alpine igloo
flint wasp
#

I donโ€™t do shader graph, but if you do most things you do should already be on the pixel shader

#

One option is you can make some fake normals. Like if your tree is a sphere, each leave can also pass the sphereโ€™s normal as well. This usually results in more cartoon-like trees if you use it for lighting straight out, however this way you can get your fresnel

#

Sayโ€ฆ if you arenโ€™t generating these trees in runtime, you can make an approximation of the shape in blender and pass those normals to your leaf shader

#

https://youtu.be/DEgzuMmJtu8?si=uY31fmCzmCJKLPzD

Something similar is done in this tutorial

In this video, David from Lightning Boy Studio will show how to create 3D trees in the style of Ghibli films, all in Blender 2.83

You can download a free Blender scene with this tree setup on our Gumroad page :
https://lightningboystudio.gumroad.com/l/RZcQI

You can follow us on Twitter and Facebook :
https://twitter.com/LightningBoySt1
https:/...

โ–ถ Play video
alpine igloo
#

thx! ill see if i can make it work

visual mesa
#

How are shaders, such as a shader for footprints, synced over the network? Or are they not? My assumption is that only player positions are synced and the footprint shaders are done locally based on the position of the players. Is that correct?

visual mesa
# amber saffron Yes

Thanks. I kind of answered my own question there, but needed someone to confirm that was correct so I appreciate it ๐Ÿ™‚

steel notch
#

So I have a plane here that has been alpha clipped around a circle at the base and then displaced upward with a Cos function.

#

For some reason I'm getting some very rough looking shadows.

#

Anyone know why?

#

Shadows are all kinds of messed up.

karmic hatch
steel notch
karmic hatch
snow forge
#

Hi all, what would be the best way to 'blend' two Normal maps together? (I've got 2 versions of the same texture set with one version 'on top' of the other but rotated 45 degrees). I've tried the Normal Blend node, but it makes the normal map look like complete ass. ๐Ÿ˜•

steel notch
#

I guess I just dont understand what I'm looking at. Why do the shadows looks so poor here?

dapper heath
#

heya, I've been following this tutorial (https://www.youtube.com/watch?v=IZAzckJaSO8) and have it functioning properly, but I'd like to make it so each hexagon of the surface appears or disappears all at once. atm the alpha appears like so in the screenshot, where it blends across the hexagons instead

#

is anyone aware of a method to do this? ideally without using surface normals but that is an option if nothing else works

karmic hatch
steel notch
regal stag
# dapper heath heya, I've been following this tutorial (<https://www.youtube.com/watch?v=IZAzck...

If it uses flat normals, I think a Dot Product with a direction towards the collision point should give you appropriate alpha values per-hex/face. (Could also bake those flat normals into UV channels if you need smooth ones too)

Or if you want to avoid normals, could also bake pivots of each hexagon into UVs and use those against the sphere check (in Coords port). Kinda similar to this fracture effect but controlling alpha rather than used for displacement.

karmic hatch
#

You can shrink the distance over which shadows are cast and increase the resolution of the shadow texture and it'll look less bad

steel notch
#

Is it because the plane itself is flat and it's getting stretched across this deformed shape?

dapper heath
#

in this sphere mask part

#

I assume I need to multiply this by some kind of stepped normal value but I'm too inexperienced to know what that is

flint wasp
regal stag
# dapper heath normals are alright, I'm just trying to avoid using screenspace normals since th...

Indeed, you need a consistent alpha value across each face. Your current setup uses the Position node which is different per fragment/pixel, hence it's fading along it rather than the whole face.
Hmm.. since the shield is a sphere, you might just be able to swap that out for the Normal Vector (object space) and convert the SphereCenter/Radius/Hardness properties to be object space too.
Otherwise look into the methods I mentioned in the last post.

dapper heath
#

oh, actually

#

this is the model itself, it has these faces baked in already

#

but let me try that, tyvm

karmic hatch
dapper heath
#

worked like a charm

#

thank you very much yo you continue to be the best unity shader person

steel notch
# karmic hatch Because they depend on the resolution of the shadow texture which has to cover a...

I'm kind of confused because this guy doesn't modify the normal and his shadows look peachy.
https://www.youtube.com/watch?v=poi10W6LHJo&ab_channel=LlamAcademy

Learn how to create 2 types of waves - linear and radial/circular waves in ShaderGraph with Maths!
The most common application for waves is water or liquids, but you can apply these throughout your game or integrate them with other shaders to get cool effects, like Wind.

If you are new to ShaderGraph, be sure to check out the Vertex Displacemen...

โ–ถ Play video
flint wasp
#

Is anyone experienced with buffers?
I'm working with some compute shaders. I want to use an append buffer, but have some complications so the workaround I've been using is using InterlockedAdd to get a synced index and then writing data to that index in a structured buffer.

Is this significantly slower than an append buffer?

#

I know the append buffer itself also has a hidden index value, just dk if there's some optimizations in incrementing it

karmic hatch
lean lotus
#

With unity builtin, when a camera is far from an object, is it possible for the generated motion vectors to be of objects that are not the closest? So the motion vectors are instead made for an object that should be obscured by a closer object, instead of being made for the closer object? in deferred btw

lean lotus
#

ITS DYNAMIC BATCHING

steel notch
karmic hatch
solar gulch
#

Is there are decent resource for someone new (me) looking to work with shadergraph for a 2D game?

rare wren
sly delta
#

Hello guys!
I'm starting a 2.5D project similar to octopath, and I already got the multidirectional billboard shader going , but i'm looking to try to make my sprite renderers cast shadows as well. I've looked into some videos, but none of them worked, tried to do multiple passes but also didnt work. I've used the debug mode on the inspector and set my sprite renderer to cast shadow but no use eighter.
This is my shader atm:
https://pastebin.com/LWDGeMqZ

#

I dont discard the idea how adding another gameobject with a diferent shader just for the shadows if need be

regal stag
sly delta
#

I removed it on the paste, Yeah i tried to write a separate pass for the shadowcaster but i didnt get it to work tbh

#

It should be URP tho

regal stag
#

Oh right. I throught it was a surface shader because of this line
#pragma Lambert vertex:vert AlphaTest: _Cutoff addshadow keepalpha
That is doing nothing, you can remove it

sly delta
regal stag
# sly delta Ok i'm checking it out, but i see that they are HLSL programs instead of CGProgr...

Might be okay to mix them between passes, I haven't really tried. But ideally you shouldn't.
In short, CGPROGRAM includes some stuff for Built-in RP, but that causes conflicts when using URP includes (like #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"). HLSLPROGRAM avoids that.

Using URP's shader library is mostly important for making shaders compatible with the SRP Batcher (to optimise setup between draw calls). Though that only supports sprites in 2023+ so if you're on older versions might not be that important.

sly delta
#

Yeah, im in. 2022 version

regal stag
#

Coding shaders is a bit of a pain in SRPs so I'd see if a shader graph can do what you want first. The Sprite type graphs probably don't allow shadows, but the Unlit or Lit graphs should.

sly delta
#
struct Attributes {
                half2 uv : TEXCOORD0;
                float4 positionOS : SV_POSITION;
            };

             struct v2f {
                float4 pos : SV_POSITION;
                half2 uv : TEXCOORD0;
                float4 positionCS:  TEXCOORD1;

            };
            
            

            v2f DisplacedShadowPassVertex(Attributes input) {
                v2f o ;                
                // Example Displacement
                input.positionOS += float4(0, 0, 0, 0);
                
                o.uv = TRANSFORM_TEX(input.uv, _BaseMap);
                o.positionCS = GetShadowPositionHClip(input);
                return o;
            }
            
            ENDHLSL

this is how im at atm, i just dont have the transform_tex definition

#

It is casting shadow now! (right one with the shader), now i just have to deal with the alpha probably

regal stag
#

May need to override the ShadowPassFragment with your own function. Sample _MainTex and use clip(tex.a - _Cutoff);

sly delta
#

something like this?

half4 ShadowPassFragment(v2f i) {
                half4 col = tex2D(_MainTex, i.uv);
                clip(col.a - _Cutoff);
                return col;
            }                    
            

its giving me "function return type missing semantics"

Sorry, i cant find docs for this type of things

#

ok, it was just adding SV_Target. If i raise my _Cutoff above 0 shadow just dissapears

#

            half4 ShadowPassFragment(v2f i) : SV_Target {
                half4 col = tex2D(_MainTex, i.uv) * half4(10,10,10,10);
                if (col.a > 0.2) {
                    discard;
                }
                return col;
            }                    
``` seems like nothing changes when i change this function
regal stag
#

Make sure you have _MainTex in the properties at the top of the file. Maybe also rename the function and the one in the #pragma fragment just to make sure it's using the correct one.

sly delta
#

Okay, disabling cast shadow on the sprite renderer disabled the shadow. so maybe the shader isnt doing anything?

sly delta
dusty cloud
#

Hello I need help. I found this online. I copy it and still mine doesnt look the same...

#

Below is mine. Above the one I've found online. Also my preview won't show, no mather what i do?

dusty cloud
#

Where is that setting?

shell walrus
#

Is polybrush still the best way to paint vertex colors (materials) onto meshes in Unity? I've heard it's problematic in that it works by creating a duplicate of the mesh and paints onto that? Which is problematic because if you update the original mesh, it doesn't update the new dynamic duplicate mesh that it created?

regal stag
#

And even if the main preview shows nothing, save the graph (top left corner) and check it in scene/game

shadow kraken
#

Yes my bad ๐Ÿ™

regal stag
#

Though I imagine with that you'd still need to keep the vertex count the same. Not sure how it would act if you added vertices after painting.

dusty cloud
dusty cloud
shell walrus
#

@regal stag Not quite understanding the description. So if I want to avoid it making a clone and actually write to my mesh I should use 'additional vertex streams' over 'overwrite'?

regal stag
#

If it's something you need to do often, it might be better to paint directly in Blender or something

shell walrus
#

Yeah, that's what I'm doing at the moment with Maya. Ideally would be nice to be able to paint within the context of the scene so I know where exactly to paint, overwise it's a bit of back/fourth and tweaking to make sure everything lines up as I want it to. The export mesh asset is a nice option but it adds an extra step to the pipeline. Works as expected in Unreal, I can update VC in Unreal and tweak mesh in Maya and it holds the info pretty well. Obviously any major changes and you have to repaint but only the area that was heavily edited with additional verts etc.

heavy stirrup
#

is there a keyworld / way to get entire object's world space position (not per-vertex)

#

hlsl

lone crow
#

I tried creating this shader using SDF and it looks pixelated in game view. Any Idea how to fix this?

#
float4 frag (Vert2Frag i) : SV_Target
            {
                uint maxHealth = _HP + _Shields;
                float numberOfSections = maxHealth / 25;

                float numberOfHPSections = _HP / 25;
                float numberOfShieldSections = _Shields / 25;

                float healthAtFragment = lerp(0, maxHealth, i.uv.x);
                float sectionOfFragment = int(healthAtFragment / 25);

                float4 fragColor = lerp(_HPColor, _ShieldColor, sectionOfFragment >= numberOfHPSections);

                float healthMask = healthAtFragment < lerp(0, maxHealth, _Health / 100.0);

                float2 coords = i.uv;
                coords.x = coords.x * numberOfSections;
                coords -= float2(0.5,0.5);

                float mask = step(0, calculateBoxSDF(coords, float2(0.5 + sectionOfFragment, 0.5)) + 0.05);

                float4 healthColor = lerp(float4(1, 1, 1, 0.05), fragColor, healthMask);

                return mask * float4(0, 0, 0, 0.6) + (1 - mask) * healthColor;

            }
#

The text and the lines are smooth as they are not included in the shader

#

I think it has something to do with Anti Aliasing but idk how to implement that because I am not using textures

regal stag
regal stag
lone crow
#

thats because of AA too right

summer path
#

Im using 2D Tilemaps and creating seasons. And really donโ€™t feel like recoloring my Tilemaps for every single season, is there a way i can have shaders for each individual Tilemaps (plants, grass, dirt) to adjust the hue instead ?

shy sinew
#

? how you use webp in unity editor (can you load webp like in blender - keep save as file: Lit_Text.webp but without convert png) ?

stiff nexus
#

@deep moth Hey, so, you know that issue I had forever ago where there was a black bar thing at the top of the screen? Well the way I got around that was originally by starting the game, stopping it, then increasing the size of the scene view. But I just launched unity, and the issue is 10 times worse now. All I did was create a second camera in the scene outputting to a render texture. Is the post processing being applied twice? First image is the before enabling the shaders. Second image is after.

flint wasp
stiff nexus
fervent spire
#

how can I make this effect in the shader graph? I have a texture with the areas I want deformed on different color channels, and the distance from the "wall" as a float. The arms looks normal from perspective

deep moth
#

It would answer questions like is it rendering twice pretty readily.

stiff nexus
#

Ill try out the frame debugger rq

flint wasp
#

Does anyone know why I canโ€™t access the zbuffer directly instead of _CameraDepthTexture? I believe it has to do with how itโ€™s not synced with any thread, however every pixel should be written to by only one thread, and if Iโ€™m only reading that specific pixel on the same thread I edit it there should be no racing issues

stiff nexus
#

I can't figure out why its acting that way

#

I can't find anything online for it

regal stag
deep moth
#

It could be related to that?

regal stag
fervent spire
regal stag
#

Ah well... I don't think we're meant to help with anything modding related in this discord. You may have to ask elsewhere

flint wasp
flint wasp
hot cloak
#

Hi, I'm very new to shaders and I'm trying to set a particular colour based on the height of the object, now, all of the logic seems to work perfectly fine, except for when the blend distance is too low, the colours start acting weird, get significantly brighter / darker. Not sure what causes this, and any insight would be appreciated. Lmk if you need any more info.

#

To clarify, colours get more exaggerated the closer to 0 the blend distance is

stiff nexus
#

This is the scene view with just posterization enabled

#

All the shader does is this

#

So I don't get why its doing that.

deep moth
#

Oh interesting!! Does it show up in builds?

cerulean moat
#

Helloo

#

This is my first time with shaders

#

I created a glow shader, but the effect doesn't show up

#

I added a volume to my cameras but it only shows on the scene view, not on my game view

hot cloak
#

Can someone tell me why this shader applies a kind of gradient to my colours, it gets very dark at the bottom and very bright at the top.

hot cloak
#

I do this with multiple colours and all of them have it

#

the only time they don't, is when I take out the transitioning, so the entire lerping part of it

solar gulch
#

Wrapping my head around shader graph and just sort of playing around. This is probably about as basic as it gets, but I"m just using tiling and offset plus some cosine waves to make a sprite move up and down, but my sprites are getting cut off, depending on the distance the shader makes the sprite travel.

#

I was thinking maybe it was the border size of the sprite itself, but I remade one of the sprites with a massive amount of vertical space above and below but it didn't change anything

#

nm, just figured it out

#

Mesh type set to Full Rect on the sprite solves it

#

So the border size was the issue, but I suspect that 'tight' mesh was just ignoring the extra border I made around the sprite.

dim yoke
# solar gulch Wrapping my head around shader graph and just sort of playing around. This is pr...

if the "blocks" text that needs to be moved is a single mesh, I'd must rather just move the vertices up and down as it would potentially be bit faster and you wouldn't need to care about the padding around the elements (more padding also generally is more work to be done for the renderer because the transparent pixels must be dealt with too). that way the actual mesh moves rather than the pixels inside the mesh

lone crow
regal stag
steel notch
# karmic hatch https://www.desmos.com/calculator/fegsqy6h4x The normal is the gradient of whate...

Tried following this article for a more generic solution.
https://www.ronja-tutorials.com/post/015-wobble-displacement/

#

Still getting some strange shadows though.

regal stag
karmic hatch
# steel notch

Might be that the mesh doesn't have the resolution at that peak

steel notch
karmic hatch
#

You could try increasing the bias in the shadow settings

steel notch
#

Though to be fair I'm pretty sure I'm doing this incorrectly given the look of the normals (currently outputting them as color).

karmic hatch
#

Ah, that does look dodgy

steel notch
#

This is the graph, which I'm pretty sure is a proper recreation of the following code.

regal stag
steel notch
#

I SAW AND IM SAD

#

fixing

regal stag
#

Also instead of the Split->Add->Combine, you can use Vector3->Add. Would keep connections cleaner

steel notch
steel notch
regal stag
#

Try flipping the inputs to the Cross Product

#

Actually might be the subtracts before that

steel notch
#

2 questions.

  1. It still kinda looks grainy.
  2. Why does the shadow rapidly get brighter as I zoom out?
regal stag
#

I think Negate makes more sense here

steel notch
#

Ya that did it.

steel notch
#

just this instead

alpine igloo
#

im trying to make my shader able to scale my UVs so I can get bigger leafs for a tree shader, but I have no clue as to where to put that thing at the top in my shader. Do i put it before/after my object position, do i multiply/add it? I have tried out a lot of things but nothing seemed to work

amber saffron
#

But that's probably not really what you want.
If you tree is a 3D object, with already working UV and texture, to make the leaves bigger, you need to actually scale the mesh.
But not the whole tree mesh, only the leaves themselves, relative to their "local" pivot. And to do this, you need to have that pivot information

#

Unless the leaves are individual meshes

alpine igloo
#

yeah but the leafs and the tree trunk have seperate meshes

amber saffron
#

Ok, well, to scale a mesh in the vertex shader it's as simple as : object position = object position * scale

alpine igloo
#

ill give it a try

#

this does indeed scale the leaf mesh in its whole, but since its relative to the pivot point of all the leafs it also goes up while scaling

amber saffron
#

That's what I mean with the "local pivot"

#

You will need this information in the vertex shader, usually this is done by storing the data in the vertex color of the mesh

#

Then you can scale around that pivot by doing : objectPos = (objectPos - pivot) * scale + pivot

alpine igloo
#

But then wouldnโ€™t it be easier to scale just the uv space instead of the whole object?

amber saffron
alpine igloo
#

It should be ok, the unwrap for the leafs is a square which fits perfectly in the 0-1 uv space

#

So if I just scale every uv separately it shouldnโ€™t give any issues

amber saffron
#

Up to you to try
You probably still want to scale by the leaf "base" in uv space (like, bottom center if the leaf is oriented up)

stiff nexus
deep moth
#

Oh that's not good. You probably need to add it to always include.

stiff nexus
#

Most likely, could be because I had to delete the library folder

stiff nexus
#

I added it to always include before.

deep moth
#

I don't think deleting the library would get you in any trouble!

#

Could be something else. You might wanna use a development build and check the logs.

stiff nexus
#

Alright, once I get home I'll check it out. Though I still don't see why the pixels are squishing like that in the editor.

#

It looks like the image is being squished to fit half the screen instead of all of it.

deep moth
#

Ohhhh! I was running into that too. I'm not sure what that is...

#

The squishing

#

That really bothered me but I never quite nailed it down.

#

Seems like the kind of thing you'd solve in c#

stiff nexus
#

I'm pretty sure the issue cause by the outline shader is caused by the same thing.

#

So if we figure it out in c# we could probably solve both problems.

cerulean moat
ruby sonnet
#

when unity exports "ShaderLab" shaders into GLSL theyre supposed to be raw GLSL, but is it only for the new version or also older ones like 2020.x.xx

sly delta
#

yo Guys. i need some shader magicians here.

I'm trying to make a multidirectional billboard shader that is able to take into account

  1. A character's movement direction in WS (passed to the shader from C# code)
  2. The camera's view direction

And then calculate the correct UV coordinates for a tilesheet.
The tilesheet has diferent directions going down from the Y axis(front, front-left, left, back-left, back...), and animations going forward on the X axis
The animation part is working already, the billboard as well.

I'm just having a lot of trouble calculating the uv.y coordinate from movement direction and view direction.

I tried using the dot product, tried using atan2 function, i've been on this for some hours now and i just cant get it be right.

If any of you magicians could help, it would be much apprecciated!

#

So.. code here

    float2 dotp = dot(normalize(_WorldSpaceCameraPos.xz), normalize(_MoveDir.xz));
    float angle = dotp * RAD2DEG + 270; //some offset here
        int yIndex = (int)angle / SINGLEFRAMEANGLE;
        float frame = _AnimFrames - (1 + round(_Time.y * _Speed) % _AnimFrames);   
        o.uv = float2((v.texcoord.x + frame) / _AnimFrames, v.texcoord.y * UVOFFSETY  + UVOFFSETY * yIndex );

For some reason, clockwise rotations are kinda working, but counterclockwise arent

#

im doing this on vert btw

stiff nexus
#

This is what I added to the C#: ```cs
int screenWidth = camera.actualWidth;
int screenHeight = camera.actualHeight;

if (source.rt.width != screenWidth || source.rt.height != screenHeight)
{
RTHandles.ResetReferenceSize(screenWidth, screenHeight);
}```

deep moth
#

ah nice!! what's the buggy part?

stiff nexus
#

It glitches out a bunch

#

moving the viewing of everything down or something weird

#

This is how it looks in play mode.

deep moth
#

huh

#

where did you find the solution?

stiff nexus
deep moth
#

have you tried using the drawfullscreen method they use there?

#

it seems like the documentation I sent was outdated w/ the blit

#

here's the render function from the new documentation

    {
        if (m_Material == null)
            return;

        m_Material.SetFloat("_Intensity", intensity.value);
        m_Material.SetTexture("_MainTex", source);
        HDUtils.DrawFullScreen(cmd, m_Material, destination);
    }
stiff nexus
#

Thats what I already have though?

#
public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle destination)
{
    if (m_Material == null)
        return;

    m_Material.SetFloat("_Intensity", intensity.value);
    m_Material.SetFloat("_StepCount", stepCount.value);
    m_Material.SetTexture("_MainTex", source);

    HDUtils.DrawFullScreen(cmd, m_Material, destination, shaderPassId: 0);
}```
stiff nexus
#

I don't get why the post process is resizing the render?

stiff nexus
deep moth
#

noo

#

: (

#

usually when I have problems like that its some kind of order of operations problem -- like im somehow grabbing the wrong texture in the list. This one is pretty strange.

stiff nexus
#

Yeah, I dont get it. It is just resizing the image wrongly.

odd willow
#

Best way to render grass in mobile?
I am using alpha cards (billboards) , from a free unity asset from polytope studio , it still lags in mobile, is there any alternative ?

#

NOTE- idk anything about programming shaders and seeking any premade asset

hot cloak
kind juniper
alpine igloo
#

how do you get the pivot point of an object?

#

i cant seem to find a node for that

meager pelican
# alpine igloo i cant seem to find a node for that

Pivot point? Like applying a rotation to the model? That's the object space position of 0,0,0. It is set in the modeling program. All other vert locations are relative to that.
You can then, say, transform that 0 vector3 into world space by applying a matrix transform to it...Theres a node for it, sort of.
https://docs.unity3d.com/Packages/com.unity.shadergraph@16.0/manual/Transform-Node.html
So you'd transform an input of (0,0,0) in object space to whatever you're after...like world space or something.

sly delta
#

Any idea why my shadow caster pass is telling me "no matching 2 parameter intrinsic function" for the tex2D function?

                v2f o ;            
                float3 objWorldPos = normalize(mul(unity_ObjectToWorld, float4(0,0,0,1)).xyz);
                float3 fromCameraToObject = normalize(objWorldPos - normalize(_WorldSpaceCameraPos.xyz));
                float angle = SignedAngle(fromCameraToObject , _MoveDir , float3(0,1,0)) + 180;
                angle = fmod(angle, 360);
                float mappedAngle = floor(angle / SINGLEFRAMEANGLE) * SINGLEFRAMEANGLE;
                int index = round(mappedAngle/SINGLEFRAMEANGLE);
                float intervalSize = 360 / _nDirections;
                float frame = _AnimFrames - (1 + round(_Time.y * _Speed) % _AnimFrames);   
                
                o.uv = float2( (input.texcoord.x+ frame) / _AnimFrames , input.texcoord.y*UVOFFSETY+UVOFFSETY*index);
                o.pos = GetShadowPositionHClip(input);
                return o;
            }

            half4 ShadowPassFragment(v2f i) : SV_Target {
                half4 col = tex2D(_BaseMap, i.uv);
                if (col.a > 1) {
                    discard;
                }
                return col;
            }    
regal stag
# sly delta Any idea why my shadow caster pass is telling me "no matching 2 parameter intrin...

In URP code it's usually

TEXTURE2D(_BaseMap);
SAMPLER(sampler_BaseMap);
// (might already be defined like this in an include file)
...
half4 ShadowPassFragment(v2f i) : SV_Target {
   half4 col = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, i.uv);
...

More info - https://www.cyanilux.com/tutorials/urp-shader-code/#texture-objects
Somewhat related - https://docs.unity3d.com/Manual/SL-SamplerStates.html, the macros here basically switch between the DX9 or DX11 styles depending on platform

sly delta
#

Thanks!

stiff nexus
lilac oracle
#

Hello everyone, im having the typical issue of mapping a quad onto a sphere and wanting the least distortion... In my case I want to map a voronoi noise on the skybox. I thoght of making my own triplanar and multiplying the noise by each rgb value, this way i would map the noise on each face (i dont mind if it repeats). But this doesnt yield the result I expected, it still has a seam but i cannot understand why, in theory the same noise is mapped to each face(?

#

In fact, if i plug the output of normalize into the output, it draws the spherical cube correctly

flint wasp
#

int appendInd = 0;
InterlockedAdd(structures[COUNTER_IND], 1, &appendInd);
structures[appendInd + START_IND] = newStructure;

Does anyone know if I can access addresses directly like this in a shader?

flint wasp
#

... does ref exist in hlsl? I think that's a C# thing, unless I'm wrong

lilac oracle
#

I know out works

#

in fact that might be it

flint wasp
#

so InterlockedAdd(structures[COUNTER_IND], 1, out appendInd)? I'll try that

lilac oracle
#

yes

flint wasp
sly delta
#

Hey guys.
I feel like i'm pretty close to finishing this shader i've been working on for the last 3/4 days. I opted to go the shader graph way now because the project is in URP and its a pain to get documentation on it.

Im trying to do a billboard shader that is able to take in a spritesheet as main tex and then choose the correct sprite to play based on the camera direction and position of the object as well as time. Kinda like octopath traveler or ragnarok online

So.. my spritesheet for test purposes is 512x512 and it starts with the forward animation (-y) , then has 7 more directions for a total of 8 and 6 frames for each animation(x axis)

The billboard part is done, i need help with 2 things now:

  1. Getting the correct index for the flipbook
  2. Adding shadow to the shader graph

This is my process up until now:

First image: Getting camera and object worldPos, then going the ACOS way to get the angle between said vectors in the xz plane, then multiplying it by the n_directions in my sheet to hopefully be able to move downwards on the sheet Hey guys.

second image, using time and modulo to get the current frame index which then i add on the flipbook part (3rd image)

Right now my problems are:

  1. No shadow :<
  2. Indexation for the flipbook is wrong, i.e., it almost plays the animation correctly but the first(or last) frames bleed onto indexes for other animations(bleeds onto the y axis)

Please, would surelly appreciate the help on this, its driving me nuts!

haughty holly
#

does anyone know how to fix this? this is my first time writing shader code

#

im trying to make it change color based on health, but currently the shader bug makes every block i attach it to the null purple color

simple yarrow
#

Sorry if I'm not asking the correct question or making it clear what I'm trying to do. I want to take my 3d character and render him out to look like pixel art, example being dead cells, but I want to do that in real time so I can have procedural animation. My first approach was a render texture with small dimensions, and slapping that on a quad. But I am left with everything that is behind the player also being made low res. My question is, how would I make a shader that only renders on-top of the player model, and ignores everything else captured by the render textures camera. Please ping me with any resources/article or just any insight. Thanks!!

tacit parcel
kind juniper
#

Alternatively, render the character into a render texture by a separate camera and the rest of the scene by a normal camera

tacit parcel
# stiff nexus

try using shaded wireframe mode, to check what is cropping the light volume.
Also you might want to use frame debugger to find what might be the cause

tacit parcel
golden flint
#

How can I fix my shield mesh from looking weird with the shader? I mean the middle part of the shield

grizzled bolt
grizzled bolt
golden flint
grizzled bolt
sly delta
stiff nexus
stiff nexus
#

This is what it looks like with my custom post process

#

It seems to shrink the rendered image.

#

I need a way to prevent this.

#

Also, @deep moth I tried disabling post processing on the second camera and the issue persists.

broken sinew
#

is Unity shader.SetX() smart enough, to skip unnecessary updates?

#

e.g. when I want to update an uniform every frame, does it remember last value and avoid sending it to GPU if the value didn't change?

#

or is it completely up to me to assure updates are not needlessly made?

split sand
#

Hi everyone! Unity noob learning how to code a custom shader and I have a problem. In Unity, when I double-click a newly-created shader file, nothing happens. VS is supposed to launch so I can code right?

broken sinew
#

are you double-clicking the .shader asset?

#

you can also try clicking topmost "Open" button in the inspector when shader asset is selected

split sand
#

yes, thats the icon. I tried double-click and then the right-click>open. Still nothing

#

@broken sinew

broken sinew
#

hmm, try to check if you can double-click regular C# scripts by double click

#

and if you have the editor set up in the... Preferences?

#

Yes, Edit > Preferences > External Tools > External Script Editor

split sand
#

I see this

broken sinew
#

yup, select the external script editor and it may work

split sand
#

is that devenv good enough to code shaders, or does it need to be in VS?

broken sinew
#

I don't even know what it is, I just use Rider ยฏ_(ใƒ„)_/ยฏ

#

I recommend VSCode as a free IDE though

#

you can get an extension for authoring shaders and whatnot

split sand
#

Sorry this is literally my first time doing this, I do not know much of the terminology.

ok so VS is an option in the dropdown menu, do I have to do anything else here?

split sand
broken sinew
#

and if you are a student you can get a free Rider license from Github Educational Pack (google it). Rider is superior imo.

split sand
#

well, I am following what's supposed to be a "simple" youtube tutorial. When they double-click it goes into a white screen with code. I dont get that, probably because I installed this today for the first time.

hollow wolf
hollow wolf
split sand
#

huh, guess I'll do that now ๐Ÿ˜

deep moth
stiff nexus
#

The way I got around it before was by starting the game and it would fix itself

#

but that doesnt work anymore now that I have two cameras.

#

Also, for the outline shader it appears to be mixing the two cameras together.

#

Since this is what the second camera sees

#

And this is what the game looks like with just the outline shader.

#

You can faintly see the radar covering the whole screen

#

Its more defined when disabling the fog though, since the outline shader renders before the fog.

#

But the issue happens much less without two cameras

#

In fact, with only one camera, the issue only happens in the scene view.

#

But I can't get rid of the camera since I need it for the render texture displayed on the radar.

livid kettle
#

Im having an issue with Shader Graph. After multiplying with a rectangle, i am unable to connect to the position node.
I am using this to add rocks to a terrain, but rocks at the edges would show the edge.

patent spoke
#

hey so I made a simple outline shader and am having issues with some artifacts only on certain sprites, can anyone tell me why?

regal stag
regal stag
patent spoke
regal stag
patent spoke
#

ah okay, whats the easiest way to modify the sprite sheet then? anyway to do it in unity or just change it in asperite and put it back in

regal stag
#

Would be using external tools yeah

regal stag
patent spoke
#

yeah its just easier to fix them in an editor

grizzled bolt
patent spoke
grizzled bolt
grizzled bolt
patent spoke
grizzled bolt
patent spoke
patent spoke
#

thanks

stiff nexus
deep moth
#

It's really weird that its an issue reproducable w/ their example code.

#

this one was what mine looked like

stiff nexus
deep moth
#

oh wild.

#

hm -- what is the resolution of your game view / scene view ?

hot cloak
#

Is there any way to manually cull faces through shaders? For example, I want to be able to walk around a tree and see it normally, but cull the backfaces based on the camera, now this isn't typical backfacing because you can still walk around and see the other side of it as you normally would.

kind juniper
#

Just use a double sided shader and it'll do just that.

hot cloak
#

because then you're rendering everything, even if you can't see it. The tree was just an example, a better example would be hills

#

imagine there is a hill and behind it a mountain overshadowing it, you don't want to render the back side of the hill nor the mountain, only the front side that the camera can see

hot cloak
kind juniper
kind juniper
#

Unless you have a very specific case where the scene is always meant to be rendered from a certain position/angle, any kind of manual optimization would be ineffective.

hot cloak
kind juniper
#

Ah, verts

#

Because you use the verts to determine the depth

hot cloak
#

yeah but it's still rendering them even though they aren't visible

kind juniper
#

It's not "rendering" them. You can't render vertices in the first place.

#

It runs them through the vertex stage to calculate screen position and depth. Then the generated fragments/pixels are to be rendered in the pixel stage/shader. That's where they would be discarded before processing them.

#

Vertex stage/shader( and consequently the vertex count) is rarely the bottleneck anyways. The pixel shader is usually the culprit of performance issues.

#

Besides, if you're talking about vertex count metric in the stat window/profiler/frame debugger, even if you were to cull the vertices in the vertex shader, these metrics wouldn't change, as they tell you how many vertices are passed to the GPU from the CPU side.

hot cloak
#

thanks for the insight

#

looking through the profiler, it seems like my primary bottleneck is memory so I'll just focus on that for now. Cheers again

kind juniper
#

You mean memory allocation? Like the GC?

hot cloak
#

the GC used memory seems to only hit 500 mb so it's not that bad, I mean my overall memory.

kind juniper
hot cloak
#

I'm rendering 1.1m tris so I thought that would be my primary issue

kind juniper
patent spoke
#

does anyone know why my outline shader makes the rest of the image black only in the editor? in build it looks fine

kind juniper
patent spoke
#

any suggestions on how to fix it?

#

the shader also appears fine on other objects, its specifically in that ui

#

using Images

#

on spriterenderes its fine

kind juniper
# patent spoke how would I know?

You could try playing with the graphics API priority in the player settings and seeing if it makes any difference(in build specifically).

kind juniper
patent spoke
#

no idea what it means though

#

well i figured out that if i turn the cavas to screenspace instead of overlay it fixes it but this causes things to look wonky

#

so I assume its an issue with how the UI renders the shader

#

fully fixed it, turned on alpha clipping in the shader

hollow harness
#

how can i achieve a flashlight (which will look like a spotlight) that will work on unlit shader having a single pass? any help will be great for me...

gilded mantle
#

Hello guys ! Maybe someone can help me I am trying to figure out how to fix an issue, I am developping a shader with shader graph to blend textures for a ground.

The issue I am encoutering is I have tiles that I want to spawn procedurally so the model for the floor can be rotated 360 degrees. The normal map for the floor rotates with the model so it causes the normal map to be inverted when my tile spawns with a rotation. Is there a way to offset the normal map to always be in one direction ?

#

Note that I have a basic understanding of shader graph, I know my way around it but I am missing some logic notions to be able to do what I want to do ?

amber saffron
gilded mantle
amber saffron
gilded mantle
amber saffron
gilded mantle
amber saffron
hollow harness
#

@amber saffron optimization really matters a lot in my case...doesn't lit shader cost more performance than unlit?

amber saffron
hollow harness
#

that's why i had to chose this tough way

#

but it is really tough for me as i am not too familiar with shader coding...

amber saffron
hollow harness
#

what catlikecoding shows takes more than one pass....but i am trying to stick with a single pass...isn't there any way to create a spotlight type thing manually?

amber saffron
#

Nothing prevents you to include the lighting code in a single pass.

hollow harness
#

here the problem is that the shader uses lightmap, i was curious if I can have the spotlight effect on the lightmap in that shader at the same pass or not... is it doable?

amber saffron
#

Yes, it's doable

hollow harness
#

amazing, i thought i would end up using two passes, but can you please give a hint about the whole function?

amber saffron
amber saffron
gilded mantle
#

I've tried the solution but my problem persist I've attached here a gif to show the issue, with my output shader

One thing I understand is that I could set the normal to be in worldspace, but this bring a lighting issue, we have a day and night cycle and when the light moves around the floor looses all the normal map information so I put it in tangent. But as you can see when the model rotate, the normal map does too. I used the rotate about axis node, but maybe I am missing what to plug in the rotate input ? Like how do I put the Y rotation parameter from my object into it ?

amber saffron
hollow harness
#

@amber saffron maybe i am making it a bit confusing....what i am trying to ask is, how do i do the spotlight part that takes two pass in a single pass? i mean the catlikecoding tut does the lighting using two pass...but i am trying to limit it to one single pass...some clarification would be helpful

amber saffron
hollow harness
#

as far i know it doesn't work like that...but i'll try it, thanks....

gilded mantle
#

Like here is the example shown, I have 3 tiles with various rotation, but as we can see, the normal is affected. I understand what I need to do, but am missing the how I can do it ?

#

Do I need to take the tiling and offset node I am using for the uvs of my texture > one minus it > and plug it into the rotation port ?

amber saffron
gilded mantle
amber saffron
#

You've mentioned this earlier :

One thing I understand is that I could set the normal to be in worldspace
Should I understand that you are mapping not with the mesh UVs, but the world position ?

amber saffron
#

Okay, now it comes together ๐Ÿ˜…

gilded mantle
#

My bad I must of explained it wrong ๐Ÿ˜ตโ€๐Ÿ’ซ

amber saffron
gilded mantle
#

nah both are normals mapped with world position. I blend these 2 with a mask to do something like this : Depending on my vertex paint, A shows up or B shows up blended with a mask

#

both are in world

amber saffron
#

Then using world normal mode should be enough.

But ๐Ÿ˜„ :
The sample texture node is by default in tangent space (and normal maps are also in general in tangent space).
But since you use a planar mapping (world XZ coordinates), you can consider that your normals are in the world Y-plane tangent.
You can easilly convert the output of the sample nodes (or better, after the normal strength nodes) to world space with a swizzle node, set to xzy

#

(also, for security, you might want to normalize the output of the normals lerp)

gilded mantle
#

Ohhhh I seee, yeah I am unfamiliar with Swizzle, also normalize ? I will with your explaination try to make it work, Dang, thanks Remy

amber saffron
gilded mantle
#

So as a rule of thumb, after a lerp, you normalize ( For a normal )

#

interesting I feel like I am getting there, this should be the setup if I understand correctly, But This is the result I get

amber saffron
gilded mantle
#

Oh I did not, since we are using directional main lights to light our levels, depending on the angle of the light, using world makes it so depending on the angle of the light we loose normal details

amber saffron
gilded mantle
#

Oh ๐Ÿคฆโ€โ™‚๏ธ๐Ÿคฆโ€โ™‚๏ธ๐Ÿคฆโ€โ™‚๏ธ damnit, my inexperience make me do silly things as you can see iโ€™ll try that

hollow harness
amber saffron
hollow harness
amber saffron
hollow harness
#

alright...let's see if @regal stag notice this unlit flashlight issue๐Ÿ˜… ...anyway thanks @amber saffron

regal stag
# hollow harness <@532477925250039820> maybe i am making it a bit confusing....what i am trying t...

Hmm, I mostly only work in URP which already passes everything into a single-pass for forward rendering. If you don't have a lot of custom shaders/assets converting the project's render pipeline could be an option. I think SRP batcher is also pretty good for optimisation. (Just be sure to back-up the project before)

If you do want to stick to Built-in RP. Afaik you need a ForwardBase pass, (otherwise it won't render unless a point/spot light shines on it). Other lights usually use a ForwardAdd pass, but there are "non-important" per-vertex lights (included in ForwardBase), which you might be able to hack into the fragment shader. Similar to this forum answer from bgolus - but probably using ShadeVertexLightsFull with last param as true, not Shade4PointLights.

Alternatively if that doesn't work out, write a C# script to pass the light position, direction, radius, colour, etc. into the shader (via your own material properties / global shader properties) and handle the spotlight calculations yourself. I think that ShadeVertexLightsFull function above should also shows how to handle that, would likely remove the loop and swap the unity_X variables for your own properties.

hollow harness
# regal stag Hmm, I mostly only work in URP which already passes everything into a single-pas...

i tried something like what your 3rd point says...but when i was moving the light source(fake) backward, the radius was decreasing where it should have been increasing as real light's bahaviour...i mean i couldn't do i correctly, i did the circular lighting part only...most probably i also couldn't do the opacity part...opacity wasn't changing based on how far or close the light source is

regal stag
#

Maybe try again using that function I mentioned/linked as reference, it should show how to handle the attenuation properly.

hollow harness
pseudo wagon
#

I have a line renderer with a given shader. Inside the shader, how do I access the length along the line each pixel is ?

regal stag
pseudo wagon
#

In other words, I want the beginning of the line to have a spcific effect, regardless of the total length of the line.

pseudo wagon
#

Strech and repeat don't work, Custom i'm not sure what is it

#

I feel like the only solution is to somehow find the total length of the strip and pass it to the shader ๐Ÿค”

chilly robin
#

I'm trying to overlay this eyebrow alpha texture to my character, but the transition doesn't seem to be smooth and I can't figure out what it is

#

The edges are darkened a bit

#

All I'm doing is using a Lerp node with the eyebrow alpha for the T.

chilly robin
#

Nvm, I see where I screwed up. All good now!

stiff nexus
proven sail
#

checkerboard floor ๐Ÿ˜Ž

young spruce
#

I'm trying to write a vertex shader that lerps the vert positions between perspective and orthographic based on distance to a given point but I'm struggling with the matrix math. I've got my ortho projection matrix, how do I lerp between the two different projected positions?

dim yoke
young spruce
#

Shader code, sorry.

dim yoke
# young spruce Shader code, sorry.

makes it ton easier. transfer the vertex positions to view space -> transform to clip space using the two matrices (one for perspective, one for orthographic projection) -> lerp between the two, that all in vertex shader of course

young spruce
dim yoke
# young spruce Gotcha, thanks. I think what I'm stuck on is, what space does the vertex shader ...

it's the position after MVP (Model, View Project) transformation (either UnityObjectToClipPos or mul(UNITY_MATRIX_MVP, float4(pos, 1.0))). So basically you need to only do the MV (there's also UnityObjectToViewPos function for that) transformation and then use the projection matrix to transfer from that to the final position. Also note this documentation if your orthographic projection matrix isn't already in GPU compatible format (I think it does some swizzling to ensure correct format on different platforms): https://docs.unity3d.com/ScriptReference/GL.GetGPUProjectionMatrix.html

young spruce
flint wasp
#

does anyone know if I can bitshift a vector type? For example
uint2 vector = uint2(1, 2); int value = vector >> 32; ?

dapper pollen
#

im using clip(color.rgb - subnoise + amnt); inside a urp forward pass shader to cut out the grey part, but its not clipping just the one objects pixels but seemingly everything?

dapper pollen
#

fixed it, depth priming was interfering with it

tropic field
#

It appears any shadergraph I make That uses the URP Sample Buffer node is not compatible on android devices. It simply is not visible, not even pink, its just not visible.

#

However I use this node for a lot of full screen renderer features

#

What is the solution here? I can't afford not to use this, and I can't afford the time to convert all of my shadergraphs into .shader code

#

This node is integral to some of the visual effects I want to achieve in my game

tired skiff
valid knoll
modest granite
#

I've made a few fun shaders with Shader Graph, but I just had an idea to make a small modification to the standard build-in shader. I can't find a template or starting point anywhere. I realise I could start from scratch, but as this must be a fairly common need, could anyone point me to a Shader Graph version of the standard shader?
I have a feeling I'm missing something obvious, so apologies!

dim yoke
modest granite
#

Ah, ok thanks, I guess I'll just build it from scratch then, and save as my own template. Just wanted to make a Shader Graph double-sided version of the standard built-in. Searched everywhere but can't find one of those either.

red smelt
#

The reflection probe. I already did bake. But the object dont showing on the table mirror. It is because it's too close?

slender ore
#

Using shader graph is there a way to achieve effect similar to this but instead of lerping between 2 patterns to make it lerp between random paterns?

regal stag
regal stag
slender ore
#

If I could set a random offset between each lerp, then I could probably achieve it

regal stag
#

Oh okay. By patterns I thought you meant totally different noise types or something. If it's just the same but offset that should be doable.

#

Maybe some offsets based on Time->(some remapping)->Floor->Random Range. The remapping would be to sync it, so the jump occurs when the noise is hidden by the lerp. Depends how you calculate your current t value.

tropic field
#

Yes, i have double checked. The correct urp assets are being used

regal stag
tropic field
#

It is almost as if It does not run at all

#

Like it has no impact, it is completely ignored

#

It works on PC

regal stag
#

So the problem might be the fullscreen feature, not the URP sample buffer node specifically

tropic field
#

There is an alternate route that has worked. But I despise it thoroughly.
I can make custom Post Process Scripts for each of the effects that I have made

#

but that requires polluting the project with 3 .cs files. And then further making sure that the post process is added on a volume component somewhere in the scene

#

its a very ugly implementation, and will take too much time to convert everything to that

#

and I have to use a .shader file instead of shadergraph

#

What leads me to believe it is an issue with the URP Sample buffer node is the following:

  • Normal shadergraph materials work, so its not a problem with shadergraph.
  • I have 3rd party assets which use RendererFeatures which work. So I know RendererFeatures is not the problem
  • My post process effects work if I use the alternate route mentioned above.. using .shader instead of .shadergraph
#

I'm left with the conclusion that its the URP Sample buffer node that is the problem, as that is the only differing variable

regal stag
#

To me it sounds more like a problem with the Fullscreen Pass Renderer Feature that Unity provides specifically. But idk for sure. If you make a graph just outputting a Color node and see if that runs in android it would help confirm it.
Either way though, may need to make a bug report

tropic field
#

I tried it

#

its specifically when I use the other node with it

#

ill try bug reporting

#

im not sure

regal stag
# tropic field A graph that SIMPLY sets a color works

That's confusing then. Afaik the URP Sample Buffer node isn't doing anything special, it's just sampling the _BlitTexture, which in this case is the camera view.
Are you sure the Opacity property in your previous graph isn't just set to 0? What if you hardcode it as 0.5 in the graph and test on android then.

tropic field
#

I will need some time to test it out

#

Will test and messsage here again

sweet granite
#

So uhm can someone help me make outlines?

grizzled bolt
#

Last time you didn't give any precise details so it wasn't possible

grizzled bolt
grizzled bolt
#

If you increase the custom shader's material's Scale variable by a large amount, does anything change?

sweet granite
#

ill check

grizzled bolt
#

You could show your shader graph and the gameobject's mesh renderer so we can at least confirm it's exactly as in the tutorial

grizzled bolt
# sweet granite

That's entirely different from the node setup in the video tutorial

sweet granite
grizzled bolt
regal stag
# sweet granite

This should be equivalent to the "inverted-hull" style outlines, provided you make sure under graph settings it's set to cull front faces (Render Face : Back)

#

You would also use it as a secondary material. For URP could also use RenderObjects feature.

valid knoll
# sweet granite

did you make sure to invert the mesh normals for the outline material? currently it seems like it is working but occluding the main material due to the normals not being inverted.

sly delta
#

Hello guys. I've made a shader with the shader graph, but everytime i change one object's property, it changes all objects property that share that material, any way i can add per instance data?

#

I could enable GPU instancing but that darkens my colors by A LOT

#

The weird part is that my player and my Enemy share the same material, but the player is not changed when i change the enemy settings and/or enable GPU instancing

regal stag
# sly delta Hello guys. I've made a shader with the shader graph, but everytime i change one...

If using URP/HDRP, you are meant to assign different material assets, or from C# use renderer.material to create a material instance. Property blocks can work but breaks SRP batcher compatibility.

For Built-in RP it's fine to use property blocks. Though iirc they won't batch unless you also use GPU instancing. I don't think shader graph has full support for it, so may require using a custom function instead of using the blackboard properties - https://www.cyanilux.com/faq/#sg-gpu-instancing

sly delta
#

so.. doing this for C#?

#

Material mat = transform.Find("Sprite").GetComponent<SpriteRenderer>().material;
transform.Find("Sprite").GetComponent<SpriteRenderer>().material = new Material(mat);