#archived-shaders

1 messages · Page 231 of 1

glacial pond
#

How do I add normals onto an .obj?

worldly drift
#

Alternatively you could try setting Normals to Calculate in the models import settings. But I doupt this will create good looking normals

glacial pond
worldly drift
regal stag
#

Will want to make sure the model is uv-mapped too if you're applying textures

glacial pond
#

The materials are in the obj, the textures just aren't applying to the model rn, like

#

I actually think I might have it

worldly drift
#

Can anybody help me unclutter this matrix mess?
This is what I had to do to make my shader work with multi pass, single pass instanced and for normal cameras:

#ifdef UNITY_STEREO_INSTANCING_ENABLED
#if UNITY_UV_STARTS_AT_TOP
output.positionCS.y *= -1;
#endif
const float4x4 projection = unity_CameraProjection;
const float4x4 inverseProjection = unity_CameraInvProjection;
#else
const float4x4 projection = unity_CameraProjection;
const float4x4 inverseProjection = UNITY_MATRIX_I_P;
#endif
#

I build the shader so it worked with stereo instancing and than found out that the matrices dont work out in the other cases

distant sleet
#

This raytracer is so unoptimized my gpu is crying

#

lol

dense thunder
#

How do I access the shader graph blend node opacity parameter through c#?

sullen jungle
#

Hey, I'm still very new to shader development
I am working on a project that has already pre-existing shaders scripts(FlatKit)
I want to create curved world effect which I have already do in Shader Graph but the issue now is that all objects in the scene is using FlatKit but still I want to add my curved world effect to this FlatKit

How can I do this?

One best way I want to try to achieve is by converting the curved world effect to a shader script(Using the compile button in inspector)
Issue is:

  • I don't know to write code with shader(Just through shader graph)
  • I don't know how to import the curved world shader to one of the FlatKit shader

Can someone advise me on what I can google/research on how to implement this and if there's any advice to share with me?

meager pelican
# sullen jungle Hey, I'm still very new to shader development I am working on a project that ha...

It looks like FlatKit integrates with the Curved World asset. See the FlatKit "Releases" info section on the asset store.

Short of that you'd have to learn shader programming and convert the various shaders, I'd guess.

(For those interested in what FlatKit is) https://assetstore.unity.com/packages/vfx/shaders/flat-kit-toon-shading-and-water-143368#releases
https://assetstore.unity.com/packages/vfx/shaders/curved-world-2020-173251

Add depth to your next project with Curved World (2020) from Davit Naskidashvili. Find this & more VFX Shaders on the Unity Asset Store.

Add depth to your next project with Flat Kit: Toon Shading and Water from Dustyroom. Find this & more VFX Shaders on the Unity Asset Store.

spring sparrow
#

Questing.. has anyone developed a decent parallax shade that uses a 2d photo and its depth map to simulate semi 3d, similar to how Facebook 3D photos works in unity?

dry oasis
#
            float4 Dither(float amount, float4 screenPosition) // Controls dither.
            {
                float2 uv = screenPosition.xy * _ScreenParams.xy;
                float DITHER_THRESHOLDS[16] =
                {
                    1.0 / 17.0,  9.0 / 17.0,  3.0 / 17.0, 11.0 / 17.0,
                    13.0 / 17.0,  5.0 / 17.0, 15.0 / 17.0,  7.0 / 17.0,
                    4.0 / 17.0, 12.0 / 17.0,  2.0 / 17.0, 10.0 / 17.0,
                    16.0 / 17.0,  8.0 / 17.0, 14.0 / 17.0,  6.0 / 17.0
                };

                uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
                return amount - DITHER_THRESHOLDS[index];
            }
``` I basically copied this code for a dither from the unity node code. But it wont return a dither?. thanks
lusty phoenix
#

Still compiling shader variants after 32 hours. Anyone had similar problems with long build times?

neat hamlet
#
        {
            float2 coords = ScreenPosition.xy / ScreenPosition.w;
            float2 uv = coords * _ScreenParams.xy;
            float DITHER_THRESHOLDS[16] =
            {
                1.0 / 17.0,  9.0 / 17.0,  3.0 / 17.0, 11.0 / 17.0,
                13.0 / 17.0,  5.0 / 17.0, 15.0 / 17.0,  7.0 / 17.0,
                4.0 / 17.0, 12.0 / 17.0,  2.0 / 17.0, 10.0 / 17.0,
                16.0 / 17.0,  8.0 / 17.0, 14.0 / 17.0,  6.0 / 17.0
            };
            uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
            return In - DITHER_THRESHOLDS[index];
        }
  ``` I did the same thing recently, this one works for me @dry oasis
#

the screenposition is handled differently in shader graph

sacred trellis
#

did something happen to the "3d with extras" pipeline? it doesn't look like i have it for some reason

dim yoke
#

not pipeline, it's template. is uses build-in render pipeline same way as regular 3d project

distant sleet
#

Hi, just wondering if anyone uses visual studio as their IDE for shaders

#

I'm having a problem with UnityCG.cginc

#

The code runs fine when tested as the file is located and included, but in my IDE its unable to get any of the methods from this file so it always shows errors

#

Anyone know if theres a fix apart from including the entire UnityCG.cginc path?

lavish oasis
#

which side looks better? ||left is the default urp shader, right is custom||

#

it should look like "Sapele Pommele wood"

distant sleet
signal niche
#

Hi, which shader graph should I use to create a shader that will prevent the image from going out of the scrollbar masking?
how come the UI/Unlit/Transparent default shader can work? What am I missing?

distant sleet
#

so annoying

#

the kernel is invalid and I dont even know why because it doesnt see the in built shader functions

distant sleet
#

Hmm I'm having some trouble with UNITY_SAMPLE_TEX2DARRAY so if anyone can help thatd be great

#

I think it may be diffuseTextures being a Texture2DArray but I'm unsure what type it should be

regal stag
distant sleet
#

I did that

#

but I'm passing in the declared tex2d array

#

But I see, so I need that sampler state

#

Tysm

#

let me try it

#

The errors gone now which is awesome but I have this instead

#

Kind of a pain when my IDE doesnt know what the functiosn are lol

distant sleet
regal stag
#

Ah, you need to use the LOD version probably. Don't think you can use the regular samples in a compute shader

distant sleet
# distant sleet

obj.diffuse is a float3, and diffuseTextures is a Texture2DArray passed in my main .compute file declared as _DiffuseTextures

distant sleet
#

Man theres barely any examples or documentation on this

#

Oh so it was because the name of my texture was different in the function params and main compute

#

so it did generate sample_DiffuseTextures

#

but not samplediffuseTextures

regal stag
#

Yea

distant sleet
#

Hm its really annoying having them in different files so I may pass in the samples diffuse/specular/refl as an argument instead

regal stag
# signal niche Hi, which shader graph should I use to create a shader that will prevent the ima...

It uses Stencils. Shader Graph does not support them yet (and so doesn't have proper support for making UI shaders either). You could generate code from the graph and add them though (but then it's a code shader now and if you want to edit the graph you'd need to re-generate and do this again)

e.g. https://github.com/TwoTailsGames/Unity-Built-in-Shaders/blob/master/DefaultResourcesExtra/UI/UI-Default.shader
In Properties,

_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255

then

Stencil {
    Ref [_Stencil]
    Comp [_StencilComp]
    Pass [_StencilOp]
    ReadMask [_StencilReadMask]
    WriteMask [_StencilWriteMask]
}
distant sleet
#

Its like a hydra

#

fix 1 error and in return 3 more

#

Yeah the problem is

#

if I have them named the same this error wouldnt happen but then

#

I'd have to declare sampler_DiffuseTexture twice

#

because if I declare it in my .compute, it says its being redefined

#

if I dont define it in my cginc, it says unkown identifer

regal stag
#

Are you declaring it in the .compute before the #include? That should stop it being an unknown identifier

distant sleet
#

Thanks

#

Wait but

#

Wait lemme test it

#

Hell yeah tysm

#

@regal stag but I'm kinda confused, I'm including the cginc in the compute and not vice versa

#

So how come defining the sampler in the compute via DECLARE_TEX2DARRAY also defines it for the cginc?

#

Or does that function define it in a broad scope that encompasses all the files involved in compiling

regal stag
#

As long as the DECLARE_TEX2DARRAY is defined before that include, it'll work.
Don't think of the cginc as a completely separate file. It's like, you copy the entire contents and paste it in place of the #include line, then it compiles.

distant sleet
#

Ah I see, yeah then it makes sense

#

thats awesome

#

Man but Ive had this other problem with the damn thing Ive been tryna figure out forever and its so weird.. for some reason

#

diffuse uses specular textures, specular uses refl and refl uses nothing

#

I've triple checked when I'm passing it into the shader its really weird

#

I guess maybe I made a mistake somewhere

distant sleet
#

Yeah i'm 100% sure im passing it into the shader correctly

distant sleet
#

In the CopyTexture step when Im copying from all the meshes to a list it ended up mixing them up and I think its because of the function taking a second to execute

distant sleet
dry oasis
#

I have this dither outline shader. The outline isn't being drawn (only when its the first pass). I cant fin any fix to this, I'm pretty new to shaders. So I honestly have not really a clue why the stencil buffer wont render the outline.

sullen jungle
#

Hey
Is there a tool to convert shader graph to shader script(Is it called a shader script?)
Or does the compile button do the job?

royal jetty
#

Hey, do you know if this is possible in a compute Shader to take a 3d model as parameter and duplicate it ?
For example if i want to use a compute shader to generate grass, is it possible to take a mesh as input for grass blade and not generate the mesh from code inside the compute shader ?

late needle
#

Hi, I'm working on a Hololens project that requires we NOT use the HDRP or URP. So, for a task I've got in front of me I figured out a littel shaderlab and wrote a very simple shader to move UVs around and displace verts. However, I did not write it with Single Pass Instanced rendering in mind, and I can only see the models with that material in one eye when I deploy the app to my device. I'm trying to google this, but I keep finding info on URP and HDRP instead of the default base rendering system. If anybody has a link or something or can dumb down what I've got to do to a fifth grade level that I can understand (:)) I would greatly appreciate it

regal stag
distant sleet
#

it isnt 100% related to shaders

#

the issue is all on the CPU side

late needle
#

yall are awesome ty so much

distant sleet
#
Graphics.CopyTexture(ResizeReformatTexture(rtMesh.diffuseTex, TextureFormat.RGBAFloat), 0, 0, _DiffuseTextures, index, 0);
Graphics.CopyTexture(ResizeReformatTexture(rtMesh.specularTex, TextureFormat.RGBAFloat), 0, 0, _SpecularTextures, index, 0);
Graphics.CopyTexture(ResizeReformatTexture(rtMesh.reflectivityTex, TextureFormat.RGBAFloat), 0, 0, _ReflectivityTextures, index, 0);
late needle
#

