#archived-shaders

1 messages ยท Page 23 of 1

neat hamlet
#

nope

subtle thicket
#

Someone mentioned using a render texture to broadcast a camera looking at a sprite onto the ui... but that feels pretty janky

#

Is a code shader harder to work with than shadergraph?

neat hamlet
#

ehh, I find it much easier but I don't like graphs

#

how complicated is your graph

subtle thicket
#

Like ten nodes. But I'll need to add more to it later

#

Everything else including animation is in code form already, so I guess why not add shaders to the list

neat hamlet
#

URP still uses the built-in shaders for UI, so you can grab those

subtle thicket
#

What do you mean?

neat hamlet
subtle thicket
#

(I only learned about shaders like a week ago)

neat hamlet
#

thats what URP uses for UI

#

now, you see the properties with stencil, and the stencil block? those, and the ZTest mode make it work in UI

subtle thicket
#

hmm geez, that's some weird stuff going on

neat hamlet
#

Stencil block is for UI masks, Ztest is to make it render in game view

#

so if you don't need the UI masking, you can just use the ztest mode

#

maybe you can generate the code from the shader graph, and just add the ztest

subtle thicket
#

What would UI masking do?

neat hamlet
#

the UI mask component, use one image to keep another image in its alpha

subtle thicket
#

Geez, I'm looking at his built-in shader code and not understanding any of it ๐Ÿ˜…

neat hamlet
#

oh nearly all of it is boiler plate

subtle thicket
#

Well my sprites do use a secondary texture to get the colored glow effect. But I don't know if that counts as masking

neat hamlet
#

no

subtle thicket
#

Okay good! So how do you 'generate the code' from the shader graph?

#

Is there an automatic way or no

neat hamlet
#

I think theres a button on the graph somewhere

subtle thicket
#

I guess it's this one. It pulled up a 1300 line class ๐Ÿ˜…

neat hamlet
#

yeah

#

graphs arent very efficient :V

subtle thicket
#

So I guess I can't just set the ztest in here and call it a day?

neat hamlet
#

well hopefully all of the unused stuff gets pulled out at some point, but yeah theyre not human friendly

#

should be able to

subtle thicket
neat hamlet
#

yeah, so replace the ZTest LEqual

#

ZTest [unity_GUIZTestMode]

#

with that

#

also save it in another file so it doesnt get overwritten next time you hit generate code

#

and change the name on top to you can find it when you switch the material

subtle thicket
#

hm, looks like there are one or two errors

#

let's just ignore those

neat hamlet
#

that just looks like its trying to parse it as c# or something

#

is it a .shader file?

subtle thicket
#

Oh right.

#

I TOTALLY know what I'm doing here

#

hmm... I'm not seeing how to 'equip' a material with this code shader

neat hamlet
#

whats the name on top

subtle thicket
neat hamlet
#

should say "Shader "Something/whatever" " in the file

#

might say "Shader "ShaderGraph/TeamShaderUI" "

subtle thicket
neat hamlet
#

hmm

#

and its a .shader file?

#

if you click it, any errors?

subtle thicket
#

oh never mind I got it

#

was editing the wrong one

neat hamlet
#

ah ok

subtle thicket
#

k moment of truth I guess

neat hamlet
#

if it still doesnt work your alpha is messed up :V

subtle thicket
#

sadness

neat hamlet
#

the preview doesn't show alpha either

subtle thicket
#

hmmm...

#

the spriterenderer version still doing fine

neat hamlet
#

can you dm me the graph, I'll have a look

subtle thicket
#

oh okay

kind juniper
#

Would be nice to hear if and how you solved it.

fossil cloak
#

Hey, i tried to recreate the Height from the URP/Lit Shader. But mine (left in the video) is not working like the one from Unity(right) when adjusting the sliders:

meager pelican
lucid scarab
#

hi, is it possible to reproduce a 6 sided skybox shader in shadergraph?

meager pelican
# lucid scarab hi, is it possible to reproduce a 6 sided skybox shader in shadergraph?
lucid scarab
#

it's not possible to use render textures with cubemap ๐Ÿ˜ฆ

#

now I'm trying to understand if it's possible to sample a texture imported as cube

meager pelican
#

There's a node for that.

karmic hatch
#

in shader graph, if you're using a transparent graph, there's an alpha slot in the fragment node

lucid scarab
#

?

robust path
#

Hi, I have an object with a custom shader that does not have emission on it, and I'd like to add emission
The shader is too complicated for me to mess with, it's from the asset store
My plan is to add emission in a separate shader, but I'm not sure how to do that - I tried using simple lit, but depending on my Sorting Priority, it either shows nothing, or it changes the entire look of the object (completely overrides the other shader)
How can I deal with this?

kind juniper
# robust path Hi, I have an object with a custom shader that does not have emission on it, and...

Firstly, you need to understand a few things about shaders:

  • They define how an object is rendered. You can't "add up" shaders to the object as components. All you can do is either have several materials with different shaders, in which case the same mesh would just get rendered twice and one of the renders would overlap the other or they might even start z-fighting. Or duplicate the object and give it another material(but the effect is probably gonna be the same or even worse.
  • Emission is usually just a color unaffected by lighting and shadows. You can achieve the same effect by just adding the emission color to your final color value that the fragment shader outputs.

As for a solution to your issue, modifying the shader (or using a different one) would probably be the simplest solution.

robust path
kind juniper
#

What passes does it have?

#

Maybe it would be easier to recreate the shader in shader graph?

civic lantern
#

Is it a HLSL shader?

robust path
robust path
robust path
#

ExtraPrePass seems like the main custom thing

kind juniper
#

Forward is the one that defines the final color, so you should look at it's fragment shader.

robust path
#

will try!

kind juniper
#

What does the shader look like? Extra prepass is probably some intermediate calculations.

robust path
civic lantern
#

@robust path Been a while since I messed with written shaders, but if you see anywhere something like:

