#archived-shaders

1 messages Β· Page 73 of 1

reef grove
#

whats attenuation? the light level?

tacit parcel
#

you need to use the normal dot lightdir for that

#

this line
half NdotL = dot (s.Normal, lightDir);

reef grove
#

well

#

i said in my answer i know thats an option and it wont work

#

i would like it to be more dynamic than that

tacit parcel
#

πŸ€” maybe you can multiply the NdotL with the atten to get the lookup factor

reef grove
#

what is the atten exactly

tacit parcel
#

light attenuation, how strong is the light at that texel (I assume XD)

untold sierra
#

I'm only using unity to turn existing models into avatars for use elsewhere. Is it possible to have a translucent material cull out parts of the mesh behind it? Like if I have a translucent object with a hole set into it, I don't want to see any of the hole's walls looking in through the side.

#

Basically, draw the material as if it were opaque, hiding anything that isn't in front

#

hope this is the right channel

atomic elm
#

Does the built-in render pipeline support displacement maps like this?

hushed silo
#

an actually very basic question here, how do you make it so that you don't see an object through itself if it's transparent. For example, in this image, I actually want the mesh to appear all the same grey, even though it's transparent ( as it's layered over video)

#

It's like I actually want the whole thing to be rendered solid, and then afterwards have it's alpha overridden to .5

loud saffron
#

hi! has anyone had luck reducing shader size for android build? I saw online that one way is to update the player settings as in the image below. But that barely did anything. Shaders are a third of my game's size. It is specific to all the URP shaders like Lit.shader, TerrainLitAdd.shader, TerrainLit.shader, etc.

rare wren
rare wren
rare wren
loud saffron
rare wren
#

There have been 19 versions so give it a go. And in graphics settings you can check shader striping. 68mb isn't that much dependent on your game

loud saffron
rare wren
#

Stip unused. I was more talking about the setting below and in the submenu (urp global settings iirc?)

#

And maybe in the player settings the strict shader matching, but never tried playing with that myself

loud saffron
rare wren
#

And textures, meshes, and audio is something else.
Focus on what is actually used most first. Shaders are probably the hardest to fix, and are not the biggest file size cause.

If it's mostly textures look at crunch compression maybe

loud saffron
rare wren
#

Check the build logs to see it per file

hushed silo
#

yeah I'm devving a thing for quest 3 at the moment

#

passthrough, meshing, all that fun!

untold sierra
hushed silo
untold sierra
#

No

#

And idk if mine can be done compared to yours because it can't be separate code. I'm using the avatar in VSeeFace so it has be done with a material with a built in shader if possible

#

VSFAs allow custom materials but are a nightmare to set up, VRMs are much easier especially since I'm not a Unity user otherwise

hushed silo
#

ah, I'm custom shaderizing everything pretty much

regal stag
hushed silo
#

thanks, can you do that straight up in shadergraph?

regal stag
#

No. If you're in URP using the RenderObjects feature might help.

brazen merlin
#

hello

#

i have a problem

#

i tried using graph shader

#

i was following a tutorial

#

but whatever i do the output is only 1 color

regal stag
# brazen merlin but whatever i do the output is only 1 color

Might just be looking at the dark side of the sphere, I think you can rotate it by clicking in the view. But sometimes it is bugged. Personally I always find it easier to hit Save Asset in the top corner and just apply the shader/material to an object in the scene view to visualise it.

#

Would also depend which render pipeline you're using. I think the Main Light Direction node does not work in Built-in RP.

fair jackal
#

is there a way to disable batching in a shader graph? I have a shader and if I use it on more than one material everything breaks

regal stag
# fair jackal is there a way to disable batching in a shader graph? I have a shader and if I u...

There's a tag you can usually add to code shaders to prevent it batching ("DisableBatching" = "True" under SubShader), but shader graph doesn't allow you to do that. Could copy the generated code to a shader file, edit and use that maybe. But then it's separate from the graph.

But I am curious, what breaks exactly? What objects is the shader being applied to (sprites?). I would probably look into methods to try and fix it breaking before disabling batching.

fair jackal
rich flint
#

How to make the wall on the right darker like the right wall? I am using URP-High Fidelity and new to these stuff so I am confused (shader nodes are not mine)

fair jackal
#

thanks though!

kindred blade
#

I'm working on a little puzzle game and I'm trying to create a shader for the background of the game. The shader I'm trying to create is looking a little bit like Lego Builder Journey's. My problem is that every time I try to actually go into play mode to run the shader, my Unity Editor just crashes. I don't understand where it's coming from and I can't find anything online about it either so maybe someone here knows

#

It works perfectly fine in the Game view, but once I try to run it, my unity freezes and won't unfreeze or sometimes compiles for infinity

regal stag
kindred blade
#

I should clarify, I made a little shader put on a material on a sphere surrounding the entire 'level', the shader is just some lerping math but even if i remove the shader and add any basic shader from unity on a material, it also crashes

#

It appears it's not a shader-specific issue, just more a shader existing in general?

regal stag
#

Does it crash in a new/empty scene?

#

Or could disable objects, try to find which one could be causing the crash/freeze. It's very likely a script causing it, not a shader.

kindred blade
#

You've put me on the right track, let me investigate further, thanks a lot

#

Yeah, it is indeed a C# related. We have a script to put the entire level in the center of the screen, which is probably stuck by hitting the sphere.

#

I think a seperate layer mask should work

regal stag
rich flint
gloomy quail
#

Any tutorial on how to use Keywords to have shader graph that branch depending on wether or not a texture is provided ?

brazen merlin
regal stag
brazen merlin
#

idk what is that πŸ™‚

#

im new to this

regal stag
# brazen merlin idk what is that πŸ™‚

In short they change how rendering works. There's some info here - https://docs.unity3d.com/Manual/render-pipelines.html
Can be kinda complicated, but the regular "Built-in" render pipeline doesn't have great support for shader graphs (the Main Light Direction node here included)
I would either :

  • focus more on code tutorials (surface shaders) if you want custom lighting/shading in BiRP
  • Or if you want to continue with graphs, switch to URP. Can create a new project with the template or install under the package manager. The docs has setup, linked in pinned messages in #archived-urp channel. Most shadergraph tutorials probably assume URP.
regal stag
uneven turret
#

hello, has anyone ever tried sum custom 2D lighting stuff within the shader graph? I managed to get to the lightTexture of the current view, but I struggle to crop it to the rendered object. Also the light texture is black and white even when the light has some color

uneven turret
#

oh mb, I am :/

#

that should have been mentioned

gloomy quail
tired skiff
#

Hi everyone,
I need a local fog volume and I watched many tutorials to make it
I was wondeing if its possible to make it without using the sky and fog volume.
is it possibile to use a fog shader and sse the clouds without the sky and fog volume?

grand jolt
snow forge
#

Hi all,

I'm having yet another brain fart morning.

I've got myself a very simple 'scrolling noise' shader, but I want to have it fade to nothing on the vertical axis of the UV Map, but I can't seem to remember how to do it. lol.

Any pointers in the right direction please? πŸ™‚

eager folio
snow forge
#

Thanks πŸ™‚

stoic oasis
#

I impoorted this material from blender. How do I edit this material? Everything on the material is grayed out

somber arrow
#

How do I remap the Position to give a linear 0-1 range? For example to get a fade along Y axis (either in world space or object space) instead of using the UV.

#

I want it to work regardless of the mesh size or object scale etc.

regal stag
somber arrow
somber arrow
#

I'm working on a vertex displacement that should track shadows, by dividing the main light direction by the dot product of the light direction and up-axis, and multiplying by the object height, to get the offset. But I'm having trouble getting it to work regardless of object rotation etc.

#

In the above screenshot it works fine. But if I rotate my cubes it breaks. I need the offset direction vector to stay relative the world, not the object..

#

Is Light Direction in object or world space?

#

Here's what I have so far.

stoic oasis
#

I am using a script that makes something transparent if it is between the player and the camera by adjusting the materials alpha value, so I need to set the Shader to transparent. Howerver, if I am using the transparent shader, even if I set the alpha to 1, the player can still see through the object.

How do I prevent the object from being see through if I am using a transparent shader.

karmic hatch
# somber arrow Here's what I have so far.

