#archived-shaders
1 messages ¡ Page 239 of 1
use the button in the last image i send
Shader graph can now let you chose the anisotripy level directly from graph view (Shader Graph 14)
fixed the crash, a bad shader wasnt compatible with my gpu but its still rendering black
Is there a way to make a shader's parameters change / store separate values per instance of a material?
I noticed an option that looked like it allowed for this Shader Declaration: Per Material but it doesn't do what I thought it would.
Basically I am changing an opacity parameter, but when I change this in the sprite renderer material settings, it affects all of the other GameObjects using that material:
Ideally want a separate value for each
I realise the alternative is editing the alpha value of colour of the sprite renderer but wondered if you could do it with the shader instead (as I have other shaders that are more complex that I would also prefer to have separate parameter values)
Hey is it possible to use the Fresnel effect on a Quad and have its origin be the center of the quad? I tried taking the UV and subtracting 0.5 but it no emitting from the center
im so dumb i have a script setting vital global variables but only did it in onvalidate
how would i make the object render different render textures to each eye (urp)
I am not too sure if this is the correct channel for this but I will try it anyways:
I have bought the Zombie Collection Asset in the Asset store. I already have imported it and some of the materials were converted to URP.
Sadly, the majority of the materials CANT be converted to URP and i am not too sure why.
This is the error I get:
Could not create a custom UI for the shader 'Knife/PBR Double Sided'. The shader has the following: 'CustomEditor = ASEMaterialInspector'. Does the custom editor specified include its namespace? And does the class either derive from ShaderGUI or MaterialEditor?
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Can somebody please help me with this? Please ping me on reply
Hmmm guys, I designed a 2D Shader for water zones. I designed it for a regular quad. Later I tried to design something for creating dynamic ripple when the player enter the water through a custom mesh. Yet of course the material doesn't act as intended on this mesh. :S Does anyone have experience applying shaders to 2Dmeshes ? :S
anyone had idea for such error like this ? in short, i've been created my own basic shader, with "basecolor" properties exposed, error warning comes after i created my instanced material. i dont know what to do since, i've changing my variable name into several but warning error still coming out. is this bug or i did it wrong ?
btw, even i changed into different name, the error still shown same as on console.
but in game scene, when i applied textures, the texture color still show up normally,
Using shadergraph, is there a way to get a lit transparent object to receive shadows?
it should work out of the box, just make sure you have "receive shadows" enabled from SG's graph settings
it should be like this by default afaik but maybe yours have it toggled off?
It is turned on, but It's not receiving any shadows, but it does receive shadows with Opaque surface type
@primal harnessis it really receiving issue then? sounds like you are more of having issue on casting shadows from transparent materials
which - if you use URP - is actually only an issue if you use stock URP Lit shaders and not their SGs
@fervent tinsel Example here, Surface type is Transparent and receive shadows is toggled on, but the blue plane is not receiving shadows from the cube in the middle
@primal harnessis the cube on the middle using transparent material?
no
is the cube in the middle set to cast shadows?
does it cast shadows to other objects?
yes
no idea then.. works on my end
Alright well thanks anyways, I'll keep experimenting.
@fervent tinsel Could you show me your setup so I can try and replicate it?
dunno if it makes much sense since it should work out of the box
so.. I guess try to repro this on new project if you can't figure it out
So I just did a test in 2021.3.0f1 and it works!
Hey I have following Shaders from the Zombie Collection Asset by Knife Entertainment: Fire, Fresnel, PBR Double Sided Cutout and PBR Double Sided.
Can someone please help me upgrading them to URP? I just cant because of this:
"Theres no upgrader to convert Knife/PBR Double Sided Cutout shader to selected pipeline.
Bruh I seriously need help with this. I would be so grateful if somebody could help me.
Check if the asset contains a URP version of the shaders. Maybe try contacting the asset make to ask for it.
The only other way is to redo the shader using shadergraph to make it work on URP.
I already asked the author but they seem to be "gone forever". I was just wondering because everbody else (as far as I can see it on youtube) has managed to work with the asset perfectly fine.
I thought it would be an error on my side.
Is there a way to open existing shaders with the shadergraph or do I have to make them from scratch?
No way to open existing shaders (code) into shadergraph
Okay thats sad. Thanks for helping me.
Maybe if the shaders were done with amplify shader editor you could open them again with it and convert them to use the URP target.
Yes the first comment in the script says "Made with Amplify Shader Editor".
Guess I have to buy it then đŚ
how do increase the value of a property/float in a shader graph over time in a script
Like with regular shader/materials, use Material.SetFloat()
I love you it works now â¤ď¸
hey is there a way to use urp features in my unlit shader?
What do you mean ?
URP is a render pipeline which means setting that up for the project as default render pipeline will make all the shaders go through that/'use' that.
well im trying to make it so i can use integers in my vertex data however I can only do that in a custom shader not shader graph but i still want all of the positives of using a lit shaders in my custom shader is there a way to do that?
You can use integers in shadergraph đ¤
If you want to stick to non shadergraph, you'll have to work your way through the multiples passes urp uses.
A way to do make this easier is to build a skeleton of shader using shadergraph, show the generated code and use it as a base for your custom shader
having this weird issue where the alpha on my mesh is culling the rest of the mesh, but only from certain angles
it happens when depth write is on
without that checked, the whole mesh just overlaps itself
any ideas?
i just want the transparent part of the texture to act transparent without it doing all this weird stuff
Wouldn't that be nice
It doesn't look like the material utilizes any transparency so you probably should be using an opaque cutout shader
here'show the texture is baked;
https://media.discordapp.net/attachments/963475869488271360/964224375870079026/unknown.png
the decorated part is a flat plane using an alpha
So try the opaque cutout
the egg part will be semi-transparent as well, just not showing it here because of the clipping it looks very messy
Cutout requires you to define a cutout threshold
oh is it under rendering mode? i only see opaque and transparent
no option for cutout
Use a transparent material for the egg, opaque cutout for the grill and opaque for the ring
Cutout may be called "alpha clipping" also
You may need to enable the option within shader graph to see it
found it, but it's still doing this:
https://gyazo.com/dbcbf314df50321ad99f01be05757bb9
Hard to guess without knowing the shader graph settings
I would use three different materials
Considering one part needs transparency, another needs cutout / alpha clipping and the third one needs to be plain opaque
Am I setting this struct wrong or something?
struct IntAndFloat
{
int intDude;
float3 floatyDude;
};
RWStructuredBuffer<IntAndFloat> myBuffer;
...
//Later in code
...
IntAndFloat myVar;
myVar.intDude = 4;
myVar.floatyDude = float3(1, 1, 1);
myBuffer[id.x] = myVar
I'm trying to get this buffer into another shader but it's not working, all the float3 values are just origin, so I'm not sure if I'm just setting the struct wrong, or if it's something else? But I've looked a lot and can't find any other issue, I'm setting it all correctly and the buffer is the right size etc
I feel like the struct should be get with a constructor but compute shader hates that...for reasons
One thing you can do (and the optimizer might even re-write that code to do this) is to assign it this way:
myBuffer[id.x].floatyDude = float3(1., 1., 1.);```
that saves constructing an IntAndFloat and the later assignment.
But IDK what's giving you zeroes (I think that's what you said you're getting).
I'm trying to get the water to hide in the boat, however in that box collider that i put the shader material on, the water is still visible. When viewing from outside the box collider, it works as intended. Any ideas on how I can make it so that the water is also hidden when inside the box collider? (I'm a little new to shaders generally) I used this script:
SubShader{
// Render the mask after regular geometry, but before masked geometry and
// transparent things.
Tags {"Queue" = "Geometry+10" }
// Don't draw in the RGBA channels; just the depth buffer
ColorMask 0
ZWrite On
// Do nothing specific in the pass:
Pass {}
}
}
tried that too, didn't work, will look into it more tomorrow I guess
in that case you should instead of using the depth test as culling, use a stencil buffer, and an inverted mask mesh (render with Cull Front tag)
@cosmic prairie how I see it, @lyric oyster is using old unify wiki depth mask example here and it actually works for him on that example. the main issue is that he tries to treat is like a volume instead of material
@lyric oyster in other words, when you are inside a cube mesh, your camera will not normally render it, this is why the effect gets lost when you move inside it
link for the wayback machine for that original wiki page: https://web.archive.org/web/20210308125015/wiki.unity3d.com/index.php/DepthMask
unity has taken that wiki offline already
I reformatted my PC recently and after reinstalling Unity and reopening my project, one of my shaders is no longer working and I don't remmeber how it was made well enough to debug why it stopped working.
Exact same version of Unity
Its really hard to debug shadergraph shaders as well
As far as I can tell, the Scene Color node is no longer showing any of the scene
The effect used to distort what the scene looked like behind it, but now it just renders nothing
Does anyone know possible reasons why this could occur and how I would debug to find out?
my entire shader right now is just this, and its still a blank square
if I turn off opaque texture, I get a grey square
if I turn it on, I get a square of nothingness
New to the whole shader game here so please keep this in mind lol. I am creating a hex map and am generating a mesh for each hex that I need to do some highlighting with. I am using URP and want to use shader graph to create a shader that will highlight the edges of the hex plane mesh. Essentially I am trying to figure out the node sequence needed to get the edges of the plane. With how mysterious and powerful shaders are I imagine this is doable. The mesh is generated with triangles from the hex origin to each adjacent set of outer points. Any resources or advice will be greatly appreciated. Thanks all!
Someone up here was going something extremely similar: #archived-shaders message
.
Hi, I'm creating a scrolling effect and it's working pretty much fine but there's a weird bug. When I'm in the scene view, the picture show up properly, when the game is build too, the picture is nice and transparent ... But on the game view in editor there is a weird background ... Any idea of what I'm doing wrong ? I'm using Unity 2022.1.0b
Nevermind, it's a bug of 2022 version ^^' Work fine on 2021 version
Hey, I hope someone here can help me
I have an outline shader (cf: img 1) that heavily rely on DepthBuffer and SepthNormals buffer (like.. 2/3rd of the shader is filtering depth and depth normals)
now to my problem: Transparent objects are not writter in the depth buffer so I have some trees without outline (cf: img 2)
I am using Unity 2021.2.15f1 with URP 12.1.5
thanks in advance
You need the opaque texture on for scene color to work. That's what it uses to grab the background.
All I can think of now is to make sure you're in a transparent queue. The opaque texture is grabbed between the opaque and transparent passes. So your shader has to be after that. It should also not write to the depth buffer (transparents don't do that).
I think the trees don't need to be transparent, they need to be alpha-clipped in the opaque queue. Research alpha clip threshold.
P.S. Nice outlines.
Hey,
I am now testing things with the Camera Filter Pack Asset. Sadly, if I apply any filter to a camera (via AddComponent) the camera does not render the effect at all. Its just displaying the normal camera image.
I have added the script directly to the camera (as I said with AddComponent. Am I missing some options I have to configure first?
(Do you have any clue @amber saffron ? I really appreciated your help yesterday đ )
I think this asset is simply not compatible with HDRP
I am using URP
Not compatible neither (it's in the first line of the description)
Oh no
thanks m8
yup it works
still som adjustment to do but it works
yep, that's why I suggested rendering backfaces, and switching to stencil since depth would be no use with the inverted mesh
might need a combined method tho to keep the water in front the volume
do pre-pass of outer volume, render inner volume where there is no outer (stencil, depth ignored), then do both depth and stencil check when rendering water?
as an extra effect you could even render water to the volume where water isn't but would be by the inverted mesh I think
stencil mask would probably be most robust solution.. could also just punch a hole to the water shader in place where the ship is. some games do this, or just displace the water so it's always below the ship
What is the name of the shader where the material acts as a window to a still, unmoving image?
As in, the image looks like it's 2d on the screen, but the material acts as a mask to show parts of the image.
you are basically looking to sample texture using screen space UVs
Alright, perfect.
among first google hits: https://www.ronja-tutorials.com/post/039-screenspace-texture
i didn't know the terminology đŚ
yeah it wasn't meant to be dismissive comment đ just said that was what I found when looking if there was something already for this
oh, fair enough
usually when people mention google it's derogatory
but cheers for the tutorial
or I mean meant to say anyway, didn't mean any disrespect đ
it's all good man, i will get started on this new meme
Is it possible to check if a texture is set in a compute shader?
hey i've got a problem where the faces of each of my cubes facing away from the sun are completely black ignoring ambient color i'm using a custom shader that derives from urp
@keen sparrow care to share how you got your glow shader to work with planes? I am working on the same thing with a hexagon plane.
sorry iv asked a lot of questions recently. I am applying a grayscale shader to my game during a scene just after disabling a UI panel and I get this horrible visual glitch when I turn the shader on where it seems to keep blocks of the panel back.
Did you implement the ambient light in the custom shader?
What's the code?
im just using UniversalFragmentBlinnPhong function
` half4 frag (v2f i) : SV_TARGET
{
UNITY_SETUP_INSTANCE_ID(input);
SurfaceData surfaceData = InitializeSurfaceData(i);
InputData inputData = InitializeInputData(i, surfaceData.normalTS);
half4 color = UniversalFragmentBlinnPhong(inputData, surfaceData);
color.rgb = MixFog(color.rgb, inputData.fogCoord);
return color;
}`
hmm that should have ambient and baked GI, what's your shadow strength on the light?
im not using baked GI im just using realtime shadows and even if i turn shadow strength all the way to 0 it still has the normals pitch black
here is more of the code
yea, but I was just looking at UniversalFragmentBlinnPhong's code
it has MixRealtimeAndBakedGI
or is ambient light different from GI?
I believe you need to use inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.vertexSH, IN.normalWS).
Even if you don't support bakedGI the same variable & macro is then used for ambient lighting iirc.
(or forget the macro and just use inputData.bakedGI = SampleSHPixel(IN.vertexSH, IN.normalWS))
Also with OUTPUT_SH(OUT.normalWS.xyz, OUT.vertexSH); in the vertex shader (after the normalWS is assigned)
i added OUTPUT_SH and inputData.bakedGI however nothing has changed
is there anything wrong with this?
I have such a shader, tell me which way to dig so that you can turn the parameter in the shader settings (slider) and the material becomes flat (just a strip of color without shadows and specular)
like this
any Shader graph gurus here can answer a simple question?
I'm trying to put an array of floats in a struct that's being passed as a compute buffer but I keep getting the error
ArgumentException: Array passed to ComputeBuffer.SetData(array) must be blittable
whats the difference between the interpolator an rasterizor
Does anyone know if Unity 2021.3.0f1 has the shader graph for the built in render pipeline? Im thinking about updating a project so just wanted to check.
It's there
Can someone help me out with this shader bug? I wanted to make a build for MacOS and this error comes. I am using a PSXEffects filter from the asset store and I am really new to shaders.
It works normal when I Build to Windows or Linux by the way
Rasterization is the process whereby the "pixels" are assigned to the polygon. So the vertex stage outputs clip-space coordinates (google that if you must) in floating point and those flat 2D results are "splatted" to the camera's view in a plane. Then, this plane is mapped to the pixels. The pixel shaders are then called for the pixels, with some exceptions for those that are determined not to be necessary (such as happens with early-Z/depth test failure).
Interpolation can now happen, where groups of the processors are assigned pixels to be shaded. The "v2f" structure contains data for each vertex in the polygon. Rasterization decided where all the pixels fell, including edges, in some rational way. The v2f data is "smeared" across each of those pixels according to the pixel's location within the polygon. That's why when you see a typical example of the RGB triangle having colors smeared across its surface from the 3 verts, the colors blend. Most anything in the v2f structure is interpolated (smeared) across the polygon, unless a nointerpolation attribute is given to it. The structure can contain anything, from worldspace coordinates, to colors, to whatever.
This is also why ddx/ddy functions are not available in the vertex stage, that stage just doesn't have enough information since it doesn't even really know the size of the pixels yet, so it cannot tell how much has changed pixel to pixel. That and the fact that it is only processing the 3 verts, not the entire polygon.
So if you need something "smeared" across the polygon, that's interpolation, and it pretty much comes from the vertex stage output and the smearing that happens during rasterization. You may wish to google "barrycentric coordinates/interpolation" too. There's a limited number of interpolators available to be assigned to do that work, during the process of rasterization.
So the two concepts are interrelated and happen between the vertex and the fragment stages.
I am using the unity tree instancesI have a material property I'd like to override _ClassColor("Color", Color) = (1,1,1,1) at runtime that exists on the materials used by the prefab in each tree prototype;
Each instance of the same prototype is one color and so on.
Is there a way I can access the renderer for tree instances on a terrain?
and if not is there a workaround that will let me set this value in the shader?
what would be the equivalent of a color ramp(blender) in unity shader graph?
Is it possible to set the gradient color here to an image, so the time is spread on the image?
for example:
(right now, the entire Image is one pure color.
I want to have multiple colors spread on one image like in the arrow above)
I did find this:
https://answers.unity.com/questions/51283/is-there-a-way-to-make-a-gradient-material-white-t.html
But it doesn't use the shader graph, it's good for now but if anyone knows how to do it with HDRP Shaders I will be happy to know!
you might have to use the uv node
I think there's a way to combine the x variable(right) with the gradient node
I'm a beginner so it's hard to describe
Hi
what do u recommend I use to have some nice shading around my UI ? The shadow component is way too hard for my design
doesn't seem like a shader question
oh sry
I though it was
no one prevents you from using shaders for ui. not sure what "shading around UI" means exactly tho
uuh
one sec
like
at the edges of the navbar, and around the buttons there is a shading
I asked here because I felt that maybe applying a shader could be a simple solution
Hello there, if I have a shadergraph question does that come here?
Id like to ask about using the depth shader node on mobile, I'm trying to make an intersection effect however it seems that while the effect works on pc in editor, it doesn't show up right on Android
My suspicion is something to do with shader precision? But I'm not sure where to set that
Is there a way to smooth out the stepping in a radial mask or soften the edge where it terminates in Shadergraph?
Smoothstep?
i dont understand why my shader isnt working, heres a part of the code:
{
float4x4 mat;
mat[0] = float4(cos(rotation), -sin(rotation), 0, 0);
mat[1] = float4(sin(rotation), cos(rotation), 0, 0);
mat[2] = float4(0, 0, 0, 0);
mat[3] = float4(0, 0, 0, 1);
return mul(mat, float3(0, -1, vertex.z)).xyz;
}
v2f vert (appdata v)
{
v2f o;
v.vertex.xyz = mul(UNITY_MATRIX_VP, rotationZ(v.vertex, v.vertex.x));
o.vertex = UnityObjectToClipPos(v.vertex);
return o;
}```
it supposed rotate each vertex of the plane around the center of the world given the vertex's x position
thus making the plane into a tube
Define ânot workingâ. I donât think that would make plane a tube even if that worked
It seems youâre messing with space transformation quite a lot⌠first youâre doing some rotation matrix magic for local space position, then transforming from view space to clip space and then transforming from object space to clip space⌠Iâm surprised if that works in any reasonable wayâŚ
is 2450 or 3000 good for a Render Queue on integer on a transparent shader? For some reason, I get some drawing issue where it draws part of the back of an object in the front of the object? What shader do I use to stop parts of the back of the object in the front of the object and add reflection + refraction and transparent?
Itâs most likely not about render queue but rather transparent object sorting issue. Transparent objects doesnât (ussually) write to depth buffer so they canât be âsortedâ by depth value. Maybe if you show image of the model, it would be easier to figure out how to solve the ordering issue in this case
its a crystal. crystals are transparent. it SHOULD be transparent but without the clipping.
and game engines should be able to render transparents order right but yet here we are đ
Is anyone aware of a method to render pixel perfect particles? Currently I using a render texture resized to 320x180 and combining that with my main camera. However, this method hurts performance a bit AND doesn't allow me to control the sorting layer of my particles because they are rendered on a separate camera. I have looked everywhere for some sort of Shader that allows me to render pixel perfect/ grid snapped particles, but have found nothing. https://gyazo.com/a6cc82167dd78cbd6a7904c445213895
Here is another example of some wind particles, https://gyazo.com/0972bc8bea5d3d8562f9f9b655dffc93
https://youtu.be/nm3QRLe846M?t=575 how can I achieve this in shadergraph, is there any kind of mapping-node equivalent?
Get my Beginner's Shader Course: https://www.canopy.games/p/procedural-materials-in-blender
Jump on the Discord server for more procedural goodness: https://discord.gg/qEmdVC3
This time we're learning a simple way to create a grid pattern and using randomness in a controlled way with procedural nodes in Blender!
Have you got a favourite node ...
Hey I'm having a rather odd problem that I dont know how to fix:
Multiple objects that share the same shader material are being affected by the opacity of the sprite renderer on other objects that share the material
I have Object(1) and Object(2)
the material parameters are not being touched at all, but when I raise the opacity on Object(1)'s Sprite Renderer component, it doesn't raise the opacity of the other sprite renderers, but the material does become equally visible on all objects that share the material... and if I raise the opacity on another object, its stacks additivley
Is there a way to modify an Array in Vertex stage and then sample that Array in pixel stage?
Hey is there a good way to calculate the tangents and bitangents needed for normal mapping(or any other ways of applying a normal map?) from world space normals and uv's and normals of each triangles vertex in a compute shader?
I'm currently Unity 2019.3.15f and in the create option I cannot find Shader Graph option in there, I've been searching for solution but can't get to solve it, I've made sure to have the Shader Graph installed in the Package Manager, idk how to get the option to appear
Are you using urp or hdrp?
Then youâre most likely using build in render pupeline which doesnât support shader graph
oh ok... then I guess I'll leave the shader graph last to check cause this build I'm using is compulsory for what I'm doing
but it has vfx shader graph?
idk this is here but all I want a blank shader graph
If you want to check your render pipeline, you can go to Edit > Project Settings > Graphics > Scriptable Render Pipeline Settings. It says None if youâre using built-in render pipeline
Atleast vfx graph is not meant to work on birp. According to some unity dev:
Just to clarify things out, VFX Graph is not officially supported and there are no plans to support it with Built-in pipeline. Hence, we greatly recommend using VFX Graph with rendering pipelines.
You would have to add a rendering pipeline
In order to use vfx graph and shader graph, you have to use scriptable render pipeline. Urp is very similiar with built in pipeline
I cannot find it in package manager
nvm I think I have to download lightweight rp?
or any of those
Yes. Urp was called lwrp back in the days. You can follow this to get it working https://docs.unity3d.com/Packages/com.unity.render-pipelines.lightweight@5.10/manual/installing-lwrp-into-an-existing-project.html. Only installing the package doesnât do anything
Maybe try again. I havenât tried lwrp myself (only urp) so canât really help much
I think I have to get rid of the universal?
well, get rid of it before installing the lightweight
wait... it's required
I guess it has to be the same version
well it gets a little bit frustrating because after installing the LWRP I can't even get it in the rendering
no error this time
just straight up nothing
you just need URP, you don't need LWRP
oh
LWRP is just the legacy version of URP
you need to use URP materials in a URP project
you'll have the same issue
hm...
How can I fix this artefacts on outline?
is this an asset or your own thing
my own thing, I'm just trying to make a vfx before implement it into a project
are you using anything special for the material or is it just the default shader?
This is Toony shaders oultine
I made a mesh with vfx on it, that's it
https://youtu.be/12gkcdLc77s
This is for hdrp but the concept can be extrapolated to udrp or lwrp aswell. The main portion about converting textures is the biggest thing youll have to focus on by the sounds of it
Upgrade to HDRP and take your graphics to the next level!
This video is sponsored by Unity
đ LINE OF CODE: https://lineofcode.io/discount/SHIRTMEUP
â Temple asset: http://devassets.com/assets/mayan-temple/
â HDRP Documentation: https://bit.ly/2tyBHyz
â More about HDRP: https://bit.ly/2BOBvPZ
â Upgrading to HDRP: https://bit.ly/2VjfMr1
â ...
Yes, in fact that's a good "trick". But it only works at certain hardware levels, and maybe on certain devices. Like Direct X 10.1 or higher or whatever the requirement is. "They" allowed the vertex stage to bind UAVs and such and modify them. So you can create a compute buffer/Structured-Buffer and use it as an array for example and modify it in the vert stage, read it at the pixel stage.
BUT...make sure that you can't just pass whatever to the pixel stage directly, that you have to do what you asked about, as it's more efficient to just pass it in the v2f.
(Sorry @lean lotus , I quoted the wrong post)
^^ See above
If it didnt have a material it wouldnt be pink
And you wouldn't be able to see it
for the love of everything holy, why can I not edit the colour node
Im going insane
Hi there, I am working with URP and Core RP librarires and was using unity 2020.3 and upgraded to unity 2021.3. That however seems to have broken some dependencies and is now asaying that stuff was not defined. Currently learning HLSL shaders/compute shaders. Reimporting everything, reinstalling core RP, even just moving the files to a new project/rewriting just didn't work. Anyone came across this issue or knows how to solve something like this?
is it possible to modify the surface options during runtime ?
Hello I'm a poor 3D Artist trying to implement shaders, I'm using Shader Graph and would make a texture scale within the objects, it doesn't work beacause I used a Position World node to achieve the effect I was looking for. I broke the internet looking for a solution, any ideas?
Yes, but not easy as most of the time it needs to enable/disable keywords and passes (in particular for HDRP), and in a build it will need the corresponding shader variants to be available
Could you explain what you are trying to do, it's not very clear to me what the objective is here.
i'm using urp
It might still be valid đ
But furthermore, URP doesn't implemet (yet) surface options on the material level when you're using a shadergraph. The best thing you can do is to have variants of your materials with the surface options you want at hand, and swap them
Basically I want the tiling of this texture to scale accordingly to object scale instead of remaining the same
You could use the object scale (there is an object node) as input for the tiling
It doesn't work
Like, it doesn't do anything ?
No at all
but this is a bit messy no ? Like duplicate all materials ?
Yes, it is messy.
It could be automated in the editor if needed, the question would be : do you really need this ?
Strange, it should đ¤
I know I don't like it too XD
i don't know, i'm here to find idea to solve my problem đ
But I'm almost a beginner so probably I'm forgetting something but I dunno what
And what is the problem ?
mybad i thought i posted it in this channel but it was in urp one.
hoy, i want to do turn objects between player and camera transparent. But, we are using decals so, we can't turn surface type from opaque to transparent. So I thought of doing a render pass feature but i don't know if it's a good idea and also if eys, how to do it well.. Any help ?
There is the good old dithered transparency trick đ
but my artist won't like it..
If object scale is not working, you can "hack" by transforming a vector (1,1,1) from object to world direction.
Take only y+z of the result, and they should give you a scale value
everything is a problem lmao i need to choose the best solution đ
If everything goes bad, I'll do come here again XD for now thank you đ
Then, look for the keywords/passes solution.
I'm not sure rendererfeatures would help here
yeah, but, by doing that it won't solve the probel of the decals right ? it's real alpha without decal or dithered with decals right ?
How can I get the light effect of the shader from directional light?
Shader "CustomShaders/ThreeColorsGradientShader" {
Properties{
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
_ColorTop("Top Color", Color) = (1,1,1,1)
_ColorMid("Mid Color", Color) = (1,1,1,1)
_ColorBot("Bot Color", Color) = (1,1,1,1)
_Middle("Middle", Range(0.001, 0.999)) = 1
}
SubShader{
Tags { "Queue" = "Transparent" "RenderType" = "Transparent"}
LOD 100
Blend SrcAlpha OneMinusSrcAlpha
ZWrite On
Lighting On
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "UnityLightingCommon.cginc" // for _LightColor0
fixed4 _ColorTop;
fixed4 _ColorMid;
fixed4 _ColorBot;
float _Middle;
struct v2f {
float4 pos : SV_POSITION;
float4 texcoord : TEXCOORD0;
};
v2f vert(appdata_full v) {
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
o.texcoord = v.texcoord;
return o;
}
fixed4 frag(v2f i) : COLOR{
fixed4 c = lerp(_ColorBot, _ColorMid, i.texcoord.y / _Middle) * step(i.texcoord.y, _Middle);
c += lerp(_ColorMid, _ColorTop, (i.texcoord.y - _Middle) / (1 - _Middle)) * (1 - step(i.texcoord.y, _Middle));
c.a = 1;
return c * _WorldSpaceLightPos0;
return c * _LightColor0;
}
ENDCG
}
}
}
Yes, I don't think URP implement decals on transparent objects
yes is it the only one cons on the doc lmao
Thanks, I'll look into that, but figured I probably will calculate the thing on CPU as it does not need constant updates.
Hello, i am a shadergraph newbie and i am trying to make a Shader in shadergraph that automatically tiles a Texture for differently sized cubes.
I need to be able to scale the cube in all directions while the Texture automatically repeats and sits correctly on the cube. already found a way to do this by feeding a world Position node multiplied by prefered texture scale into the uv of the Texture sampler. Howeveri need to be able to move the cube, and still have the texture sitting on it. With this solution however, when i move the cube, the texture moves along the cube into the opposite direction.... The other thing i tried was multipliying the tiling by the object size. This however only worked as long as the cube had all 3 axis the same size. As soon as scaled it to Something like (3;2;3) the Texture was stretched in an ugly way.. cannot think of any other solution, tried everything i can and googled a lot.. Please help me, i have no idea how to get this done..thanks a lot!!
Add the cube position to the world position before your coordinates calculation to take it into account when moving the cube
@amber saffron okay thank you, i will try this!
@amber saffron it's working, substracting did it, thanks a lot!!!!
But if i rotate the cube the texture rotates in the opposite direction, how do i fix this?
Now this gets a bit more complicated.
I suggest that you look at the "triplanar" node that will greatly help you for your goal
And instead of world space position, I think that object space position, scaled by the object scale, should work
@amber saffron unfortunately this does not Work
@amber saffron you mean multiplying object scale by object space position and feeding this into the uv?
Into the position input of the triplanar node
@amber saffron unfortunately this is not working
There's something to do with this, or play with the transform node, but I'm to busy to try it out myself right now
Is there a way to make a "6 planar" shader, so the backside is textured too?
https://www.youtube.com/watch?v=dFDAwT5iozo following the first part of this tutorial, i have made a shockwave shader for 2d. does anyone know how i could make the sprite it is on transparent but keep the shockwave effect? and even further, does anyone know how i can add more than 1 ring?
A shockwave shader graph (or shock wave shader graph) is a relatively simple effect, that can add a lot of pop to actions in your game.
Shockwave updated for 3D in my timeline video here: https://youtu.be/A5jl5RVEjqE
The reason I'm doing this tutorial at all is because someone commented on one of my YouTube videos requesting it. I bring this...
In the shader graph you should be able to enable double sided and it will apply it to both sides of a face
does someone know if i can develop a shader for textmeshpro using shader graph ? (urp)
does anyone know why this error is poppping up?
Texture 'lut' is not readable, the texture memory can not be accessed from scripts. You can make the texture readable in the Texture Import Settings.
I'm trying to use a texture as a LUT for my shader
Select the asset and look at the inspector, which turns into the import settings. There's an option to make it readable.
ah I found it
I now have a different issue though, it is not scaling with screen size properly
is there a way i could input materials into properties of a shader?
basically what im trying to do is have a cool transition between 2 materials
(also i cant use scripts)
make one shader that has the content of both and lerp the end values of the calculation based on the blend you want to make
just plopping in another material is not a thing.
hey everyone
in the standard shader if I set o.Emission to 1 on every pixel it sets the emission to white across the whole object
which probably sounds like what you expect except that o.Alpha is being controlled by the texture
is there no interaction between the alpha and the emission values?
in other words: it's multiplying pixels by the emission color even when their alpha is zero and that seems like something that the standard shader would have accounted for no?
im curious if o.Emission has 4 channels or only 3
Hello everyone. I am completely new to Unity and have been having the same problem with each new project I make. My material colors are severely off and I have no clue how to fix them.
this is supposed to be gray
Upload an albedo or adjust the color of it (white box beside albedo option). The shader might not have predefined base colors
looks like your texture has color
I found that when I untick the reflection box the colors return to normal.
I don't know how to permanently fix them though
why doesn't HLSL have a pi keyword đ¤
How do i go about connecting these two to the base colour?
Most examples I see online show the bottom part connecting to the uv of a texture 2d node.
So i'm unable to find examples of how this setup would work
different results in game and editor view
what's with this đ¤
oh i fixed it
wrong render queue
connect the world space RG into the UV for the simple noise. Then the output of the sample gradient into the base color.
real quick
in a shader is it faster to use UNITY_ACCESS_INSTANCED_PROP at every use or only once and save it to a variable for the otherss?
neat
thank you so much! I knew I was overlooking something right in front of me, lol. I should go through the documentation before jumping into this first.
Probably better to put it in a local variable rather than used an indexed memory lookup each time. That said, there's a limit to local variable storage, and also the optimizer may just hoist that usage out and make an internal local for you anyway...so you may not see a performance difference if it realizes that it can do that for you. Depends on how smart it is, I mean, if you have a lot of expressions around it confusing it it may decide that the local resource usage is better off another way...or whatever. Not really a compiler expert, but yeah.
Hey all, Is there a shader node that measures the depth of a line going through the object from the camera and a certain pixel?
I want to make sort of a foggy effect
https://youtu.be/RyXcXm8b21k You may be thinking of an effect like this
Hey, I'm trying to publish my still life tutorial build but it's throwing an Internal Server Error while processing. Any tips?
hey so im getting desperate here, does anyone know whats wrong with my normal map application? to the left of the line is the world space normals, and to the right is supposed to be the world space normals after applying the normal map(after multiplying by 0.5, and adding 0.5 to convert it to [0,1])
As you can see, for some parts, the overall normal gets changed in some places and I have no clue why...
this is what its supposed to look like
ok
im even closer
but there seems to be like a constant direction offset...
Yeah ok I do not know
The calculated normals in places go screwy as soon as I try to apply the normal maps(again, left of line is world normals, right of line is world normals with the normal maps), you can see things that Iâm talking about in places like the arch of the 2nd pillar on the left, world normal is one color, but the normal map turns it yellow
is there an outline shader that doesn't require that I put an object on a specific layer named "Outline"
I use layers for raycasting in my game and need the Player to be on the "Player" layer.
does anyone know why my shader only updates whenever I move?
If you mean in editor, you want to enable Always Refresh under effects button
where is it located?
ah
do you know what to do cause an error keeps popping up telling me to remove
UNITY_MATRIX_MV from my code
also for some reason I'm unable to edit the texture ?
it's grayed out
It would help if you showed the whole shader code and the error message
sure
here, I'm getting two warnings
Use of UNITY_MATRIX_MV is detected. To transform a vertex into view space, consider using UnityObjectToViewPos for better performance. and [Worker0] Performance warning: There are more than 100 preview scenes. There might be code not releasing the preview scene after creating it. plus I can't edit the texture because it seems grayed out. @dim yoke
hello?
Hello đ. [PerRendererData] makes you unable to edit the texture. Just remove that. The first warning have spotted you use UNITY_MATRIX_MV even though unity provides a function to do the transformation from local to viewspace for you. In this case youâre not simply transforming between coordinate spaces so I donât think you can use that, just ignore the message. I donât know what that second warning means, maybe google would know
ah, thanks a lot!
could you link me any tutorials for implementing normals maps for shaders? đ
I couldn't find anything online for HDRP specifically
also tiling does not appear to work, is this something you have to do yourself? I'm a complete newbie when it comes to shaders
What sort of shaders? Youâre not meant to use shader code in hdrp (until surface shaders are released), you are pretty much forced to use shader graph
is using the code I showed you above okay or should I try to redo it using shader graph then?
also about tiling...
If it works, no problem but hdrp shader code tends to be very complicated and not documented at all
yeah I can see that now
though do you know how to fix the texture not tiling? it staus the same even after increasing it
You could try to use TRANSFORM_TEX in the vert function same way as itâs done here https://github.com/TwoTailsGames/Unity-Built-in-Shaders/blob/master/DefaultResourcesExtra/Unlit/Unlit-Normal.shader. Donât know if that works in hdrp shaders too
got this error Shader error in 'Sprites/Glitch': redefinition of 'vert' at line 211 (on d3d11) but I am 100% sure it's somehow my fault
actually yeah it is give me a second
fixed the other one but now getting this Shader error in 'Sprites/Glitch': undeclared identifier '_MainTex_ST' at line 191 (on d3d11)
Can you show the current code (use codeblock or paste site, reading txt files on mobile is painful)
v2f vert(appdata_t IN) {
v2f OUT;
UNITY_SETUP_INSTANCE_ID(IN);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
OUT.vertex = UnityObjectToClipPos(IN.vertex);
//OUT.texcoord = IN.texcoord;
OUT.texcoord = TRANSFORM_TEX(IN.texcoord, _MainTex);
OUT.color = IN.color * _Color;
#ifdef PIXELSNAP_ON
OUT.vertex = UnityPixelSnap (OUT.vertex);
#endif
return OUT;
}
sure, should I put the entire thing there?
You could share link to paste site because itâs quite long code
sure
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I managed to fix it!!!!
Btw I think you have to add that code to both vert functions. You could try to move this line up here and declare float4 _MainTex_ST; as shown in the page I linked
yeah this is what I did to fix it
I'm sorry to keep asking you questions, but do you have any idea why making my code try to react to light makes it purple?
I donât know. I donât really understand most of that code. I gotta go bed now
since you see it looks nothing like the other material using standard HDRP lit around it
good night
hey - would anyone with experience with Unity Graphics Programming and compute buffers be interested in helping me out with a very simple job (paid) job. As mentioned it's very simple and is for an art project, so doesn't need to be professional level. The job would involve simply porting over a shader from unity into unreal and slightly modifying it for unreal.
If you are interested - DM me! Thanks~
Shader error in 'spriteGlitch': CGPROGRAM cannot contain #pragma surface as well as other programs at line 35 how come it had that same thing in the literal docs wtf
Would anyone know why VFX Graph would not display any particles (imported the package, added to scene, no luck).
I am using URP and when I re-create my steps in a new blank 3D URP project it appears to work just fine...
uhhh built in shadergraph can receive shadows, right??
I am doing just a basic texture setup
but my materials arent receiving shadows
okay nvm material override was set to transparent
got really worried for a sec there
Would anyone know how to make a shader so that each triangle has its own color for all vertices?
possibly SV_VertexID would be useful? https://docs.unity3d.com/Manual/SL-ShaderSemantics.html
Unity seems really bad when it comes to importing shaders into projects. Often, importing a package results in half the shaders being incorrectly imported and objects simply appear invisible (2021 LTS). Worst is that all this is silent and no errors are thrown. The fix is to literally right click and reimport the package a few times until Unity eventually figures it out. What's going on here? Is there anything I can do to make unity import shaders to the project more reliably?
Usually it occurs for shaders that UsePass, I assume it's something like the other shaders are not yet imported so the passes are missing. Is there a way to declare some order of import?
Uhh. Something's wrong with my shader...
If you know how to fix this please tell me
Won't know without seeing the shader
Is there a good way to share it? Or do I just make a few screenshots of it
It's kinda big
There's no one super practical way but screeshots can work if they're readable
Hmm I don't see an error with it
My foam is also broken
It doesn't show
I'll just finish the tutorial, and see if it's still broken
Weird...
Maybe it's not the shader, but a property of the material or camera that's breaking it?
im getting a syntax error at line 28 and i cant really se anything thats wrong here
o wait the line numbers arent visible.. line 28 is the 2nd to last line
o wait am i missing the pragma?
Ok well I fixed the waves, sort of. They aren't white and I can't figure out why. The second pic is how it's supposed to look
If the scene lighting doesn't exactly match, the appearance of albedo/basecolor texture won't match either
Alright
What's the error message? The usual "expecting ...", or something else?
Uh.
Try adding the pragmas like you suggested to yourself.
#pragma fragment frag```
Add a space after SV_Target (shouldn't matter but we're spitballing here).
nothin
Try changing CGINCLUDE to CGPROGRAM
still nothing
its not too big of an issue, i found a different example that works the same way and has no issues
tho, it brings up a new question, i posted it earlier in the wrong channel so i just took a screenshot of it
I'm not seeing a missing brace either.
You're missing a standard include, but maybe it isn't necessary.
#include "UnityCG.cginc"
Or just try commenting that all (whole shader) and substituting something from here:
https://docs.unity3d.com/Manual/SL-VertexFragmentShaderExamples.html
I'm not seeing it.
nm, if you have another answer.
adding it seems to change nothing still
the other example was using standard surface shader, but it still "creates" an error, but the error doesnt stop the shader from working
which is annoying
but it works
Ok the shader is completely broken even though it's the same as in the tutorial
Hello and welcome to, like, the 10 millionth water tutorial Iâve done. In this weekâs video weâre looking at some more in-depth Unity Shader Graph features to make water, or an ocean, with shoreline/edge foam, depth, and waves.
Shader is compatible with HDRP., Edit: it used to be compatible with LWRP but Unity changed something. I'll update t...
38:53 gives a good view
The foam isn't working;
The normal map for the water looks weird;
The shader follows the camera???;
The depth thing is kinda broken;
The waves look weird
Making 20 pics of it is a but unhandy, so here's the file
Here's the material inspector
I'm using HDRP version 12.1.6
Doesn't have the same issues in an URP project
Does foam work with objects in the water?
Your normals look different than mine though
Are you using the same ones?
No, I don't have the same textures obviously
Ah, could you send those to me if possible? Maybe that's a problem which causes it to look weird
You're using a height map as a normal map so that causes some weirdness for sure
You can fix that by using Normal From Texture node to generate one
But it doesn't explain why your whole sea is dependent on on camera position
yeah...
You could using Position world in "absolute world" to see if that makes a difference
It needs a 2d texture though right? Not a normal
Either that or use a proper normal map texture
I'm not super familiar with it but I believe HDRP uses camera relative rendering which is probably sticking your world position to camera, so try the absolute world
Tried. The shader is just invisible
I changed that to absolute position
absolute world*
Still, if you don't know exactly how to set up normal maps or what are the implications of things like camera relative rendering, it's better to avoid HDRP in favor of built-in RP and URP
yeah
because HDRP expects you to know these things and it'll be a pain if you don't
I mainly chose HDRP because most of the terrain building tutorials were using it...
Someone else told me the same thing
I'll change to urp when things go badly wrong, but I really just want to try it
I do encourange trying out stuff
There's also nothing I can find online about shaders following camera
The fix is as simple as using absolute world space
No idea why it doesn't work for you
It likely offsets the vertices way off somewhere
Considering world and absolute world space use wildly different values
I decided to fly up... high, because you said that
Look
That tiny distortion...
That's the ocean plane....
Quite so!
But I can't reach it?
Okay so uhmmm how do I fix this?
It appears they only show up when they're far away from me
If I get close, they become invisible
ohhhh wait
Got it
Nope I don't
The object goes outside of the camera and gets culled
The wave values (or nodes) are wrong so the vertices get offset too much
Yeah....
more weird stuff
Ok and now it gets super bright when I go further away
this is sooo weird
You should probably practice more with simpler shaders
Yeahhh
This stuff will become clearer in time
but it's a tutorial, and so many people say it works so I expect it to work....
But of course, these weird things happen to me like always đ
And it also turns out it created 53 ocean planes out of thin air
WTFFF
There are many complex things going on in the shader, and there's always unkown variables across unity versions and render pipelines
that's why it's so bright...
Ok now it looks good, though it's culling in weird ways
And I should probably get my eyes fixed. The second comment pointed this out
why is it that when these images dont have a source image they show up with the stencil, but once they have a sprite they disappear?
what im trying to do is to make a stencil for a linerenderer to reveal the jam on the bread, but i can only get it to work and it hides the bread and everything behind the stencil once it unhides the jam
the linerenderer position seem to matter but im not too sure how that works because its supposed to be 2d, but unity 2d is wack
Hey, I really need help with my shader
I'm using hull outlines and I want the outline to be the inverse color of what's in the background/surrounding it
as in, white when it's in the dark
but black when light surrounds it
how would I go around this? I'm using shadergraph on unity 2020.3.26
the final effect would look something like this
if the backround is handled by the camera component you can just pass that value in and do a one minus
sorry, what does that mean?
what don't you get
what value should I pass?
the color
what color??
of the backround
camera.main.backroundcolor
how do i do that in shadergraph?
aaah, thanks!
how would i go around passing that color via property, exactly?
like this?
I have a plant prefab that has a shader on it that makes the plant sway (like wind) and shadows are impacted as well, should this prefab still be marked as static?
make a material and have a script pass the value to the material
Yeah, I'm testing and didn't notice anything, but was just curious if there was a definitive answer. Thanks mate.
Hey, what's wrong with this?
"Colour Close" is a float
ohh nvm Im stupid
It's supposed to be a colour, not a float
If it is a lit shader, it might cause problems as you don't want a static shadow map to shade a moving object. There's other systems as well that could be impacted. See the documentation: https://docs.unity3d.com/Manual/StaticObjects.html
Look at the systems and decide which ones should be static or not.
@devout impis correct that the shader itself won't give a rip, but it WILL move the resulting polygons possibly causing an issue.
@devout imp...@simple violetreplied to your post already.
oh no i know i didn't mean it ina rude way
just, more feedback is always better yknow
can someone help me with a, presumably real easy question? I'm trying to calculate the normal for a 2d sprite from a height map. I've used the wikipedia page to look at the conventional encoding. In the fragment shader I'm using the following trivial logic:
float3 res = tex2D(_NormalMap, i.uv);
i.normal.xy = res.xy * 2 - 1;
i.normal.z = (res.z - 0.5f) * -2;
i.normal = normalize(i.normal);```. Unfortunately the normals are all wrong and seem to interact with light at the wrong angle. The only axis that seems to be correct is the Z axis (as setting both x and y to zero results in the normal being similar to a quad's)
oh I can upload images on this server, nice. Well the left image is the quad with the shader and normal map applied, but it should be black at this angle, similar to the right quad which is using a default shader
there's something really fucky going on with the way the files are stored isn't it? The normals work fine if the asset is labeled an image, but when as a normal map everything becomes seemingly arbitrary
Support me on Patreon â https://www.patreon.com/DanMoran
Follow me on the Twittersphere â https://twitter.com/DanielJMoran
Get the Assets for this Video here â https://github.com/Broxxar/NormalMapping
Music:
Donkey Kong Country: Tropical Freeze - Stickerbrush Symphony, 2014
David Wise & Kenji Yamamoto
@grand jolt
the "problem" I ran into was that the source I was using for the normalmap wasn't encoded the way I thought it would be (I was expecting rgba, but apparently Unity uses the "DXT5" encoding). But this channel is pretty awesome regardless, so thanks. Definitely some things in there I want to watch
Hey, why does the foam extend when my camera gets further above it (or actually, when more of the terrain is viewable where the foam appears)?
This is the beautiful shader graph I made via a tutorial which took me the whole day to complete đ
Unity had a pretty good water shader tutorial in their main channel for urp
this is hdrp
For the boat game
And I didn't like that one
It was too simple
Ůآ؎ا؎ا ŮŘŽ ؾاش٠اشŘŘŘŤŮŘŤŮ
ĂŘŁ آĂŮĂáĂŮĂŮŮآ[ĂŮŮ
Whoops
changed my keyboard language
BEHOLD, the dinosaur's foot water shader @simple violet
There's only 2 things broken with is so far. But those are minor things which can surely be fixed.
Tomorrow I want to add swimming and effects, but that will be hard I think
But anyways, back to this question as I cluttered the chat a bit
In most cases the Foam is based on the depth difference from the water surfece to the ground in screen space
so if you move the camera the screen space changes.
if you need camera independent waves you would either need to render the depth value via a orthographic camera from above or pre bake it into a texture
Hey does anyone know why my normals after applying a normal map are so wrong?
For reference, left side is world space normals, right side is world space normals after applying normal map(all in custom shader)
And at the end is unitys normal draw mode in scene(so what it should look like)
This has been driving me insane for several days now, and im out of ideas for what I could be doing wrong
what file type is your normal map? Normal maps are encoded differently when labeled one than from anything else. I literally just ran into this exact issue
heck ok so I think I did figure it out
I am using linear space
But turns out when I do packtextures with the normal maps
it puts the normal map into a different format, and thus one that is not going to return the same data?
When I changed to gamma it was perfect
Testing now with explicit formats for atlas's
oh packtextures keeps forcing it into rgba32
The texture importer should be set to texture type normal map.
Just use compression format. (Image from Unity docs).
There are macros for decoding them that you should be using if making hand-written shaders.
ah ok
thx
Realized that the packtextures keeps making my dxt5 texture an rgba32 texture even though the format of every input texture IS dxt5
Still havent found why
looking for a shader that wobbles the texture a little bit
like an underwater looking thing
and code, not shaderr graph. anyone know of one?
try on github
wobbling the texture is just applying offsets of various types to the uv coordinates. There's 1000 ways to do it.
You could use another "wavy" texture, grayscale, and sample that moving over time if you want. Then take that sample, scale it to whatever amount, and apply it to your uv reads. That's slower than "pure math" though, since it is a dependent texture read.
YMMV.
If you want to find one, look for "distortion effect" or some such.
any reason for not using a shadergraph? those are supported even in built in nowadays
i tried but i couldnt get lwrp to work with the written shaders i already have
eh, i guess i could just try remaking them with the graph. it would save me a lot of headache
orr just cause another headache
Wait no ok so thats not even it
Hey guys, so im trying to make a a material transparent during runtime and this is what I got so far. I've noticed that it update the material but not until i click on the material dropdown in the inspector. How should i implement it?
When I try and open up a Shader, it just opens up in my code editor? Anyone know why this is happening?
Good luck with patience
What do you mean?
You are going to wait for a while to get answer that I highly doubt u won't
Thats fun
File associations in Windows
you have associated .shader with whatever code editor you use
or, a program other than Unity has done that for you
It's just a text file so you could have it open in basically any text editor.
OK SO I FIXED IT
I needed to SPECIFICALLY
Convert the G component of the atlas from linear to atlas by doing pow(NormalTex.g, 1.0f / 2.2f);
so im looking at a tutorial to make a shadow matte in shader graph but my settings looks different
i dont have that option
I imagine because im using LWRP instead of HDRP.
anyone know of a workaround? i just need a shader that shows only the shadows on it, not the mesh itself
and if not, is switching to HDRP worth it? i just dont want anything too high-pperformance if i dont need it, and so far ive only been using really simple shaders
Does unity have a built in shader editor?
unity has "Code" shaders and shadergraph shaders
for the "Code" shaders you can use any text editor or your normal IDE
"code" shaders have the extension .shader which is just a text file. I'm guessing you're referring to this one because opening a shadergraph shader will automatically open the graph editor inside unity
switching to a cutout shader for the hair should fix it
Looks like your mesh normals are inverted
in blender it is normal only in unity it is like this
blender draws backfaces by default. Unity's default materials do not
Your normals are inverted
i have a question about shaders, i feel like this should be simple to pull off but i am missing something. i've created a shader with a dither fade based off of the distance to the camera. i would like to now basically mask that fade so that it only occurs in the center of the screen. is there a simple way to access the fragment screen space to see the fragment's distance to the center? i though i could simply use positionNDC to grab the distance but i'm doing something wrong
make a quick shadergraph shader with those nodes and check the generated HLSL đ
haha not a bad idea
Which solution would be the best regarding performance?
What?
Atm I'm using "Eye" for the scene depth. Which should I use instead to render the depth value via an orthographic camera from above?
I have the orthographic camera setup, though am not sure how to select it in the shader graph
Or should I edit the screen position node instead?
You may be better off using clip space. So in the vert() function, it outputs clip space results. Clip space is similar to NDC space...but you may have to divide by the .w component.
Anyway, google it. (0,0) is the center of the screen. That's the point. Once you get there you can do a distance() calc from whatever result to (0,0). The ranges IIRC are from -1 to +1 in both X and Y for the camera's frustum, so regardless of distance. It ends up as a 2D kind of "splat" on the surface of the video screen.
You'd pass that value in your v2f structure. The one you got out after using UnityObjectToClipPos (and maybe divide it by .w, which is a perceptive divide, but don't output/return that divided result in the vert function, just stash it into the v2f member variable).
So off the top of my head I'd do something like
o.distToCenter = distance(float2(0,0), o.pos.xy/o.pos.w);```
Haven't tried that in the editor/code, but yeah. Maybe you want a float3 instead of a float2.
And calcing it in the vert() is the fastest way, it will be interpolated across the polygon for you, less work in the frag().
that looks really close to what i tried, i'll give it another shot đ thanks
it works đ
i was doing the calc in the frag shader, must of did something wrong there
Hey, my water shader has these weird greyish spots... I'm guessing it's because of reflections, though how do I fix this?
@naive shuttle if you post the code people can look at it
đ
here it is
The depth should be in the bottom right
Under section "Don't ask me what this is"
ah okay
I'll look at it when I get home, can't open the graph rn
Hey, i'm trying to make an 2D dissolve shader but i'd like the red outline to be fully red instead of additive. Any tips?
You can use Blend node instead of Add to get other other types of blending
I would use Outline Color in the blend node as Blend input, and the uncolored outline as Opacity input
If blending to solid color I mean
I managed to make this little black (shouldn't black never illuminate light?) dot that is so bright that it makes the whole screen white. Guess what I did... I added single elbow node to my shader graph and that happened, lul. Maybe I should report for a bug đ
Elbow node?
Oh okay. I've only heard it called a relay node.
Black pixels causing bloom to kick in sounds like NaN
nan/infinity or something like that
Why is unity viewport so low quality in general?
Like the shadows are all pixelated and my game view is low res
doesn't sound like #archived-shaders related question. try to ask on #đťâunity-talk
ok
Someone please explain how can this (those weird colorful rings) đ˝ be result of using custom interpolator?
Am I misunderstanding something really badly or is it just unity being mad at me today?
Hi ! đ
I would like to know how I could go from a transparent color (a bit like a ghost) to an opaque texture in shader graph ? đ¤
Please do not crosspost
Nope
"Make it look like foam" is quite nonspecific
There are many different ways to go about it and I'm sure tutorials for it too
The type you have there is limited by the submerged object's shape so it's not easy to add texture to it
The "foam" cuts off where the object's silhouette ends
So any texturing or line shape will cut off likewise
Your closest option is to have a texture on the plane surface and mask it based on the foam
You need to connect the A output to the Alpha port
erm@regal stag
Doesn't look like it's using the A output
Thanksâ¤ď¸
thanksâ¤ď¸
this might be a stupid question but does anyone know why my graph shader only results in this missing-texture pink color? no matter what I do with it the result is just pink
that's what happens when the shader is either completely invalid, or it's for the wrong render pipeline or something
I guess it's because I made a universal RP pipeline material? does that mean my project is using a different one?
until now i've just been using the automatic materials imported with my .fbx files.
you have to use materials compatible with whatever render pipeline you're using.
I have a mesh quad that I want to place a texture on
but I don't want the texture to change when the meshquad's scale changes
what do I do?
You can adjust the tiling if the material in the same way as the scaling of your Quad.
Any ideas?
I donât know what is correct then. I donât see what could go wrong if I just put object space position in and interpolate it to fragment shader. I have read the documentation you linked (multiple times) but I donât still get whatâs wrong
That works exactly as I expect it to works despite those weird rings
Sadly I never used this node
Itâs relatively new feature (added on 2021.2) which means thereâs very small amount of information and tutorials about it
Is there a way yet to get access to the wave functions that come with shader model 6 in a compute shader in unity?
What makes you think it's the result of using a custom interpolator? Maybe check that assumption.
The dark colors are negative numbers. You're outputting local position, so you'll get negatives/black.
As far as the rings go, are you sure you don't have two different materials on the object? Or maybe they're the result of overflow or underflow (wrapping around) on the value. What is the precision of your floats? What size are they? How are you stuffing the value into the interpolator? Etc.
Just examples of how/why it may not be the fact that you have custom interpolators. Then again, maybe it IS a bug and you could report it.
It looks a lot like you have two materials to me, but if not, IDK.
In a hand-written shader, nearly all interpolated values are basically "custom". So that in and of itself isn't really a thing to me. I realize that it's a new feature in the shader graph system, allowing you to assign values to the "v2f" interpolated data. If you don't accidentally have multiple materials or something, maybe look at the generated code for some insights.
Thanks for reply. None of these seemed to be the issue but that actually made me realize the actual issue. It wasn't interpolators at all, it was because I put negative numbers to base color node. I have had any problems with that earlier but why it happened now was because I'm first time using URP 3D Core template which applies some post processing effects automatically. It seems Neutral tonemapping seems to be messed up when trying to apply it to negative numbers. ACES on the other hand doesn't seem to have any problems with negative numbers. Because the rings seemed to move relative to the model when I watched it from different angle, I was pretty sure it can't be because of negative numbers/wrapping around. That was actually because the vignette effect (and bloom) is applied before tonemapping and it made the rings move when the object was close to the edges of the screen. That was really dumb issue, sorry for bothering and thanks for helping đ
how can i blend two textures based on a world height value?
ok so now i select texture based on height, but cant figure out how to blend between the two where they meet
you can use lerp node. you can use remap node to specify where the blending starts and ends
Hey again. I just imported the shaders to a urp project though I'm having some problems. I thought you might know how to help me as it does work for you. First of all, my planes aren't moving, they are just flat. Secondly, the colours are weird. The ocean colour doesn't change properly when I alter the colours. The opacity isn't working either....
Could you please tell/show me how you imported it and changed it so that it works with urp?
Oh and I'm using unity 2020.3 with urp. Maybe that's relevant
I imported the shader, made a material for it, assigned the property values and textures you see in my clip
I cannot tell you how it's supposed to work because I really don't know the tutorial you're following
Try making easier shaders
I first had to change the shader hdrp to urp, then change it from opaque to transparent and stuff....
Yeah... will do that first
Right, had to change the build target but that's the only alteriation I made
Hi. Is there a way to add motion vectors to UI Canvases?
World-space UI is unusable when working with HDRP + VR + TAA/DLSS due to the temporal effects making the text and images blurry because they don't have any motion information.
I managed to use custom shaders on UI images, texts to move them to After Post-process pass but now they lack antialiasing so when I move the UI in an way the edges are very noisy.
I tried enabling Transparent writes motion vectors on the shader and material and also in the camera custom frame settings with no luck.
should the lerp time parameter be the output of remap?
Now I have no idea what you have done đ . first of all lerp has nothing to do with time, but yes ig, you should put the world height (you mean y position?) in remap node and then put the output of remap to the T parameter of lerp node to blend between A and B
actually I think you could use inverse lerp like this. is this what you want? (this blends from red to green based on world y position)
should i also clamp values?
with inverse lerp one side is super bright and the other super light
@dim yoke
you can put saturate node (same as clamp between 0 and 1, no idea why it's named like that) between inverse lerp and lerp because inverse lerp (neither is lerp) isn't clamped by default
thanks @dim yoke last thing, what would you suggest to make the transition colors look more natural?
right now too much yellow is passing over grass
maybe i should lerp only alpha value?
Maybe making the transition faster could look better but I don't really know any good ways to make that transition better
Is there any way to blend a PBR Metalic shader with an SSS effect? I have a scanned ring with some pearls inside. Can't find any solution so far...
Unity provides some matrix variables to the shader like projection matrix
I see code sometimes multuply these matrix variables with vectors
But i have no idea whats going on
Is there a resource that shows what i can use these matrix variables for?
This goes pretty deep into matrices
https://catlikecoding.com/unity/tutorials/rendering/part-1/
Anything else?
matrices in this context are generally used to transform world space coordinates into screen space coordinates. This is exactly what a projection matrix is. It has the position/rotation of the camera as well as some "projection magic" built into it to determine where on the screen a given pixel should appear based on its location in the world.
The actual "translation" part happens by simply multiplying vectors by the matrix, following the rules of normal matrix multiplication https://en.wikipedia.org/wiki/Matrix_multiplication
(vectors are just "skinny" matrices, e.g. a Vector3/float3 is a 3x1 matrix)
Hey so Nvidia just released a new blog on nsight profiler, and im wondering if its possible to do this with unity compute shaders? The main bit I wanna know specifically is if I can compile shaders with options, specifically enabling this functionality?
for the blog itself, here it is
https://developer.nvidia.com/blog/identifying-shader-limiters-with-the-shader-profiler-in-nvidia-nsight-graphics/
what's the PBR heightmap neutral value?
Hey. It's possible to get the normal from a texture 2d in a shader graph, though is also possible to get the ambient occlusion map from a texture 2d via the shader graph?
0.5
- Normal From Texture Node 2. You need to write it by yourself
Hey, what is the Alpha in the newer shader graph version? The image below shows what the tutorial sees, and the lowest image shows what I see.
ohh wait, that's only visible when selecting the transparent surface...
Ok back with another question lol. I just made a dissolve shader, though obviously, when you put it on a prefab its previous material gets erased, so you don't see it anymore. Is it possible to make a shader that alters some parts but not everything, like the albedo/diffuse ?
And second question: Can you let players decide if they want it 2-sided or not? Or is that a variable you can only change in the shader graph itself, and not in the inspector?
You want all previous inputs to stay the same and only alter the base colour?
No, the reverse
I want the base colour to stay whatever it was, and alter the emission
and alpha
and alpha clipping
These are the only variables my shaders change
I think you'll have to create a new shader for it at the moment
I want the rest to stay the same
Oh alright
So you mean, I'd have to manually input the normal map, smoothness, metallic, and albedo whenever I apply it to a prefab?
if im understanding you correctly, the prefab currently has a non-editable material/ shader?
does it use an in-built shader or something?
No
It is editable
Hold on let me ss
Ok so this is the current rock which I want to dissolve...
And I want to slap this shader on top of it
Is that possible in a not too complicated way?
ah, i dont know the answer to this Q - i think it should be possible, but idk. sorry for confusing you
https://assetstore.unity.com/packages/vfx/shaders/dissolve-shader-urp-185279 Like this but less complicated
but assuming you can edit the shader in the graph, can't you simply add the nodes that change emission and alpha?
and leave the other inputs be
Yeah true, but then I'd have to do that for every prefab
That's... a lot
And the dissolve should be able to be enabled via a script.
So that the material stays the same until you activate the dissolve, which then adds the dissolve shader without altering the current texture
Im doing a mobile game. The post process is working on the editor but when I build for andorid the post process disapears
This is the custom shader i made for the bullets, as u can see they glow in editor but not in mobile
is there any setting i should change?
Maybe it's a quality setting in project settings. Not sure though
@naive shuttle The shader code that executes the dissolve has to exist on the shader that you're dissolving
I don't know of any reasonable way to hack around this limitation
Normally I suppose you would make a dissolvable variant of the Lit shader that your objects use and use that for all of them
If the property references are identical you can switch shaders in editor without losing the assigned textures and values
I managed to fix being able to add a texture to it, though it's just a bit annoying that these things don't work automatically, like the "Convert to URP" button which you can use with standard shader materials
Materials are stored sets of properties for shaders, it's not possible for a material to exist with two shaders
And how about a button in the inspector (which appears by right-clicking the material you want to convert) that converts the selected material(s) into appropriate materials with the shader? Just like the "Convert to URP" button
I can't think of a situation where that would be necessary
As I mentioned you can already "convert" the material to another shader if the property references match
I wonder if Unityâs ever gonna add a node for custom lighting in shader graph- apparently the only way to do it right now is to make a custom function that calculates it, and i havenât really been having much luck with that approach
Hello everyone. Does anyone know how I would achieve an effect like this using shader graph? I am new to the subject and I'm just trying to understand how to affect a specific range of pixels on a texture to change the color. This range would change based on an input
You would not need a shader for a emissive material
But do what you want ig lol
I'm trying to figure out a way to force Unity's URP Projector to also influence transparent objects. As you can see in the screenshot, opaque geometry is "dimmed" by the projector (basically a Fog of War). Map edge geometry, on the other hand, is not dimmed as it is transparent (fading alpha).
Now, I do know that URP Decal system does not support transparency, most likely due to transparent geometry not being in depth buffer. However, URP Shade Graph provides a way to force transparent materials to write into depth buffer (checked with Frame Debugger, it works). In the latest URP (14.0), there's also an option in the renderer asset to copy scene depth after transparents (instead of opaques).
My question is - isn't there a hacky way to overcome this limitation of the URP Decals? What am I missing? And if there is none, is there a way to write custom projector that would allow me to project a texture over the environment while influencing both opaque and transparent geometry?
Has anyone ever had any luck toggling the ShadowCaster pass in a surface shader on and off using
r.sharedMaterial.SetShaderPassEnabled( "ShadowCaster", enabled );
I've tried nearly everything.. including "SHADOWCASTER". Using Unity 2020.3.33f1
I only need to add this pass to write to the camera depth texture.. If there's another way to write to the camera depth texture that I can toggle on and off, I'd be open to that.
Thanks
Hey, back with another shader problem. I have a capsule of which the material gets dissolved when a target gets close. The problem is, the base colour (albedo/diffuse) which I assigned as red doesn't get shown, though the edge colour (purple) takes over. I can't seem to find what's wrong and I've tried soooo many things. Please help!
I hope these are enough images lol
My URP shader doesn't work, i tried to do this:
i'm a beginner at shadering with unity
But i don't know why the preview is pink
I have now this problem: I have a gradient which has to change color my renderer to be like the gradient
But however, it doesn't change anyway
This is my code to do the change color
But all colors i can put on gradient, it doesn't change anyway
Are you sure a material with the correct shader is applied to the mesh?
yes, but i think it's due to my calculation of my octaves
i'm trying something
Okay the color is well, but the octaves aren't working anyway, i don't know how it is working now, i didn't even change something
Does anyone having any good extensions, or tools that'd help VS understand HLSL, or the unity technologies library to make intellisense more functional for it? It'd be nice not having to navigate HLSL and the unity technologies shader library through search functions and google
Does anyone know of a good custom lighting setup for shader graph? I've been using the one showcased in Unity's 2019 blog on the matter, but it has a few major issues, such as it only accounting for a few lights in a scene, and it generally just... not being very good, as shown here
afaik this is one of the only ways to implement cel shading per-object in unity, so any help would be welcome
Hello, I made a shader with shadergraph but it doesn't work on mobile because generated code is too heavy, most of the code I think is unused, someone could have a look? I'm going to attach the code here below
Hi everyone, i need help on my project đŹ
I have a transparent material using a graphs shader to make a crystal. But one probleme, object inner my object are visible. I wan't to keep my transparancy but hide every part of objects in my other object. How could i do this with my graphs shader please ? đ
You can enable ZWrite in graph settings
Transparency sorting is a difficult problem to solve
It look working !!! Nice thanks đ
Hey guys, I created a Tessellation shader in a game environment to enhance the details. Here is a quick look how the render looks on right side vs how the #tessellation is done in real-time in left side.
This video demonstrates how you can use the Tessellation shader to subdivide a specific mesh. To show detail, we need high mesh, but we can use this concept and leave it upto the GPU to tessellate the mesh at runtime so that we can have low poly mesh in the game.
Runtime tessellation helps in transferring the load to the GPU and reduces the work...
Hi everyone!
I'm trying to complete Catlike Coding's "Compute Shaders" tutorial (https://catlikecoding.com/unity/tutorials/basics/compute-shaders/ ) but I have some issues with scaling. It's part "2.5 URP" in the tutorial where a HLSL script computes a scale and a position of an element. The two issues I have are (I'm pretty sure they are interconnected):
- The CPU-based version of the "Point URP" shader generates much bigger objects then the GPU-based "Point URP GPU" shader, and
- When I use the GPU version of a shader the objects are so small that they don't even get rendered if the amount of objects is high.
The code to control an object size is the following. On the .cs side:
float step = 2f / resolution; computeShader.SetFloat(stepId, step);
And in the shader:
float _Step; ... unity_ObjectToWorld = 0.0; unity_ObjectToWorld._m00_m11_m22 = _Step;
If I use some large fixed value instead of _Step, e.g. 0.2 or 0.5, everything is really great (except of objects not scaling obviously but that doesn't really concern me atm).
Could someone please help me to understand the reason of such behaviour? I spent ~5 hours trying to fix it but now I have no ideas at all.
My code and shader settings are literally as in the tutorial and I'm using Unity 2021.3.1f1 with URP.
Also, feel free to share if you know some nice tools to painlessly debug a hlsl.
Hey, is it possible to add an if statement or a check in a shader graph? I want to check if the user has inputted a normal map, and then use that. But If they haven't I don't want to apply anything
I want to do this, because even when I haven't inputted a normal texture, the material still gets altered. The above image shows how it looks without anything in the normal map input.
The image below shows when I input a sample texture with no normal map into the normal texture
Dissolve Shader
Properties can be set to have default values in node settings
You can set a texture's default value to "normal map" so it will be neutral if no texture is assigned
That's how then looks
That's how it looks when I set Normal Map(T2) to nothing
If I remove those 2 nodes, and just leave the Normal(Tangent Space)(3) empty, it will look like the above image
So, what is the default value of Normal Map(T2) set to?
"mode", it's called by the settings
nothing
... it can't be nothing
Bump should be the same as normal map
Hey again...
I'm trying to publish a shader on the asset store, though it's asking for texture size. What do I fill in here? Do shaders/shader materials even have a texture size?
Hi, I am trying to add bloom effect to this 2D sprite with lit sprite graph, but as I connect the sprite emission, it turns gray and has no effect. Is there a way to add emission or bloom to 2D sprite? Any help is appreciated!
In this video we create an awesome Glow effect for extra flare!
âş Check out Popcore! https://popcore.com/career
â Download the project: https://github.com/Brackeys/2D-Glow
â Get Gothicvania Church Pack: https://assetstore.unity.com/packages/2d/characters/gothicvania-church-pack-147117?aid=1101lPGj
â Learn more about 2D Shader Graph: https:/...
Sprite shaders don't have emission, I believe, but you can get emissive effects by multiplying or adding values so the final color is increased above one, as texture colors are in 0-1 range
Brackeys shows one way to do it but the specifics aren't important, only that the color values are intensified
Hey, I made a dissolve shader though I want it to go up and down, instead of just in random spots. I've already spent 2+ hours trying to get this to work, though it just won't work...
Can anyone please help me?
This is what I have so far
I am watching a tutorial, but when i change the color in the shader as base color, the material dont change
you'll have to be more specific
show screenshots?
i got it, i had to create a render pipeline and add to graphics on project settings
But now everything is pink
i have to create new materials for everything
i guess
it does not upgrade the default materials?
if you read that page it discusses that exact thing
then you didn't read the whole page
So to create a simple shadder i have to change the hole project
What if i only want to have a shader graph material for one object and the normal ones for others? Because i like the default materials
As long as you're using Unity 2021.2 or newer, Shader Graph is supported in all render pipelines. You don't need to use URP to use Shader Graph
Does anyone know why the normal node makes everything grainy?
Im still new to shader graphs btw so i dont know much on these things
all im trying to do is i have a lava shader thats currently working fine and i just want to make it look a bit 3d by adding a normal map to it thats all
my grues is that the strength of the Normal from height node is way to high
I tried all sorts of different values of strengths it doesnât change
Itâs just grainy by default idk why
try to import one from photoshop maybe? (use your grayscale texture and try to convert it into normal) and input it as separate texture sample normal map. maybe the grain would lessen.
You must take the normal from texture at the sample texture node, not the remap.
Can anyone please help me on this? I already went through 4 tutorials though none helped.
I'm not good with shadergraph, but maybe you can take object position from object node and world position node to calculate the texel position, then add texel position y to dissolving treshold calculation.
Or, if your model is unwrapped with head up layout, you can use a gradient look up texture to add to the threshold calculation
because the height to normal node is using ddx & ddy function which works in 2x2 grid, thats why the normal looks 'pixelated'
What's a texel position?
What you need the remap node for? Youâre now making the range of values quite high which is not needed for the normal node. Youâre supposed to use the strength to change the strength of normal map.
Texture and pixel i think
Trying to do a color swap shader, but the shader is only accepting my entire spritesheet which looks horrible in the shadergraph. How do I fix this?
did you create it as a sprite shader?
Tessellation on a sofa đ
In this video, we take a look at a very interesting concept of Tessellation. This is a very useful concept when it comes to adding details on GPU rather than CPU. Fixed tessellation is when we tessellate an object using a shader with fixed number of tessellation parameters. Another way is to tessellate an object based on the distance from the ca...
Is there any shader macro I can use to check if any kind of VR rendering is active? I need sth like UNITY_SINGLE_PASS_STEREO which also works for multipass
Just made a new shader graph to double check, and yes. It's a sprite shader
I need the spritesheet for animations, but well... putting the entire spritesheet in looks terrible
this is what the main preview looks like
hey, i'm ne wto unity and i wanted to know why i have this error in the shading ? i can't find the packages in all the packagings
I think itâs something you could find using a c# script and then based on that enable a keyword on your shaders
Use : multi_compile in your shaders for the same @worldly drift
Want to consider using URP? Whatâs hybrid renderer ?
I thought there might be an existing keyword. For now I just check stereoActive in C# and set my shader variable value depending on it
Whatâs ya trying to do? I earlier there was a sprite renderer and you used to assign a shader to it. Does it not work like that these days?
Ahh okay, I doubt if it is. đ
i don't have URP shading
So, I'm making a shader to replace certain colors from the sprite with a different color. This is the graph I got going, when i put the spritesheet into the texture2D field, it looks like this
This is urp
Yes it would look like that because it samples the whole texture. If you have to run a sprite, you need to change the tiling in xy and give offset xy.
Thatâs why earlier sprites had a sprite renderer with a material assigned to it. The renderer used to handle the uv tiling and offset
Let me see how itâs in urp, I mostly write âď¸
Maybe you need to upgrade the urp version. Can you check what is the version you are using right now via the package manager ?
change the tiling and give offset?
I mean, I am using a sprite renderer with a material assigned to it like this
does the SpriteRenderer display the sprite properly
oh, so turns out that it does actually work, although it looks horrible in the preview window. I just had to increase the "range" of my color swap a little bit and it seems to have picked up the right colors. Appreciate the reply though 
Haha thatâs cool đ
Hi, i'm trying to pass a Texture3D to a compute shader but its not working and giving an error saying that i have to set the UAV flag. I don't see an option to set it on a texture3D, so i was wondering if anyone knows how to fix this error?
You need to set enable random write to true in the texture after you create it
Texture3D's dont have a option to enable random write i believe, only render textures
Texture3d must be a rendertexture with depth, I remember passing render tex as 3d tex
There I had the read/write flag. Tex3d might also have something similar
Yeah i think im stuck using a rendertexture with depth since i did that before and that did work. Because i cant find anything on enabling read/write for tex3d
Thereâs only isReadable
But does compute read n write textures well? I complete forgot what I wrote about years back now đ¤Ł
I believe it does
That doesnât seem like same shader at all⌠I have no idea how you could get that result with the give nodes⌠only way I can imagine is if vertex colors are like that or if Width is 0 and Rectangle node doesnât work as intended because of that
I have a leave cutout texture on a triangle mesh, but when I apply a shader to that material, I lose the cutout shape of the leaf and just have a square. I want to have the shape of the leave but the color of the shader. Is this possible?
Hey there, does anybody know how to do 'SceneColour' in a custom function? I want to do multi-tap sampling of the backbuffer without driving myself nuts with node hell
I've tried 'shadergraph_SampleSceneColor' but it doesn't seem to work
but then sampling textures doesn't seem to work either... unity makes easy things hard
Any image you can share ?
So I want to compile a compute shader to be able to be debugged by the nvidia shader profiler thats part of Nvidia Nsight, but they say that you need to basically compile shaders with arguments, such as "dxc -Zi [..] -Fo shader.bin shader.hlsl"
How do I achieve this through unity for my compute shader so I still get access to debug info?
my current shader are super pale by now, coz it's generated from blender
I'm using blender coz Unity doesn't have material ID for a single mesh selected.
now I'm considering to switched to URP.
it's not described if Amplify Shader Pack are a URP kind of thing or not
Good morning everybody!
Sorry for popping in here with a question, I kind of have an annoying problem that just randomly popped up while adjusting my model's rig (shoulder position) recently and I was wondering if anyone knew what was up.
There's a strange gloss and darkness, on the arms (left image), that is unconnected to shadows, metalness or roughness.
I believe it to be some kind of basic fresnel effect around the edges that vrchat standard shader has and that behaves... irregularly.
Anyone know what could cause this and how it could be fixed?
I use the Standard shader with Normal, AO, Metal+Smoothness & Emission. However it seems that they are not involved, because just choosing any of the "Default" Materials also produces this line. :<
My first guess is that you're using a normal map which is not marked as a normal map in import settings
Or something else is wrong with it, but I'm fairly sure that's a normal map problem
Oooh that's an interesting take, Normals are indeed set to import and the used texture is set as texture type normal map? Is that what you mean?
Yeah, it's correct
Usually if the texture type is wrong it causes that kind of glossy weirdness
You could try removing the normal map from the material to see if that's causing it
Ah yeah I did try that! Even with the regular "Green" Material without normal maps or anything it creates that insane fresnel
Thanks for helping btw, it's very appreciated!
Oh, check for inverted normals
The fresnel works correctly in the body but seems to invert at the elbow
That's definitely a clue
In Blender at least all the faces are facing the right way
I did muck about with the shoulder position a while back, could that cause some weird overrotation that confuses the shader?
Not sure how that could happen, but maybe
Hah oof. It's a mystery
Oooh, if I calculate normals in unity it is fixed, but some other issues crop up
I'm quite sure the arm is inside out
Maybe the bones got a negative scale somehow
Hm, scale is below 1 but positive. But overrotating does seem to cause this effect, even in the recalculated version
ALRIGHT, recalculating Normals in Blender and re-exporting did it!
Thaaaank you so much for the help @grizzled bolt
Hey folks, this isn't exactly a shader question, but might be shader-related. Is there a way, from within Unity, to paint/define areas of a mesh so they can use different material-slots. For example a tree mesh that has one material slot, I instead want to be able to assign one material to the wood and another to the leaves. I know this would usually be done at the model-creation stage, but this is more for prototyping where I'm working with pre-made models and trying to achieve a certain art-style.
Polybrush is not exactly the solution I'm looking for because I want to retain the flexibility of using whatever different shaders I want on the different materials/slots
Hey guys, need some help with a unity shader issue which I am unable to figure out from a while.
It's regarding lighting of the world reflecting onto my character. Is it possible to have independent shadow casting and lighting built within my own shader? This is so the external light does not have much impact onto the skin tone of my character.
Here's a little demonstration of what i mean, i want the same lighting on the back as on the front, but currently the world light is impacting it.
Let's define some terms. đ
A material, in unity, is a shader plus the unique instance of the settings for a particular material...like textures, colors, any passed values.
So you cannot have multiple shaders in one "material", because a material IS ONE shader.
BUT, there are ways to map multiple, different, textures based on settings for each polygon in a mesh, for example. This is commonly done in terrains for example. Unity's terrain system uses a map to decide what texture to draw where. So your shader logic could say something along the lines of "if polygon type is a 0, use the leaf texture, if a 1 use the bark texture" etc. In your shader logic. You could pass an array of textures and stuff a texture index into a vertex color value, for example (and don't combine verts in the model). That would still require you to pass the info in the model, though. Otherwise, from the shader's view, it's shading some polygon somewhere, without any information as to what "type" of polygon it is. Somehow there would have to be a map or an attribute to differentiate each polygon type.
When we put multiple materials on an object, it draws that same object multiple times, once for each material. Often to be avoided as duplicating draw calls is inefficient. But you could have one shader draw the bark, and another draw the leaves, and each would discard what it wouldn't want to draw. That requires 2 passes, and still requires you to indicate in the model or in some external map what type each polygon is, so you may as well draw them all at once in one pass.
Thanks for your reply. Yes I can see some of my wording was a bit confusing, but yes I do understand the basics, I've been doing this stuff for years đ
I just meant I want to retain the flexibility that comes with multiple material slots on a single mesh. Draw calls aren't really a problem in this project since I'm using all unlit shaders with no textures. So while I know how trees for example are traditionally done, this is a non-traditional use-case
Basically in most instances I can apply an unlit single-colour material to an object, say a rock or a wall, but for a tree this doesn't work because I need a colour for the trunk and another for the leaves - so that's my use-case that I'm aiming to solve without needing to prepare or alter any models in 3D software
Hey can anyone please help me on this? I still haven't fixed it yet though I don't have much time left đŚ
I'm quite new to shader graphs so I need a bit of help...
i can make a shade like this on my 2d game?
That doesnt have anything to do with shaders... that's just a 2d texture
OK, but the point is that the shader needs to be able to tell leaf from trunk. How will it do that? I'm not trying to nit-pick wording, I'm just trying to...think out loud and talk about it.
I suppose you could have a material that is, say, all bark. And then a 2nd material that is transparent where the bark is, and is green where the leaves are, but you'll need to UV map it all and IDK how your model is set up. So we're back to modeling again.
Basically, IDK of a way to not UV model, or otherwise map/attribute it so you can tell leaf from trunk. Somehow, that has to happen.
If the tree is already UV mapped, you should be able to "just" substitute a new texture, or in the case of multiple materials, textures. Depending on what the UV model is. You'd probably want some of the texture areas transparent and make sure the material is in the transparent queue and with the proper blend.
Just paint vertex colors on the model with polybrush or something and have the shader either sample the color directly or use it to lerp between the desired trunk and leaves color
He doesn't want to touch the model, though. And that's the problem, and we don't know how the model is set up.
I mean, if he just wants solid colors he can (maybe) swap out the texture. Maybe for a color map. But the question indicates otherwise.
His initial question is "is there a way to paint the model within unity so that..."
He also said he is going unlit with no textures
So a simple vertex color is the way to go imho
"Is there a way, from within Unity, to paint/define areas of a mesh so they can use different material-slots. " Sounds like he wants a color index.
But sure, vert colors might work too if he wants to define them, but he'd have to do that in the model, and he doesn't want modelling software used.
Polybrush can paint vert colors right in unity
We use vert colors for all our material variation
But we have a custom paint tool cause polybrush sucks
Sure, I mean, if he wants a custom shader/material instance, he can paint leaves with one index, and trunk with another index, and then assign two colors in the shader, and have room left over for other stuff.
It would work.
For his Im guessing flat color look sampling the vertex color to push to the frag will be exactly what he wants
Hope he reads this convo hah
Hey everyone, new to Unity/Shaders - is there a way to make a UI panel have a 2d shader? Trying to combine a holographic shader with UI elements to make a "Holographic Inventory"
Hi all. Wrestling with a problem that I just can't solve no matter what I try, and was wondering if anyone would be willing to help. My knowledge level in shader writing is novice; I think this is a shader problem, though maybe I'm wrong?
I have this HLSL shader with one pass, vertex and fragment programs. This shader is meant to render a minimap on a HUD; it does this by displaying a simple render texture that a camera draws onto. It's on the overlay queue, rendertype transparent.
This mostly works, with one exception: I can't get it to draw anything that's behind a transparent material. Instead, all transparent materials blend into the skybox. I've been fiddling with this for hours, and nothing helped.
Any pointers? (Or questions?)
Ok, I figured it out. The alpha channel from the render texture had to be cleared by the shader when appropriate, otherwise it would make this material itself transparent. Thanks anyway!
So I have this asset Ive made in blender and I want to import it to blender with the cycles render engine. Is it possible?
Nothing prevents you from using shaders on ui elements. Are you talking about handwritten shader or shader graph?
Yes, just figured it out, thanks!
has there been any more detail recently on what the shader foundry layer will look like, or other SRP changes?
(I can see the github, but it would be nice to see a breakdown of key changes)
I have no clue where to send this so I'll put it here. The model looks fine on blender but in unity, The textures go haywire and backface culling gets turned on for some reason.