o.Albedo = ...```
You can try adding a line with 
```cs
o.Emission = ...```
kind juniper
robust path
civic lantern
#

Look for that

#

Look for the part that samples your main texture

kind juniper
#

or just look at the return value of the fragment shader - that's the final color.

robust path
#

I mean it's in the code 6 times, somewhere in the forward pass

#

wait no

#

it's just

color.rgb += Albedo * mainTransmission
civic lantern
#

You should be able to add to that rgb.

#

To get emissive effect

robust path
#

it works

#

I didn't know emission was just adding a color, huh

amber saffron
long lynx
#

can someone explain to me why my sprites arent showing right ?

regal stag
long lynx
#

yes thanks, just found it out

#

im new to this so. sry for the dumb question ll

#

lol

#

why is this my preview:

#

and this ingame:

shadow locust
# long lynx

Looks like lighting and/or a postprocessing Bloom

long lynx
#

thats the result when I remove bloom and global light

#

it really only gets white when I add my own material based on the shader

#

forgot to add textures

#

thought I didnt need to because I named the components right

#

but no

queen lance
#

Hello again - I'm having an issue with custom shader graph blocks.
https://gdl.space/atexoxajov.cpp
The output of this shader is always a black square. I have a couple questions which are difficult to test myself because there doesn't seem to be a way to debug shader code:
What's the range of a float of RGBA from Sample texture 2D? I think it might be 0-1 instead of 0-256.
Have I defined my array of colour values correctly at the top of this script? I can't seem to set pOut to be a value from this array.

#

the function that doesn't work is PaletteMatch_float

shadow locust
#

colors are indeed 0-1

regal stag
queen lance
#

thanks - it's still only doing black, but now it can actually read the values, I think, so that's good

regal stag
# long lynx thought I didnt need to because I named the components right

Afaik it should automatically assign the textures. _MainTex is handled by default, but for "secondary textures" you'd need to connect them with the sprite asset : https://docs.unity3d.com/Manual/SpriteEditor-SecondaryTextures.html
Make sure the name used matches the reference field of the property (under Node Settings, while property is selected that is). It's a bit different from the property name which is only for display purposes.

lucid scarab
#

is there any way to make dynamic skybox in Unity?

#

I think there is a big limitation with render textures

queen lance
#

It would seem my mistake was far dumber than I thought. I forgot to update the best distance value when a new best distance was found.

queen lance
fervent flare
#

Given something like this, would there be some elegant way of randomly offsetting my textures UV's by X whenever the Sine value reaches its lowest value in the curve?

reef owl
#

I mean you could do something like this to generate a value of 1 around the time sin(t) = 0, and 0 any other time:

- invert abs(sin(t)) ( take -abs(sin(t)) )
- subtract some number n ( something like 0.8, so the output of -abs(sin(t)) now ranges from -0.8 to 0.2 )
- clamp between zero and one -> now all values should be zero or some small positive value
- round up

then you could just multiply that number by whatever offset you want, before you apply it

also you could adjust n to change the window that the shift is active in

#

if you don't want a sudden jump you could multiply by some amount instead of rounding up

#

@fervent flare bc I forgot to use a reply

crude flume
#

Hey anyone know a good shader that makes good water with crashing waves on the edge of it, similar to those dark stormy nights in horror movies and stuff

tame topaz
#

There are a few high quality ocean shaders on the asset store.

vague spoke
#

Does someone know how to make an interaktive shader for grass? I already one for Wind velocity (everything pixelperfect)

undone anvil
#

how to access secondary texture via Shaderlab ? i want to implement shader to UI canvas that can get 2nd Texture from sprite editor

halcyon magnet
#

Question. I'm trying to manipulate the vertex positions using a texture and, while the preview shows obvious distortion, the mesh I'm applying the material to remains unchanged.

karmic hatch
jade hinge
#

Howdy peeps ; looking for some directional advice re "water":

I need a mobile (VR performant) water-shader or material of some kind. I don't need transparency (would be un-performant) or anything super fancy, I just want to give any kind of stylized impression that "this is a water surface"... Hopefully something that can work double-sidedly so that when underwater the player can see the under-side of the water surface...

#

the other limitations is that I'm trying to avoid real-time lighting of any kind, and that, ideally, it works for a sphere mesh (a 360 spherical water surface)...

#

scrolling some basic UV noise seems like the absolute simplest approach, but I was also hoping to integrate that with vertex manipulation...

#

So... if anyone has any insight about how i can do a minimalistic water shader as performantly as possible, would greatly appreciate it!

#

(the blue sphere /w the noise pattern is my current placeholder)

undone anvil
#

try exactly resource example of custom shader config and i got this ๐Ÿ˜ฆ

visual ocean
#

Hello! Has anyone experience with the use of Material instances for each gameobject in the built-in render pipeline?
What are the performance impacts? Especially on mobile? Would love to hear from your experiences

rotund ingot
#

Hello, I'm working on a triplanar shader and I'm trying to split the top from the bottom of the normal. The goal is to have the green only on the top, and have the rest be brown

karmic hatch
#

Also depending on how large it is, you probably want a float multiplying the offset so you can change how much it's offset by (otherwise it's just a fixed 1 meter)

#

could multiply it by sine time or something for debugging, just to check that it's moving

grizzled bolt
#

@halcyon magnet With certain export settings the mesh may appear normal but get a scale of 100 or 0.01 which messes up object space effects

#

The rotations may get flipped which is likewise relevant when mapping a texture in object space

true steppe
#

Hey guys! Some parts of my textures appear pink only in the build. What could be the issue?

quaint grotto
#

how do you calculate the depth under a water plane?

im currently subtract the scene depth in eye space by the position node in view space

#

but im getting crazy bright white result when i put it in my base color

harsh marsh
#

Trying to make get a 3D pixel art style going. Currently, I'm trying to figure out how to add edge highlights to sharp edges on objects that are pointing towards the directional light of the scene.

For example, this screenshot

#

should have highlights like this

#

but I'm a bit confused on how to achieve this in URP w/ shadergraph

kind juniper
spiral agate
quaint grotto
#

what causes this bug ?

spiral agate
quaint grotto
#

annoying flashes

spiral agate
#

how would i go about this?

spiral agate
quaint grotto
#

i saturate then i added a pow function

spiral agate
#

well, thats the pow function then

quaint grotto
#

is it cause a value in my output is exceeding 1 ?

spiral agate
#

use pow first, then saturate

quaint grotto
#

sure but 1 never exceeds 1 in a power function

#

ok good point

spiral agate
#

it might be negative values

#

since pow does not return negative values there must be some weird stuff going on at 0

north verge
#

how can i find 3d modelers & or animators?

quaint grotto
#

good point

quaint grotto
north verge
#

i am

#

wheres the best place to go

#

on the server

quaint grotto
#

not sure if theres a room for posting ads but there are in other unity servers like UDC and GDL

spiral agate
spiral agate
#

i believe its called parallel prefix sum, but using max instead of add

#

but i really do not know how to implement this in a shader, i really could need some help here
please @ me so i can catch your message

somber chasm
#

So i've upgraded my project to URP and need to update one of my CG shaders, it's a very small shader (85 lines) but i'm at a complete loss of how to convert to HLSL

#

Essentially I have things like:

            UNITY_DECLARE_TEX2DARRAY(_MainTex);
            fixed4 _Color;

            sampler2D _OverlayTex;
            fixed4 _OverlayColor;
#

And UNITY_SAMPLE_TEX2DARRAY(_MainTex, i.uv)

#

Which are not compatible with HLSL?

tardy spire
#

Is there a good way to load a compute shader without referencing it in the inspector or putting it in a Resources folder? I'm kinda surprised there isn't a Shader.Find equivalent

harsh marsh
#

sure do enjoy a nice 3 hours of trying to figure out how to get unlit materials to receive shadows in URP ๐Ÿ™‚

#

and im just stuck here

north wren
#

Is there any way to implement transparent and double sided shaders on mobile without huge performance hit? (using a specular shader)
I don't need a translucent material, just want the holes in my texture to be transparent

quaint grotto
#

ok im stuck i have a water plane and im trying to project caustics on to all the objects behind the water plane, but i seem to get stretching on the faces that vertical on the Y axis - how can i fix this stretching issue?

kind juniper
kind juniper
kind juniper
plush imp
#

is it possible to always include shaders at compilation time?

#

i only found a way that works in editor because the relevant interfaces dont seem to exist in build mode

kind juniper
#

Include where?

karmic hatch
#

obviously not ideal circumstances but sometimes it's how the cookie crumbles

plush imp
#

i want to not add the shaders there

#

but instead in code

#

to include the shaders at compilation time

#

and not include them using unity's pipeline that processes the project settings

kind juniper
plush imp
#

i guess

kind juniper
# plush imp i guess

I guess you could hook into the build pipeline somewhere to include the shaders..? But why not do it via the project tab..?

night isle
#

so i need a shader with multiple passes. right now i have 4 extra passes, one for each diagonal like this

#

however instead of moving it around, it would be better to just scale it from the middle like so

#

its guaranteed to be a plane, i just need the coordinates in terms of the plane

#

and im not sure how to do it

night isle
#

oh and also i need it to be from the centre regardless of its pivot

#

and scale out exactly n screen pixels on each side

#

also just randomly my shader stopped working, i got the message that line endings are inconsistent but i thought i fixed it in vscode

#

yet the shader is just pink and no warn or error messages

#

oh its because unity injected some code into my shader and messed it up lol

night isle
#

not even sure if this is possible actually

#

if anyone has a good pixel outline shader please let me know

#

ohwever it needs the be able to go outside the original sprites plane

night isle
#

heres what i need to figure out, a is the original size of the plane but i dont know how to get that

meager pelican
#

But you'd have to know b.

#

You have to have one known, either a or b I'd suppose.

shadow locust
#

Are you trying to solve for scale or a?

#

if it's scale then:
scale = b / (b - 2x);
if it's a then:
a = b - 2x;

#

if it's b then b = a + 2x;

night isle
#

yeah i need to know either a or b

shadow locust
#

Or you're saying you know one or the other?

night isle
#

i know neither

#

and i need a way to get one of them at least

#

but im not sure if thats even possible in a shader

shadow locust
#

or maybe even better - can you explain the situation and what you're trying to do?

night isle
#

scale up a plane in a second pass of a shader

#

ive figured out the scaling by shifting the vertices according to their sign

#

which scales them by exact screen pixels which is what i need

#

but now i need to find the scale factor of that to use in the fragment shader so i can scale uvs down when i sample the texture

grand jolt
#

I have a generic question regarding Shader Graph, as it's a visual scripting tool and if i think about the underlying code, would it be better to use a single node and just route it to several input locations?

basically, if i attach a sampler state property to each SampleTexture2D, is that generating the code required for the sampler state multiple times? whereas if I use a single property and route it multiple times is that just using one set of code? or does it not matter?

I know it's probably micro-optimization if theres a difference but im always fond of knowing these things

reef owl
#

Do I need to declare a new sampler for every Texture2D I declare? if not, how can I determine when it's possible to use the same sampler across multiple textures?

terse nexus
#

How do I account for the offsets of sprites in my shader.
Texture number one is a texture split into multiple sprites (actually its a tileset)
Number 2 is world space auto tiled. It seems to add the offset of the sprite on the tileset to the offset though. So aligning tiles doesnt work

gray harness
#

any idea why this isnt working?

#

and the object looks black

#

if i do return float4(1, 0.8, 0, 1) it works

regal stag
#

Your property is named coluor but colour in hlsl

gray harness
#

oh

#

i see now

#

thx

spiral agate
#

how can i make a compute shader having a starting point, and checking anything before, comparing those 2 values and return max of both of them?

quaint grotto
#

why the hell is ComputeWorldSpacePosition function not available in shader graph yet they have that function in their api

deft narwhal
#

is there any way to have a shader use global positioning to make all objects using it have the texture line up? Like blenders "object" mapping option in the shader creator. right now all the meshes in my scene are somewhat different sizes so i end up making a whole new material to kind of line them up and i cant imagine thats good for file size

quaint grotto
#

strange, when i apply a local to world matrix to my material it doesn't seem to update ๐Ÿค”

kind juniper
low lichen
meager pelican
harsh marsh
#

doesn't help that pretty much every github repo for such a thing is a post processing shader rather than just a normal material shader

#

If anyone has any github repo examples of outlines using depth normals in URP that is a single shader made in shadergraph that'd be great because I literally do not know how to continue

halcyon magnet
#

@karmic hatch @grizzled bolt I appreciate the help. The solution that worked for me without changing the wireframes were the following nodes:

heavy stirrup
#

Is there a way to override final blit pass to use our own uber post process shader?

spiral agate
kind juniper
deft narwhal
sage ridge
#

im not a 2d artist how to make 2d shaders like cool shaders for unity ?

heavy stirrup
kind juniper
# deft narwhal how do i do that exactly?

Depends on wether you're writing the shader manually or using a shader graph. In the latter case there's a position node that you can use to sample the texture. In the former it's a bit more complicated.

kind juniper
quaint grotto
#

how do apply a normal map only to the faces that have a normal facing up in world space

#

i applied my approach to colour and it looked fine

#

but as soon as i apply it to the normals it affects other faces

#

this is what i got

#

the idea being then if the face has a normal of (0,1,0) i multiply by 1 or i multiply by 0

#

but it messes up entirely

kind juniper
quaint grotto
#

yeh i figured it out in the end its because the object was rotated 90 but there was like 0.0001 off so the step was rounding it up to 1 so i have changed the threshold now

#

damn float precision got me

#

im still struggling to understand if you need to multiply or add colours some times

#

im trying to add stronger caustics but its causing the blueness of the water to be less vibrant

#

very confusing on how im suppose to merge it to the colour of my water

neat tendon
#

can i make this a shader in unity

#

and can it work with triangulated ngons?

#

also each face is a seperate object in my project

#

idk i'm no shader god

undone anvil
# neat tendon

Improving our existing wireframe shader, to only render quads. This removes many of the diagonal lines from the mesh you may not want.

We use the technique of longest edge removal from the triangles. This removes the majority of cross diagonals in a mesh that is predominantly made of quads. It isn't perfect, but if this is the effect you requir...

โ–ถ Play video
#

i didnt go in deep yet sound like its should be your desire ?

neat tendon
#

yeah i just dont know glsl

#

or hlsl

#

ยฏ_(ใƒ„)_/ยฏ

#

guess i'll go learn :|

digital gust
#

I am sure this is possible with shadergraph too

karmic hatch
spiral agate
#

.

steady ledge
#

i exported height map from substance painter, but its adding like a outline to my character, how can i fix it?

grizzled bolt
stable flare
#

Hi I've been using a halftone shader i made and it works flawlessly.. Until there is a flat surface. It works great on bent surfaces as you can see on the horns, the back and the leg parts, but holyy is it so bad on flat surfaces like the gun or the two legs you can see in the other screenshot.

loud dagger
#

Hey all! How can I separate channels for the camera?

amber saffron
loud dagger
# amber saffron What do you mean "separate channels" ? Notes : - The camera position is float3, ...

Yea the float2 was just me playing around. https://www.youtube.com/watch?v=4P9Bifze8QY&t=609s
I'm kinda using this as a guide. I want to split the channels and just use X and Y. Honestly not sure why but I'm just following how he made it.

deft narwhal
#

anyone know why this shader isnt mapping to Y or Z correctly?

amber saffron
#

If the model has proper UV coordinates, just use them with texture coordinates node, or use triplanar mapping node for world space coordinates

steady ledge
deft narwhal
#

triplanar worked. thanks

swift loom
#

Does ComputeScreenPos do anything special to stretch the resulting normalized value somehow? Because I'm trying to use id as screenposition in a compute shader, however to get textures to work I have to add -1 after the texture width/height, which doesn't even work accurately all the time.

#

like (id.xy / (screenSize.xy - float2(1,1))) * screenSize.xy maybe to stretch it out?? not sure what the proper way to deal with this is

swift loom
#

^this seems to work at least...

tight vortex
#

Hey folks, I'm playing with simple parallax shaders and stumbled upon the classic "View Direction drives the offset" technique, which works fairly nicely. However, at more extreme angles the effect breaks down and the textures flatten. I think this is a common issue with the technique (as I've seen many games have the same side effect), so I'm wondering if there is another way to approach the effect, even if it's a bit more expensive?

subtle thicket
#

Why is there so much stuff missing now in shadergraph compared to what I'm seeing in these older tutorials?

#

now it's like this

#

I can't figure out how to replicate these shaders because stuff is missing, like alpha clipping, smoothness, emission, etc

#

I guess sprite mask is the same as normal

#

I'm trying to replicate a dissolve shader btw

#

Well I figured out step node is basically the new alpha clip

grizzled bolt
#

Sprite Lit also doesn't have smoothness or metallicness because 2D lights don't consider that

karmic hatch
#

i believe if you right click on it it gives you things you can add

#

there are a lot

#

also i think alpha clip might need to be ticked in the graph inspector?

subtle thicket
#

Ah, thanks

#

Tst, I forgot the golden computer rule. When in doubt, right click everything

grizzled bolt
#

I guess the Sprite Lit could use emission, but for some reason doesn't

grizzled bolt
#

The problem here being that Sprite Lit does not

subtle thicket
#

Yeah you still have to use step node

cloud fossil
#

Anyone knows how can I fix this issue?

#

I just put my blender work into unity and that's what I got (view first image from top)

shadow locust
#

You sure this is a shader issue? Just seems like a materials/texture issue

quaint grotto
#

how do we write code for lit shaders in urp the docs only show an example of unlit shaders

fervent flare
#

I need some help adding a random offset to a texture every x seconds

#

how do I get the time node to turn into a sort of periodic timer ? ๐Ÿค”

azure lichen
#

Hey, quick question. I've got this gem (sry for the quality, it's an AR screenshot) and I'm trying to change its color values on buttonclick.

#

When I click the button, it changes the color, but it suddenly becomes a lot "brighter", causing the loss of reflection details

#

But the only thing I'm doing is editing the color values through script. Alpha is excluded already, because it's 255 on all of them so the only values changing are the RGB values

shadow locust
azure lichen
#

Well, in that case it's just public void Red() { _gemMaterial.color = new Color(255, 0, 6, 255); }

#

_gemMaterial color is public Material _gemMaterial

quaint grotto
#

does shader graph automatically account for what platform we are using for things like returning depth values because on some platforms it uses negative z

shadow locust
#

everything you give it over 1 is going to be the same as 1

#

so your color is full red, full blue, full alpha, zero green

azure lichen
shadow locust
#

same color every time you do what?

#

Anyway you don't have to take my word for it

#

This structure is used throughout Unity to pass colors around. Each color component is a floating point value with a range from 0 to 1.

azure lichen
#

I'll go ahead and change it. Thanks for the answer

neat tendon
#

The mesh

#

with diagonals removed

#

what i want

#

basically to just inset the edge of each shape

neat tendon
#

i've heard that you can bake some of this information into the mesh but i might still want to have meshes imported at runtime

kind juniper
#

It would only be possible with convex shapes though I think .

#

Might be possible with concave too. But it would be several degrees of time more complex. Both computationally and implementation wise.

neat tendon
#

scaling down each object then overlaying it ontop of the original

#

each face is a seperate object

#

but i'm not sure

kind juniper
neat tendon
#

is it much slower?

kind juniper
neat tendon
#

a wireframe shader alternative

#

i imagine rendering each polygon twice could be bad for performance

kind juniper
#

Not sure what you mean by a wireframe shader since we were talking about outlines from my understanding.
But rendering the geometry twice is of course gonna be slower than rendering it once.

harsh marsh
#

hmm. It's difficult/impossible to see depth with my toon terrain shader. Any idea on how I can fix this?

jade hinge
#

eg, flower bunches, trees

quaint grotto
#

any one know what this means for my custom code?

void RGBSplit_float(float split, Texture2D Texture, SamplerState Sampler, float2 uv, out float3 Out)
{
    float2 offset = float2(split,split);
    float r = SAMPLE_TEXTURE2D(Texture, Sampler, uv - offset).r;
    float g = SAMPLE_TEXTURE2D(Texture, Sampler, uv).g;
    float b = SAMPLE_TEXTURE2D(Texture, Sampler, uv + offset).b;
    Out = float3(r,g,b);
}
shadow locust
#

what's line 303

quaint grotto
#

well according to the show generated code its literally just a comment line:

#

this is a custom function im using thats in its own hlsl file

#

not sure how exactly to get it to show me the exact line causing the problem

#

does my hlsl file need to include something for it to work ?

kind juniper
#

I'd check if you have other errors.

quaint grotto
#

where would it list other errors

kind juniper
#

If you select the shader, they should be displayed in the inspector

quaint grotto
#

the inspector for the SG only has this showing

kind juniper
#

Hmm

quaint grotto
#

maybe i need to restart unity or something

#

does my code look fine on the face of it ?

kind juniper
#

Perhaps the issue is not with the code but the custom function node settings?

kind juniper
quaint grotto
#

this is how its setup

kind juniper
#

Did you define the entry/exit nodes correctly?

quaint grotto
#

had uv set to float and not float2 but fixing that didn't change anything

#

it seems to talk about sampler and texture2d so i presume its the three lines involving the SAMPLE_TEXTURE2D

#

wait do the variables in the inspector have to be in the same order as the function's arguments

quaint grotto
#

ok restarted unity and it seems to be ok with it now

#

ยฏ_(ใƒ„)_/ยฏ

kind juniper
#

Probably the float/float2 issue use the cause and after fixing it, it just didn't take effect right away

quaint grotto
#

it seems to be ok with my variables not being in the same order as the function's parameters which is odd

kind juniper
#

Are they not? They seem to be from what I can see.๐Ÿค”

#

Ah, the uvs and split are mixed up?๐Ÿค”

#

Was pretty sure the order matters. Maybe your input gets cat to the other type?

#

But if it doesn't, that's interesting.

quaint grotto
#

i thought it was because they match by name

kind juniper
#

Ah, could be that indeed. Didn't think about that.

quaint grotto
#

ah damn it similar error popped up this time

#

even made sure all the variables matched and were in order

#

apparently cant convert UnityTexture2D to Texture2D<float4>

#

same function yet it was error free just moments ago

kind juniper
#

I guess the type used by the shader graph is UnityTexture2D. That's a wrapper around Texture2D if I get it right.

quaint grotto
#

how do i get the Texture2D then to use the SAMPLE_TEXTURE2D()

kind juniper
#

Thinking about it, do you really need a custom function there? You can do that math in the shader graph itself.๐Ÿค”

quaint grotto
#

well im calling it a few times and it just makes the graph neater

#

its becoming spaghetti

kind juniper
#

Could make a subgraph or something, but okay.

quaint grotto
#

it already is in a subgraph ๐Ÿ˜›

#

its part of a bunch of other stuff

kind juniper
#

Make it a subgraph in a subgraph.๐Ÿ˜ฌ

#

Hmm. Maybe not. The shader graph node uses that macro it seems.

quaint grotto
#

its weird because in the subgraph theres no error

#

but using the subgraph in the main graph the error shows

#

in the subgraph its fine

kind juniper
#

Perhaps it didn't recompile it?

quaint grotto
#

is there a way to force it

kind juniper
#

Press the save button?

quaint grotto
#

i do

kind juniper
quaint grotto
#

in the main graph

#

when i use the subgraph node

#

but if i open that subgraph

#

theres no errors in there

kind juniper
#

What does it say?

quaint grotto
#

still relates to the code i wrote my RGB Split function

kind juniper
#

What if you close the graph window and reopen it?

quaint grotto
#

hm that got rid of the error but now generates a new error in the console ๐Ÿค”

#

Shader error in 'Master': undeclared identifier 'r' at Nodes/WaterAPI.hlsl(7) (on d3d11)

kind juniper
#

I think the issue is with the macro. Try using the way they do it in the docs page.

quaint grotto
#

oh you mean from the texture itself ?

kind juniper
#

Yes.

#

Maybe not. But it's worth a try.

quaint grotto
#

this is what i was referencing from when i wrote mine

#

but i wrote mine like this:

    float r = SAMPLE_TEXTURE2D(Texture, Sampler, UV - offset).r;
    float g = SAMPLE_TEXTURE2D(Texture, Sampler, UV).g;
    float b = SAMPLE_TEXTURE2D(Texture, Sampler, UV + offset).b;
kind juniper
#

Yeah, I've seen that too. But I just don't trust macros.

quaint grotto
#

ill try the other way to test it then

kind juniper
#

It could be that you pass in an expression to the macro or something. Since they're evaluated at compile time, who knows what it's expanded into...

quaint grotto
#

hmm now i got a new error entirely Shader error in 'Master': undeclared identifier 'OffsetUV_half' at line 198 (on d3d11) i've not even got anything with that name

#

seems to be happening every where

#

wonder if unity is just failing to compile properly or something

kind juniper
#

Hmmm... Does it appear in a compiled shader code?

quaint grotto
#

it seems to keep taking me to a random line with nothing there

#

dunno why these errors are so poor at telling what line it is

#

that texture error also seems to remain aswell

#

(โ•ฏยฐโ–กยฐ๏ผ‰โ•ฏ๏ธต โ”ปโ”โ”ป

kind juniper
#

Share the updated code.

quaint grotto
#
void RGBSplit_float(float Split, Texture2D Texture, SamplerState Sampler, float2 UV, out float3 Out)
{
    float2 offset = float2(Split, Split);
    
    float r = Texture.Sample(Sampler, UV - offset).r;
    float g = Texture.Sample(Sampler, UV).g;
    float b = Texture.Sample(Sampler, UV + offset).b;
    
    //float r = SAMPLE_TEXTURE2D(Texture, Sampler, UV - offset).r;
    //float g = SAMPLE_TEXTURE2D(Texture, Sampler, UV).g;
    //float b = SAMPLE_TEXTURE2D(Texture, Sampler, UV + offset).b;
    Out = float3(r, g, b);
}
#

i dont get why its saying converting UnityTexture2D to Texture2D<float4> though

#

the code seems fine it just seems to not understand the type

kind juniper
#

The other way around.

quaint grotto
#

wdym

kind juniper
#

It can't convert Texture2D to UnityTexture2D.

quaint grotto
#

no it says UnityTexture2D to Texture2D

kind juniper
#

Check the shader graph manual page on custom function node. Preferably version above 10.3.

#

See the last section "working with texture wires"

#

I think that's relevant.

kind juniper
quaint grotto
kind juniper
quaint grotto
#

yeah reading it now

kind juniper
#

I think the error was making sense all along. Although, not being very descriptive...

quaint grotto
#

right so i have to use type UnityTexture2D not Texture2D in my hlsl code

kind juniper
#

Yes

#

Does it work?

quaint grotto
#

no lol apparently that type does not exist

#

guess i got to find what file to include in my script to get it work

#

pain

kind juniper
#

Yeah, I guess you might need an include.๐Ÿค”

#

Are you on urp or birp btw?

quaint grotto
#

urp

kind juniper
#

Okay

quaint grotto
#

whats birp

kind juniper
#

Built-in rp

quaint grotto
#

ohh

#

im on version 13 and still get these problems lol

#

do you know the location of unity's hlsl files to use #include ?

kind juniper
#

Actually, I don't think there's a need in include. Since it's part of the shader graph, unity should include all it needs.๐Ÿค”

cloud fossil
#

but is there any way to fix it?, I worked really hard on that model

shadow locust
cloud fossil
shadow locust
#

Blender materials do not generally transfer to Unity

cloud fossil
#

I didn't know that ๐Ÿ˜… ... , watching a tutorial rn of how to export

#

everyone tells me to 'unpack all into files' but I don't have that option??

neat hamlet
quaint grotto
neat hamlet
#

nope

quaint grotto
#

a quick test seems to not find them

#

or is that because my hlsl file is standalone but shadergraph will combine it ?

neat hamlet
#

did you actually save the file ๐Ÿ˜›

quaint grotto
#

yeah its my visual studio saying it

neat hamlet
#

ok, I dont use the suggestions for shaders, its no use

quaint grotto
#

ah lol

neat hamlet
#

it works out of the box in this version

#
void Test_float(in UnityTexture2D _Texture, float2 UV, in UnitySamplerState sampler_Texture, out float testing)
{

     float r = _Texture.Sample( sampler_Texture, UV).r;
    testing = r;

}

The quick test I did

quaint grotto
#

is in important there?

neat hamlet
#

ehh not sure

#

the sampler naming might be

quaint grotto
#

oh the name needs to be sampler_TextureName ?

quaint grotto
#

i swear it doesn't regenerate or something

#

i dunno why its talking about Result_0

#

i have no variable with that name

neat hamlet
#

theres two _ _ there in __Texture I dont know if that makes a difference

#

also you didnt at a UV

#

Vector2

quaint grotto
#

oh i seem to have to close shader graph and reopen for the error to go away

#

thats annoying

neat hamlet
quaint grotto
#

for some reason if i edit the code and hit save it wont update in shader graph until i reopen the entire shader graph

#

at least it works so thanks for explaining the issue with textures @neat hamlet !

neat hamlet
#

shader graph can still be buggy
glad its working now

quaint grotto
#

the docs do not do a good job at explaining so many things as a beginner ๐Ÿ˜„

#

constantly having to dig forums

neat hamlet
#

even for a non beginner its not easy :V

quaint grotto
#

yay finally got nice caustics working

#

oh wow gif totally compressed it to death

craggy chasm
#

Hi guys I have been trying yo implement metaballs, and use the code from this repo https://github.com/luke161/Unity-Metaballs-2D

This generated the metaballs on 2d objects but i wanted to generate metaballs on the UI and have no clue where to start from. Any help is appreciated.

GitHub

Implementation of 2D Metaballs with marching squares in Unity. - GitHub - luke161/Unity-Metaballs-2D: Implementation of 2D Metaballs with marching squares in Unity.

swift loom
winged sable
#

I created this Shader to draw a perfect circle for one GameObject, but in 2D it does not respect Sorting Layers. I figure it, because i'm using a LineRenderer and the line overlap the material using this shader, but it doesn't when i use a material that uses Sprite-Lit-Default.

If i use Sprite-Lit-Default, it respect Sorting Layer. Is there something i can do in the Shader Graph that makes sure it works respecting the order of my layers?

I read i post in "stackoverflow" (but it is an answer from 2015) that in the shader code it needs to add ZTest Off so it wouldn't mess with the layer order.
Is that true? Or is there something i can do in shader graph ?

stable flare
#

Hi I've been using a halftone shader i made and it works flawlessly.. Until there is a flat surface. It works great on bent surfaces as you can see on the horns, the back and the leg parts, but holyy is it so bad on flat surfaces like the gun or the two legs you can see in the other screenshot.

jade hinge
#

@stable flare i think this is sort of an inherent quality of flat or near flat shading unfortunately

#

I have seen some art styles use painted edges and specs as pseudo-texture, but otherwise i think you could try and use bumps/ridges in your geometry to help ensure that your half-tone shader has places to transition on

#

ridges placed like that should at least impart some shading that helps with direction and depth

#

i really like the style but ultimately it does seem tough to work with ๐Ÿ˜„

fervent flare
#

Anyone know if its possible to add an offset to a textures UV's every X seconds?

#

Been trying to crack this since yesterday without using a c# script to control values

#

cannot figure it out though, it seems like shaders cannot store any data

shadow locust
#

also the shader needs to support the params

fervent flare
#

adding amount X to an offset every Y seconds

shadow locust
#

of course it's possible

#

as long as your shader supports UV offset as a shader param

fervent flare
#

is it easy? would you be able to point me in the right direction?

shadow locust
#

I mean... what shader are you using?

#

Most of the default unity shaders support a UV offset already

elder pivot
#

https://www.reddit.com/r/unity/comments/z81jzs/material_for_image_ui_causing_random_black_bars/
basically my material on my UI Image is causing a blackbar
removing the material fixes the issue...but then my eyes look wacky so was hoping someone knows a workaround
got this advice from someone
"Looks like a shader issue to me, the EyesPaint material has the wrong one, or something wrong with it. Probably ask in the shaders channel"

#

nvm

#

"Oh, UI doesn't support Tight packing, and all our sprites has it enabled."

fervent flare
#

I just don't know what node sorcery produces this result

shadow locust
#

add your parameter to the UVs

#

and feed that result into the UV for sampling the texture

#

that's all

fervent flare
#

that doesn't add the value every y seconds though

shadow locust
#

no that's for your C# script to do

#

that's why it's a parameter

fervent flare
#

I am trying to do this only in the shader, without using a c# script (that's the thing)

shadow locust
#

you do Material.SetFloat or SetVector and feed data into the shader

shadow locust
#

it's quite standard to drive this stuff from the C# side

fervent flare
#

I imagine so, but is it possible without it ?

shadow locust
#

sure, there's the Time node

#

You'll just have no control to pause or manipulate it at runtime.

vestal pelican
#

So I'm currently into premature optimization, but before committing to a technique I want to ask for you guesstimation: I've been considering writing a terrain renderer that works soley by tessellating single quads and displacing with a height map. Tessellation factor being controlled by cam distance. Now there are voices that tessellation is expensive and only pays off in some cases (and especially only when having a dynamic height map). 15 years ago, bandwidth was a concern, but is it now better to just have a "high poly" grid and eat the bandwidth and potentially increased vertex count (in case I don't manipulate the mesh based on the camera position on the cpu, which again, would cause updating buffers). [i.e. keeping the terrain rendering as is?]

fervent flare
#

I don't really need any control over it, so that should be fine

#

I know how to add value X to the offset every frame relative to time but I don't know how to amount Y every S seconds (using the time node and without using c#)

shadow locust
#

Put it into the graph

#

it has a bunch of options

#

it just produces a number based on the time elapsed

#

(or other things depending on what setting(s) you use)

fervent flare
#

just say you don't

#

it's fine

#

it's okay not to know how to do something

shadow locust
#

I don't play the negging game

fervent flare
#

I am trying to add an offset of amount X every 1 second only

#

not every frame

#

that is what I have difficulty with

#

I know the time node exists

#

And I know that I could do this with C#

knotty juniper
#

is the timer on a per object level or for the whole world?

knotty juniper
#

(in the example the offset defined in the multiply and it gets added every 5 seconds

craggy chasm
quaint grotto
#

if you have two colours A,B and you use min() on them...what makes a colour more min than the other? are darker colours considered more minimum ?

#

so like a light blue vs a dark blue would min pick the dark blue

#

i want my shader to pick the darker colour of the two so i assumed min() would do that - if not what is a better way

shadow locust
#

so if you have (1, 7, 2) and (4, 4, 4) the result will be (1, 4, 2)

quaint grotto
#

oh

#

ok i dont want that then

#

is there a way to pick a darker colour from two choices

#

maybe the magnitude ?

shadow locust
quaint grotto
#

oh wait magnitude wont work either

shadow locust
fervent dock
#

Does anyone know of a shader already created that can take an audio file added as a component to a 3D object and control transparency?

#

In URP ideal, but not necessarily critical

gritty steeple
#

Hi guys.. is there a shader which will only let the material appear under certain colors of light? Eg. words on wall with a blacklight

#

for urp*

carmine jolt
#

Have you had any luck using light layers in your own shaders? We're quite stuck.

kind juniper
gritty steeple
kind juniper
#

Which just means that you need to write your own.

gritty steeple
#

I tried messing with Shader Graph, but I have no clue how it works lol.

kind juniper
kind juniper
quaint grotto
#

if i use the same subgraph twice in my shader graph is that calling the subgraph functions twice ?

#

for example i have a depth to world subgraph. i need the result used in a few places - can i just copy paste the subgraph and that will still only be one call or will it be calling it for every copy of it i use ?

#

because its becoming spaghetti lines every where and its annoying as hell

kind juniper
#

Nah, I think that would call it twice. Visual scripting with complicated logic is gonna turn into spaghetti inevitably.๐Ÿคทโ€โ™‚๏ธ

quaint grotto
#

damn

#

i would write the code but its a lit shader and no docs on how to write a lit shader only unlit

kind juniper
#

Use the connectors or whatever they're called. They can help you move the wires to the side so that they don't overlap other nodes/wires.

quaint grotto
#

yeah i'll have to

fervent dock
kind juniper
quaint grotto
#

any one know a guide to writing lit shader code

#

unity only has docs for unlit shaders

#

which is annoying

shadow locust
quaint grotto
#

URP

#

ideally also HDRP but URP for now

#

i dont want to touch the actual lighting stuff - just want to write the visuals of the mesh before the lighting

#

i have no need for custom lighting etc

#

right now i use a lit shader graph but its becoming so complicated that i would rather write it in code

shadow locust
#

and go from there

quaint grotto
#

have you seen generated code ๐Ÿ˜

#

its a mess

shadow locust
#

yeah >_>

quaint grotto
#

dunno why it has to be so ugly looking

shadow locust
#

that's kinda how generated code works

quaint grotto
#

one thing im considering as an alternative is one giant custom node function

shadow locust
#

yeh all the examples in the docs are unlit ๐Ÿ˜†

quaint grotto
#

and just write a massive function

kind juniper
#

And the compiler doesn't care how ugly it is.๐Ÿคทโ€โ™‚๏ธ

quaint grotto
#

i know but they haven't provided an easy way to write custom lit shaders by code

kind juniper
quaint grotto
#

would that work in urp ?

#

thought it was a whole change at this point

kind juniper
#

If it's the urp standard shader, yeah.๐Ÿ˜ฌ

quaint grotto
#

what about in hdrp ?

kind juniper
#

You'd need an HDRP shader.

quaint grotto
#

any one know how to convert depth node in eye space to be linear

#

it apparently isn't linear which is annoying

gray harness
#

can you mark vertex as not to render in vertex shader, so it doesnt render any triangle with it

#

?

quaint grotto
#

that would also skip two other vertices with that associated triangle so the only way would be to swap the winding order in the vertex array

#

could do that in a buffer of vertex data then pass that to the shader from compute shader for example

#

basically you would be flipping the normal of the triangle

#

but thats really only skipping for the fragment shader not the vertex

swift oak
#

Heyo fellow people.
So ive got a weird question for shadergraph.
I currently calculate the distance between two vectors, but i would rather like to keep track of what the current smallest distance is .

e.g if distance = 3 (store 3)
later distance = 1 (store 1)
later distance = 2 (store 1)
later distance = 100 (store 1)
Later distance = 0 (store 0)

#

The purpose of this is im making a beard cut shader but i need the hair to stay cut

#

The way i would do it in a script for unity is :

public min = 100;
public float distance;

private void Update(){

  distance = Vector3.Distance(ThingA,ThingB);

  if (distance < min){
      min = distance;
    }

}

This code would store the smallest value that this distance has ever been, but i have no idea how to translate this into shadergraph ๐Ÿ˜–

#

If anyone has been following this , I think a soln could be to store a number that i can compare to.
The problem is i cannot find a way to store a parameter to refer to again. The easiest if there were a setFloat() node equivalent inside shader graph.

regal stag
swift oak
#

Considering there are logic gates im thinking of trying to create a flip flop of some sort and see if that works

kind juniper
#

And reuse it wherever.

regal stag
#

Or do calculation in C# and store in mesh data, via vertex colors or an unused uv channel

cobalt totem
#
float4 frag (v2f i) : SV_Target
            {
             ...
             float viewLength = length(i.viewVector);
             float3 rayDir = i.viewVector / viewLength;
             ...
             }
#

I have implemented as:

#
float viewLength = length(viewVec);
float3 rayDirection = viewVec / viewLength;
#

And this:

                float nonlin_depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.uv);
                float depth = LinearEyeDepth(nonlin_depth) * viewLength;

Has been converted to:

depth *= viewLength;

Where depth is from the scene depth node shown above

#

But it seems no matter what I do, I just get a transparent cube

#

So the following happens next:

#

I get the distance to the box and distance inside the box, and advance the ray origin to the point that it intersects the box

#

I then need to set the step size, to do this I calculate (1 / numSteps) * dstInsideBox

#

and advance the ray using: rayOrigin += rayDirection

#

To convert from world coordinates to sample coordinates I do the following:
float3 samplingPos = ((rayOrigin - objPos) / objScale) + float3(0.5, 0.5, 0.5);

#

Where objPos and objScale are the world positions and scales of the cube being raymarched

#

A few things I'm unsure of:

  1. Is the world view vector in shader graph the equivalent of i.viewVector?
  2. Is the scene depth node the equivalent of calling SAMPLE_DEPTH_TEXTURE() followed by LinearEyeDepth()?
night isle
#

how do i get somehting like the Is Front Face in shader code

regal stag
regal stag
gritty steeple
#

Hey, I'm a complete shader noob here so I apologize. I'm trying to make a Shader with Amplify that changes it's opacity or translucency based on a certain color light hitting it, think Blacklight or a Reveal Shader. How would I go about doing that? I apologize, but would appreciate some better understanding.

hot lagoon
#

Why is unity throwing this error in this line?

Shader error in '': Parse error: syntax error, unexpected TVAL_ID, expecting TOK_SETTEXTURE or '}'

loud wolf
#

Hi. I've got a problem. I just added post-processing to my VR project but it change my shader in a weird way : it duplicate the result of my shader (I just need the bottom in the second screen). How can I achieve that please ?

low lichen
# loud wolf Hi. I've got a problem. I just added post-processing to my VR project but it cha...

When using bloom, you want to enable HDR rendering if you haven't already. That allows pixels to be brighter than 100%. Your bloom threshold is set to 90% now, so any pixel brighter than 90% will have bloom added to it. If you have HDR enabled and your threshold set to 100%, you can make sure your shader doesn't contribute to bloom if you clamp/saturate the color to 0-1 before outputting it.

#

Alternatively, you can clamp it to 0-0.9 if you don't want it to contribute to bloom with 0.9 threshold, but that will also make it darker.

low lichen
loud wolf
#

the post process is for an other shader (outline) but for this shader I don't need post process so how can I avoid that please ?

low lichen
loud wolf
#

How can I achieve that please ? I'm new to Unity shader ^^'

hot lagoon
low lichen
low lichen
tardy spire
#

I'm learning how to modify mesh data from a compute shader and am trying to get my shader to support 16 and 32 bit indices via a shader keyword.
I have a base Deformer.compute shader that provides helper functions for working with the raw mesh data which I include in other compute shaders. At the top of the shader I have a keyword

#pragma multi_compile INDEX_FORMAT_16 INDEX_FORMAT_32

and further down I have a function for reading an index from a byte address buffer which I want to use the keyword

#ifdef INDEX_FORMAT_16
const uint raw = index_buffer.Load(bit_index);
return asuint16(raw);
#else
return asuint(raw);
#endif

I thooought this was correct? but when I try to set the keyword from C# I get an error saying Local keyword INDEX_FORMAT_16 doesn't exist in the compute shader.

if (indexFormat == IndexFormat.UInt16)
    deformerShader.EnableKeyword(new LocalKeyword(deformerShader, "INDEX_FORMAT_16"));
else
    deformerShader.EnableKeyword(new LocalKeyword(deformerShader, "INDEX_FORMAT_32"));

I'm guessing I've made a silly mistake/misunderstanding

loud wolf
#

But I've got an other problem since while. I've got a line that cut the material how can I remove it please ^^ ?

low lichen
low lichen
low lichen
loud wolf
hot lagoon
#

i didn't

#

or well, i did

#

but i reseted my pc and had to decompile them back

low lichen
hot lagoon
#

oof

#

time to find a better one

low lichen
low lichen
loud wolf
low lichen
# loud wolf what is additive blending ? ^^'

It's one of the blend modes you can choose from when making a transparent shader. I don't use Shader Graph, so I don't know where the option is, but I imagine it's in the same place where you switched from Opaque to Transparent.

low lichen
loud wolf
#

I'm with alpha ^^

#

Oh my god i'ts working with additive thx ๐Ÿ˜ !

loud wolf
subtle cove
#

Can anybody tell me where I can find the "Enable" node: ?

cobalt totem
regal stag
patent plinth
#

@regal stag I saw your stylized water shader, would you mind sharing the tech used ? ๐Ÿ˜†

#

if I'm not mistaken Unity retweeted that too

regal stag
subtle cove
#

Ok

regal stag
patent plinth
subtle cove
# regal stag It's the window that contains properties & keywords. There's a button in the top...

https://youtu.be/SOK3Ias5Nk0?t=405 There in that exact second, you can see the shader graph for spherical world bending. I wanna do that. But why does the transform node looks like this (weird):

Recreate Animal Crossingโ€™s world bending shader in Unity.
In this shader graph tutorial, we will recreate the world bending shader (โ€œrolling logโ€ effect) from games like Animal Crossing and Subway Surfers.

๐ŸŽ FREE High-quality assets: http://bit.ly/2dhp-free-yt
๐ŸŒŽ Curved World shader asset: http://bit.ly/curved-world-shader-2021
๐Ÿ“ฆ Download projec...

โ–ถ Play video
loud wolf
# low lichen Sure

I want to make this type of outline in my project : Glowing (not necessary with light), round border and diffuse like the first picture. I want this shader be able to be adapted with every mesh that I want and if it's possible, I want that the material of the shader will be a secondary material of the object (like in the second picture). However, I was looking for a tutorial for this type of shader but I find one complicated tutorial and moreover, it was not adapted to URP : https://www.youtube.com/watch?v=SMLbbi8oaO8&t=52s . And the other videos that I've fond just present some paid assets from the asset store. I've been looking for this since a while (1 mounth and a half TwT). How can I achieve this effect please ? No matter if it's shadergraph or shadercode ^^

Support me on Patreon โžœ https://www.patreon.com/DanMoran
Follow me on the Twittersphere โžœ https://twitter.com/DanielJMoran
Get the Assets for this Video here โžœ https://goo.gl/LJQRFl

โ–ถ Play video
loud wolf
# low lichen Sure

If you want to talk in private message, it was not a problem for me ๐Ÿ™‚

regal stag
subtle cove
#

Like where should I insert it?

subtle cove
#

It works now I think:

wind canyon
#

Hey, I think I need to texture the inside of this laser beam but I'm not sure how. Doesn't appear when you're inside of it which isn't what I want.

#

I've seen people say you've gotta use a shader but I have no idea what to do lol

simple oak
#

Hey, i got a question.
why is the black fabric only shown from the outside?

#

everywhere else it looks like this

knotty juniper
# simple oak

the geometry is one sided
unity will cull the backside unless explicitly told otherwise by the shader used on the material for that mesh
the better option is to have one mesh face for the outside and one for the inside

#

enable back face culling in your 3D software to see how it will be in unity

low lichen
loud wolf
simple oak
#

disabled it

#

and still looks like this

low lichen
loud wolf
subtle thicket
#

Having trouble implementing a dissolve shader on an unlit material. The same shader works perfectly on a lit material, but on an unlit material it causes the transparent space around the sprite to become black when fully dissolved

#

Here's the relevant part. The 'split' is the main texture opacity.

#

whereas if I set the material to 'lit shader' it works fine and there's no black outside the sprite

#

(the glowing parts not being dissolved is a separate issue I haven't figured out yet)

regal stag
subtle thicket
#

Yup, that worked! Thank you.

#

Oh, the reason why the glowing part isn't getting erased is because that part of the sprite is fully white, so step doesn't get rid of it. Any solution other than using an image editor to change it form white to one pixel off-white?

grand jolt
#

How does Graphics.Blit and such keep the ordering of operations intact?

subtle cove
#

Now the objects and the player itself sort of float on top of the "cursed" plane.

#

Like 2 meters above them.

#

How can I fix that?

quaint grotto
#

this is getting on my damn nerves now, can any one tell the difference between my code in the sticky note and the subshader setup in this image???

i get completely different results using my code setup versus the subshader but they look identical to me

shadow locust
subtle thicket
subtle thicket
#

Anyway to use dotween on shader propterties, like colors or floats?

#

Figured it out. You have to do this:

quaint grotto
#

how do you create custom SG nodes but not as in a custom code function - like an asset for the asset store

#

is it just subshaders at this point ?

subtle cove
#

Why are objects on my world bending shader floating like 2 meters above the plane, just following this video?: https://youtu.be/SOK3Ias5Nk0?t=405

Recreate Animal Crossingโ€™s world bending shader in Unity.
In this shader graph tutorial, we will recreate the world bending shader (โ€œrolling logโ€ effect) from games like Animal Crossing and Subway Surfers.

๐ŸŽ FREE High-quality assets: http://bit.ly/2dhp-free-yt
๐ŸŒŽ Curved World shader asset: http://bit.ly/curved-world-shader-2021
๐Ÿ“ฆ Download projec...

โ–ถ Play video
supple leaf
#

Hey, im using the URP Decal Shader for my project. i created a new material from the shader but unity doesnt seem to like it even though its the original decal shader. does someone know how to fix that?

loud wolf
cobalt totem
#

How can I store the result for a fragment to be re-used between frames?
I've tried the following:

RWBuffer<float> buf1;
RWBuffer<float> buf2;

void Raymarch_float(...){
  if (t > 5) {
    Out = float4(buf1[0], buf2[0], 0, 0);
  }
  ...
  buf1[0] = someComputation1;
  buf2[0] = someComputation2;
}

But I'm obviously doing something wrong

#

(this is HLSL)

loud wolf
swift loom
#

is this the correct way to clamp a texture in a compute shader??

{
    Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
    AddressU = D3DTADDRESS_CLAMP;
    AddressV = D3DTADDRESS_CLAMP;
    AddressW = D3DTADDRESS_CLAMP;

};
#

or am i missing something

#

tried simply typing "Clamp" too but idk. I haven't found a page that really explains the values to use nicely.

#

in a nutshell this is all i'm doing but it keeps wrapping a pixel.

haughty moat
swift loom
#

ok ill try that thank you

#

but also does that mean i really only need one sampler?

#

if they all use the same settings

haughty moat
#

If you only need one type. I think so. There might more to it, but not that I'm aware

swift loom
#

is the point of sampler_MainTex to inherit the settings of the maintex really?

#

cause if so that makes sense

#

but anyway ill try it

haughty moat
#

yeah, texure settings in the editor control the sampler that Unity will create

#

The doc explains it ok, basically some api let you separate textures and samplers

swift loom
#

Yeah that seems to work. ๐Ÿ‘

#

still losing a pixel at the bottom of my my sprite that uses an atlas however... not sure where in my math there that would originate.

haughty moat
#

Question/thoughts. I have an ocean surface, an sometimes some faces get rendered through the water, which is expected, but ugly. How would I go about discarding pixels that are behind the closest face of that surface ?

swift loom
surreal locust
#

I have this code: materialNormal.SetFloat("_MagnetMask", magnetPercent); and it works, but the material is modified persistently

#

Should I create a new material runtime and work on it?

shadow locust
#

you can also use MaterialPropertyBlocks if you want to make non persistent per-renderer changes

surreal locust
#

which one is better?

shadow locust
#

they do different things

surreal locust
#

I'm reading doc of materialpropertyblock
Note that this is not compatible with SRP Batcher. Using this in the Universal Render Pipeline (URP), High Definition Render Pipeline (HDRP) or a custom render pipeline based on the Scriptable Render Pipeline (SRP) will likely result in a drop in performance.

#

I'm using urp

#

so it's better for performance to create a new material in awake and use it

#

I have only one renderer with this material so I can use both solutions

#

am I wrong?

shadow locust
#

if you only have one renderer using it it's probably not a huge deal either way.
BTW if you use myRenderer.material that automatically creates a new material

#

Actually only if there's other renderers using the same mat ๐Ÿค”

surreal locust
#
    private void Awake()
    {
[...]
        mRenderer.material = new Material(mRenderer.material);
    }
cobalt totem
#

In my shader I want to update only certain pixels each frame, and re-use pixels that aren't updated. I'm using shader graph and an hlsl script and was wondering what the best way of accomplishing this would be? Is there a way to render the entire screen as a texture and use the previous frame's output as an input texture to shader graph? Or would that be too slow?

shadow locust
#

If you want to use the entire screen output as a texture for a shader - that kinda sounds like PostProcessing

#

so maybe you're looking at making a custom post processing effect

cobalt totem
#

Hmm, actually I guess I donโ€™t need the entire screen, just the pixels of the object Iโ€™m rendering

cobalt totem
#

Iโ€™m trying to understand temporal reprojection but want to start with a really basic version first

#

Iโ€™m ray marching a volume and done some optimisations to get it down to 20ms but want to push it further by only raymarching partially and blending the results over multiple frames

#

(Or maybe I could do a high quality ray march for some pixels and a low quality one on others?) I would just need the pixel position (x,y) coords

deft narwhal
#

recently upgraded to HDRP and ive had a slew of issues but this one makes the least sense. its only got 1 texture on the pink parts, and it has a texture but the pink makes it look like theres a 2nd texture missing underneath. it only does this on a few of the windows despite all windows sharing the same texture and model. very confused

shadow locust
quaint grotto
#

would underwater caustics be in the emission channel or the albedo channel

#

kind've confusing

#

hard to know what goes where

deft narwhal
shadow locust
#

it's the materials

deft narwhal
#

oh just saw the tab on top. deleted extraneous material. thanks

grand jolt
#

where do I plug this

knotty juniper
# grand jolt where do I plug this

from what i can read online the paralax uv channel goes into the textures UV cordinates
and the depth offset can be enabled and connected on the master node

knotty juniper
#

the one labeld "Fragment"

knotty juniper
#

no to depth offset (you need to enable that first )

grand jolt
#

looking for it rn

knotty juniper
#

this in in HDRP

grand jolt
#

what

#

I'm on urp

grand jolt
knotty juniper
#

not sure what renderpipline supports that

#

does it not show for you?

#

from what i can find at least at
Jan 2021 it seems that URP does not support it

#

and still not supported in 2022.2

grand jolt
#

eh I guess I'll have to switch to hdrp

#

aaaand everything's pink

grand jolt
#

yeah it's too laggy

#

@knotty juniper what version of unity did you say supported pom on urp again?

knotty juniper
#

"and still not supported in 2022.2"
aka not a thing in URP

grand jolt
#

that's the latest?

knotty juniper
#

at least not with shadergraph

#

that is the current beta

grand jolt
#

well shit

#

normals are fine anyways

knotty juniper
#

for most cases yes

grand jolt
#

how about realism

#

idk I'm not really sure what to do in unity anymore but I've always wanted to get really realistic water so

#

I'm doing that

#

ยฏ_(ใƒ„)_/ยฏ

grand jolt
#

how did I scroll a texture again? @knotty juniper

knotty juniper
grand jolt
#

yes but instead of doing that it changes its color

knotty juniper
#

tiling and offset only works with UV cordinates
you have to use the value in the texture sample node in the end

#

keep the UV inpuit to the tiling node empty or intput the UV 0

grand jolt
#

it's not a single texture it's 2 which I want to scroll in opposite directions

#

so which ones do I plug?

knotty juniper
grand jolt
#

but the thing changed colors

#

I basically want them to be tiled automatically depending on the object's scale so I don't have to tweak it each time I change something

#

and at the same time move around

#

do I just tile the final moving result?

knotty juniper
#

you could plug your tiling valus in tile offset node

grand jolt
#

it just kind of flashes

knotty juniper
#

no no no

grand jolt
#

also why did the normals change color

#

I changed the texture type to normal map and now it's just a single color

knotty juniper
#

because you are doing it wrong

grand jolt
#

well how do I do it right

#

istg this worked before for the other water shader what is going on now

#

now they're gone altogether

knotty juniper
grand jolt
#

why do you have to multiply by 1

knotty juniper
#

you dont its just so you can adjust it that just some demo values

grand jolt
#

oh is it for speeding up

#

or slowing down

knotty juniper
#

correct

#

if you want to have control what axis it should scroll input a vector 2 into the multiply

#

then you can controll the speed and direction for each axis independently

grand jolt
#

the scale will make them be proportional to the size of the object right?

#

Ophรฉlia are you writing an actual paragraph or something

#

I'd like to be able to represent a texture by values given from the user, could be either floats or integers...
not too sure how that would be done! I put something together real quick that does just that, check it here => https://github.com/OpheliaVRC/ShaderStuff/blob/main/TestShader4x4.shader;

I'd like to know how actually that would be done, a better approach, just anything different... like maybe provide a texture and then change each pixel of it to the new given values?

how would you go about it?

grand jolt
#

converting an image to numbers?

#

that's more than doable

#

almost, numbers to image yes

knotty juniper
#

sure you can do set pixel via code

grand jolt
#

code! you mean C#?

knotty juniper
#

correct

grand jolt
#

the thing is... I'm not allowed to use that...

#

it should all be part of the shader itself

knotty juniper
#

then how are you setting the values to the shader/Material?

#

or better
what result do you want to have?

grand jolt
#

numbers

#

lots of numbers

#

yeah this looks bad

#

any advice to make it look good

grand jolt
#

oh

#

like

knotty juniper
#

you could color / modify a existing texture before displaying it in the shader with the values that the user gives you
but this will not make a new texture asset

grand jolt
#

you for some reason manually type in the values of an image

#

and use that

#

instead of painting it normally like any sane and normal person would

#

"Innovative"

#

how do I untile this

#

so it looks natural instead of this tiled abomination

#

istg like 80% of the reason stuff I make in unity looks bad is because, and solely because of tiling

grand jolt
knotty juniper
grand jolt
#

there's also that it looks too flat and too shiny in some way

#

pom would've helped...

knotty juniper
#

pom is the the solution for water vertex offset and normal should do it

grand jolt
#

ok

#

I'll try putting it into position

#

I can't plug it into position

#

why?

#

how do I plug it into position

grand jolt
#

so I'll just adapt everything to this

knotty juniper
#

so no texture resolution change

grand jolt
#

nvm I can't

#

@knotty juniper how do I even set it up

knotty juniper
#

or dont use it

grand jolt
#

yeah it doesn't work for this

knotty juniper
#

check the example shader

grand jolt
#

as I said it doesn't work for my node setup

#

unless you can save the resulting normal into an animated texture

#

that just loops

grand jolt
#

any alternatives?

grand jolt
# knotty juniper you cant change the texture at all you only can read the texture and combine the...

ok got this, so since I can't change the resolution of an existing texture in a shader, I think the way I'm doing it currently is the way to go?
that's if you already checked it... I'm not too sure what's exactly happening, but the final result is exactly what I've been looking for, however,
due to my shaders lack of knowledge, I wasn't too sure if what I'm doing is even right to begin with, but it works!

with that said, should I stick with what I have, or could it be done in other better ways? limited to shaders

knotty juniper
#

you can do that too

grand jolt
#

ok