The position node up top is in object space, that might be causing the problems. (And if you're doing everything in world space, make sure the vertex node is also in world space in the graph inspector)

somber arrow
karmic hatch
#

Probably would all work if you transform the light direction from world space to object? (assuming it's in world space to begin with)

somber arrow
gusty temple
#

I am actively trying to flip all of the colors from scene depth in URP SG and each time I do it becomes fully white so it breaks the shader and just makes it bright

#

I tried one minus, negate, flip...

uneven turret
#

in shader graph, how to apply a uv to an already sampled texture? (so not providing it as the UV input of the sample texture node)

somber arrow
somber arrow
#

So now, I have fake volumetric light that follows the light direction πŸ™‚

fresh leaf
#

hi, im making a 3d fps with 2d hands, is it possible to somehow flip how those sprites are being illuminated? I'm using the "Screen Space - Camera" canvas render mode which basically just scales my canvas down and puts it in front of the camera which makes the sprites appear dark when staring at a light source and light when my back is turned toward it.

lament karma
# fresh leaf hi, im making a 3d fps with 2d hands, is it possible to somehow flip how those s...

It's unfortunalely quite difficult to create custom lighting behaviour in Unity without doing a lot of low-level coding (to me at least). It seems like quite a simple problem, but you need to implement subsurface scattering to the object, as the normal can only point towards one direction. For this you need light-data, which is quite a handful to work with in Unity in its current state.

I'd recommend making the hands slightly emissive to make sure that they're visible by the player, even when not lit up by a light source. You can do other tricks, such as flipping the normal when you turn around, or pointing the normal upwards instead.

#

if you want to dig into an actual solution, then you basically want a dumbed-down version of subsurface scattering.
If you have good knowledge of the VFX-graph then this package might be useful: com.cyanilux.shadergraph-customlighting.
I reiterate though, custom lighting is unfortunately quite difficult at the moment.

#

if you are in HDRP, there's already SSS implemented, but it might not give optimal results...

ebon basin
#

maybe some tricks like rendering textures / cameras and displacing the sprite but rendering on the main camera forward

#

or some other similar hacky solutions like that

dapper heath
#

heya, is anyone aware of a way to texture these slopes with a 2d sprite?
alternatively, a way to texture right on top of the slopes (following the border of this plane: https://i.gyazo.com/69b7c1645e8482b65131eb19869f4efe.png)

i've tried a few things, but texturing via worldspace uvs doesn't work as these slopes are at different heights (and therefore the texture tiles differently)

#

what'd make sense to me is probably making something like an outline where the area that needs the sprite texture is white and everything else is black, but i'm unsure how to orient those sprites to face the correct direction

#

i would be trying to use this sprite as reference

lament karma
#

You want to texture the grass in this case?

dapper heath
#

this might be a more straightforward visual

#

basically I want to texture the border between grass and mountain with that sprite

#

but I'm unsure of how to make the texture orient itself to face the edge/corner

#

(ignore the slopes in this case)
getting it to face the edge of the right here isn't too hard, but then I'd need to figure out how to do it for every other angle there

lament karma
#

all the faces with this are slopes?

dapper heath
#

atm it's just a triplanar shader projecting grass onto the top and cliffs onto the sides fwiw

lament karma
#

all slopes should share a texture is what you're saying?

dapper heath
#

sort of

#

i can get slopes to share a texture, my issue is more orienting the texture correctly

#

like how can I have the border face east on the eastern cliffside, f.ex

#

vs. the south, which is the way it's already facing

lament karma
#

the border of the texture?

#

the more grey part?

#

I think I'm missing something...

#

The slopes already seem to be facing the correct direction no?

dapper heath
#

here's a really bad mockup of what I mean

lament karma
#

ah, detecting the edges and changing texture accordingly?

dapper heath
#

correct yeah

#

or rotating it ideally

#

since it'll be the same tex

lament karma
#

right

#

hmm, I mean looking for discontinuity in normals and rotating accordingly is probably how you would do it. Actually implementing that though is beyond me...

dapper heath
#

yeah, i've been trying to look up resources for this but it's surprisingly scarce

#

i'm trying to replicate an effect like this

#

oh you know what

#

i guess i could use the vertex/world height

#

it'd be a very weird interpretation of the word outline but if the vertex below the current one is 10 meters below, you know the edge has to face south

fresh leaf
#

I was hoping that flipping normals would somehow do the trick but I guess it's not that easy, I did see quite a few people have an issue with this while making a 2.5D platformer

lament karma
grizzled bolt
# fresh leaf hi, im making a 3d fps with 2d hands, is it possible to somehow flip how those s...

A solution that's useful with sprites is to implement a custom lighting attenuation that ignores normal direction, only being dependent on distance
Although implementing any kind of custom lighting in URP is not as easy as it should be, it's not particularly hard in this case especially if you only need to skip the normal attenuation part of the existing lighting calc for the desired effect
Here are some resources
https://nedmakesgames.medium.com/creating-custom-lighting-in-unitys-shader-graph-with-universal-render-pipeline-5ad442c27276
https://github.com/Cyanilux/URP_ShaderGraphCustomLighting

ebon basin
compact adder
#

yo, how could i make a Fullscreen shader that would render only the wireframe of 3d objects in the scene?

wild marlin
#

hi, i have this displacement shader which i think i followed unity's tutorial for
how could i do so the displacement only starts after a certain height?

somber arrow
#

Is this a bug? My lightshaft shader works fine in the editor, but when running inside my Quest 3 the calculation is off.

#

I'm using OpenXR, URP.

#

Weird thing: it works correct for a unity cube primitive, same in both editor and player, but not this hollow cylinder exported as fbx from blender.

#

the cylinder has baked transforms and is also 1x1x1, samt dimensions as the cube.

#

Very weird. Using the same cylinder next to a cube primitive, both scaled to double height, it works fine in both editor and player. Could there be an issue with the ceiling mesh (from VR template) giving this problem?

somber arrow
#

Ok, it was static batching that broke it. Making the light shaft non-static fixed it!

silk grotto
#

Unity6 Demo Building from Shader Compiler is slow (Use CPU)

whole mesa
#

Why does it looks like tihs ?

gleaming star
#

I'm trying to render a mesh using compute buffers, without sending data back to the CPU.
When I try to render the mesh, the number of indices is zero and the mesh doesn't render, but I do get draw calls in the render pipeline.
I previously used Ver and Tri compute buffers to render the mesh using the meshRenderer component and it worked fine, so the problem is probably with the shader.
How can I make it work?
draw call :

shader.Dispatch(0, (res + 2) / 32, (res + 2) / 32, 1);
        Graphics.DrawProcedural(
            material,
            new Bounds(transform.position,transform.lossyScale*10),
            MeshTopology.Triangles, 6*(res + 1) * (res + 1), 1,
            null, property,
            UnityEngine.Rendering.ShadowCastingMode.On,  true, 0
        );

Shader :


Shader"Hidden/VertexColor" {
  SubShader{
    Tags{ "RenderType"="Opaque"}
    Pass{
      Cull Off
      CGPROGRAM
      #include "UnityCG.cginc"
      #pragma vertex vert
      #pragma fragment frag
      StructuredBuffer<int> Tri;
      StructuredBuffer<float3> Ver;
      StructuredBuffer<float4> Col;
      float3 worldPos;
      float4 vert(uint vertex_id : SV_VertexID, out int vertexIndex : TEXCOORD0) : POSITION
      {
          vertexIndex = Tri[vertex_id];
          float3 position = Ver[vertexIndex];
          return mul(UNITY_MATRIX_VP, float4(position, 1));
      }
      
      fixed4 frag(int vertexIndex : TEXCOORD0) : SV_TARGET
      {
          return Col[vertexIndex];
      }
            ENDCG
              }
          }
      Fallback"Diffuse"
}
dapper heath
steel tendon
#

Hey guys, so quick question. I'm making a grass geometry shader for a small game I'm working on. I am brand new to shaders and I have been following this tutorial: https://roystan.net/articles/grass-shader/ I have it working as I want it to. I even combined some tutorials to make it cuttable. The issue I'm having though is I made a scene where the geometry isn't even and the grass is not uniform across it (as you can see in the pic and the middle part is a different material). Just wondering how I can fix it. Any help would be appreciated.

chilly robin
#

Is there a way to get colored ambient occlusion?

hollow sun
#

Hey, how do I enable and disable reflections of a standard material (in code)?

stray gorge
#

i am trying to use shader graph to make my sphere become scabrous but it created slits

#

how to fix it ?

hushed silo
#

I want to have a rendertexture, black and white, with the cheapest possible DOF on it, in URP. I haven't managed yet. I've tried normal PP and aren't getting anything, tried an asset which claims to do fast shader based blur (sounds perfect? ) but it doesn't work. I considered writing depth into blue channel or something and using that to mask between a blurred and non blurred image, but I think without adding edge expansion/bleeding (how?) this wouldn't work. Any ideas?

somber arrow
# stray gorge

Maybe try skipping the multiplication, and just add it to the position?

twilit jackal
#

Any thoughts on why the outlines don't show up on the unity toon shader?

karmic hatch
grand jolt
#

Can someone give me some direction on how to offset a specific vertex of a UI sprite? For example the bottom right vertex, instead of all of them.

regal stag
grand jolt
regal stag
#

For example (uv.x > 0.9 && uv.y < 0.1) ? 1 : 0 may work assuming UV is in 0-1 range.
In shader graph could use Comparison, And and Branch nodes for that.

regal stag
tired skiff
#

Hi everyone, I do not understand how to expose grandient color on the editor. is it possibile to expose gradient shader? It seems like you can not check the "exposed" box on shder graph for gradient parameter.

regal stag
#

For more complicated gradients, can use a texture and Sample Texture 2D instead.

tired skiff
grand jolt
#

I'm using amplify

#

I'm note used to shader logic so I'm not 100% sure why it worked but it's fine

tired skiff
#

I used to have a gradient noise ad sample gradient before

regal stag
tired skiff
#

it works, but it seems like it's an "adding" mix between them like a blue and a red made me a green color that is not what i would like to see rather a noise with red and blue

regal stag
tired skiff
regal stag
#

I would do something like :
Noise -> Multiply by a "Strength" float property -> Add to UV -> T input of Lerp
The Inverse Lerp is only needed if you need more than 2 colours in the gradient.

tired skiff
#

I need more than 2, I just put 2 for testing

dapper heath
#

I had no idea this guy was here, one of the best resources for shader stuff and made all the modern orthographic related guides

#

so based

regal stag
regal stag
dapper heath
#

but being able to map uvs to simply say where to put each texture at which rotation would be amazing

fervent warren
#

Yo guys someone help me out , so I installed a different version of UniGLTF and it caused many errors so I reverted back to previous but then I get this error .

#

Package Version Does not exist in the current context

steel tendon
jovial moon
#

you are using model's uv coordinates for this node

#

idk what is your uv for this mesh

#

but i think it's not something close to uv from 3d space

jovial moon
# stray gorge

basically you can get something like this with /0.0f operations, you may also get the same result with wrong normals, try to fix them

fervent warren
regal stag
regal stag
# dapper heath you wouldn’t happen to know any resources for this would you? most of the marchi...

No resources come to mind really. But I'd probably still use positions for UVs (similar to triplanar) but calculated on the C# side.
If you use a texture containing a bunch of tiles layed out horizontally, you can divide the calculated X coord by the tile count. And for each configuration of the marching cube/square you can offset that to select a different part of the texture. That's the general idea at least.

An alternative could be pre-modelling the marching square tileset (can manually apply UVs then)

fervent warren
#

Becuz I downloaded before , and the navmesh didn't work and it was some other version

regal stag
fervent warren
#

Oh okay thanks for Ur time tho

dapper heath
#

I need to do some testing but I can probably bake that into the vertices and pull from it in the shader

#

and blend between textures/rotations based on that

velvet robin
#

Hello guys!
I'm trying to apply a barrel distortion shader to a camera
And it is working
But I would like to quit the black parts that I am not using
I'll show you with a photo

#

This is the shader that I am ussing:

warm pulsar
#

The Add node is used to compute a vertex output. The Multiply node is used to compute a fragment output.

I have somehow connected a node to both of them.

#

If I delete a connection, Unity won't let me re-create the connection

#

But it seems to...work just fine

#

What's the deal with this?

#

It's annoying because I want to use the same math in both the vertex and fragment shaders. I guess I can just make a subgraph.

dapper heath
split veldt
#

Hi, any idea why there is no srgb/linear option for this imported texture?

gloomy hamlet
#

Im trying to create a water shader with waves, but instead of waves the entire mesh just moves up and down. I followed the tutorial and it gives me the same preview. It just works weird on objects on my side

#

Alright figured it out haha

#

nvm ;w;

wild marlin
runic swallow
#

Does anybody have any tips for reducing shader build times?

slender ore
#

Has anyone an idea on why is my shader to working when cull mode is set to front? Main effect here is Fresnel Effect, but it completely stops working in cull mode front after using One minus block on the Frensel Effect

rare wren
runic swallow
#

Cold builds are nice, but whenever somebody does a shader change it ends up having to spend hours recompiling lol

rare wren
#

That's a big shader then :o

runic swallow
#

I think it's that multiple shaders are sharing the same... subshader? subgroup? Forgot what the name is

#

Importing the same shader script, and therefore forced to recompile if that changes

rare wren
#

Ahhh yeah could be, not sure what is best to do there tbh

runic swallow
#

from my understanding unity has to completely recompile the subshader for every single shader that uses it, which seems a bit excessive

cursive spade
#

Hey everyone, how can I change the apparent sss thickness of a plane in shader graph using a texture?
Adjusting the transmission mask or thickness didn't make any difference for me.
Subsurface mask made a difference, but it seems to either mask to fully thick or a predefined thickness.

indigo ginkgo
#

I'm struggling a bit with the "refract" node in urp, has anyone got some tips?

quick bluff
#

I'm having trouble with learning shader grqph in hdrp. I just can't work out how to make it do anything at all and none of the tutorials work. Any ideas?

amber saffron
amber saffron
cursive spade
amber saffron
velvet robin
warm pulsar
#

You can use alpha clipping here.

#

HLSL has a function called clip that discards the pixel if its input is less than zero.

#

Instead of using return float4(0,0,0,0);, just do clip(-1);

velvet robin
warm pulsar
#

Right.

#

I'm not sure if you need to make any other changes. I haven't written shaders by hand in a little while.

#

Returning transparent black would require you to make the shader transparent, rather than being opaque

#

You could make it transparent, but I prefer to avoid transparency if I don't actually need it

#

An opaque shader is all-or-nothing on each pixel: either it writes to the screen or it does nothing at all

#

A transparent shader writes to every pixel, but might wind up making no change

velvet robin
#

I changed it as you told me

warm pulsar
#

Ah, it still needs to return, I guess

#

You have a compile error in the console.

#

So return 0,0,0,0 after calling clip

velvet robin
#

Sorry, I forgot the return

warm pulsar
#

You wouldn't return clip(-1).

#

I presume you get another error when you try to do that, since it's not a float4

#

just return float4(0,0,0,0) after calling clip(-1)

velvet robin
#

yes sir

#

@warm pulsar

#

You are just my hero

#

Yo don't know how grateful I am

#

I've been looking for the error for three days

warm pulsar
#

no problem (:

#

it's tricky to learn a lot of this stuff..

#

too many links Nooo

ebon basin
#

I'm trying to understand, if you clip the pixels here, is the distortion being expanded out into the clipped space?

warm pulsar
#

By using clip, we can eliminate the black borders around the distorted area.

ebon basin
#

right, so why does the black area matter here if the effect is what's contained in the area

warm pulsar
#

so that the shader draws nothing at all, rather than trying to draw transparent black (which would require a transparent shader, not an opaque shader)

warm pulsar
#

perhaps this will be drawn in front of a computer screen model

#

and Flare wants to see the model, not black, at the edges

ebon basin
#

oh, so I guess they want half the camera warpped like that, and half non-distorted?

warm pulsar
#

No. This doesn't get rid of any distorted areas.

#

All it does is draw nothing outside of the area that shows the image

#

rather than drawing black

#

The distortion effect means that the image doesn't fit in a square anymore

#

It has some gaps on the sides.

ebon basin
#

Wouldn't the border turn into that effect where the pixel buffers aren't flushed?

#

so kinda like the edges would have that dragging pixel effect

#

so in the end you either render something or have a space of unupdated pixels

#

im just curious what the end result is here

warm pulsar
warm pulsar
# velvet robin

But there are lots of other shaders drawing to the screen here, including the skybox and the ground

#

Just because one shader doesn't draw to a pixel doesn't mean that another shader doesn't

#

You can have a problem if your shader writes to the depth buffer (which indicates that nothing behind that point should render) but doesn't actually draw to the pixel

#

Then you get a pixel with whatever data happened to be in it from the start

ebon basin
#

Ah, true, so yeah there would be some parts of the scene undistorted instead the black frame if that's the desired effect of the shader

quick bluff
#

The fact that the pipeline matters so much is a big problem. All the tutorials are URP and they don't even work in that.

#

Like all I want to do is makr it do something.

#

Anything

#

But all it does is produce garbage.

#

Thinking of just going to code them because it's probably gonna be easier to find working examples.

somber arrow
#

I have a shader graph used as material in custom render texture, used as animated light cookie. this works in vulkan but breaks in opengles. is this a known issue or something I'm doing wrong?

amber saffron
amber saffron
burnt crown
#

Ok, so very weird problem

#

in-game my water looks like this

#

but the when im in a build this happens.

#

idk what the issue is tbh. normal transparent shadergraph. been working fine until today

quick bluff
quick bluff
burnt crown
#

Why is my transparent doing this in a build

#

its supposed to look like this

warm pulsar
#

I am having a very weird problem with the StackLit shader graph. I'm sometimes getting big patches of pixels that fail to render at all (so you wind up seeing the skybox behind them). This only happens in the game view; it's fine in the scene view.

I'm using UV1 and UV2 for an effect, and I've noticed that the problem only happens if I'm trying to use a UV map in the vertex shader. In the example above, I'm using UV0. I compute the length of the output from the UV node and multiply that by a frequency value.

I also multiply the time by a move speed value.

If I add these two values together and the "Move Speed" property is a whole number, it works fine. If I use any input other than UVs in the top half of that graph, it works fine.

If I filter out NaNs from either of these values, the issue goes away. Everything works fine. In the graph shown above, connecting either of outputs from the "Branch" nodes to the "Add" node fixes the issue.

This makes no sense -- if there were NaNs present, then surely I'd be seeing the vertices jump all over the place as I enter and exit areas of NaN that got replaced with zeroes! My only guess here is that there's other vertex shade work that's getting broken by a NaN, even if the vertices I can see aren't relevant...? Very confused.

This only happens with a skinned mesh renderer. If I export an identical model without its armature (or just display the skinned mesh with a MeshRenderer), there is no problem.

I am absolutely baffled. I'm going to fix this for now with the NaN filtering, but I really need to figure out why this is happening. I'm cleaning up an example so I can share that.

amber saffron
warm pulsar
#

yeah, I've had that happen to me a few times before

#

NaN can wind up eating the entire screen

warm pulsar
sacred hull
#

Hi! I have been following a tutorial for my first compute shader (shell texturing). What does this error mean and how do I fix it?

#

Does this mean that it's a problem with my Unity version? I am on 2022.3.18f1

warm pulsar
amber saffron
quick bluff
#

It also says this, but I have no idea what it means. Is it saying the 'power' function is the problem?

amber saffron
#

That's also why you can see purple pixels in the previews

quick bluff
amber saffron
quick bluff
#

Can you see any other issues with it?

amber saffron
#

You are outputting the graph in the base color, so this will affect the surface albedo that itself is getting lit byt the scene ambiant and dynamic light sources.
If you were expecting this to act like a fake lighting, you need to connect it to the emission output.
Furthermore, if you are using HDRP, you should also make it go through the emission node with "exposure weight" set to 0

quick bluff
#

Orb is so far the same

amber saffron
#

Here's my setup, IDK is this was you are expecting though :

quick bluff
amber saffron
quick bluff
#

Doesn't work in either

#

URP tutorials are easy to come by, but never work in HDRP, and I've not done much URP

#

Any ideas why it isn't working in HDRP?

amber saffron
amber saffron
quick bluff
#

Or from the video?

#

If the latter, you may be right

amber saffron
amber saffron
# quick bluff Sure

So, I took your shader, assigned it to a sphere in my scene.
I changed the "inner color" property to use HDR color, and increased the intensity to make it more "dramatic" : Is that getting closer to what you'd expect ?

quick bluff
#

That's what it's meant to be like

amber saffron
#

Well, I've further increased the intensity of the color to have more bloom and :

quick bluff
#

Where would I do that?

amber saffron
quick bluff
#

Hmmm this isn't working still

#

Even though the material seems to be?

amber saffron
#

Did you assigne the red preview material to the sphere in the scene or the other one ? Tried setting the intensity even higher ?

quick bluff
#

I set it really high & low

#

It flickers with red dots for a second, then nothing

warm pulsar
#

interestingly, the glitchy areas appear and disappear in waves; the closer the second parameter is to 2, the slower the procession is

#

It's got to be some floating point hijinks, but I can't figure out exactly what they are

harsh steeple
#

Hi,
I struggle to find some information on material transition in a game level. Correct me if I am wrong on these assumptions on how people achieve it:

  • Transition on tiles is just e.g. grass tile -> grass/rock transition tile -> rock tile
  • Decal projected on object
  • object simply put on top on another object (not technically transition)
  • big painted texture maps ??
  • Other options????

Bonus question:
How breakdown a tiled material with another material on top of it with bigger scale so player cannot see those repeating tile that much. Example with some cracks. I know I can use other props like some rocks, building, plants, lighting etc. I am just curios if there is other options.

gloomy hamlet
#

Could someone explain why my vector4 can't connect with the other vector4

warm pulsar
#

(so you try to mix nodes together that wind up flowing into both the Vertex and Fragment outputs)

#

I don't see that happening here, though.

gloomy hamlet
#

This is what the function does

warm pulsar
#

what does DepthFade do?

gloomy hamlet
#

I just want to lower the waves height closer to the island

warm pulsar
#

That sounds like it might be fragment-only

gloomy hamlet
warm pulsar
#

yeah, you're reading Scene Depth

#

NOTE: This Node can only be used in the Fragment Shader Stage and it is not guaranteed to work with an opaque material.

gloomy hamlet
#

hmmm thats fair. Do you maybe know a solution for my issue then?
I am still pretty new to this(like 2 days)

warm pulsar
#

I'm not sure what a good alternative would be here.

regal stag
#

You may be able to sample the depth texture manually in a custom function node using SAMPLE_TEXTURE2D_LOD

gloomy hamlet
#

I don't actually have a water texture. Its just a plane mesh

regal stag
#

I'm referring to the camera's depth texture, that's what the Scene Depth node samples.
A custom function using this might work

float rawDepth = SAMPLE_TEXTURE2D_X_LOD(_CameraDepthTexture, sampler_PointClamp, screenPos, 0).r;
float eyeDepth = LinearEyeDepth(rawDepth, _ZBufferParams);
Out = eyeDepth;
#

Always need to use LOD versions of the sample function when connecting to the vertex stage. (Kinda wish shader graph would just automatically switch to it)

gloomy hamlet
#

So something like this

#

How do I access camera's depth texutre?

#

and what would be the input in the custom function?

regal stag
#

Would need to pass a Screen Position (regular mode) into the function for the screenPos

#

The rest should hopefully work but check if the errors say something is undefined

warm pulsar
#

there's so much weird niche information (like that _CameraDepthTexture exists in the first place) that I've been struggling to find

regal stag
# warm pulsar Do you know why that's the case?

The regular sample functions use the screenspace derivative functions (ddx / ddy) to calculate which mipmap should be sampled. Those are available as the fragment shader runs in 2x2 pixel blocks, hence it only works in the fragment stage, not vertex.
Specifying which mipmap you want with the LOD sample avoids that

warm pulsar
regal stag
#

I think it's something to do with objects being further away have a greater change in derivatives across pixels, hence need a lower res mipmap. Exactly what calculation is done I'm not sure though, bit beyond my knowledge

regal stag
# gloomy hamlet

Hmm that's a bit annoying. What render pipeline is this for, URP?

gloomy hamlet
#

Yeah URP

regal stag
#

May be able to add #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl" then

gloomy hamlet
#

weird its talking about normal render pipeline

#

nope still nothing

#

@regal stag Maybe this causing the issue

low lichen
# warm pulsar ah, that makes sense (although now I'm left wondering why you need to compute th...

It's a convenient way to estimate the "density" of the UV coordinates. Where it's more dense, you want lower resolution mip maps so the pixel density of the texture matches the pixel density of the screen as closely as possible. Many things can affect the UV density, like distance, angle, UV tiling. Derivatives handles all of that automatically by comparing the neighbor pixels in the 2x2 cell.

regal stag
gloomy hamlet
#

Output Texture but never mind that wasn't it

regal stag
#

Has the shader still got an error message?

gloomy hamlet
#

Yeah still the same error

warm pulsar
#

it's all Core SRP and URP stuff

#

(and some ShaderGraph code)

regal stag
gloomy hamlet
#

Uhm how do I do that?

regal stag
#

Might be other errors too. Make sure you add the screenPos input, and rename the output Out

gloomy hamlet
#

What is the output value?

#

its so weird

regal stag
#

Change the body to

#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl
float rawDepth = SAMPLE_TEXTURE2D_X_LOD(_CameraDepthTexture, sampler_PointClamp, screenPos, 0).r;
float eyeDepth = LinearEyeDepth(rawDepth, _ZBufferParams);
Out = eyeDepth;
#

I'm hoping that will force the shader to declare _CameraDepthTexture

#

Rest looks okay, though may want screenPos to be a Vector2. Add a Screen Position node to the graph to connect to it.

regal stag
# gloomy hamlet

Once working, should be able to copy the nodes you have for your "Depth Fade" subgraph but use this Custom Function instead of the Scene Depth node

gloomy hamlet
#

Only thing Im worried about

#

is that everything looks pink now

#

Yeah its still bitching about _CameraDepthTexture

#

I can't find anything about it online either

#

One thing I realized is that the #include dissapears in the generatedShaderCode

glossy sky
#

Not sure if this is the right way to go about it, but looking for some help with an issue that i think shaders may be able to solve, decently new to unity postprocessing / graphics

regal stag
glossy sky
#

Gotcha, wouldn't know which it is to be honest, looking for a way to not render the lights from a room behind a door in a 2d sidescroller project

regal stag
# gloomy hamlet One thing I realized is that the #include dissapears in the generatedShaderCode

Could maybe try using File mode instead of String. Would be something like this (in a .hlsl file)

#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl

void GetHeight_float(float2 screenPos, out float Out){
  float rawDepth = SAMPLE_TEXTURE2D_X_LOD(_CameraDepthTexture, sampler_PointClamp, screenPos, 0).r;
  float eyeDepth = LinearEyeDepth(rawDepth, _ZBufferParams);
  Out = eyeDepth;
}
glossy sky
#

scares me how fast you came up with that

gloomy hamlet
regal stag
gloomy hamlet
glossy sky
#

was trying to use occlusion areas to just not render it to be honest, wanted it to be essentially black space beyond the door

regal stag
glossy sky
#

current situation is this, have URP 2d lighting system with a shadow caster on the door sprite, if camera moves far enough then you can see the light source in next room despite shadow being cast. gonna give your angle and sprite generation ideas a whirl. thank you!

fair jackal
#

it's been a while since I've messed with the 2d lighting, are you sure it's not a layering issue?

glossy sky
#

something else to check for, thank you!

#

I guess in theory I could just tie its order in the sorting layer to opening the door

#

idk if there is a "right" way to doing this though typically

#

dont wanna do the sketchy solution and pay for it further in development

regal stag
# gloomy hamlet

Not too sure why this error is occurring. But I'd try this instead

#ifndef SHADERGRAPH_PREVIEW
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl
#endif

void GetHeight_float(float2 screenPos, out float Out){
#ifdef SHADERGRAPH_PREVIEW
  Out = 0;
#else
  float rawDepth = SAMPLE_TEXTURE2D_X_LOD(_CameraDepthTexture, sampler_PointClamp, screenPos, 0).r;
  float eyeDepth = LinearEyeDepth(rawDepth, _ZBufferParams);
  Out = eyeDepth;
#endif
}
gloomy hamlet
#

AAAAAAAAAAAAAAAAAH

#

figured the issue

regal stag
#

oh there's a missing "

gloomy hamlet
#

got a new one right back

#

I feel like its broken on a deeper level LMAO

regal stag
#

Yeah that's really weird, this has nothing to do with lights

gloomy hamlet
fair jackal
#

can you show a screenshot of the node settings for the custom function?

gloomy hamlet
fair jackal
#

set "GetHeight" to the function name

gloomy hamlet
#

That works

#

yeah

#

Holy shit

#

It jsut doesnt work in the sub shader

#

but thats not the worst

fair jackal
#

whichever function name you put in the node settings is what function is called from the Source file + whatever precision the node is set to. So you can have multiple functions in one file and only execute which function you want from your custom function node

gloomy hamlet
#

Aaah

#

okay that makes sense

#

Thanks for the help!

#

Now I just gotta clamp the value ad it should be fixed

fair jackal
regal stag
#

May want to change the 6.7 to 17.0 in that link for a more up to date version

fair jackal
#

ah my node is returning 14.0 which was 404'd

#

nvm it's the rest of the url that was 404'd

#

I guess they changed the filename

#

oh, no I see

regal stag
#

I think the F1 just checks the node name, but that's something we define for that node

fair jackal
#

it tries to open the documentation for the node title, which in this case is the custom function

#

if I'm writing my own custom lighting shader graph(https://blog.unity.com/engine-platform/custom-lighting-in-shader-graph-expanding-your-graphs-in-2019) is there a way to not render cast shadows without disabling them? I'm sampling the shadow map myself to do some customization to how shadows are drawn so if I try to draw my own shadows they are getting drawn twice. If I turn off shadows I can no longer sample them so that's not an option

regal stag
fair jackal
#

meaning they are being drawn by default by the shader, and then my custom render of shadows are being drawn on top of that

regal stag
#

You'd typically want to use an Unlit graph when doing custom lighting. That would stop the default shading/shadows appearing

#

Though there are some workarounds needed

#

Or look at the CustomLighting.hlsl file at least. Need to use the #undef REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR to avoid errors in Unlit Graph, and define keywords in the graph.

gloomy hamlet
#

@regal stag @fair jackal Thanks from you two It is working correctly now!

fair jackal
glossy sky
#

think I found a solution to my issue as well, will let yall know if it works. ❀️

pale apex
#

So, i'm working on adding hats but i'm curious on if there is a shader that would use a mesh to hide other meshes so for instance a hat goes on the person head but the hair goes through the hat. So I was wondering about using a mesh with a shader that would hide the hair.

fair jackal
# pale apex So, i'm working on adding hats but i'm curious on if there is a shader that woul...

How to Use Depth Mask to Hide Water in Boats in Unity

1:06 to skip Intro
5:14 to jump to Blender Instructions

Have you been trying to figure out how to put your boats in the water, but not let the water seep in? Then this tutorial is for you!

Here is the Unity Wiki on the depth mask:
http://wiki.unity3d.com/index.php/DepthMask

Last I checked...

β–Ά Play video
#

only inverted obviously

pale apex
#

Yes like that pretty much.

worn kettle
#

Hey everyone. Dealing with a lots of world space canvases and i needed to disable backface culling.
Found a shader in the forums to do that.
It works great, but those elements can only be seen on the left eye in VR.

I'm a complete beginner when it comes to shaders though.
Could someone help me adjust this code so it works in VR on both eyes? I dont want to change Stereo Rendering Mode for Oculus since it works with default UI shaders too.

I did the steps explained in the docs: https://docs.unity3d.com/Manual/SinglePassInstancing.html
But it didnt have any effect

If possible (but not as urgent), i'd also like to be able to Mask the Ui Images that use Material of this shader.

I appreciate any help.

The code for the shader i used is too long to post here: https://pastebin.com/YLiAieh8
Source: https://forum.unity.com/threads/worldspace-canvas-backface-culling.310857/

warm pulsar
#

I'm using XCode to do in-editor GPU frame debugging on my macbook. The capture works great, but Unity freezes afterwards, and I have to kill it and restart.

The debugger isn't paused -- I can pause and unpause in XCode and nothing happens over on Unity's end.

Has anyone else had this problem before?

#

I'm discovering that using simplex noise in the fragment shader can get very expensive πŸ₯²

#

on my macbook, the ALU is parked at 100% utilization, and the fragment shader is doing billions of ALU ops

rustic notch
#

How can i optimize my scene / remove things as even with this basic room its sending my VR usage from 4.2ms of 11.1ms (In SteamVR) to around 17/11 ms
and taking away on the screen mirroring FPS by nearly 60fps when sat doing nothing πŸ™‚
This is my current Room and theres really not much to it

#

im assuming my main problem is the ligthint

#

you can see the GPU usage here once i unhide the room

#

and it gets worse too

warm pulsar
#

Real-time lighting can be very expensive, yes

#

You should see how it behaves when you toggle the lights -- or when you turn off shadows, if they're enabled

rustic notch
#

how can i toggle shadows sorry?
im new

warm pulsar
#

Look at the inspector for your lights.

rustic notch
#

still burns FPS

#

with "no shadows"

#

less of a jump now between Lights on and off

#

still goes quite high tho for a background ap

warm pulsar
#

The next thing I'd check is how complex these assets are.

#

You can get a vague idea with the Stats window in the game view -- it will tell you the total number of triangles

rustic notch
#

uhhh quite high

#

21.4m

#

Wait is this not using my GPU?

#

or is that what "Render Thread" is

warm pulsar
#

the render thread is responsible for setting up work for the gpu

#

software rendering would be giving you truly catastrophic framerates

#

and yeah, you have 21 million triangles in this scene

#

that's a lot

rustic notch
#

its going from 7.4 (when not in play mode0

#

to 21.4 when in Play mode

#

How is 1 Spot like 3million?

#

MY CHAIR IS 15MILLION
Nahhh wtf

#

somt broken right there

warm pulsar
#

I believe you get an inflated triangle count because one object can get drawn multiple times.

#

I know that turning off decals on one of my skinned mesh renderers significantly reduced how much it contributed to the tri count

#

I'm a bit fuzzy on that.

rustic notch
#

whats a target for Scenese then of this size its like
4mx6m and just a gaming room

warm pulsar
#

it's hard to give a target; it's just that lower is better

#

I guess that you could look at what VRChat suggests: it wants your avatar to have under 70k triangles

#

20 people standing around would therefore be 1.4 million triangles

rustic notch
#

Thanks for helping me

kind swallow
#

Hi. I am trying to achieve perspective rendering of 3d characters inside UI. Since our UI uses an ortho camera, my idea was to send in the main cameras projection matrix and worldToCameraMatrix and transforming the verts using those. So to validate the idea I am just doing it on a normal sphere in the scene (using a perspective camera, not UI), and changing out UNITY_MATRIX_V and _P with those values from camera. It works fine when using the values in shader of UNITY_MATRIX_P and my provided camera.worldToCameraMatrix, but using the values of camera.projectionMatrix instead of UNITY_MATRIX_P then i can no longer see the sphere. First of all, is this a valid work around conceptually? And is there some kinda transformation that happens to UNITY_MATRIX_P that isnt being done when I use camera.projectionMatrix?

quick bluff
#

Like, say, to stop random cars filling with fog?

grand jolt
#

doing some work for a course but the material looks visually demolished compared to the professor's example. is this a graphics issue on my end or something? I'm hoping it at least appears like the right side on someone else's computer

grizzled bolt
grand jolt
hushed silo
#

I want to be able to dissolve a piece of geometry.... how to describe it. It's like I want to have thousands of invisible spheres all over the mesh growing and where they are they cut out the geo...

#

which I'd blend into with distance from a transform

#

I would want it to be in world space rather than UV space

#

3d voronoi mabye but not? Is there a node that noisily clusters spheres everywhere? (would be too good to be true)

#

I don't suppose you can use a VFX graphs' geometry to inform alpha clip on another object

karmic hatch
sacred hull
hushed silo
#

displace the vertices along their normal vector

#

world position + nomal vector times multiplier

dim yoke
cursive spade
#

Hey everyone, how do I do refraction in shader graph on an transparen object using HDRP?

hushed silo
#

RTX πŸ˜‰πŸ”₯

cursive spade
#

I don't want to use raytracing

#

The lit shader has a screen-space refraction option, but I don't see how to do it with a custom shader graph

fickle grail
#

Hello people! One quick question: I want to add an interaction with a snow shader when the player walks on top. I have seen a lot of tutorials that use an extra camera and a render texture to do that... Is this efficient tho? Is it the best way?

#

What if I have a really big snow plane

#

I just don't know if it's the only option hahaha

dim yoke
# fickle grail Hello people! One quick question: I want to add an interaction with a snow shad...

I'm usually bit hesitant to use render textures (with camera) for this type of things due to the overhead of using extra cameras. Compute shader is something that I would definitely consider using to draw those trails on the texture. On larger map the map should probably be divided into chunks and same way there should be one trail texture for each chunk to keep only the relevant areas on the memory at once

fickle grail
#

Wow, hadn't thought of using Compute Shaders, do you know any examples or info I could use?

#

I think I found something based on a grass shader

dim yoke
fickle grail
#

Thank you!!

#

Tech art is dificult ahaha

fair jackal
warm storm
#

https://ameye.dev/notes/rendering-outlines/#blurred-buffer

Can someone help me understand how this was done? I'm so confused.

#

Like how do you scale down the render result of a pass?

dim yoke
warm torrent
#

I have an enemy damage flash material with appropriate shader graph. Now i want to make an outline around my sprites to indicate something. Is it possible to give a sprite 2 materials? Or should i somehow combine both shader graphs into one? What is the right approach here

craggy dune
#

Hi, I'm looking for dissolve effect but i don't have the emission on my game like the mats someone know why pls ?

warm torrent
#

dunno not good with shaders

craggy dune
#

maybe its a post processing side ?

#

im new to shader so x)

warm torrent
#

i wouldnt know sadly, im dont know anything

#

about shaders

craggy dune
#

i fix it its because of the Sun emission is too high so i didn't see the emission of the shader

halcyon plank
#

So the triplanar node seems to require a Texture 2D but i want to use a procedural texture i have generated in a seperate shader graph, is there a way to combat this or will i have to just make the triplanar mapping from scratch

grizzled bolt
warm storm
#

Never using it again

dim yoke
zenith girder
#

i have made a fairly basic shader graph shader using builtin, but it takes FOREVER to compile. i did some research and i'm guessing it's all these keywords causing variants to be genereated. How do i get rid of these keywords to speed up build time?

trail hamlet
#

I have a question I have found myself confused.
Let’s say I add a normal sphere.
It has 1 material slot element 0.
When I increase to 2, I can add 2 materials(vertex displacement component)
One for the base material and one for a highlight material.
But let’s say I am getting a complex material with multiple materials spread out over a mesh.
Why is adding a 2 material slot creates this highlight effect?
How can I do this with a mesh with more than one material?
Is there a name for what I am doing?

grizzled bolt
#

I think all shading of a mesh should generally occur within one shader/material

trail hamlet
#

So merging the materials into one?
And swap between shaded and non shaded

#

And add extra slots would likely just choose a random mesh to duplicate in a multiple material object?

grizzled bolt
#

You can't quite "merge" materials but you can create shaders that support all the necessary features

#

It's unclear to me what "shaded" and "non-shaded" mean in this context

trail hamlet
tardy spire
#

I'm using shader graph with URP and have just started getting this odd error when connecting new nodes:
_AdditionalLightsPosition: implicit array missing initial value at line 151.

This is an Fullscreen shader type so there should not be anything lighting related, despite the error message. Any ideas? I'm not seeing anyone else that's run into this on the forums

Here's the full error that's logged to the console when I save the shader: https://hastebin.com/share/copivigiru.sql

#

It appears to be happening on any parent nodes of a custom function node. However I'm still confused because there are plenty other parent nodes that cause no issue

regal stag
tardy spire
#

Just tried adding a node that already existed and the error shows up. So strange!

regal stag
#

Might be that #include line causing conflicts with shadergraph's own "shaderlibrary" used for node previews

tardy spire
#

The fact that it happened is still a super confusing thing to me since everything seems properly ifdef'd, but some things can remain a mystery πŸ€·β€β™‚οΈ

gusty canyon
#

would this prevent the triplanar node from even being evaluated if the value is not greater than zero?

#

I dont want to waste gpu time running a triplanar node when its not going to be used

#

I only use it when the value is greater than 0 because im lerping between 2 triplanar nodes

#

This works fine but I just want to make sure its not pointlessly actually evaluating it

regal stag
# gusty canyon would this prevent the triplanar node from even being evaluated if the value is ...

Probably not. The Branch node uses a ternary operator which in HLSL evaluates both sides. Actual branching may require if statements in custom function nodes.

Afaik branching around textures also requires some special handling, need to use SAMPLE_TEXTURE2D_GRAD and calculate the uv derivatives (using ddx/ddy functions) before the branch. Mentioned here - https://medium.com/@jasonbooth_86226/branching-on-a-gpu-18bfc83694f2

gusty canyon
#

Bro why 😭 😭 πŸ’€

#

graphics programming always doing the most

#

what if I just lerp the textures before using the triplanar node

#

then it would only require one triplanar node

#

well 2, one for normals and one for the actual texture

#

im just gonna get rid of the branch and leave it be

#

maybe in the future ill return to this

#

I do plan on making this terrain material a bit better eventually

#

but its a material for an entire planet so its a little complicated

#

actually that means nothing, its the same complexity of any other terrain material

#

idk why I said that

#

for now it looks pretty good from space

#

and pretty good on the ground feelsShrugMan

gusty canyon
rustic notch
#

how can i fix this happening whne i zoom outit like clips out of view i want the Power button visible from some distance

normal nebula
#

Can someone help me understand this behavior?

I have a custom shader and I had to add the following so that my custom stuff would get masked in the UI:

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

I dont know where to look/what to ask for help on, its totally bizarre behavior!

lyric wraith
#

Anyone have a good video to explain how to make textures for my terrain for unity? I have no clue on where to find a video on this. I'm going for a low poly one colored texture.

gloomy quail
#

Hello
I'm having lots of trouble turning on a keyword by code in the editor.
I made a static function that take a material, assign the textures to it, and then turn on some bool keywords, but for some reason the keywords dont change. i'm really stuck i dont know what to do

#
    [MenuItem("CONTEXT/Material/Set card texture from folder")]
    static void MaterialSet(MenuCommand command)
    {
        Material mat = (Material)command.context;

        Texture2D t = getTextureFromPath(mat, "background");
        t = getTextureFromPath(mat, "holo_mask");
        if (t)
        {

            mat.EnableKeyword(new LocalKeyword(mat.shader, "_HOLO"));
            mat.SetTexture("_HoloMask", t);
        }
        t = getTextureFromPath(mat, "holo_pattern");
        if (t)
        {
            mat.EnableKeyword("_HOLO");
            mat.SetTexture("_HoloPattern", t);
        }
}
#

i tried two ways of turning it on but no luck.
If i check mat.keywords its missing all of my keywords.
But if i check mat.shader.keywordSpace, there are here

snow forge
#

Mornin' all,

Would anyone be able to point me in the right direction for this please? I'm trying to build a Terrain Shader for a spherical world using a heightmap to drive the different texture layers I want to add. (different textures for different heights (grey levels) of the image, but I'm struggling to figure out how to get/set the height from the image.

I've used the node tree attached before to create a 'linear height' shader, but need to adjust/edit it to work with the height map image.

regal stag
#

If you want it to control layers should just need to swap the Position node out here for the Sample Texture 2D

snow forge
#

Just control the layers.

#

Oh cool. Thanks. Will give it a go after lunch πŸ™‚

regal stag
regal stag
gloomy quail
#

I'm not sure about "exposing the propeerty"

#

All i did was create a material and assign the shader to it and they show in the inspector

#

it looks like its on

#

do what you say is the material use another float for showing the value in the inspector so it has anotherr name

regal stag
# gloomy quail it looks like its on

Generate Material Property is probably what exposes it to the inspector. You only need that if you want to be able to toggle it on the material

#

May need to view the generated shader code to see what the property name is

gloomy quail
#

i think i found sommeone saying i need to do "mat.SetFloat("_HOLO",1f)

#

do i do this on top of the enablekeyword or just this ?

#

Thanks i was hitting my head on walls xD

#

It worked thanks ❀️ ❀️

normal nebula
regal stag
#

Also what render pipeline is this

normal nebula
#

Im instatiating a new prefab ontop of the current page ( and then closing it )

#

so no new camera or anything like that

#

and I think(?) its URP?

runic swallow
#

What's the fp number when compiling shaders?

low lichen
#

It's reporting the number of variants for each shader. Fragment shaders often have more variants than vertex shaders.

runic swallow
#

aah, oki, ty

#

Is there a way to see what all the different features it's compiling variants for are? I tried putting on logging, but I don't see what's actually causing all the variants there

#

like, surely 5 minutes to compile a single shader is too long lol

tranquil dew
#

Hello, since I switched to URP I cannot set the [Range] and [Color] attributes in the material properties when writing a custom shader. It throws a parsing Error "unexpected TVAL_ID". Does anybody know what happened to those attributes? Is there an alternative?

regal stag
tranquil dew
regal stag
regal stag
tranquil dew
normal nebula
#

the buffer indeed clears, but now its entirely empty

#

what would reseting the buffer to full look like? im not too good at shader code, but can I invert this?

regal stag
brittle bolt
#

Question on Stencil buffers and overlapping. For optimization reasaons, im trying to limit the amount of unique layers. I am using a box surrounding an interior space, where you can only see the inside of the space via a threshold. The outerbox has a stencil shader on it set to equal, so it masks out the geometry its around. this works perfectly as i would like, however when you enter a space, you can see the other stencil boxes from inside because the stencils are overlapping. Any insight on how to use a single stencil layer in this fashion, where when you are inside the other same layers arent composited on it? Seems like it needs to be something with depth or sorting order?

brittle bolt
desert crater
#

Can anyone explain why my noise texture will have random colors on the edge and not white?
The first image is using "Noise Texture".
The second image is using "Simple Noise Node".

regal stag
desert crater
#

How to do that, its a bit too late to make drastic changes. Even once a use the step node on the "Noise Texture", it already have RGB colors. So i think it might be the texture being the problem, as shown above.

regal stag
#

Shouldn't be that big of a change. Use the R (or G, or B) output from the Sample Texture 2D node instead of RGBA.

#

Importing the texture as Single Channel may also fix it, not sure

desert crater
#

Ohh, that what you mean.

#

Ok, yup it works, thanks.

stiff nexus
#

Y'know @deep moth, I find it very interesting how similar the effect caused by the posterization looks to the function in a graph

lean lotus
#

Is there any way to get the per-instance index in inline raytracing in a compute shader? Like I need to know which instance I am looking at so I can properly get its transform from a buffer

deep moth
tranquil dew
#

Hello! I have the following bit of code to produce a smoothed out circle:

    _Size, 
    _Size - 0.1, 
    length(uv - _Position)
);```

**_Size** and **_Position** are in UV Space.

Now, i'd like to specify the size of the circle in world space dimensions (meters). 
How would I go about this?
lethal vault
#

Hello! I am relatively new to Unity. I was trying to use lilToon to achieve semi-transparent stencils, but despite following the docs it doesn't seem to be working. It may be because I messed up something in duplicating materials, as I wasn't really sure how to do it properly.

lethal vault
#

ah, nevermind! i solved the issue on my own

steady moth
zenith girder
#

i am making a shader using shader graph the builtin pipeline and the unlit shader as a basel. For some reason, in game (vrchat) the shader is being rendered at an offsett on the right eye. does anyone know what could be causing this problem?

elder ingot
#

i created a simple shader that makes the surface of a plane wavy using noise

#

however the wavy surface is not visible even though the shader is set to lit

#

how can I make unity recalculate lighting?

#

I think I have to somehow update the normals as well right?

amber saffron
# elder ingot I think I have to somehow update the normals as well right?

Eaxctly, you are only displacing the vertices position, without affecting the normals, so light calculation is still done like if it was a flat plane.
There is no way to automatically recalculate the normals after displacement (unless using shader code and geometry shader ...), so you have to do it yourself in the vertex function.
If the noise that you are using also outputs derivatives in addition to the noise value, you can use them to calculate the normals, else you can sample the noise 2 more times for each vertices (with a X and Y offset) to calculate the derivatives yourself and build the normals.

tacit parcel
young silo
#

I added this shader to a material an used this material inside of an image. Why doesn't the texture get shown as the image

rustic notch
#

How can i make this material not react to the lighting in the scene? the purple makes it unusable

rustic notch
#

thanks πŸ™‚

cerulean fjord
#

anyone have a object specific pixel material

weary dragon
#

is there something im doing wrong? it isnt working.

#

its a shader graph and im trying to put a cubemap onto it

#

anyone able to see whats wrong?

weary dragon
#

nvm figured it out

tranquil cave
#

Could someone kindly provide guidance on procedurally generating a canvas UI-based repetitive shader - Graph without the utilization of any textures?

deep moth
# tranquil cave Could someone kindly provide guidance on procedurally generating a canvas UI-bas...

Hi!! This sounds like a cool problem. I'll bet you could get a good start at it by using 2d distance functions for shapes and domain repetition techniques in the uvs.

Here are some resources that are geared to glsl but very informative in terms of technique / concept and pretty easy to transcribe if you have experience with written shaders.

For understanding making shapes with shaders:
https://thebookofshaders.com/07/

For understanding how to repeat those shapes:
https://iquilezles.org/articles/sdfrepetition/

Articles on computer graphics, math and art

young silo
#

I apply this shader on an Image. I'm only seeing a grey to white square that fadedes like the texture should do. Why doesn't the image get rendered?

steel notch
#

How slow are Shader Graph shaders vs normal ones.

#

Like I know it depends quite massively on exactly what the shader is doing, but should you expect a pretty big performance drop regardless?

steel notch
#

Also, if let's say you had 1000 quads stacked on top of each other (slightly varying z) and pointing at the camera.
If these quads are opaque, I assume the renderer doesn't try to render all 1000. It knows which frags will be representing which quad.
So it's only the vertex func that'll be ran for all, I assume.
With transparent quads though, even if the alpha is max, will it render all the quads fully?

dim yoke
# steel notch Also, if let's say you had 1000 quads stacked on top of each other (slightly var...

Yes, if depth, prepass is enabled, only the top most will be rendered and if not, some of the fragments can still be skipped by chance if something is already drawn in front of it (closer to the camera). Transparent geometry on the other hand must always be rendered (if not behind opaque geometry) even behind other transparent geometry (theoretically it could be possible to write to depth buffer only if the alpha is 1 but I don't think that's easily possible in unity). That is exactly the reason many games suffer with performance when you go inside smoke grenades because the smokes are usually rendered as multiple large transparent quads/particles

steel notch
dim yoke
steel notch
#

I'm doing some (relatively simple) custom lighting on them, and did a stress test. My Laptop isn't amazing, but with 200 on screen I'm hitting around 40 FPS in build.

#

Checked the profiler and it's mostly from Rendering.

#

Custom Lighting is definitely doing it. I swapped to unlit and hit 60 easy even with 400 units.

dim yoke
steel notch
#

I'm actually using shader graph.

#

And ya, I imagine there is quite a few things I can do to improve performance. I'm pretty sure the custom lighting node I found is calculating specular highlights and then doing absolutely nothing with it.

dim yoke
steel notch
#

I did but I got some strange lighting behaviour.

#

I'll look at it again toomorrow, it's pretty late for me.

#

Mind if I toss you a ping if I find anything?

dim yoke
#

feel free

steel notch
#

thanks

tranquil cave
snow forge
#

Afternoon all, Yep, I'm struggling again. lol.

I'm trying to add displacement to an irregular shaped object using Shader Graph (URP), but struggling with grabbing the object normals and displacing from those instead of the origin. Any pointers please?

dim yoke
snow forge
#

I shall give it a go. Thanks πŸ™‚

#

Hmm. Okay, soooo, obviously doing something wrong I think. lol.

snow forge
#

A haaa, nm, fixed it πŸ™‚

snow forge
#

Okay, next question. Is it possible to update a Mesh Collider based on the object displaced by the shader? (the displacement/update only happens on start, so no worry about performance etc)

karmic hatch
loud saffron
#

Hi! How do I update from lit to simple lit shader? I heard that simple lit works faster for mobile?

karmic hatch
karmic hatch
snow forge
dim yoke
snow forge
dim yoke
snow forge
velvet robin
#

Anyone knows any shader or script that I can use for a free form deformation on a camera?

compact adder
#

how can i make dithered shadows similar to tiny combat arena? (in shader graph)

dim yoke
compact adder
dim yoke
# compact adder its not very visible in this image but kinda like this is what i mean

oh, that won't be achieved by modifying the shadow pass rendering. In order to achieve that, you would need to modify the shader for the object receiving the shadow. In given image, it would be the ground below. I'm sorry but I have no clue how you would be able to achieve that in shader graph, not with supported features atleast. You would have to do some magic with the custom function nodes if possible at all

tacit parcel
narrow flicker
#

Idrk where else to put this
so I have a glasses model right? but the lens are not transparent. is there any way I can make the lens transparent and not the rims?

grizzled bolt
marble anchor
#

I'm creating a 2D game with built in render pipeline. How to achieve glow/bloom effect for flame or laser beam?

marble anchor
#

I don't want any post processing. I want to apply the bloom to specific objects, not to the whole screen.

grizzled bolt
marble anchor
marble anchor
marble anchor
#

Thanks

thorn plinth
#

Hey, I'm currently writing a really simple transparent vertex-lit shader that lit said material with ambient light, though I'm encountering this one issue: the transparent/alpha part also seems to be affected and gets changed to a semi-transparent white instead. I'm assuming it comes from the Blend part? as the unlit version doesn't have this issue, but still can't get my grasp on (rookie mistake!)

For a few clarifications: I'm using an old version of unity thus don't have access to shader graph. I tried to write said shader the most simplistic way as target hardware uses very limited fragment functions.

regal stag
# thorn plinth Hey, I'm currently writing a really simple transparent vertex-lit shader that li...

I'm not too familiar with the legacy/"fixed function" style of writing shaders but the problem is likely the Blend DstColor SrcColor as that is ignoring the alpha channel for that pass.
I'd probably combine the passes into one as that will be cheaper, and keep using Blend SrcAlpha OneMinusSrcAlpha for transparency.
Also side note, may also want to avoid using a red cross symbol. Might cause legal issues even with the additional triangles here, better to use alternate colours or "H"/heart symbols, etc.

grave stone
#

main pewview is not showing preview

thorn plinth
# regal stag I'm not too familiar with the legacy/"fixed function" style of writing shaders b...

This is my first thought aswell, though, switching any Blend color with alpha (or just omitting the line) will result in an entirely white and textureless material
About the single pass, unless I'm doing wrong, it makes the shader unsuitable and with a bit of search on my end, it has to be separated? unsure.

(No worries about the red cross, this is a strictly personal project I do on my free time for education purpose, and have no intention of releasing it blobsalute)

regal stag
thorn plinth
#

Oh, this works! ...It was all down to how I sorted things in a single pass. Order does be tricky

#

Thank you for the answers!

regal stag
regal stag
mighty flax
thorn plinth
#

I'm aware of it, thanks for the heads up though

stiff nexus
#

This appears to mix the posterization with the original image.

#

If I set step count to 1 it looks like this.

#

This is how it looks with 64 steps.

#

It appears to be mixing pre image with posterized

#

This is how it looks normally

#

Oh wait, I get it

#

Its smoothly transitioning between each step.

deep moth
#

something i didn't make clear is that you can adjust the smoothness in that equation too

silk sky
#

URP, I need help on building a shader that support multiple alpha objects, my friend modeled on blender a set of different flower and trees as billboards and then exported the whole group as a single object sharing one material. I tried building a simple shader on unity with transparecy in it but I get a very weird effect where far elements gets rendered on top of the nearest. Can somebody help me fix that?

deep moth
#

sorting order issues are really tricky! One very simple way to solve the problem would be to use a cutout shader instead of a transparent blend shader.

#

So they're technically opaque but discard the pixels that are below a certain alpha threshold

#

beyond that solutions tend to get pretty technical and are hard to solve w/ shaders alone in my experience.

#

This is the domain of solutions for this problem ^^

#

easiest is just to use dithering with alpha discards -- cutouts

rain parrot
#

Anyone know if its possible to rotate an individual tiles on a tilemap using a vertex shader? My attempts so far have only rotated the entire tilemap. I'm trying to make the individual tiles react to external stimulus and the effect would essentially be to rotate the tileObject.
I'd be fine with a fragment shader as well. - thanks

warm grotto
#

Hi Guys,How to make it that over normal character/terrain texture you add just one layer of highlight on the edge of the object, like they did in this new game No Rest for The Wicked.
It looks like just one layer of toonshader, without overwriting the texture. But it's actually not so smooth as toon shader - looks like real (maybe too strong) highlight.
How to do that? πŸ™‚

tacit parcel
warm grotto
weary dragon
#

so i made a shader graph that allows me to put on cubemaps, but when i put it on objects, it doesnt line up. is anyone able to help with it?

amber saffron
tacit parcel
#

How can I 'preset' shader sampler?

 sampler2D _GlobalMap;```
The global map is set to a rendertexture using Shader.SetGlobalTexture at runtime, which is running fine (atm). 
But the problem is, during editing, it's become grey texture, which is hindering the editing process. I want to set it to black during editing so it become transparent
#

Oh, I forgot to add, I'm using fragment shader

regal stag
azure badger
#

Hey everyone,

I'm in need of some assistance. If anyone could guide me in the right direction or already knows how to handle this situation, I would greatly appreciate it. I'm attempting to render elements only when they're viewed through another object. In the example below, the cube should only be rendered when viewed through the door. I'm encountering significant difficulties in achieving this. Most tutorials and online resources I've found are geared towards URP, but I'm working on an HDRP project, which seems to have significant differences. Any help would be greatly appreciated. Thanks!

From what I've seen, there doesn't seem to be any way of filtering the opaque layer masks in HDRP settings. If you believe there is any other method besides stencils that I could try, please let me know. I've done some more digging, and I believe the way to go in HDRP is by using a "Custom Pass Volume," but I might be mistaken.

amber saffron
tacit parcel
fossil cloak
#

Hello!
Do you think i can archive a shine like this via a decal shader?
i want to project a decal on the ground and add the shine in the same shader without any additional geometry.
Is this possible?

azure badger
# amber saffron You're right, to do this you'll need to use custom passes and the stencil buffer

Thanks for confirming! Custom Pass Volumes sound like the right track. Where exactly does the stencil buffer come into play with Custom Pass Volumes? Is it handled in the shader or through scripting? I assume I need to write custom shaders or scripts to achieve this effect? I haven't found any HDRP examples for a stencil scenario. Maybe you know of any resources or a similar workflow example? Thanks again for your help! I apologize for the barrage of questions, but I'm fairly new to HDRP and would greatly appreciate any additional guidance or resources you could point me towards.

keen egret
#

Hey, did I do anything wrong while making this shader? I'm new to the shadergraph. (It's an 8k screenshot, so that everything is readable)

amber saffron
regal stag
#

I'm also not really sure about being able to choose the channel anyway. Seems like unnecessary shader variants imo. Might be better to author textures with consistent channels. (I guess that's the point of this over the URP/Lit though?)

#

You also have an emission map & color but haven't used those yet btw

keen egret
#

I made the shader to reduce the memory load by loading less textures and combining the metallic map, roughness and occlusion into one texture and seperating the channels.

regal stag
keen egret
regal stag
regal stag
#

Yeah it's under the advanced part

keen egret
regal stag
#

Ah okay, must be a 2022 thing then. Guess stick to the shader method πŸ˜…

keen egret
barren cedar
#

now I think about it in this context, that was probably a solution to that problem

#

each individual pixel is still opaque or completely transparent, but the overall effect approximates partial transparency

twilit jackal
#

Using the Unity Toon Shader, why does my model blow out as blinding white light in the scene view with the post processing if the rotation of Y is set to 0?

regal stag
twilit jackal
#

Ahh, that make sense. I can just make sure it's never 0. Be easier than trying to debug it forever. It looks really nice other than that little bug.

fossil cloak
slender ore
#

Is there a way in shader graph (HDRP) to make less transparent objects behind more transparent objects visible?

#

To be more specific I have a cube with an alpha of 0.4 and inside there is another cube with an alpha of 0.9 and I can't see it from outside

azure badger
# amber saffron Check out the "draw renderers" custom pass , in there you have a toggle to "over...

I've created two render passes, one for each layer (portal and inside), and regardless of the changes I make in the Stencil Override settings, nothing seems to happen. My thought was that there were no declarations for the meshes' stencil references. So, I devised a simple shader code to assign them a specific reference. However, in this case, neither of them renders anymore, regardless of what I try to change in the custom pass settings.

Do I even need this shader code, or am I missing something completely different? Once again, sorry, and thank you for your help. I'm struggling to understand how to make the stencil and the passes work together from the documentation alone.

Shader "HDRP/Custom/StencilMask"
{
  Properties
  {
    [IntRange] _StencilID ("Stencil ID", Range(0, 255)) = 0
  }

  SubShader
  {
    Tags { "RenderType"="Opaque" "Queue"="Geometry-1" "RenderPipeline" = "HDRenderPipeline"}

    Pass  
    {
      Blend Zero One
      ZWrite Off

      Stencil
      {
        Ref [_StencilID]
        Comp Always
        Pass Replace
      }
    }
  }
}
grizzled bolt
grizzled bolt
fossil cloak
queen tapir
#

Hello everyone, is it possible to use any node similar to "Sample Texture 2D" that will sample a RenderTexture?

I am trying to write a compute shader that outputs into a texture, which is then sampled in a Shader Graph and used later on.

If there is any other way, like sending a texture reference to the CS and directly editing the texture, I am open to hearing options. Thanks!

grizzled bolt
weary dragon
#

Ill make a duplicate and see if it fixes it when i do that

regal stag
queen tapir
#

Because from the preview, my RenderTexture is same as the Texture2D πŸ‘€

weary dragon
tall smelt
#

I’m not sure which category this goes in but when I changed me build settings to android these white dots appeared, why and how do I get rid of them?

#

This has never happened before for me but now it’s doing it

#

Ok so I think it’s with the textures

#

They also have the dots

#

Can someone please help I’m so lost

#

I went back to windows and now it’s fixed but I need it in android

rough haven
#

the default output particle quad has a uv mode option and when i use my own shader graph the option disappears

#

do i have to basically make a shader graph that accounts for the flipbook uv?

regal stag
rough haven
#

hmm okay gotcha

#

another question, do you know how i would go about making a drop down option for single texture uv and a flipbook for a shader if i wanted to

spark leaf
#

Anyone know how to make stencil only work if they are in front of the object depth wise? I don't want stencils behind an object to reveal things on the stencil layers.

regal stag
rough haven
#

i managed it to get it working but now this is happening

#

actually

#

it might not be the best idea to use a distortion effect with a flipbook effect

#

i feel like the other textures might bleed in

lament granite
#

Hi, is there any way of having two separated shaders into the same object?

tacit parcel
lament granite
tacit parcel
#

You can deactivate the renderer or the gameobject, but I dont think you can deactivate materials
What are you trying to do?

flat hedge
#

Hi, I have this texture that looks normal in the sprite editor/when applied to the object but when I try to sample it in the shader graph it's completely off.
What could be causing this?

#

I tried restarting, reimporting etc. but none of that works.

lament granite
tacit parcel
flat hedge
# vocal narwhal https://unity.huh.how/graphics/shader-graph/alpha-output

Question, why can I just plug the output of the final multiply into the clamp node and use that as alpha(pic 1) but I have to multiply the alpha of the main tex with the final multiply before clamping and using as alpha(pic 2).
This is kinda confusing because I am already multiplying rgbA output of the main tex with the base color which is then included in the final multiply.

vocal narwhal
flat hedge
vocal narwhal
#

(And you want w/A, so you'll need to split it off to handle it individually)

weary dragon
lament granite
azure badger
#

Stencil Mask HDRP

#

this
If anyone has insights about Render passes and stencil masks in HDRP, please join the discussion in the thread above. Your input would be greatly appreciated. Thank you so much!

amber saffron
amber saffron
weary dragon
#

i got it from the asset store

loud saffron
#

Hi! I have been trying to reduce the android build size and to also speed up my android build (super slow currently). Shaders is the biggest part of the build. Do you know if I need all these shaders for default URP. I am not even sure which are required, and which are not:

vale gale
#

Hello, I have created a wave shader which modify the textures uv, is there any way to make it ignore the parts of the texture that is transparent?

#

the texture looks like this and i only want the effect to be applied to the non transparent part of it

grizzled bolt
vale gale
#

the alpha should basically be ignored completely

karmic hatch
vale gale
#

sounds like it could work. im still very new to shaders, how would you combine them afterwards?

silk sky
#

Is it possible to create a custom shader for an HDR? I want it to be able to also be rotated on the vertical and not just on horizontal

dim yoke
silk sky
old copper
#

how do I get the max Y value of an object in world space compare to its origin in shadergraph

#

for example I wanna get the number 6.5 (height of the object) in this case

#

but I want to apply the shader to everything, and it would be a pain to manually set it up from every object

dim yoke
silk sky
dim yoke
fickle grail
#

Hello! Is there any way to get the object current rotation and scale inside a URP Shader?

regal stag
fickle grail
regal stag
fickle grail
#

I'm writing it on Shaderlab :(

#

I don't know where to find the information notlikethis

regal stag
fickle grail
#

Mhh projected from the forward vector, basically the texture that the player leaves to the ground must point towards the forward vector

#

If that makes any sense

#

It's like a dash effect

#

Sort of a trail that you leave behind

#
float cosAngle = cos(_RandomRotation);
float sinAngle = sin(_RandomRotation);
                //Map the UVs within the PainterPosition space
float2 newUVs = (_PainterPosition.xz - i.worldPos.xz)*0.3;
                //Rotate in 2D coordinates. Reference 3D Math Primer ebook
newUVs = float2(
   newUVs.x * cosAngle - newUVs.y * sinAngle,
   newUVs.x * sinAngle + newUVs.y * cosAngle
);
                //Offset the UVs
float4 texMask = tex2D(_MaskTex,newUVs+0.5);

#

I have this right now

#

I don't know how to get the "RandomRotation" , which rn is just a random number between 0 and 360, to get the angle from the Forward Vector

regal stag
#

You should probably calculate that in C# when you dash and pass it into a material property

fickle grail
#

Oh, okay! I thought I could do that with matrices

tall smelt
#

i dont know where this would go but when i changed my build settings to android this happened to my texture, why and how do i get rid of it?

tall smelt
#

Can someone please help me I’m really confused

dreamy nacelle
#

I’m using URP to make a Mod for a game and I need to make a shader graph that raises lowlights to make a night vision effect. I’m not versed at all in shaders or shader graphs so if someone could help or tell me how to make a shader graph to do that, that would be a HUGE help because im completely lost

weary dragon
#

so i do not know if i can reorder it

karmic hatch
tacit parcel
tacit parcel
tacit parcel
#

Question, does unity_worldtoobject matrix work on spriterenderer?
I tested it on meshrenderer and itworks, but not on spriterenderer

silk sky
#

I'm havins issues to make a skybox from shadergraph starting with this hdr, can somebody please help?

grizzled bolt
weary dragon
grizzled bolt
#

You might be looking at a material asset rather than the texture import settings

weary dragon
#

ok nvm but is there a way to add this to the shader graph?

regal stag
amber saffron
weary dragon
weary dragon
amber saffron
silk sky
weary dragon
# amber saffron

Huh. Well im a little confused because i cant find how to add that but i will look in the morning.

amber saffron
unique latch
#

Hey folks. I'm having some trouble with passing vertex data to Sprites. My issue is that SpriteDataAccessExtensions.SetVertexAttribute works for sprites in simple mode, but apparently not in tiled or sliced mode. I've detailed the issue more extensively in this forum post.

https://forum.unity.com/threads/spritedataaccessextensions-setvertexattribute-not-working-on-tiled-or-sliced-sprites.1568944/

brittle bolt
#

Does anyone know how to get Stencil Shaders to check depth with one another? I am currently using a stencil shader in scene, and it renders on top of other stencils.

#

I have a stencil in scene that hides certain geometry, and I have another stencil in scene that, if closer, needs to cancel the other one out. But they dont seem to be doing any sort of depth testing

tulip carbon
#

Hi. Does anyone know a way to get the edges so I can show like some wear in them please? Thanks in advance

amber saffron
amber saffron
tulip carbon
#

so there's no way to do it with shadergraph itself so it is procedural?

amber saffron
tulip carbon
#

oh okay, thanks

floral tendon
#

might be a stupid question, but I'm following a tutorial on how to make a water shader. but what is this depth fade distance node? I'm super new to shaders, so I'm following this tutorial religiously, but it's not explained in there. and I can't find it when i type it in.

regal stag
floral tendon
#

ahh okay! thank you!

weary dragon
#

and it looks like i cant add it

grizzled bolt
# weary dragon ok i was meaning this kind

The nodes that sample a cubemap expect a cubemap texture asset
As Remy said you'll have to compile the images into one cubemap texture, according to the vertical or horizontal layout shown earlier
It can be done in any image editor but I prefer the Image Sequencer of VFX Toolbox

hushed silo
#

what's the super cheapest way to get one channel triplanar mapping onto an object?

#

I really just want one channel, black and white

grizzled bolt
hushed silo
#

perhaps, but I've seen people talk about solutions that avoid doing 3 texture lookups per pixel, which is I guess the more important part

tacit parcel
sterile zinc
#

I have the following HLSL code for a custom function in shader graph, which works perfectly fine (basically just the sample texture 2D node at the moment)

#ifndef BIOMES
#define BIOMES

void Biomes_float(UnityTexture2D Tex, UnitySamplerState SS, float2 UV, out float4 Out) {
    Out = SAMPLE_TEXTURE2D(Tex, SS, UV);
}

#endif
#

however, UnityTexture2D and UnitySamplerState are not defined types, so my code editor is complaining

#

Cannot resolve type: 'UnityTexture2D'