it's unlit

distant sleet
#

ResizeReformatTexture alters the texture via copying it to a RenderTexture, altering it and then copying back

late needle
#

literally nothing else but moving uvs and verts

#

and displaying color texture

distant sleet
#

but then when i add all of these to the Texture2DArray its all the same picture in each index

distant sleet
regal stag
violet olive
#

Ello.. So I downloaded a free asset, but its all pink.. Looks like it's something to do with the shaders ... is there a shader pretty universal? The model was on standard.. I got a couple working, but some of them remove the albedo.

regal stag
distant sleet
#

It still copies the same image to all 3 Texture2DArrays even though they are 100% different

royal jetty
#

Btw i found your blog once by doing research on coding shader on urp, greate ressources !

regal stag
# violet olive Ello.. So I downloaded a free asset, but its all pink.. Looks like it's somethin...

If the model is using the Standard shader and you're in URP you will want to swap it to the URP/Lit shader which is the equivalent. I assume that's what you already are doing. The MainTex property was renamed to BaseTex so you will need to reassign that texture manually.

Could probably also use the "upgrade materials" option to do it automatically. See https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@11.0/manual/upgrading-your-shaders.html
Or for 2021.2+, https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@12.0/manual/features/rp-converter.html

violet olive
#

Ah thanks I just found the URP shader setting. I guess Standard is just for a normal 3d project?

regal stag
violet olive
#

I'm sure I'll get to that stuff on the unity learn path eventually.

regal stag
violet olive
#

I've got a bad habit getting carried away with stuff.

late needle
#

You are basically shader jesus cyan

#

i hope you get paid for this

regal stag
#

I don't get paid, just like helping out

late needle
#

the hero we don't deserve

distant sleet
#

Attempting to copy 3 textures to 3 Texture2DArrays, all duplicates

#

Thanks to Cyan being a god like usual I can finally do some texture mapping for my raytracer

#

Can't wait to implement PBR materials cause they are so simple but look so good

sullen jungle
#

Hey guys.

Situation:

  • Want to implement curved world effect to multiple materials in my scene
  • The materials in my scene are already using FlatKit shaders which are shader scripts and not shader graphs
  • The curved world effect is in shader graph but I figured out how to convert it to shader script

Problem:

  • I want to add the curved world effect to all the FlatKit shader scripts like a subgraph so how can I do that?
    like making the curved world effect shader script into a sub shader script

Please tag me on response

grand jolt
#

I've gotten a lot of shader jobs lately and I'm kinda wondering: do other shader artists always start from scratch without peeking at Shadertoy for ideas? 🤔

sullen jungle
grand jolt
#

I see. So it's not cheating 😎

sullen jungle
#

My brain is frying trying to find how to do that

grand jolt
#

Extract your shader passes into separate headers then just include them in each shader.

sullen jungle
grand jolt
#

That just means creating a new header like MyPass.hlsl. And you cut and paste all the code between HLSLPROGRAM and ENDHLSLPROGRAM into it.

sullen jungle
grand jolt
#

You could put your curving into a function that takes a position vector, normal and so on packed into a struct and returns that struct with processed values. And put that function into a header.

#

Then any shader that needs it can #include "thingy.hlsl" and call the function.

sullen jungle
grand jolt
#

Yeah. Shader includes are just snippets of code. When you include them the compiler just copies the text from them and pastes into your shader.

sullen jungle
#

Damn things got complicated

shadow osprey
#

I am getrings this phenomena on my water surface created with Gaia. I imported my scene into the „Hurricane VR Physics“ Sample Scene and reassigned all variables. After building the project on my quest2 all looks great besides this and I am getting double vision on my headset when enabling Post Processing on my camera object… Any idea what I can try to fix this?

umbral mountain
#

question : for those who use hlsl where did you guys learn it?

distant sleet
#

normal mapping is op

distant sleet
#

I spent 1 hour trying to figure out why my mapped normals looked like this

#

Until I just realized the solution was literally just transposing a single matrix

#

just transpose(TBN) was the solution for a 1 hour problem 🤦‍♂️

spring sparrow
#

Question.. .. has anyone developed a decent parallax shade that uses a 2d photo and its depth map to simulate semi 3d, similar to how Facebook 3D photos works in unity?

spring sparrow
pliant pond
lean lotus
#

hey is there any way whatsoever of outputting variable values from a compute shader, much like C++ cuda can use printf to output values to console?
trying to debug an advanced thing and the compute shader being a blackbox is irritating

balmy thicket
#

I'm following an official unity tutorial on distortion, however no matter what when I use screen position I get no background distortion. I've made sure that all my parameters are identical, does anyone have any experience with this? https://www.youtube.com/watch?v=atPTr29vXUk&t=338s

In this video, we are creating a Distortion Shader using Shader Graph in Unity 2019!

Download the project here: https://ole.unity.com/DistortionShaderProject

Shader Graph in Unity 2019 lets you easily create shaders by building them visually and see the results in real time. You create and connect nodes in a network graph instead of having to...

▶ Play video
#

My shader looks like this in-game

regal stag
fleet rampart
#

anyone having experience with adding materials via texcord

#

i have really big maps and assinging 1000 materials per zone is a bit too much

balmy thicket
grizzled bolt
#

@balmy thicket is "opaque texture" enabled in your quality settings?

dry oasis
daring summit
#

Hello. I want to use Unity's 2D Lights in a way that when an enemy sprite is iluminated it fades out of view (possibly changing the alpha) It seems a way of doing would be getting the light data from the light object and passing it on to a shader. According to this link https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@13.1/manual/ShaderGraph.html it is possible to create your own sprite lit shader but I have no idea what kind of node could give the light output. Or maybe I am way of base. What do you think?

fair spear
#

Hi, sorry for bothering. I'm trying to make some objects fade when it's too close to the camera (like how in Genshin, there's a dither effect when your character is too close to the camera). I followed this tutorial: https://www.youtube.com/watch?v=rVeS7oh3oug and copied the Shader Graph that Pablo made. The thing is, after tweaking some values, it works on objects close to the spawn point, but after a certain distance, the faded objects somehow show up again even though it's close to the camera (I'll show how it looks like). I've tried tweaking the graph, I've tried changing the MinDistance and MaxDistance values again but nothing seems to be working. I presume it's cause I'm using Cinemachine to operate the camera. Does anyone know what I'm doing wrong here?

A follow up to the previous tutorial, I show you how to use dithering in Shader Graph to fade out meshes when they are close to the camera.

Previous Tutorial
https://youtu.be/iTlSwQ4b-uM

(づ ̄ ³ ̄)づ ~(˘▾˘~)

TWITCH ( ͡° ͜ʖ ͡°)
https://www.twitch.tv/PabloMakes

TWITTER (ಥ﹏ಥ)
https://twitter.com/PabloMakes

₪ ₪ Time Stamps ₪ ₪
00:00 - Int...

▶ Play video
#

Top: How it should look like (and how it looks like on objects close to the spawn point)
Bottom: How it looks like on objects far from the spawn point (there's a sprite hidden behind the wall)

#

And here's the shader graph I used for those 2 walls and the values

green holly
#

Anyone know how to code a ui globe like shader?

#

I mean the globe should behave like it has a level topped gas-liquid filled inside?

fringe hound
#

Coucou ! : )
I have this annoying thing. Each time I move a preset in my shader graph, the volume in the main preview become blue. I have to move it manually in the main preview window so it could show the changes. Is there away this could be updated automatically? Am I doing something wrong or is it this way it works anyway?

regal stag
fringe hound
#

@regal stag maybe it is because there is a texture containing a video? I have restarted Unity and also upload the lasted version ( 2021.2.8f1 ) in case. It still the same. The strange thing is that nothing happen if I don't move manually the shape on the main preview. It could stay blue all day

regal stag
#

It is happens with regular textures too, might just be a bug

fringe hound
regal stag
#

The alternative is just to split the passes into two separate shaders and apply both materials to the MeshRenderer.

covert walrus
#

hello

#

can somebody help with grabbing a color from a texture ?

#

I have a value that fluctuates between 0 and 1 and, I want my shader to grab the color that corresponds to the location in the texture

#

ColorGradient with Texture

red belfry
#

Can anyone recommend a mirror shader for VR that works in single pass?

dry oasis
dry oasis
#

Dont worry about it anymore. I got it to work and the effect looks kind of shitty with the way that I'm doing the outline, Thanks.

upbeat horizon
#

I need to make a shader that functions like the sprite mask, but for 3d

#

and it also needs to work in URP

#

I have no knowledge on shaders tho

#

can someone help me with creating this in shader graph?

#

nvm figured it out

shadow locust
#

it's just called Lit graph now

tropic ermine
#

Hi, could anyone give me a hint on how to implement gpu LOD with drawmeshinstanceindirect and shader. Is it right that I need 2 drawcalls with 2 lod level?

tame topaz
#

@versed iris There's no memes in this discord.

gritty harness
#

How do I create a shader graph?

grand jolt
#

Are there any tutorials of making wind like its blowing out of a fan?

bronze viper
#

So I'm making a water shader, and I like it a lot so far, but there's a big problem.
There's an obnoxious white outline around objects not making contact with the water

#

The issue is caused by the edge detection that's designed to create the edge foam.

#

How can I hide the thin white outlines on non-colliding meshes?

#

Weirdly enough, the issue does not present itself in the editor

lavish trellis
#

hi all, can someone help me with this issue im having?
i followed this tutorial to create a wobble shader (https://www.youtube.com/watch?v=xDCRah7BbIo) however when trying to apply it to my image it does not display correctly

Bytesize Gamedev is a series of videos featuring tiny tutorials, delivered in 60 seconds or less. In this video, learn how to make a sprite wobble effect using Shader Graph and URP.
This video was previously posted on Twitter: https://twitter.com/daniel_ilett/status/1318598139419480070

Unity 2019.4.12f1, URP/Shader Graph 7.3.1
---...

▶ Play video
#

can someone help me find where i've gone wrong, or if this can be applied to UI images

dim yoke
#

That doesnt happen in editor because editor camera doesnt use anti aliasing

#

post processing anti aliasing like fxaa should work fine tho.

#

@bronze viper if you scroll down on this page, youll find bgolus deep explanation to this and some links to fix that https://forum.unity.com/threads/jaggy-white-pixel-artifacts-on-edges-with-specular-and-antialiasing.320984/ . It seems to be quite complicated problem and id probably just use fxaa if possible

silk sky
#

is it possible to move an offeset by a certain amount each X seconds via graph?

#

I'm trying to create a dance floor and want to move the color texture based on the squares

regal stag
tired spire
grizzled bolt
tired spire
#

yup,i tried using particles system but it could end up costing too much CPU performance,not ideal. scrolling textures probably is the way 🤓 i tried but not looking good at some angles and not realistic cuz all the light move with the same speed

glacial pond
#

anyone have a problem with a side of a mesh being see through?

shadow osprey
#

Does anyone know why my water reflections look so shitty in VR and in Game View it looks perfectly fine? Everything looks pixelated on my Quest2 but in game view it looks great. I am using Gaia with XR Support in Unity 2020.3.25f LTS. When I turn post procespon it looks better but I get double/cross vision . I am going nuts please help 🥺

bronze viper
distant sleet
#

Ah god I still can't figure out global illumination in path tracing

#

When I'm returning the "color" for each object, the only one that returns color is the light source

#

Hence the only way the rest of the scenery is illuminated is that light bounces off it and into the light

#

I think I need to read more because I'm probably missing something even though it seems correct in theory

#

Radiosity looks nice though

wintry summit
#

Is there still any way to make grass swaying on wind shader in HDRP that doesn't look weird when camera moves? Changing Position nodes to absolute world doesn't do anything

bronze viper
#

it didn't

dim yoke
#

@bronze viper atleast you can use something other than msaa

bronze viper
#

yeah i'm using fxaa

marble thicket
#

hey guys i am trying to make a shader, but my shader is white when i put it on top of a material. Why is this happening?

#

@shadingpeople

regal stag
#

Make sure you click the Save Asset button in the top left of the graph

marble thicket
#

Oh my god thank you so much

grand jolt
#

hello! i downloaded a shader but i dont know how to install it in unity

tame topaz
#

You don't, it's just a script file. Put it in your project assets folder like you would anything else.

grand jolt
#

@tame topaz are you here?

#

ok so i installed the unitypackage file and this folder appeard here

#

but i dont know what to do next

tame topaz
#

Make a material that used that shader.

grand jolt
#

ok

#

wait

#

and how is this going to work

#

i mean

#

i want everything to change

#

I mean

#

The shader changes the graphics

#

right?

#

i mean what do i do with that material?

tame topaz
#

Put it on a mesh.

#

Surely you know how materials work by now, based on how often you ask for help here.

grand jolt
grand jolt
#

I thought that shaders changes the whole graphics

tame topaz
#

Shaders give the materials their functionality to make whatever mesh they're assigned to, appear in a particular way.

grand jolt
#

Oh

#

Okay thank you

south acorn
#

Kind of stuck here. New to the shader graph. I know how to make the top brown but how could I make the bottom a darker brown?

robust wharf
#

Hey, how does one use sprites in the shader graph? In BluePrints you can just create a 2D texture node and select a sprite from the list or drag in a sprite from the assets explorer, but that doesn't seem to be the case with the Shader Graph.

robust wharf
south acorn
grand jolt
#

literally

#

it looks the same

tame topaz
#

What was it supposed to do?

onyx coral
#

Hello guys
Please, could anyone that knows Shader Graph help me?

#

I have a "Shockwave" effect

#

I've created a mat using this shader

#

I've put this mat as a Renderer Feature thanks to Blit

#

But now I need to know, how can I "activate" the effect?

#

in other words, how can I make a boolean that, if set to false, would prevent all the calculations from being made from the shockwave

#

and how can I make sure that when I put this boolean to true, the shockwave starts from the beginning (instead of it starting mid-"animation")?

wary horizon
#

keep the gameObject disabled, and enable it when you want it to do its thing

onyx coral
#

I don't think it would work tho

#

Because the shockwave effect won't necessarily start from its beginning

#

as it uses Time.time

#

excepted if there's something I'm missing

regal stag
#

Use your own float property instead of time, then you have full control over when it begins

onyx coral
#

hmm

grand jolt
#

this is the shader

#

someone told me that it makes the standard pipeline to look better

tame topaz
#

It says it's the Unity Standard Shader right in the description. What was it supposed do to your materials?

#

And how does it make it "look better"?

grand jolt
#

I dont know

#

Look

#

Can i dm you?

#

@tame topaz

tame topaz
#

No

#

If you don't know what look you're trying to achieve, then nobody here can really help. You're just wandering in the dark at this point.

grand jolt
#

Ah sorry

#

I already dm you

#

You can look in dms. I told you everything about my problem

#

And if i type it here its going to take a while so

vocal narwhal
#

The hell

grand jolt
#

oh

#

sorry

#

ill send the messages here then

#

Hello
My game should look like this with the shader

#

but mine looks like this

#

my friend told me to install the shader, and change the material shader to rero standard

#

and i changed it but nothing happend

#

what do i do

grand jolt
vocal narwhal
#

No idea what you're talking about specifically

grand jolt
#

i installed a shader

vocal narwhal
#

Turn down the smoothness if you mean how it's slightly shiny

#

Add emission to the eyes

grand jolt
#

no

#

no emission

#

i deleted that

tame topaz
#

Also, lighting your scene to match your reference image is necessary.

vocal narwhal
#

Again, no idea what you mean specifically

grand jolt
#

bruh

grand jolt
#

i dont know if its from the light

tame topaz
#

It's lighting, it's post processing, its everything.

grand jolt
#

wait

#

post processing

#

which effect do i need?

#

i've installed it but i dont know which effect i need

tame topaz
#

Tinker around with it and find something that works.

grand jolt
#

i tried

#

maybe its color balance?

#

oh guys

#

it was that simple

#

i had to change the color space from gamma to linear

modest spoke
#

Hey, I'm looking to make a sort of night vision shader, and it's hard to find information on how exactly to do this with a physical object. I'm looking to create something like this, but working in the dark. Does anyone know how to somehow boost brightness looking through the object with a shader?

#

Sort of like this effect in Boneworks:

#

for reference, this is what it's like when it's dark

meager pelican
#

I enjoyed these articles, and thought others here may as well, so sharing:
https://interplayoflight.wordpress.com/2022/01/22/shader-tips-and-tricks/
https://therealmjp.github.io/posts/shader-fp16/
No warranties, express or implied 😉 Cannot comment on Unity-specific uses/compatibility.

grand jolt
#

I'm so confused

#

Is it either all or nothing with URP? Not finding any up to date tutorials explaining why it does this and none of the comments related to it

#

oh apparently probuilder has it's own shaders that URP doesn't know about so it refuses to upgrade them

#

now i need to fix the textures maniacally flickering

grand jolt
#

dude, it was a complete ball ache and it took me longer than I'd ever hoped, but these textures look 800000000x better

grand jolt
#

Is Vegetation studio Pro better or Nature renderer+Shader?

vocal narwhal
grand jolt
#

Yeah I figured that

#

but I have another issue now

silent sluice
#

How do i make a window which doesnt get any darker when on other window?

#

i need the shader file

grizzled bolt
gritty harness
#

why cant i make shader graph?

grizzled bolt
gritty harness
#

what is a rendering pipeline?

#

2020.3.23f1

grizzled bolt
#

Shader Graph is only for the universal render pipeline and high-definition render pipeline in all editor versions before 2021.2

gritty harness
#

so can i not use it?

#

do i need this?

grizzled bolt
#

Your project currently does not support it

gritty harness
#

so i can never use it?

grizzled bolt
#

That's a bit extreme don't you think

gritty harness
#

so is there a way i can use it or not?

grizzled bolt
#

Install a rendering pipeline that supports it or upgrade to an editor version that supports it even without the rendering pipeline

gritty harness
#

what render pipeline is best for trash pc (my pc)?

grizzled bolt
#

Universal Render Pipeline

gritty harness
#

ok

grizzled bolt
#

The install process has many steps so look up instructions before you try

gritty harness
#

ok

lament scarab
#

Hey! Is there a way so that my stencil shader, when behind another stencil shader with a different referenceID, dosen't show?

#

With a DepthMask I just get a grey square instead.

lament scarab
#

Here's the code for it:

Shader "Stencils/Masks/StencilID"
{
    Properties
    {
        _Color("Main Color", Color) = (1,1,1,1)

        _StencilReferenceID("Stencil ID Reference Reference", Float) = 1
        [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8
        [Enum(UnityEngine.Rendering.StencilOp)] _StencilOp("Stencil Operation", Float) = 2
        _StencilWriteMask("Stencil Write Mask", Float) = 255
        _StencilReadMask("Stencil Read Mask", Float) = 255

        [Enum(UnityEngine.Rendering.Shader_ColorWriteMask)] _ColorMask("Color Mask", Float) = 0
        [MaterialToggle] _ZWrite("ZWrite", Float) = 0
    }

    SubShader
    {
        Tags
        {
            "RenderType" = "StencilMaskOpaque"
            "Queue" = "Geometry-100"
            "IgnoreProjector" = "True"
        }


        Pass
        {
            ZWrite [_ZWrite]
            ColorMask[_ColorMask]

            Stencil
            {
                Ref[_StencilReferenceID]
                Comp[_StencilComp] // always
                Pass[_StencilOp] // replace
                ReadMask[_StencilReadMask]
                WriteMask[_StencilWriteMask]
            }

            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            fixed4 _Color;

            struct appdata
            {
                float4 vertex : POSITION;
            };

            struct v2f
            {
                float4 pos : SV_POSITION;
            };

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

            half4 frag(v2f i) : COLOR
            {
                return _Color;
            }
            ENDCG
        }
    }
}
digital vector
#

Heyo, i'm trying to follow this guide here https://github.com/Unity-Technologies/Graphics/blob/c6ae7599b33ca48852eddd592b3e40f33f2dd982/com.unity.render-pipelines.universal/Documentation~/writing-shaders-urp-reconstruct-world-position.md right now, but all i get is some white noise.
I have both, Opaque-Color and Opaque-Depth enabled in my URP settings, and i can perfectly sample Scene Color. Only the depth is screaming at me in an unwillingness to cooperate

Here is an image of where i copy pasted the attached code into unity (minus thelast depth < 0.001 / > 0.999 check )

GitHub

Unity Graphics - Including Scriptable Render Pipeline - Graphics/writing-shaders-urp-reconstruct-world-position.md at c6ae7599b33ca48852eddd592b3e40f33f2dd982 · Unity-Technologies/Graphics

#

When i copy paste the thing without modifications, it just remains black

#

and here a last demonstration of the scene color working (i scrambled the channels)

#

Ok so it only doesnt work in viewport

#

... ok no it works in the tiny camera preview, and only there

digital vector
inland zinc
#

im trying to make shadows work with my shader but i cant seem to get it working
i have shadows, shadow cascade and soft shadows on but nothing is working

digital vector
#

Looks like my custom shaders arent writing depth as they should... but why does the preview then work

digital vector
#

WORKS! Added the depthonly pass and that did the trick

steel notch
#

Hey so I'm trying to make a shader where you have some plane that when it intersects with another mesh, only displays the parts where it and the mesh are intersecting. For example if the plane was intersecting a sphere right down the middle, the plane would only display a circle.

neat hamlet
surreal oriole
#

You guys, is there a good tutorial to learning shaders for beginner?

swift loom
#

Is there a UNITY_SAMPLE_TEX2DARRAY variant for tex2Dgrad ??

#

i don't know if it's that big of a deal to use a normal tex2D inside a [loop] for loop

#

it works 🤷‍♂️

south granite
#

Hi, can you suggest a great tutorial for beginners for Compute Shaders>?

primal harness
# south granite Hi, can you suggest a great tutorial for beginners for Compute Shaders>?

Let's take a look at how we can use Compute Shaders and Compute Buffers to take some of the work that your CPU struggles with and offload it onto the GPU instead.

Tooltip System: https://www.youtube.com/watch?v=HXFoUGw7eKk
Debug Cheats: https://www.youtube.com/watch?v=VzOEM-4A2OM
Line Renderer: https://www.youtube.com/watch?v=--LB7URk60A
-----...

▶ Play video
#

Does anyone have some example shader code for receiving shadows in URP?
It's hard to find any up to date code for receiving shadows for URP

wise skiff
#

hey would it be possible to make a shader that takes the density of a certain particle in an area and based on it, the area is fully filled witha a color?

silver sparrow
#

is there a list of functions available for shaders such as clamp, saturate, frac etc.

slender prism
#

ok so this is a rly dumb one
but a few months ago i accidently did smth that made everything purple when there isnt a material applied to it
and bloom doesnt work either after i did that

#

im assuming its a shader problem

#

but idk

silver sparrow
umbral mountain
#

Anyone could have an ideas why my shader is purple in scene & game but it shows the shader in prefab viewer?

silver sparrow
#

aight thanks

regal stag
regal stag
# slender prism ok so this is a rly dumb one but a few months ago i accidently did smth that mad...

It sounds like you might have tried switching to a different render pipeline? e.g. Built-in to URP or HDRP? They require different shaders so if materials in the scene is still using Standard ones it'll show as magenta. URP/HDRP also uses different post-processing. I don't think there's an automatic way to convert that, I think you need to manually set it up again.

If you want to go back to Built-in RP you can remove the pipeline asset under Project Settings -> Graphics. Should work assuming you haven't converted any materials yet. Can then uninstall the URP/HDRP package.
If you want to switch pipeline look at the appropiate docs (e.g. pinned in the #archived-urp / #archived-hdrp channels) for setup instructions. I'd recommend backing up the project before doing anything.

pulsar imp
#

Hi 🙂 I'm working on a sand shader and i got stuck. Is it possible to get rid of these seams (near red marks) between the meshes, something like blending on the border of the mesh? The meshes have the same material.

daring dew
pulsar imp
#

@daring dew Thank you, could you give me some example custom pass with blur the normal buffer?

south creek
#

Added URP shaders to my Udemy shader course https://bit.ly/urpshaders https://youtu.be/9xGCKeec2qE

There is a major update to my highly rated Unity Shaders course. Learn to create URP Shaders. Starting with a simple unlit example, through to a PBR lit clipped shader. 12.6
Learn to use the new helper functions in URP include files. See how to use Renderer Features for custom post processing and stencil effects. The new videos also include tips...

▶ Play video
lean lotus
#

hey is there any way to output numbers from a compute shader, similar to how in cuda you can do printf?
I wanna return numbers for debugging purposes, but idk

shadow locust
lean lotus
#

oh really?
and I thought renderdoc didnt really like to work with compute shaders?

shadow locust
#

It might not, there's some tool that does it may or may not be RD, I've never done it personally

lean lotus
#

computebuffer may be my best bet then thx

shadow locust
#

I usually debug via ComputeBuffer or via positioning things in my shader in a really hacky way to show values of things lol

lean lotus
#

fair enough

lean lotus
#

ugh debugging byte shenanigans in a compute shaders is frickin annoying

fervent flare
#

Does anyone know how to get smooth lerping from 0 to 1 and back to 0

#

in shadergraph ?

#

I'm playing around with the Time nodes Sine Time output

#

but that's far from smooth

white marsh
#

So ive been learning how to write shaders for a while now, so I wanted to try to write a basic shader with unity's surface shaders. The problem is that i cant get the transparency to work with it. Ive set the render mode and que, set zwrite and blend mode. Only thing missing is to set the alpha but nothing happens. It renders just like normal, unaffected

south creek
#

Sin time range is -1 to 1. Use an add node to add 1 and a divide node to divide by 2. Then you get smoothly changing 0 to 1

white marsh
#

Blend SrcAlpha OneMinusSrcAlpha

south creek
white marsh
#

Uh no, i guess that is the problem then inspect

#

There we go, now it works. I didn't find any documentation on what optional parameters it could have. Is there any list somewhere?

daring dew
white marsh
#

thanks thumbsupani

burnt wigeon
#

Wondering. Does anyone have a shader to enable HDRP/URP decals to project on a transparent mesh?

#

I dont even know where to start looking to get this to work

burnt wigeon
#

To be more precise, I dont need to rely on the decal feature I am just looking for a way to have blow shadows on URP/HDRP on a transparent surface

burnt wigeon
#

As a side note, it works on Built in so I am scratching my head a bit

nimble solstice
#

Hi is there a keyword or some such directive to make shaders calculate AO?

lean lotus
#

So it turns out that Vector4 and float4 dont have enough precision(missing by 2 digits max) for a good conversion from 4 Uint32's to Vector4/Float4
is there something else I could use in a struct and easily pass to a compute shader that will have the extra precision that I need?

lean lotus
#

It’s a list<struct> rn

shadow locust
#
public struct Vector4UInt {
  public uint x, y, z, w;
}```
lean lotus
#

The struct is 5 float4’s

shadow locust
#

What struct

lean lotus
#

It needs to be uploaded to a computer shader via a structured buffer
Public List<NAME> NAME2;
Public struct NAME {
Public Vector4 node_0;
Public Vector4 node_1;
Public Vector4 node_2;
Public Vector4 node_3;
Public Vector4 node_4;
}
Sorry for formatting on phone now

#

This gets uploaded via a structured buffer to a compute shader with the same struct, but with float4’s instead of vector4’s, and it’s formatted this way to reduce memory things or something that apparently optimized fetches or something

#

But turns out the floats the vectors are composed of are not precise enough, so I needed full uint’s but unity c# doesn’t seem to have uint4’s I could use instead

shadow locust
#

so instead of 5 Vector4s

shadow locust
#

And have 5 of these in your NAME struct

lean lotus
#

Oh I see

#

I could but doesn’t unity not like nested structs?

shadow locust
#

Unity is barely even involved at that point

#

but no, unity has no problem with nested structs

lean lotus
#

Oh ok cool

#

Then yeah I’ll try that thx

steady lintel
#

Anyone know any good starting points for making a water shader in Unity’s Built-in pipeline? All I see are tutorials for URP or HDRP.

amber saffron
steady lintel
stiff tapir
#

So, I've got a BRP Shader I wrote

#

It does a number of things, but what's important is that it renders a tex2d with screen coordinates

#

No matter where you look at it from, the texture is always facing you, simple simple

#

However this shader was written with VR Chat in mind

#

As in, a lot of people looking at this shader are going to be wearing headsets

#

Their view of the world is Stereo

#

I can use a texture space of IN.screenPos.xy / IN.screenPos.w when there's only one camera, but once you throw Stereo vision into the mix, one way or another I need to apply a correction to the texture coordinates to shift them left and right an appropriate amount based on which eye is viewing them

#

I've been made aware of unity_StereoEyeIndex, which is great, but I don't know how to properly calculate the amount the coordinates need to be shifted based on that information

toxic fable
#

Shader beginner here - Is there a way to only render pixels lit by a certain light source?

regal stag
regal stag
toxic fable
stiff tapir
#

Interesting. I'll look into it and continue testing, thanks.

regal stag
#

If it's just one, I'd create a C# script to pass the position and radius of the light into the shader/material.

toxic fable
#

I figured a light could simulate the spherical line of sight.

regal stag
# toxic fable Yes, it is only one light. I'm trying to figure out an implementation of a Fog o...

Hmm I see. I guess you also need point light shadows then (would need to be in at least URP v11 / 2021.1 since older versions doesn't support them too)
I'm not sure if you'll be able to use the GetAdditionalLight function in URP's ShaderLibrary specifically as it uses a light-index which I don't think you can obtain. It's mostly designed so you loop though all lights. But looking through the functions in Lighting.hlsl (or RealtimeLighting.hlsl in v12+) and Shadows.hlsl (e.g. AdditionalLightRealtimeShadow) should help piece together how to calculate the additional light and shadow attenuations correctly.

toxic fable
#

Thank you for the suggestions, I'll look into this. I'm at the stage of figuring out the best possible solution for my usecase so any idea in the pool is a great help. If it wouldn't be of much bother for you, would you happen to have any other idea of how could this be implemented?

#

I mean, the light solution might not be the best performing, so I was wondering if there are other ways to achieve this effect.

#

I've been googling for two days and only found a solution involving depth cubemap. While I do understand the concept, I'm not sure how to actually implement it and given the fact that rendering a cubemap is rather expensive task, I'm not sure about this option either

regal stag
# toxic fable Thank you for the suggestions, I'll look into this. I'm at the stage of figuring...

I'm not sure. I don't really understand the verticality here, as I would have assumed every layer above the player should be in fog. Which means you likely don't need a proper spherical line of sight, and might be able to just compare the y positions?
I guess unless an enemy is standing near/on the edge, then you might need to be able to see them? But might be able to handle something like that with raycasts. Idk, I haven't done much with fog of war before.

clear elm
plush bane
#

Is there a node in graph that returns if a value is in between 2 floats?

plush bane
#

Well these I need 2 to check if float is in range

#

Any idea why this is OK in preview, but doesn't work in editor or runtime?

shadow locust
plush bane
shadow locust
plush bane
#

Well this I think is most important part

#

The alpha test ain't working

#

Hmm, or object space ain't working

#

:/

regal stag
#

If it's based on position the range of values may not be what you expect. The sphere in previews doesn't use the same -0.5 to 0.5 range the default sphere mesh uses, for some reason.

plush bane
regal stag
# plush bane Preview seems to use -1 to 1. I multiplied the object space input by 2. So it sh...

If anything you want to divide by 2, not multiply. But the previews range isn't really -1 to 1, iirc it's something like -0.65 to 0.65. It's a bit of an awkward/weird scale.

You could instead provide your Comparison nodes with a Float property (some put through Negate node) so you can control the value from the material. You'd want it set to 0.45 or something instead in this case.
Also instead of doing two comparisons per axis, you could also Absolute the position before splitting it. Then just need to check the positive side - Less than 0.5/float property.

plush bane
#

Mkay will try tomorrow, tnx

rustic kite
#

hello, i'm trying to figure out how to render the first pass of my shader into a sampler that i can use for the second, how do i do this? (using built in render pipeline)

normal kelp
#

hey a question about shader graph.
My friend has started a project in 2020.1.10f1 and I already have 2020.3.2f1 installed on my pc. if it's only the shader graph, would we still be able to collaborate or will I need to install 2020.1.10f1 as well

shadow locust
#

You should Both upgrade to the latest LTS version ideally

summer beacon
#

On the latest version of unity hub, has the option to create a HDRP scene disappeared? The only version i can find is to create the HDRP Sample scene, not a blank new scene.

shadow locust
#

hdrp sample scene will give you an hdrp project

summer beacon
#

I remember there use to be a bunch of options you could tick like HDRP when creating a new scene

#

Is using the HDRP sample scene the only way to do that now or am i just blind?

shadow locust
#

Creating a new scene happens when you're in the editor with a project open

#

You are currently in the hub choosing a project template

summer beacon
#

Oh shit yeah i shouldn't say scene my bad, i mean project sorry

shadow locust
#

It seems like they may have renamed some of the project templates is all

summer beacon
#

Hmm im not too sure what to do

grizzled bolt
#

Tbh just pick the HDRP sample, make a new scene in editor and ignore/delete the sample stuff if you don't need it

plush bane
#

Can't figure out what I am doing wrong with this simple XY color interpolation shader

white marsh
#

what is the best way to render a geometry shader above another geometry shader? (not using the transparent render que)

swift loom
#

Does o.worldPos = mul(unity_ObjectToWorld, v.vertex); actually contain a real .z value or is it only x and y and z contains something else?

#

i was also trying something like this to get the z value of the object being rendered but it seems to never trigger


if(baseWorldPos.z > 0.5){
    return fixed4(1,0,1,1);
}```
white marsh
plush bane
#

How do I convert Object position to angles?

torpid hull
#

Hi, when including an emissive texture into my shader (standard PBR) i'm getting some weird artifacts in game. It’s like the emissive texture is bleeding into other areas of the UV tiles, so around the edges of my mesh I get a bright outline when veiweing from certain angles. These are static objects that share a texture with other objects. I’ve tried tweaking everything in PP, texture import settings, Map Map settings, Anti-Aliasing settings, camera settings, graphics settings, I’ve even tried increasing margin around my mesh UV tiles and whilst I can improve the issue it is still present. For now, the only way to solve this is to have a separate material set up for emissive areas of my mesh, but that means more draw calls which I really want to avoid. If anyone knows how to solve this, please let me know. Cheers

white marsh
#

ok so im having a problem where this fernel isnt working properly. here is the script im using. could it be im missing something in #pragma? since it seem like _WorldSpaceCameraPos isnt working but idk

low lichen
white marsh
#

oh, ok ill try that then

#

that seems to have make it look right, but its not reacting to my camera still. the effect is only applied from where light is hitting

#

it looks correct from the opposite side but itsnt moving its static to the light

#

i se there is an option to use interpolateview maybe thats what i need?

#

o wait, it could be that the view dir is named something else in the surface shaders

low lichen
torpid hull
#

Do you have a directional light lighting that side of the sphere?

white marsh
#

i didnt really get viewDir to work, i might be doing something wrong here

white marsh
#

i did make sure to add it in the input struct btw

torpid hull
#

have you tried tunring off your lights

white marsh
#

if i use worldreflection it kind of works, but it reacts to how close i am to it

#

let me se

low lichen
white marsh
#

seems to be the same even without the light

#

oh, ok. does it need to be normalized tho?

low lichen
#

And fresnel is just the dot product between the normal and view direction, nothing else.

#

viewDir should already be normalized by the surface shader

white marsh
#

oh oki

white marsh
#

result:

slim steppe
#

Hi im using a cube with inverted normals for a (unrealistic)atmosphere shader but the shader looks different while you're inside the cube

#

This is a picture with the outside(bottom left) and the inside(top right)

torpid sapphire
#

Hey, I struggle a bit with english terms on this one, but what kind of shader terms should I be looking for. I want the effect to appear on the lens of the camera, like saliva on the cam or someone breathing on it, making some steam/fog on the lens. (The camera being the one of the game)

shadow locust
#

Water Droplets. Refraction. Blur. Gaussian blur.

torpid sapphire
#

Wow thank you, i'll try with these new words, makes more sense than mine 😆

steady lintel
#

Does anyone have any pointers for making a water shader with Unity's built-in render pipeline? Maybe with shader graph? I can't find any tutorials for it, all I can find are ones for URP and HDRP.

steady lintel
#

Like, for instance, this one by Brackeys: https://youtu.be/Vg0L9aCRWPE
It's a really good tutorial, but it seems like many of the things he does in it are outdated. (Mentions Lightweight Render pipeline, uses PBR Master in shader graph, etc.)
Are there any tutorials or pointers anyone could lend me that are like this that apply to my situation?

Let's make some simple cartoon water!

82% OFF for Web Hosting and FREE Domain included!: https://www.hostinger.com/brackeys
Coupon Code is "BRACKEYS" for an additional 15% discount.

The shader is based on this amazing video: https://youtu.be/jBmBb-je4Lg

GduX: https://www.gdux.me/
Game Dev Unchained: https://www.gamedevunchained.com/
·········...

▶ Play video
plush bane
#

Anybody know how can I use smooth step to smooth out a alpha map?

dim yoke
plush bane
#

In shader graph?

long shadow
#

Heya
So I am currently making a simple toon shader. I am following the steps in this video: https://youtu.be/GGTTHOpUQDE.
I have a problem with this

#

Basically, when I disconnect the Baked light part, everything just looks normal.

#

But when I plug it in...

#

Suddenly it becomes blue

#

What is the problem?

plush bane
#

Lot's of questions and no answers 😄

long shadow
#

Shaders are hard, actually

#

Before shader graph I can only imagine the suffering of dealing with a C like language

plush bane
#

Anybody know how to smooth out the borders (circle its just an example, it will be different forms)?

long shadow
long shadow
torpid sapphire
#

@plush bane higher resolution texture or anti-aliasing might help you there

plush bane
#

@long shadow it an alpha map... so when it cuts the borders are edgy.. like bad or no AA :))

plush bane
#

It think I need some smoothering strategy in alpha generation, not after its generated..

long shadow
plush bane
#

For now it's 1 or 0.. so it cuts ugly 😄

low lichen
near karma
#

Hi folks, I currently have a compute shader calculating the points on an orbit, and I dump those in a line renderer, but it's cut off since it's so huge that it doesn't fit in scene space. Is there a way I could render the line with a shader instead of a line renderer component? Would that solve my problem?

bronze tree
#

First time using shadergraph for sprites, and I'm having a problem where the sorting layer is not being used. Is there something you need to add to shadergraph for that to work?

sudden crescent
#

is there anyone that can help in a call with me my shader isn't working the way i want it to

ionic current
#

You know in photoshop or html/css, you can do a drop shadow? How would you do this on a sprite?

#

I'm considering making another spritesheet of the dropshadows, and putting it under the sprite, and using a "shadow" script to scale/offset it based on the Z or Y height.

#

But, if shader would be better, tell me about it! 🙂

plush bane
#

Any tips ideas, how to turn a box into 3d ring with shader graph? What I am currently trying works only on a plane.

#

The result should be like

#

Form wise

dim yoke
plush bane
#

Ouh no

dim yoke
plush bane
dim yoke
dim yoke
plush bane
plush bane
#

I'm my self working on a side project, a SDF raymarch renderer in compute shaders. So I know what I am talking about.

#

Raymarching a single primitive or generic fractal might still be ok for some showcase/demo, but if using in lots of places, it would just kill weaker hardware.

slender forge
#

Is there a fix to the tree creator optimized shaders?

plucky jay
#

Hi! I am having an (i hope) really simple begginer issue, but I am not finding any solution!

#

I am trying to make a shader that needs to tile an sprite, but somehow it is not working haha

#

I have set the tiling from "tiling and ofset" and it seems to work (is streching the image to the left) but instead of repeating the sprite on the other side, it shows it blank

regal stag
#

The wrap mode on the texture needs to be set to Repeat (rather than Clamp)

dim yoke
plucky jay
#

thanks!!

#

haha

dim yoke
tardy warren
#

Hi,

There is something in the deferred rendering path (Built-In Render Pipeline) that I can't understand, maybe somebody should be able to answer here. For a specific effect of the game I'm working on, I need to modify the final color based on a mask (for some reasons, I can't use Post Processing for this effect). I use the alpha channel of GBuffer2 which is not used by Unity to write into this mask. In the CalculateLight() function from the Internal-DeferredShading.shader file, I apply a filter to the return value based on this mask.
This works well, but I have trouble with emission that is not apply at this step. Does anybody could point me the shader that apply Emission in the Deferred Rendering Path ? Or is their a better entry point for modifying the output color in deferred ?

Thank you very much !

muted ridge
#

Does anyone know how I could construct a cubemap texture at runtime from 6 renderTextures.

low lichen
coral walrus
#

Hello (first post here 🙂 ), I have an issue sampling the depthtexture using URP on android. I can read it perfectly in editor (I checked the use DepthTexture option, in the urp settings asset ), but on device it outputs only white on my S6 and S7 (I'm using frac(sceneEyeDepth*10) to make sure I have some data in it) . Any clues would be more than welcome 🙂

const float rawDepth = SampleSceneDepth(IN.screenPos.xy / IN.screenPos.w);
const float sceneEyeDepth = LinearEyeDepth(rawDepth, _ZBufferParams);
hearty obsidian
#

do both sides of a branch typically execute or can I use branching to optimize expensive possibly-temporarily-unrequired operations

sudden crescent
#

can anyone help me with shaders

dim yoke
hearty obsidian
#

@dim yoke yes sir

dim yoke
hearty obsidian
#

@dim yoke Ah, so no performance optimizations can be performed this way. This is unfortunate. Thank you for the answer

dim yoke
hearty obsidian
#

I'm lost. Isn't the branch node "dynamic" in the sense that the predicate is evaluated at runtime and will branch according to the value?

plush bane
#

When using transparent + render face = both + Depth test = always I kind of get the result I want. The shader is always on top, visible from both sides and does alpha clipping. But then when look from sides it starts glitch and blend together. I wonder if there is any strategy to fix this?

#

Actual

#

What I want

#

2nd is with front face only. Its not visible from other side

dim yoke
plush bane
#

Maybe cloning the object.. one render with front face, other with back 😄

hearty obsidian
#

@dim yoke HAH! I get it, this makes sense. Thank you

torpid sapphire
#

Hey, it's me again, looking for some insights as to what terms I should be looking for : I want to know how I could achieve an effect where an object would pass in some tree branches and the leaves would move according to the mesh passing through it.

Example : a gorilla is hidden in a thick bushes and exits it.

I'd like to have a natural movement (as much as possible lol) of the leaves and the meshes. What techniques would that be ?

Thank you 🙂

sudden crescent
#

can anyone help me i am begging

echo flare
#

Why do urp unlit shader graphs cast shadows?

echo flare
# torpid sapphire Hey, it's me again, looking for some insights as to what terms I should be looki...

vertex displacement on the mesh with adjustable strength triggered by a collision from a collider attached to both the gorilla and the bushes. Vertex displacement is actually fairly easy https://learn.unity.com/tutorial/shader-graph-vertex-displacement

Unity Learn

In this tutorial, we’ll create a Shader Graph to displace the vertices of a mesh along their normals by an amount controlled with procedural noise.

normal kelp
lean lotus
#

Is there something like Cudas block in Hlsl compute shaders? Trying to convert a complicated cuda thing into unity but I’m struggling
If it’s even possible to convert this shader, not so sure because I think the thread count available in unity at once is less isn’t it?

sudden crescent
#

@echo flare i was wondering if you can help me fix my shader i dont understand what is wrong

sudden crescent
#

well im trying to add a gradient to a mesh and for some reason the color is pink

#

iv tried to fix it but i can't find a solution

echo flare
#

what @sudden crescent what pipeline are you using? standard, universal, or HD?

sudden crescent
#

i was trying to use universal

echo flare
#

ok, I'm pretty sure you are attempting to use a standard shader within URP. URP only deals with vertex/frag shaders which you create through the shader graph ui. You either need to upgrade your materials or create new ones https://answers.unity.com/questions/1519382/textures-and-materials-turn-pink-after-installing.html

#

@sudden crescent try changing the shader of your material to universal render pipeline -> unlit

sudden crescent
#

it still isnt working

#

is it possible to go into a vc

sudden crescent
#

@echo flare

patent lily
#

hi, Is there any tools that can transfer build in custom shader to urp ?

torpid sapphire
#

@echo flare awesome i'll have a look at this thank you. Never heard about collider interacting with shaders but this makes so much sense. Collision hit point is fed to the shader to react accordingly 💡

#

And i guess in most case a generic vertex displacement triggered by the collision is enough ! Regardless of collision position

upbeat nimbus
snow harness
#

Hey guys! Im recreating pong right now and I'm trying to have a light that follows the ball around while on Update changing its color to that of the ball. Problem is ball is using a simple shader that changes it's hue all the time. I don't really know how to solve this, and to be fully honest, I'm not even sure how to google this one lol. Anyone knows how to take hue out of a shader into a normal script?
I've tried using Material but it screams at me for saying ball is not using any.

stark musk
#

anybody have resources for how you can achieve ambient occlusion in an unlit urp shadergraph?

dim yoke
stark musk
#

any way to apply that to an unlit shader then?

dim yoke
#

I'm not quite getting what you want to do and why

#

so are you trying to add ambient occlusion post processing effect and it doesn't affect the unlit shader graph material or do you want to make unlit shader that adds ambient occlusion into only that shader without using post processing?

languid zodiac
#

Hi. Is there in urp global variable which contains shadow distance?

blissful atlas
#

does anyone know if there's a way to get the internal camera/view/projection matrix from the GPU in GUI drawing contexts?

#

I have a strange issue where it seems to silently change under the hood, which messes up some drawing I'm doing with shaders that rely on the matrix being, uh, reasonable

#

GUI.matrix is consistent, so that's not the one changing

#

and I can't seem to find a way to get the current matrix in the GL class

#

basically, when I don't have the scene view open, my rendering looks like this

#

but when it is open, it looks like this

#

the shaders I use rely on the view and projection matrix to determine their size in pixels on screen, so somehow the scene view does something to some GUI-related view/projection matrix somewhere for this to happen, but I don't know how to debug it since there's no frame debugger for editor plugins

lost idol
#

does unity come with any working shaders that have height maps? seems like they're outdated for some reason

trail geyser
regal stag
trail geyser
#

Was trying to create a subgraph.. guess I'll have to create 3 more copies for each type 😅

#

Thank you

amber saffron
lean lotus
#

Are there any resources that go beyond basic getting started with hlsl compute shaders? I’m trying to do stuff with compute shaders, but all the resources I can find don’t tend to cover what I need or go deep enough
(Aka, multiple kernels in one shader, groupshared and how best to do that, and most importantly, structured buffers that gets generated by one kernel and used by another)
Also I think I remember there being a way of feeding a structured buffer directly from one kernel to another kernel without passing it back to the cpu first, am I misremembering?

drifting sail
#

Hi, I'm having a problem with shader. I'm creating 2D game. And I have a problem with sprites. When they flip (Cause of turning left or right), they become invisible from the other side when I use material on them to make lights work on it. So i downloaded some free doublesided shaders, but problem is the texture doesn't go on the other side. just color. any help please?

drowsy linden
balmy thicket
#

Anyone know if it's possible to create a wear shader that highlights "sharp" parts of meshes?

#

Pic for reference

#

Scratch that, seems impossible/infeasible from perusing the forums

brave cosmos
#

for some reason when using the "Nature/Tree Soft Occlusion Leaves" shader the trees appear to be glowing even when no lights are in the scene. Anyone know any fixes or solutions for this?

deft root
#

Surface noise is declared tho

desert orbit
#

@deft root Please don't use ableist slurs. No matter how misspelled they are.

deft root
#

mb bro

#

I didnt mean to offend anyone or anything

#

just came out

wild dirge
#

Hi I'ts my first time using shaders, I'm using Unity 2020.3.21 and for some reason when I add a texture I get this weird glitch

#

that texture is a transparent PNG, but for some reason, it looks very weird

torpid sapphire
#

@wild dirge I believe the preview displays your PNG colors regardless of the alpha value. There might be these weird color in your png transparent pixels for some reasons. If you use alpha correctly in your shaders, the final display shouldn't display these colors, as they will be transparents.

#

Also make sure to toggle in the texture import menu that this texture as Alpha (Input texture alpha) and that alpha is transparency

wild dirge
#

Thanks @torpid sapphire I get it

lean lotus
#

If I put 3 compute shaders inside 1 shader file as different kernels, do they contribute to eachothers register count, or do they each have their own register count(and thus how many threads/warps they can launch)?

wild dirge
#

I'm trying to make a shader that adds a pink outline around a texture. But for some reason the final result looks really bad

#

That pink isn't exactly the pink I choosed at all. Also if I pick the black color, it doesn't even show up...

regal stag
#

Use a Lerp node, with Texture RGBA in A, Magenta Color node in B, Subtract in T

#

May also want to Saturate the Subtract output, to clamp between 0 and 1 to remove any negative values

wild dirge
wild dirge
regal stag
#

Subtract node -> Saturate node -> into T of Lerp

wild dirge
#

Like this?

#

It looks much better but I still have a weird outline around the object

regal stag
#

Put the magenta Color node directly into the B input, no need to multiply

wild dirge
#

starting to look better, thank you so much!

steel notch
#

Is there any form of standardized "Vertex Color Maps" for meshes? I have a series of values that are supposed to be mapped to each vertex and then converted to come color. I was wondering if there was any standardized approach for this.

balmy thicket
#

I'm working on a liquid shader and wanted to add some wobble to the top, however I have some issues as you can see with the bottom backface being visible and showing something on the inside of the cylinder (the top) that would be a projection of what's shown at the bottom

#

Anyone ever done something like this? Seems quite tricky

meager pelican
# blissful atlas does anyone know if there's a way to get the internal camera/view/projection mat...

I don't have a direct answer to your matrix question, unfortunately.
However, it occurs to me that if debugging is a challenge, you can try using the manufacturer's tool-set for your GPU. Both AMD and NVidia have dedicated debugging tools that even let you edit and play with shaders, benchmark, etc. They're a P.I.T.A to install and get going, so you'd have to bite the bullet. But you can get all sorts of neat info, and even edit the shader, IIRC. Full disclaimer, I've not tried it with an editor plugin.

blissful atlas
remote wigeon
#

Would there happen to be any good place to get materials for URP online? I know asking free is unrealistic, but I’m just curious as to what’s out there

steel notch
#

Are you unable to give Arrays (like an Array of ints) to Shadergraph or shaders in general?

simple violet
#

no

#

you could technically have a bunch of int properties but that's wasteful

#

you need to think differently when it comes to shaders

echo flare
#

your graph settings need to be set to Transparent and set the alpha clip

sacred trellis
#

why is my scene stuck with baked textures even though i got rid of the area lights and regenerated the scene (also got rid of static and it's still like this)?

#

also the scene for some reason shows it without the baked lighting only when i play:

torpid sapphire
#

@grand jolt You can use Opaque render type. But you must use alpha clipping.
If I were you I would do this :

Plug the fill color directly into base color.
Use your comparaison that tells you if the current frag (pixel) is in the fill zone or the empty zone to set the Alpha of your frag.
If it is in the fill zone, put alpha to 1. if it is in the empty zone, put alpha to 0
Set Alpha clipping to 0.5 or anything between 0 and 1 (not 1)

This way, you tell unity to discard the frag (clip it) if it is in the empty zone. It will not longer render.

In short : The color is always the fill color, but you may or may not render the pixels depending on wether it belongs to the fill zone or the empty zone.

shadow locust
steel notch
#

What's the reasoning for that?

little quarry
#

Probably that it's not implemented

regal stag
trail geyser
meager pelican
# steel notch Are you unable to give Arrays (like an Array of ints) to Shadergraph or shaders ...

You can, but they have to be fixed sized arrays. The compiler has to know the size at compile time.
You don't use Unity's Inspector Properties for it though, but you can set it in script.
https://stackoverflow.com/questions/45098671/how-to-define-an-array-of-floats-in-shader-properties

dry granite
#

It's using a compute shader

#

I would love to hear an opinion on how complex this seems to you, and if you've got some resources to where I could learn more about compute shaders, specifically about deforming a standard unity terrain with a compute shader

simple violet
#

Probably need years of experience to replicate and understand everything going on

#

There's definitely some triplanar shading going on

dry granite
#

I only want to replicate the part which edits the terrain topology

deft root
#

So i have this shader, I was following this tutorial and right now its just blank white

#

its meant to look like this

upbeat horizon
#

quick question

#

I have this polygon texture being made in shader graph

#

and I want to remove the black background

#

how can I do that?

little quarry
#

Remove?

#

Like make it transparent?

austere dew
#

Does anybody else notice shader graph tends to do different stuff per triangle of a mesh? I've ran into this problem many times over various graphs on various meshes, and it sure is annoying.

#

For example: here unity decided to use the normals on the top left triangle, but just gave up on the rest.

grand jolt
#

This might be a stupid question, but how do i add new materials?

austere dew
#

Right click in "Project" window, Create > Material.

grand jolt
#

ty

#

will this still be locked?

austere dew
#

Drag your newly created material to that inspector window.

grand jolt
#

ok

austere dew
grand jolt
#

🚫 <---- My mouse turns in to that symbol while im hovering over with the material

austere dew
#

Are you doing this to a game object in the scene? Can you show all the components in the inspector?

#

minimize the components for a picture.

dim yoke
tiny wharf
#

Maybe a silly question (also apologies for interrupting the current convo 🙏 )

Say I want to change the color of a sprite to colorA, but then change it to colorB which slowly fades back to the colorA, how would I go about that? I'm using the same material and shader to change the tint at the moment and that doesn't have the desired results :)

#

It doesn't look like there's currently a way to attach two materials to a sprite renderer, so my options seem to be

  • remove the smooth fade
  • create a new object with that sprite and render it directly overtop of the existing sprite and slowly fade it out instead

I'd prefer to keep the fade, but wanted to make sure there wasn't a better way to accomplish this with existing tools :)

#

For example, let's say there's a square that can be colored differently via the shader. If it takes damage, I want it to flash white and slowly fade that white's alpha value to zero but keep the current color of the square.

fleet flint
#

Why isn't my main camera capturing anything?

#

Am I missing something?

lean lotus
#

What can make groupshared memory in a compute shader extremely laggy?
trying to use it to speed up a stack for tracing

shadow locust
#

What's the culling mask on the camera?

#

How far is it from the cube and what's the far clipping plane?

upper sphinx
upper sphinx
#

Hey I have a problem. I’m trying to access shader properties from script but it doesnt work. I need a vector3 from a shader graph shader so I coded

playerMaterial.GetVector3(“name of the material”) = new Vector(…);

but I get an error saying that Material does not contain a definition for Vector3

neat hamlet
#

its material.GetVector, not vector3

regal stag
#

Also the string should be a property name, not the "name of the material". And not sure why you're trying to assign (the = new Vector(...); part) to a function...
To clarify too, this is only to obtain a value from the material (either set in inspector or set previously through material.SetVector). You can't set values in the shader and obtain it on the C# side.

shadow locust
upper sphinx
#

thanks yall

regal stag
upper sphinx
vagrant pumice
#

Quick question: If I have an object that's made up of flat colored faces, is it more efficient to have multiple materials, one for each color with no texture, or a texture with the colors mapped out on one material?

tame topaz
#

A texture would be, especially if you could reuse it for multiple objects.

#

Just add all your colours to a grid and align the UVs to the proper colour.

vagrant pumice
#

Oh, that's smart

#

That'll be the way to go for all my pure flat shaded stuff

tiny wharf
tiny wharf
lost kernel
#

Is it really that hard ... i want a unlit shader that receives shadows , just a color input and thats it , all examples i find seem to don't work anymore

meager pelican
# tiny wharf Ah, I tried something similar to that earlier, but didn't get what I wanted. I'l...

Like Cyan said, Lerp should work.
You'd lerp between the actual-color and White (or whatever highlight color) by passing in a value to your custom sprite shader.
The value is 0 to 1 where 0 would be, say, the normal color and 1 would be fully highlighted (single color). Then it's a result of
float4 finalColor = lerp(pixelColor, highlightColor, amtLit);
So an amtLit of .5 would be 1/2 way between the pixel color and the highlight color (white in your example).

You'd set that amtLit in script per frame.

tiny wharf
#

Thanks for help! :)

#

I just got it a bit ago using Color.Lerp correctly. I misunderstood how it worked before :)

#

Thanks a ton for the help 🙏

fleet flint
fleet flint
grand jolt
#

HOW DO I ADD AN OBJECCT

#

IN 2022

#

UNITY

eager folio
#

Is there a straightforward way of having unity not compile every single unused shader and shader variant when building?

steep creek
#

how can i find the dot product of a normal and world up. I can't find a way to get a world up direction in a shader.

steep creek
#

how do i create a new float3 tho. like float3 worldUp = what goes here?

#

i never made one with just values

regal stag
#

float3 worldUp = float3(0,1,0);
Though you might not even need a dot product. Just using worldNormal.y might be the same result.

steep creek
#

i need an angle between up and normal so if the angle is above something i can apply the stone material and not a grass one. I'm making a terrain color shader

regal stag
steep creek
#
                    {``` this for some reason doesn't work literally everything is rock
regal stag
#

Try with a value of 0.5 instead of 0.

steep creek
#

it's 0.4 idk why i wrote 0

regal stag
#

Maybe try with other values. 0.8? Otherwise check how worldNormal is calculated.

steep creek
#

i tried 0.8 and it seems to be inverted

#

i found this little patch of grass on a hill

#

yep i changed > to < and it works fine now

#

thx for help

#

shaders are a bit hard for me to understand right now

stray osprey
#

Hello there, again!
I'm using MinionsArt's compute grass shader (https://www.patreon.com/posts/54164790) and I have big framerate drops using compute shaders.
I've already talked about this with the shader creator, but this problem is weird because we have almost same GPU (1050 and 1050ti) while getting completely different result, where Joyce can have 100k grass with no problem and I get drops from 120 fps to 50-60 with only 17k grass (and 20fps on 60k grass). I get more than 4ms of delay on "DrawProcedural".
The difference is that MinionsArt uses built-in rp, while I use URP.
I've searched up if there's something up with URP compute shaders, but I found nothing on this topic.
I understand that URP might be more complex on rendering than built-in, but is the difference that bad? Or could the problem be within the compute shader itself?

eager folio
vapid heart
#

Hello. I was configuring a simple skybox shader. I assigned to Side picture the same texture, but it won't be tiling:

#

And the joint line is visible too

#

how do I improve that? I may kinda stop worrying by now, ||it's a free project for itch.io||, but... I am really curious

vapid heart
#

it gets noticeable when I push exposure

frozen lava
#

hey all, im trying to get a vertex color shader working (any) but for some reason they all come out pink, im using mesh.colors and they show up using a particle shader - problem is I need shadows also. Any ideas what the pink issue might be? thanks

#

scratch that, just tried in shadergraph and worked first time lol

dim yoke
#

also because the 6 sided uses cube as the mesh, it will not look cylindrical anyways if those textures doesn't take that into account

#

not sure why that darker line on the corners appears tho

vapid heart
#

Here are my backgrounds

#

I use project with default settings

meager pelican
stray osprey
#

MinionsArt is working on an update for this system but I'm not sure if it'll help much with my performance issue so I wanted to try to get help here

meager pelican
#

I'm saying it might NOT be from the "compute system", but rather the drawing side of things. I cannot tell from here.
Might be the compute shader, if the draw call is waiting on the compute stage to finish. Not sure.
Or it may be that the compute shader is fast enough, but the draw part in URP is having some...issues...for lack of a better term.

meager pelican
#

The other ways to debug it, besides what you're probably doing:
use PIX
use your GPU vendor's graphics analysis tools, they can tell you down to the detail where the performance hit is. For example, too many vector registers used to have enough wave fronts to make it performant.

#

@stray osprey

keen kraken
#

I have a question/problem and cant find a solution, been stuck on that almost 2 hours now

#

thats what it looks like in substance

#

thats it in cinema 4d

#

in unity

#

where did my gold shine gooo

#

how do i put in the things

keen kraken
#

well its not perfekt but putting the metallic smoothness on white and down helped somehow

velvet solstice
#

Hey guys and gals, any videos you recommend or any other suggestions or ideas how to approach this? basically I want to make the computer screen (in yellow) to project text or images like a tv or real computer will do, animated text and images, etc.
How have you done this in your projects? Thanks in advance

oblique oracle
#

Not sure If this is the right Channel to ask this but i need help, I want to make a Yellow Carpet floor. How would I do that?

dusk compass
#

How do I pass data to my shader in shadergraph?

eternal depot
#

Guys how do you go about making like a blur/transparent panel?
its like a gradient alpha

shut flume
#

hey guys! i'm making a pretty simple multiplayer game thats using defualt unity render pipeline and I wanted to add a effect in my game that would use shader graph and a pbr shader graph to be more specific. will upgrading my game to hdrp mess anything up?

#

like is there anything that I should be concerned about

vocal narwhal
shut flume
#

sorry i wasnt sure which one would be best

ivory crest
#

@regal stag hey Cyan, i found your trail renderer shader graph on google

#

How do I extend this to make it a sliced line rather than a dotted line?

#

I have a head and tail of an arrow and would like to extend only the straight line in the center

#

Also I'm using it in a line renderer

#

@regal stag was able to make it a single line :D. Still stuck with adding a footer though

#

nevermind, I guess I can skip the footer since the line renderer draws from the character's point

#

thank you Cyan 😄

#

the arrow head is the other way round 😦

#

I would like to have it at the top since thats my end point

regal stag
# ivory crest

Swapping the order of the positions would probably work

ivory crest
#

@regal stag duh! ofcourse! thank you

plush bane
#

Hey I still don't understand why I am getting those weird results with Transparent + Alpha + Both + Auto + Always ?!

#

Its like conflicting with it self

vocal narwhal
#

Using transparency, within a single mesh the triangles are rendered one by one, and are not sorted by depth. This can cause issues of overlapping geometry within a single object when viewed from some directions.

#

sometimes strategically separating portions of the mesh can result in a consistent viewing experience where each of the new object's centers will be correctly sorted. But really, the best solution is just to use opaque, if you need transparency use alpha cutout or dithering with cutout

plush bane
vocal narwhal
#

That might have the same issue as transparency, yeah

plush bane
tame peak
#

Hello, I've got a complicated shader (Super Fast Grass) that I want to modify to only draw within a certain distance, though I have little shader writing experience and the shader itself seems to be generated from Amplify Shader. Would adding a clip after a certain amount of distance act the same as, say the camera clipping planes, to help with performance?

vocal narwhal
plush bane
vocal narwhal
#

I'm not sure as to the best fix as this sort of thing can be very confusing. I can only think of spitting the object up into inner and outer faces and forcing the render order.
I have to sleep, so I hope you sort it out or someone else knows!

plush bane
#

The allways option just works bad.. Is there another way to set depth?

#

Uh, getting nice results when playing with queue

lean lotus
#

Hey so Im having an issue with compute shaders
basically, im using 1 kernel to write ray directions and origins to a rwstructured buffer that I then use in another kernel
Now if I display the ray directions from the first kernel, immediately after writing it to the RWbuffer as a texture, its fine
but if I then read it in the second kernel, and display that instead, I get this, why is that left side always like that?
Btw the code im using to index into the RW buffer is this:

    uint width, height;
    Result.GetDimensions(width, height);
    int index = id.x + id.y * width;

where id is SV_DispatchThreadID, and Result is the texture that i am writing to as output
and the ComputeBuffer when created on the cpu side has a length of Screen_width * Screen_height

lean lotus
#

also why is groupshared memory seemingly slower to access then say, memory declared in a function like this

dim hemlock
#

Hey guys. Is there a reason why i cant connect IsFrontFaced as a condition to the vertex normal parameter?

regal stag
dim hemlock
#

ahh I see. Thank You 🙂 @regal stag

digital vector
#

Ayo guys; So i am currently planning to move my grass-geometry shader to a compute shader (as most of the calculations are the exact same every time), but now i'm wondering what would be more efficient:

  • Should i store the vertex and triangle data in a mesh/mesh filter after computing and render it using the mesh renderer
  • or should i use compute buffers with Graphics.DrawProceduralIndirect (i think this is the right method? i won't draw the mesh more than once per frame)
near current
#

Hya. I havent done any shader writing in a Long time, at least 3 years. Im not using the Built-in Render Pipeline atm, and need to write a shader for a 3d Mesh object that is Unlit, and always renders in front of meshes in a certain layer

#

Where should I look to do this? What terms should I google? I found stuff about using a Stencil, but that seems to be a ShaderLab command, and I dont think I'm familiar with that

#

Should I look into the Shaderlab thing? Or is there a way to do it in HLSL? that's what I used a few years back / am used to

digital vector
#

At least they helped me a ton in that matter!

unique raven
#

I'm trying to use shadergraph to create a shader that only renders vertices on a mesh if it's below a certain local height(y) - I've got the basics of messing around in shadergraph, but don't quite know how to tackle this, any suggestions?

marble palm
#

just learning and... this took me way too long to figure out lol

#

probably did some dumb things

dim timber
#

Didn’t really know where to ask this as I’m new to unity and making games as a whole. But is there a way to make my 3D game look like road rash through use of shader graphs or something?

harsh cosmos
#

Does anyone know why my text is like this regarding text mesh pro? I used hunter asset to clean up my project, and me being me I didnt make a backup before cleaning it. Now all my Text Mesh pro text is like this

#

Im not really sure if its the textures, or the fonts

#

im getting a lot of shader errors in my console regarding .cginc

grand jolt
#

any one here expiranced with shader forge, trying to reverse engineer a shader, it has a flipbook/sprite sheet animation function, ive used amplify and such before for theese things but for the life of me i cant understand why the fuck the order is bottom left up is there anyone who could help me "Flip it to be" Top Left Dowwards

cloud dust
#

sup y'all, I made a water shader in URP with Shader Graph, and I'd like to use it in Standard pipeline. I've installed the Shader Graph package, but I still get this message:

#

Anyone know a fix or is there no way to convert the shader?

flat herald
#

Can someone help me with this? I'm trying to make a billboarding shader for my 2.5D game with URP, but for whatever reason it bugs out when I get close to other objects using the same sprite rendering shader

#

Shader graph

#

I've looked for other solutions for billboarding, but they either don't work properly or encounter the same issue

cinder fiber
#

Hi, I know nothing about shaders, I want to create a window object that can be used to "cut out" holes on my walls by making the walls invisible in the view through the window - I only need to realize this feature ASAP and it's okay if there's a solution that just works without a full explanation or teaching me about shaders at all.

#

Thanks in advance for any help

amber saffron
regal stag
wide bloom
#

Hey people, can someone help me with a 2D shader for fog? I'm using URP and a 2D renderer. Trying to make fog for my 2D game. The problem is that the fog has no transparency, so if I add the material on a sprite plane, I cant see through the fog. I'm using Unity 2021.1.24f1. This is my shader graph:

silver sparrow
#

@regal stag i'm actually really curious as to how you place the Sun and Moon in the sky, are they a gameobject or... https://twitter.com/Cyanilux/status/1316348166665625600?s=20&t=2iAz4MimlfPjEwQoDRZ9YQ

Made some improvements to this stylised procedural skybox shader I've been working on. Day-night cycle by lerping colours (in C# script). Also experimenting with moon phases based on light dir. #madewithunity #shadergraph https://t.co/wz3SyQnYtI

Likes

432

▶ Play video
regal stag
# silver sparrow <@!357936113983291393> i'm actually really curious as to how you place the Sun a...

They are a part of the shader. Basically a Dot Product between the sunDirection & normalized UV.xyz or Position node (they are the same thing in skybox shaders). Then smoothstep / remapped to make it smaller. Can obtain the sunDirection through a custom function returning GetMainLight().direction.
The moon calculation is more complicated (the thread contains some info about it), but it's an empty GameObject with a script to send the direction in, e.g. via material.SetVector("_MoonDir", transform.forward).

silver sparrow
#

sounds confusing asf ngl, are you gonna write an article about it on your website?

regal stag
regal stag
silver sparrow
#

alright good to know, thanks!

odd silo
#

does anyone has a tutorial or a document that i can start writing shaders with?

#

im getting tired of shader graphs and i want to step up

silver sparrow
#

btw, the sunDirection you're talking about, is it the Main Light node?

regal stag
#

Probably yeah

silver sparrow
#

ohhh

wild thorn
regal stag
odd silo
#

thank you ill try to understand that lol

odd silo
dusk cobalt
#

can anyone help me make procedural noise or something shader like this?

odd silo
#

you can generate it with c# and then pass it as a texture2d

cosmic prairie
#

Even better, use blender nodes, they already support this kind of stuff 😄

#

Making a shader to resemble something that does not change is a huge waste, try to avoid it

dusk cobalt
#

How i can export blender nodes to Unity?

steel notch
#

Is there any way to set the value of a Gradient in Shader Graph from C# ?

cloud dust
regal stag
regal stag
fervent tinsel
#

they added built-in target in 2021.2, yes

#

worth nothing that while that exists, it will not support instancing (unless this has changed since)

#

meaning you can't make VR single pass instanced compatible shaders for built-in with SG

#

or use shader instancing otherwise

regal stag
steel notch
regal stag
#

Probably depends on the gradient. Maybe 256x1 🤷

cosmic vector
#

So I have an infinite terrain system I'm working on right now and I'm dividing the terrain into biomes using the shader graph voronoi node, Is there any way in c# for me to tell which biome I'm looking at? any help is much appreciated!

#

heres what its looking like right now

regal stag
cosmic vector
slim tulip
#

Greetings, is it possible to make a part of the sprite shader unlit?
Working with the lit sprites, and outline messes everything up...

knotty yarrow
#

anyone know why is my scene color nodes in shader graph not working

#

im using the built-in render pipeline shader graph

#

ive been looking for solutions

#

but i only found the solutions for urp and hdrp

amber saffron
regal stag
regal stag
slim tulip
deep mason
#

How to access "Color" field in sprite renderer with a custom shader? _Color("Tint", Vertex Color) = (1,1,1,1)
or _Color("Color", Color) = (1,1,1,1) just creates a new field instead of using the sprite renderer

deep mason
#

I have a custom shader, but it overwrites my UI like so:

#

Any suggestions on why? It's code is as follows:

struct v2f {
  half4 pos : POSITION;
  half2 uv : TEXCOORD0;
};

v2f vert(appdata_img v) {
  v2f o;
  o.pos = UnityObjectToClipPos(v.vertex);
  half2 uv = MultiplyUV(UNITY_MATRIX_TEXTURE0, v.texcoord);
  o.uv = uv;
  return o;
}

fixed4 _Color;
half4 frag(v2f i) : COLOR {
half4 color = tex2D(_MainTex, i.uv);
if (color.a == 0.0)
    discard;
return color * _Color;
}
tight phoenix
#

im trying to make a fish-eye lense, but it returns just grey

#

I can't seem to find the problem, googling around this should work, suggestions?

#

Googling says Scene Color node is just broken / works completely differenty in every single render pipeline?

cosmic prairie
#

(for performance reasons this is turned off by default, not that it would be that expensive, just not all games need it)

#

it may be listed as opaque texture

tight phoenix
#

I got it to render now, but still working on getting to render what is directly behind it, instead of the entire screen

dusk cobalt
tight phoenix
#

I am working on a distortion effect.
Correct me if I am wrong but should the effect be changing as the camera moves? The distortion plane is not moving so I don't understand why it changes when the camera moves

#

entire graph currently

#

I -think- I want the effect to not change as the camera moves, only as the distortion object itself moves, but I might be mistaken in how this all works

#

A second problem im having is on top of changing as the camera moves, the distortion also gets more/less pronounced the closer/further the camera is to the distortion plane

#

The expected behaviour I would expect is that the distortion amount and position is completely unrelated to any of the camera variables

#

How can I achieve this?

#

Ah, I solved it, it was because I was adding the screen position multiple times

#

working grapgh for anyone struggling with a distortion effect like I was

#

hmm the effect does get more intense the further away from it you are still, but maybe that cant be fixed?

#

is there a way to correct this so it doesnt get more/less intense based on distance from the effect?

supple thistle
#

Does anyone here know how to do shaders and would be willing to help me with something?

#

im trying to find a doom crucible shader, I would be willing to pay someone to make one

little widget
#

I have asked this over in Amplify shader and didnt get an answer. Since many have both ASE and ShaderGraph how does one go about selecting the correct shader tool when trying to edit a shader?
What is everybody doing?

deep mason
#

I have a custom shader, but it overwrites my UI like so:

#

Why could this be happening?

merry rose
#

Hi, Any idea how can I calculate a tangent while only knowing normal on a quad sphere?

deep mason
merry rose
lean lotus
#

hey is there something like the cuda activemask in HLSL?

spring sparrow
#

Anyone know if you can use the animation timeline to blend between two materials.. the system in using doesnt allow for any scripting to be used just animations

knotty yarrow
tight phoenix
#

I am looking into the SRP Batcher and changing a 'color' variable on a shader/material without generating tons of new materials

#

Does anyone have a link to a working example of this? MaterialPropertyBlocks in the past were able to do this in the past, but ShaderGraph/Unity seems to focus on the Batcher now