#archived-shaders

1 messages Β· Page 154 of 1

thick fulcrum
#

@mortal sage you need to add in render feature, I saw a tutorial which did grab the normal... if I can find it again will post link

mortal sage
#

thanks!

thick fulcrum
#

just grab the part about scriptable render feature, add that to your project then you can get the texture in shadegraph and work with it.

atomic glade
#

Anyone know a way I can have a transparent material in shader graph that doesn't have these weird depth issues? This texture doesn't even have any transparency, but it's showing the far side of the cylinder in front, and the meshes off in the distance in front of it.

#

I've got the alpha channel of the texture mapping to the alpha of a PBR master node, and I've changed it to transparent in the shader graph

amber saffron
mortal sage
#

@thick fulcrum Great, thanks I will see how I exploit this

amber saffron
#

@atomic glade That how transparency work realtime.
If you object is composed of transparent and opaque parts, it's better to split them in multiple materials.

atomic glade
#

How would I go about splitting them in a way that would work from any angle?

#

They're already split, but they're all using the same shader

amber saffron
#

Transparent shader for transparent part, opaque shader for opaque part

atomic glade
#

So there's no way to have something opaque that can become transparent by adjusting the alpha?

echo badger
#

Pretty cool, thanks @amber saffron! Do you happen to know how performant heavy it is/isn't?

amber saffron
#

Didn't really try to benchmark it. Should be pretty light though, as it's only doing an alpha clip

atomic glade
#

I'd like to be able to fade a polygon so I can see what's behind it programatically, and my plan was to just adjust the alpha multiplier on an opaque texture so an individual submesh can be transparent. I've got them split into different materials already

echo badger
#

Oh, that's cool. I would imagine it would pretty light then. I will take a look at it, thanks again for sharing!

atomic glade
#

But even when fully opaque the depth doesn't work right

amber saffron
#

Alpha = 1 doesn't mean "opaque", that depends on the shader setup of transparent vs opaque

atomic glade
#

Is there anything I can do to achieve this effect then?

amber saffron
#

Assign an opaque material on all the polys you want to be opaque, and a transparent one to the ones you want to be transparent, using submeshes

atomic glade
#

So, just make two copies of the shader, and switch shaders whenever I want to fade one?

amber saffron
#

yep

meager pelican
#

@atomic glade What you MIGHT try, is to render this thing in it's own queue, if you want geometry+1 or even the transparent queue. Do depth testing, alpha blending, cull backfaces, and fade the alpha. Unity has shaders that do fade, IIRC.

#

Another option, if you don't mind the effect, it to fake-fade using screen-space dithering in the opaque queue.

atomic glade
#

Is there a way to generate dithering in Shader Graph?

meager pelican
#

Sure, as long as you can do a discard, but it might require a custom node. You'd feed in the alpha value, and it would look up the screen-space modulus (say 64x64) and compare the alpha value and discard or not. Google "screen-space dither".

regal stag
meager pelican
#

Even better!

#

Then you'd compare the output of that to the current pixel's alpha value.

atomic glade
#

Okay, I'll try a dithering approach to fading. Might even make for a cooler effect than just straight transparency

meager pelican
#

All depends on what you want. But you can handle it in the opaque queue

atomic glade
#

Another question, the PBR materials I've downloaded all have a displacement map. Where does that go in a PBR master node?

devout quarry
#

@mortal sage also check out this

#

it's another implementation, but should be similar to mine

#

would love to see what effects you use it for πŸ™‚ feel free to tag me

#

I used the texture to make a very primitive ambient occlusion effect

muted skiff
#

Heyo, I'm quite new to shaders and I would need some help. I followed this tutorial to give my UI text a pixel perfect outline:
https://www.febucci.com/2019/06/sprite-outline-shader/
However, when I try to thicken that outline, instead of it getting thicker it just appears at the opposite side of the element.
I changed this:
fixed bottomPixel = tex2D(_MainTex, i.uv + float2(0, -_MainTex_TexelSize.y)).a;
To this:
fixed bottomPixel = tex2D(_MainTex, i.uv + float2(0, -_MainTex_TexelSize.y * 2)).a;
Any help is appreciated! :)

Febucci

Discover how to create an outline or inline shader for your sprites in this simple tutorial, using both Unity Shader Graph or HLSL. Read more!

atomic glade
#

I've downloaded a few PBR materials, and they all have a displacement map. Where does that go in a PBR master node in Shader Graph?

fervent tinsel
#

nowhere usually

#

if you really need some depth illusion, you could use POM node with it, but do note it's more expensive

#

also you could diplace the mesh with the data but it's kinda pointless as there's no tessellation support on shader graphs, so if you just slap it into dense mesh, you could have just baked the height to the mesh itself

grand jolt
#

Is it possible to get stencil buffer working in a PPv2 custom shader with forward legacy rendering pipeline? How?

lime viper
#

hey I think I remember something being mentioned here about Material property blocks with shader graph shaders not gpu instancing properly, or am I misremembering?

atomic glade
#

How would I go about making an outline shader in URP? I've found some tutorials for writing one for the old render system, but I don't know how I'd make one in URP, with or without Shader Graph

amber saffron
#

@atomic glade In URP, I would recommand to go with shadergraph.
If you need a 3D outline, use the "shell" technique, bu re-rendering the mesh with inverted faces and pushed
For a 2D sprite outline, the best is to precompute a outline in the sprite as a "gradient contour" like a SDF, or you can do multiple samples by pixels and offseting the uvs to check for outline

atomic glade
#

What is the shell technique?

amber saffron
meager pelican
#

@atomic glade Did you have any luck with the dither-fade?

atomic glade
#

I actually wound up just toggling between the opaque and transparent shaders

#

I had to make transparent versions anyway for some materials that were transparent all the time, so it just seemed easier to do that

#

I'll check out those examples, I found a Youtube video of Unity using those toon shaders, but they're not compatible with URP and don't work in 2019.3, maybe the examples on the site are updated?

median lava
#

dose anyone have experience with perlin noise?

tepid vector
median lava
#

@tepid vector what kind of black magic is that !?

tepid vector
#

You can see

smoky raptor
#

Not sure where to ask this. I started my first 3D project and I am confused on how to get a texture to tile depending on the size of an object.

echo badger
#

... You don't need to do an exact quote πŸ˜‰

grand jolt
#

hello everyone. I have a problem with Instancing using DrawmeshInstanced and WebGL build. on editor/windows build and firefox everything is ok. on Chrome since an update a couple of weeks ago the instanced colors are meshed up.
nothing changed on my code though. I have older webgl builds that have the same problem.

raven timber
#

is there any way to mix to different materials based on percentage or values?

thick fulcrum
#

@raven timber can you elaborate or have example picture, as to me mixing materials is wood and glass on same object which can be done with standard shader.

raven timber
#

here 1 have 2 materials and 2 different shaders

#

on collision.. i want blue as base.. and red material will be as blinkin on blue

#

get me ?

thick fulcrum
#

ok that's more swapping materials, not mixing per say. Depending on the shaders you might get away with both on same model and just swap their order in code. Alternatively you swap the material via code at runtime.
Or they don't look overly complicated materials, you could roll them into one material / shader and just adjust colour and other variables from code when collisions detected.

raven timber
#

ok thanks..let me try combininb them in one material : )

orchid briar
#

i have a problem... im not sure how to solve

#

i need to dispatch a compute shader when another one is done

thick fulcrum
#

that's fairly easy, as you pull back the data to cpu can send that data to another compute shader at that point or just trigger next compute. But pulling the data from gpu to cpu will be a bottleneck, ideally you want to pass the information on IF it is reliant on previous. but that's beyond what I've experimented with.

plucky bone
#

I'm assuming fholm is passing his compute shader output to a normal shader

#

Rather than getting it back to the CPU

#

I'd just create another kernel that calls the extra compute shaders code

meager pelican
#

He needs to know that all processing for <A> is done, before he calls the kernel for <B>. IDK if that's automatic in Unity from separate kernel invocations (like some internal barrier) or if you need to make use of (code) some kind of barrier. Lemme dig around. I know I read something on this.

#

@orchid briar

#

Of note GPUFences do not need to be used to synchronise a GPU task writing to a resource that will be read as an input by another. These resource dependencies are automatically handled by Unity. That's a tad vague to me, but it's promising. IDK what happens if they're both R/W...or how unity even detects this...probably automatic too.

astral pelican
#

Problem in Shader Graph with UV Node

#

I get an error and I do not know why

#

What I want to access are the UV coordinates of the mesh

#

I use the universal rendering pipeline

meager pelican
#

I don't think you want UV coordinates passed into a spheremask node. Maybe some kind of worldspace thing?

grand jolt
#

hello everyone. I have a problem with Instancing using DrawmeshInstanced and WebGL build. on editor/windows build and firefox everything is ok. on Chrome since an update a couple of weeks ago the instanced colors are meshed up.
nothing changed on my code though. I have older webgl builds that have the same problem.

main blade
#

hello all, i am stumped with something and need some guidance. I am trying to create a debug view where the screen is split into thirds. But I'd like to split it in radial segments so that I can better visualize a problem

#

like so

#

does anyone know how I can split uv into a radial like that?

meager pelican
#

Relative to/split-by what?

main blade
#

jus screen size, black being the screen space uv

#

red being the third split

#

white being the outline generated by snipping tool

meager pelican
#

But...you're putting different things in different areas, right?

main blade
#

so I can push a certain logic to each third in my compute shader

#

yeah

meager pelican
#

IDK, you could use a mask I suppose, and mask it off in any shape you want. That's probably easiest.

#

So color it in a custom full-screen shader to display X if the mask is 1, Y if it is 2, and Z if it is 3 (XYZ being the three results). Then just draw your mask in whatever shape you want and pass it in.

#

Make it look like a checkerboard if you want, or big-bird.

main blade
#

Thats what I'm aiming for. Masks are a way, but would like to do this programmatically so I can add debug views as I go along.

#

and just add more pie slices

meager pelican
#

You can either build the "debug view" into your individual shaders (you said compute shader) or you can build it into a separate post-processing pass if you have the data. That's still "programatic". But otherwise you'll have to figure out the math of the center point of the screen and the triangles instead of the mask.

#

IDK what to tell you.

main blade
#

debug views are there, just need some guidance on radially splitting a square

#

thank you!

#

will dive deeper into the interwebs

meager pelican
#

Well, if you just want "pie slices" then compute radians and divide it up into slices. Doesn't really matter if it's a square or not around the edges. Just compute the angle.

main blade
#

thanks again. I managed to sort it out, wanted to post here, but not allowing me to paste code

astral pelican
#

@meager pelican I want to use the uv coordinates as I use the sphere mask to make perfect circles for selection indicators that are simple quads with 0,0 to 1,1 coordinates

#

This way I can reuse the shader material for every selection quad with the same color

atomic glade
#

I'm trying to use some effects from Unity's Universal Rendering Examples: https://github.com/Unity-Technologies/UniversalRenderingExamples/wiki/Toon-Outline

And I'm getting this error whenever I try to bring over some of their renderObjects:
Assets\RenderObjects.cs(63,59): error CS1503: Argument 6: cannot convert from 'UnityEngine.Experimental.Rendering.Universal.RenderObjects.CustomCameraSettings [Assets\RenderObjects.cs(46)]' to 'UnityEngine.Experimental.Rendering.Universal.RenderObjects.CustomCameraSettings [Library\ScriptAssemblies\Unity.RenderPipelines.Universal.Runtime.dll]'

GitHub

This project contains a collection of Custom Renderer examples. This will be updated as we refine the feature and add more options. - Unity-Technologies/UniversalRenderingExamples

#

I'm not really sure what this error is trying to tell me? It looks like it's trying to convert something to itself...

astral pelican
#

@meager pelican I found the problem. My Reference name for the parameter was off

atomic glade
#

Okay, I think I found it. I was copying over some code that already existed in the generic URP and I didn't need to copy over. Disregard my question.

hushed urchin
#

So is it better or worse to use same material for multiple meshes and adding a per instance variable to modify the differences? I don't think I can benefit from batching since these will be doing effects based off object space stuff. I'd assume if the per instance data never changes the only difference would be saving some minimal memory on GPU?

#

The materials will use per instance anyway.

naive girder
#

Hi all, is there a way to adjust the 'default-material' so it is GPU instanced by default?

shell summit
#

I made SUPER COOL FIREWORKS using Unity....check it out.I hope you wanna tag along.so if you are interested , subscribe....

#

Check it out

coral otter
#

I've been looking around the web for an hour and i've found nothing

vocal lark
hushed urchin
vivid kernel
spiral sorrel
#

I am getting an error in one of URP shader:
Output variable LitPassVertex contains a system-interpreted value (SV_RenderTargetArrayIndex) which must be written in every execution path of the shader. Unconditional initialization may help. at line 283.

Any clue, I am quite unaware of shaders.

meager pelican
#

@vivid kernel Don't use shader global keywords, use locals.

unborn perch
#

I'm trying to make a glow material and I'm not sure why this shader won't render in the preview or the scene. I'm really new to shader graph and unity in general is there something I'm missing here?

regal stag
#

@unborn perch Your colour node has an alpha value of 0 (shown by the black bar below it), so it's fully transparent.

unborn perch
#

@regal stag Oh thanks I never even knew that existed

quick nymph
#

Check the purple assets on the right side

fervent tinsel
#

@coral otter yes

#

but it's tricky

#

there are basically two stencil bits left for users on HDRP (at least on the recent versions)

#

but you need to write those stencil passes manually, you can't use shader graph

coral otter
#

@fervent tinsel can i do it the old way ? Like writting ```cs
SubShader{
Tags { "RenderType" = "Opaque" "Queue" = "Geometry+1"}
Pass {
Stencil {
Ref 2
Comp Notequal
Pass keep
ZFail decrWrap
}

        CGPROGRAM
#

For the stencil part i mean ?

#

Or is there another way ?

fervent tinsel
#

you have to use the stencil pass in current HDRP structure

#

like, you see that in HDRP shaders and SGs generated for HDRP

#

but yeah, it's very similar to what you pasted

coral otter
#

May you have an example ?

#

Because i have no clue about how to do it from anywhere on the internet

fervent tinsel
#

look for HDRP postprocessing shaders

#

pretty sure SMAA does this

#

altho that might be on compute

coral otter
#

But this mean i must apply it on a post processing shader ? I cannot put it on a material ?

fervent tinsel
#

not sure if I understand what you ask now

#

I'd assume you can put it on any shader

#

I haven't done it though

#

that sample overwrites all bits tho

coral otter
#

Well, thanks @fervent tinsel i guess i'll dig into how to reproduce by die and retry. I'm not a shader guy so well, i'm not sure to understand any of what i'm doing :D
If i ever manage to achieve it, i'll post a package here with the effect

fervent tinsel
#

just be aware this is the current setup they have on HDRP, I don't remember if that was already like that on 7.x but I think they use that on latest 7.3 at least

#

they've changed the stencil system 2 or 3 times already on HDRP

coral otter
#

I've no idea what is a stencil bits, i just puted the line Stencil and Ref in my shaders and it worked like magic UnityChanConfused
So i guess i'll just look in the hdrp shaders and find a way to place the same words at differents places and see

fervent tinsel
#

they use bitmasks so that they can pack 8 different things on single 8-bit stencil buffer

#

userbits are the last two (64 and 128)

coral otter
#

That's super kind from you, but it's no use to try to explain me this, i just don't have the right education to understand UnityChanSerious
I'll just dig and try stuffs, thanks again for your help

fervent tinsel
#

np. good luck

coral otter
#

Well in fact

#

It look like it's just build in when you choose an object on the default HDRP shader as transparent

shy spruce
#

how do you get the sort of lightsaber glow effect using shadergraph

#

i tried to use the fresnel effect, but to no avail

meager pelican
#

Look up a post-processing effect called "bloom" to see how that "glow" is often done. Also "emissive" colors from your shader if you want it to cast light. Fresnel might give you an interesting base color though.

shy spruce
#

glow is the hard part for me

#

it seems like the flow is restricted to the shape of the object, it's not actually emitting any light out of the object

#

i tried turning HDR on, but that didn't help either

versed gorge
#

Hello, I have been researching this answer for about a week now, but I still have no clue. I've been trying to recreate this Force Field effect in Blender https://youtu.be/NiOGWZXBg4Y , However, I have no idea what the Scene Depth node set to "Eye Space" output is doing

Let's learn how to make an awesome force field with Unity Shader Graph!

● Check out Skillshare! http://skl.sh/brackeys15

● Support us on Patreon: https://www.patreon.com/brackeys

● Project Files: https://github.com/Brackeys/Force-Field
● Water Shader shown in intro: https:...

β–Ά Play video
#

The main problem I have in trying to do this effect in Blender is not knowing what the "Eye Space" option of the Scene Depth node is doing.

restive rain
#

Depth pass shader for cracks?

fervent tinsel
hexed portal
#

quick question: I'm trying to "chunk" 2d lighting into 10x10 pixel squares - think terraria lighting, but I'm not using a tile system - but I've never actually worked with shaders. would that be an appropriate use for them?

#

to be more specific I don't want those squares to overlap

dapper pollen
#

its not strictly a shader question but is there a way to force unity to open shaders in a different ide than whatever the main one is? like for shaders open vscode, c# open rider?

rich flume
#

Hello, I would like to use Parallax Oclusion Mapping with Triplanar, but in the shader graph, the output of the Triplanar is an RGBA (or I would like to have UV to plug it in POM). Any idea ? πŸ™‚

ionic brook
#

@dapper pollen How about you have your asset folder open in an explorer and set the default IDE for .shader files as your desired IDE. Dont think that you can set multiple IDE's inside Unity though.

meager pelican
#

@rich flume As I understand it, POM is a simplified ray-tracing technique to alter the surface depth. As such, you'll have a heck of a time in SG IMO due to the loops. You could maybe use a custom node and code the thing yourself.

#

Or edit the generated code

ionic brook
flint hornet
#

I am getting a heavy amount of swappy errors (Failed to wait for fence) when I have a lava shader running. Anyone familiar with this type of error?

raw dock
#

Does anyone know what shader Unity uses to display a navigation mesh in the Editor?

#

I downloaded the builtin_shaders but I just cant find it

grand jolt
#

Hi, i dont know if this is the correct channel to post this. I'm trying to do some simple verlet cloth with a compute shader, but strangely getting eratic behavior on my constraint kernel, It seems like the constraints are computed but there is a ton of jiggle, and the entire unpinned particles are falling to the abyss, the same algorithm runs fine in cpu version. i dont know if there are conccurent access that affect the particles positions simultaneously and creating these artefacts or if i have set up the number of threads groups the wrong way. Can someone with compute shader experience enlighten my lantern a little bit on that matter. i will share the code in pm.

frank ferry
#

Hey, does anyone have any kind of metrics for compute shaders in Android? I know it runs on most of android devices, but I hear its incredibly slow?
Does the speed change at all if you use bin-sized dispatches? Unfortutanely, I dont have the devices on hand to test myself, so any information would be appreciated, thanks.

neon gull
#

Did unity remove the scriptable render pipeline repository from github?

devout quarry
neon gull
#

Ah, thanks! Was panicking there for a moment πŸ˜‚

waxen hollow
#

Hi, im want to paint triangles, which works, but i also want that the triangles are drawn with hard edges. Im using a fairly simple shader ``` struct Input {
float4 color : COLOR;
};

    void surf (Input IN, inout SurfaceOutputStandard o) {
        o.Albedo = IN.color;
    }``` What i have to do that the triangles with color drawn with hard edges ? (thats how it looks atm)
sonic bear
#

can someone explain why the following doesnt work? the bit of it is plugged into albedo
there is no change at all with color no matter what "depththingie" is set to or how far away the plane is from other objects.

regal stag
#

@sonic bear Is the master node set to Transparent surface type?

sonic bear
#

let me check, also funnily enough i was trying out your solution for a similar shader on your website ealier @regal stag

regal stag
#

If you are using URP you'll also want to make sure the Depth Texture option is enabled on the URP asset

sonic bear
#

I am using lwrp

regal stag
#

LWRP too, same thing

sonic bear
#

and itis set to opaque, also how do i do that

#

?*

#

wait found it

#

let me try it out

#

so i turned depth texture on however the issue still persists @regal stag

regal stag
#

For the Scene Depth node to be useful, the surface type needs to be Transparent (or the shader needs to be moved into the transparent queue via the Render Queue in the material inspector). If it's opaque it will return the depth of the object itself (which is equal to the Raw Screen Position -> A, so when subtracting them the result is 0).

sonic bear
#

thanks it is working now, that was the issue

ionic brook
#

For the Scene Depth node to be useful, the surface type needs to be Transparent (or the shader needs to be moved into the transparent queue via the Render Queue in the material inspector). If it's opaque it will return the depth of the object itself (which is equal to the Raw Screen Position -> A, so when subtracting them the result is 0).
@regal stag you are saying sceneDepth.eye-screenPos.a=0

regal stag
#

@ionic brook For an opaque shader which writes it's own depth to the depth texture, yes.

sonic bear
#

does anyone know how to make a splatmap in shader graph?

amber saffron
#

@waxen hollow you'll have to use a mesh where all triangles are separated (don't share vertices)

#

@sonic bear You don't make a splatmap in shadergraph, you use it.

sonic bear
#

wait they have one already in there?

waxen hollow
#

Alright, thx^^

regal stag
#

A splatmap is usually just a texture that comes from another source, like the terrain system.

amber saffron
#

A splatmap is just a texture

sonic bear
#

well i mean that is fair enough, but i have no idea of how to make one
i know how i would use it;
replace [color] with texture
but i dont know how to make it so that the texture is made in the first place

amber saffron
#

What is the final thing that you are trying to achieve ?

sonic bear
amber saffron
#

So, you already have the splatmap here

sonic bear
#

no that is from google images

amber saffron
#

Oh, ok

#

In unity, when you paint a terrain, you're editing a splat map

#

One common way to work with splat map is that the sum of all the channels (R+G+B+A) = 1

#

So that in the shader, you can multiply the different texture samples of each layer with the corresponding channel value, and add them together to have the final color

sonic bear
#

maybe i am in the wrong channel, but i dont need help with converting the splatmap texture into the final material. i need help making the splatmap in the first place

amber saffron
#

Any texture painting or image editing software should be able to help you here

#

It's just an RGBA map

sonic bear
#

no like in unity during runtime

amber saffron
#

ow, okay !

#

Is is for a terrain like object, or any kind of 3D mesh ?

open grail
#

How do I make objects get borders when the mouse is over the object

sonic bear
#

the mesh in question is a flat plane, so the texture is just a square texture with no weird uv stuff to worry about

#

@open grail have you checked the asset store?

amber saffron
#

So an easy solution would be to use a separated camera that renders in a RT, and use this RT as splat map

open grail
#

Not yet

#

Lemme check it out

amber saffron
#

You can then paint on it by placing the RT as background of the camera, and draw objets (your brushes) on it

open grail
#

Found something in the asset store

#

I'll try to figure it out

sonic bear
#

you know what that makes sense, can render textures just be thrown into a texture slot of shader graph or do have to set something up?

#

@open grail hope it works!

amber saffron
#

You can assign them just like regular textures

open grail
#

Thanks!

sonic bear
#

okaaay, thanks for the help, i will try to mess with that right now

amber saffron
#

If you want to avoid the camera route, you could try custom render textures, but you will have to write a dedicated shader to "paint" on it, and shadergraph will not help you there.

open grail
#

I can't figure it out

#

I don't know

#

Maybe I can make it so the gameobject lights up instead when mouse is over it

#

And then go back to its normal brightness when the mouse is no longer over it

amber saffron
#

use [ and ]

grand jolt
#

oops wrong channel sorry and thank you

rich flume
#

Is it possible to create custom volumetric fog in order to add wind effect and to adjust his height in function of terrain height ? (with shadergraph)

devout grotto
#

Hiya, I was wondering, is there an option to view dynamicslices files easily? I just want to view the object in an easy way

bleak jasper
#

Does any one knows how to override the wind effect of the terrain grass shader ?
"Hidden/TerrainEngine/Details/WavingDoublePass"

shadow magnet
#

why does setting the o.Normal in a shader throw a Shader error in 'Custom/triplanarGround': Surface shader Input structure needs INTERNAL_DATA for this WorldNormalVector or WorldReflectionVector usage at line 187

#

i'm doing a standare custom shader

bleak jasper
#

try to put into the input struct "INTERNAL_DATA"

#

@shadow magnet

shadow magnet
#

oh yeah it solved the problem ! thanks

#

is there a reson to that ?

bleak jasper
#

I remember that putting that was causing me error elsewhere

#

I don't know I'm not familiar with shader

stable wagon
#

how do i run the shaders?

#

im sort of new to programming

lavish sierra
#

Hey, I'm trying to write a shader that adds an outline to a quad

#

is there any way to do this in one pass?

#

actually, it's not always a quad but is always a flat mesh w/ usually 2 tris

lavish sierra
#

well, I have a post-process shader that works...but seems like there isn't any way to do it in a regular shader, regardless of the number of passes

shadow magnet
#

in a vertex shader you can do it

#

you duplicate you vertex with a greater offset and inverse the normal of the new created vertex

#

be awar it will duplicate the number of tris by two of the mesh you trying to out line

lavish sierra
#

how would I know what the 'offset' is for the new vertices?

#

my UV/texcoords are shifted, and there is only one normal since this is a plane w/ orthographic camera

#

I guess I could do something like set the 'center' of the mesh in a shader property externally and use that to extrude

#

it's likely to make a mess though

gleaming moss
#

I agree that's a poor answer for a quad, but technically you can do it single pass w/ similar theory. If you know enough about the size of the outline and the shape you want to outline for, you can expand the vertices in the vertex shader and mark out the line area with an SDF

#

you're at minimum going to need to change the clip (fancy way of saying 'screen') positions of your vertices, though

#

whether you do that on the CPU or on the fly is up to you

#

would check out some of the wireframe shaders for explanation of the edge detection bit-- quads are probably easier than triangles since you can usually just work with texture UVs instead of barycentric coordinates assuming you use the whole 0-1 range on the quad

grand jolt
#

Anyone ever had this problem? My shader renders gray :/ I use unity URP is it a problem?

proud axle
#

you have to enable the uhhh

#

this thing @grand jolt

gleaming moss
#

might also need to be a translucent shader too

proud axle
#

the scene color node only works if you enable OpaqueTexture

grand jolt
#

but I tried it :c

#

@gleaming moss How do I set it to translucent ?

gleaming moss
#

master node

grand jolt
#

Im starting with shaders x3 What does it mean?

gleaming moss
#

I know the 3D masters have the same limit (and it's hinted at in the tooltip in the image)

proud axle
#

imma guess scenecolor doesnt work in 2D

grand jolt
#

What's the solution? :c

grand jolt
#

I've looked through multiple unitys forum and it seems like using shaders and URP is clearly impossible.

#

If anyone knows a solution or something, thanks

lavish sierra
#

"Set the Surface Type dropdown on the Material Options panel of the Master Node to Transparent to receive the correct values from this node." @grand jolt

grand jolt
#

Does anybody know how an effect is called where 2 intersecting 3d models somehow get their vertices smoothed and textures blended and so it looks like they're a single mesh?

lavish sierra
#

@gleaming moss unfortunately none of that works for me since my planes could be w/ arbitrary shapes and UVs

#

I think I'll stick w/ my postprocess effect for now

wooden kite
#

Hello, i'm new using shader graph, and i can't enable post processing on URP

#

i've tried so many things

lavish sierra
#

do you mean custom postprocess effects, or the regular stuff?

wooden kite
#

the regular stuff

#

i can't enable post processing, any effects

lavish sierra
#

there are like 20 weird and useless things you gotta do

#

sec

#

ok, 8 - scroll to the first answer

wooden kite
#

i'm not using post process v2

#

i'm trying to use the integrated universal render pipeline post processing

#

i've tick the Render Post-processing, tried to check all the layers, my volume is fine and my pipeline asset is fine

full sentinel
lavish sierra
#

hmm is volume trigger being set to none supposed to work?

wooden kite
#

i've tried settings to every object on the scene, even the camera

#

none of them work

#

the shader itself is fine

#

but i really cant get the integrated post processing to work

lavish sierra
#

I would try with a known working project and compare

wooden kite
#

this project is new

#

i've just followed those steps

#

but for some reason urp post processing doesnt work at all

lavish sierra
#

what is your player quality set to?

wooden kite
#

ultra

#

the volume is not working at all

cursive ibex
#

Guys I'm a complete noob about shaders, do you know if it's possible to create a shader that fakes depth without using another camera ? Like those examples of making portals that track player position and rotation to fake perspective; I'd like to make fake windows with this, but just using two or three layers of textures, would be some sort of parallax but tracking player position/rotation, not sure if I explain myself

lavish sierra
wooden kite
#

it is not visible, even on editor scene

lavish sierra
#

have you checked the buttons along the top of the scene window?

#

I think one of them is for post

#

looks off in the screenshot

wooden kite
lavish sierra
#

yeah, and the one to the left

#

if you add the volume to the camera GO instead, is it still broken?

wooden kite
#

yes

lavish sierra
#

sounds like a bug then

#

but, your setup has to be different somehow too

wooden kite
#

x.x thanks

lavish sierra
#

what's in your pipeline asset's postprocessing dropdown?

wooden kite
lavish sierra
#

well, let me check if anyone has reported a similar issue

#

no luck

#

@wooden kite is your volume and camera on the same layer?

#

and also I looked in the wrong place...actually a lot of bug reports, but mostly VR/XR

wooden kite
#

@wooden kite is your volume and camera on the same layer?
@lavish sierra yes

shy spruce
#

how does one make a glowing object, like a lightsaber using shader graph?

#

i tried using the fresnel effect, but I want the center to not react to lighting

gleaming moss
#

are you using HDR rendering

#

the 'white core with colored outline' thing is purely an exposure + bloom thing that cameras do. If you have an HDR system, just make a flat emissive object with a super bright value and the glare system will do the rest

#

also works correctly with partial obstruction and all that good stuff

meager pelican
#

@shy spruce I already answered that for you. Use bloom. That's "glow". You can also use emission to emit light into lighting. Bloom is in the post processing stack. And you can try HDR too if you wish.

#

P.S. I see I.P. answered too.

shy spruce
#

how does one add boom?

#

i installed the post processing package, do you add bloom to the object or to the camera?

meager pelican
#

You shouldn't have to install another package, as I understand it.

grand jolt
#

looking for someone who is great with textures and material in unity , i need an important information before i even start to model

im looking to create a model for our aquafairy but want parts for them to have a random color generated on load, and i need to know how to make multiple part of a model support multiple color changes

#

they all have random colors for

-cap
-squishies
-skin
-eyes
-mouth
using diferent material on edge of geometries is out of the question

since the shapes of the marks / spots on them would overlap with the body geometry and fuck the whole thing up
is theres a thing on unity to handle multiple layers for material or how i would have to implement this thing

lavish sierra
#

It seems like you've posted a bunch of information for your question, quakeman, but I honestly still have no clue what you're asking

#

Probably the right thing to do would be to bake textures and then still have just one material with exposed properties for your colors, using a shader to map a grayscale set of colors from the texture to whatever it is you need

#

But I'm no expert

grand jolt
#

color ramp work well for toonish style / pixel art

#

but for complex texture thats alot of colors to account for

#

if youre talking in the palette swap method

#

basically i was asking if theres way to make layers to change part of a model , like skin is 1 layer , spots is another , detail is a third

#

so that we can change the color individually of each pieces individually

#

whitout using a color slider that changes the whole thing

#

diferent value , hue and saturation for the skin, then another full set for the belly spot and the hands and legs

#

another one for the details like the ones on the poison fairy

#

whitout it being a single texture that change all at once

thick fulcrum
#

@grand jolt I agree with @lavish sierra, your easiest and probable most efficient option is to use a mask to change the coloured areas.

lavish sierra
#

@quakeman you can do that with different textures as well, most standard shaders in unity let you set a bunch of different textures for different things, for example

#

But you'll have to handle the uv unwrap etc yourself

grand jolt
#

@lavish sierra i can already do that

#

what i ment was , is it possible to make layers

#

for textures

#

like uv map 1 for skin

#

uv map 2 of the same thing but for the spots

#

and uver map 3 for the detail

#

and using alpha later for transparency on top of the skin layer

thick fulcrum
#

@grand jolt lookup splat maps, this should help you understand. Basically it's a colour map which defines areas and colors you can / want to change. Which means you can alter any area to any color.

grand jolt
#

thank you

#

ill look it up

tall chasm
#

how do I overlay one effect on top of another in shader graph without adding/multiplying?

#

something like just simple stacking

blissful atlas
#

@tall chasm lerp!

#

lerp( B, A, A.a ) = A blended on top of B using its alpha channel

tall chasm
#

Thank you!! @blissful atlas πŸ™‚

grand jolt
#

"Set the Surface Type dropdown on the Material Options panel of the Master Node to Transparent to receive the correct values from this node."
@lavish sierra
I can't change that

thick fulcrum
#

@grand jolt seems you need to make sure lighting is setup in scene properly. This forum thread maybe of help https://answers.unity.com/questions/1697901/scene-color-node-in-shader-graph-not-working-with.html

grand jolt
#

@thick fulcrum This exactly says that it's not possible having URP and shaders

hot rune
#

Hi i am using a low poly wave shader from internet in my game in the hdrp, i dont know anything about shaders but the shader is currently rendered unlit does anyone know how to fix this?

amber saffron
#

Could it be that the shader you found was originally unlit ?

#

@grand jolt Not 100% sure here, but I think that the sprite master node is transparent by default. The mentions that say to set the master node to transparent is for Unlit or PBR (not sprite)

grand jolt
#

How could I do it then

meager pelican
#

@grand jolt Why can't you just recode the colors using a LUT type of thing? Color swapping. Then you don't need "layers" (which sounds more expensive). I mean, you're asking "how to change the colors randomly". The answer is to literally "change the colors". πŸ˜‰ Maybe I'm missing something. But use color as an index into another (randomized or instanced) color table. Per object. You might get away with something like 256 or 64K color values and have smaller base color textures. You can set per-instance LUT textures.

#

They could be small, whatever you want to set your limits to. Like 256x1 or 64x1

amber saffron
#

@grand jolt Well, if the shader you got is unlit, there is not so much to do about it, apart adding your own lighting code. Or trying to re-interpret the waves logic in a shadergraph is probbably the easiest solution

grand jolt
#

It's unlit

#

And what does "trying to re-interpret the waves logic in a shadergraph" mean?

#

@amber saffron

amber saffron
#

It means : look at the code that does the wave animation, and re-do it in shadergraph using nodes

regal stag
#

I think Remy meant to @hot rune not you @grand jolt

amber saffron
#

Yeah, crap, sorry !

grand jolt
#

Oh ok xd

#

Still no idea for me ? x)

amber saffron
#

My first mention was good though

#

@grand jolt Not 100% sure here, but I think that the sprite master node is transparent by default. The mentions that say to set the master node to transparent is for Unlit or PBR (not sprite)

grand jolt
#

Then what should I do ? :c

#

Are shaders not working at all with URP?

regal stag
#

Shaders are working fine, but from the snippets of the conservation I've looked back on you want to use the Scene Color node & 2D Renderer right? I'm not sure there's much you can do, it just doesn't work using the 2D Renderer currently.

grand jolt
#

I don't want to use the scene node, that's juste what they use in the tutorial

#

Do you know any ways to make a heat effect shader with URP ?

regal stag
#

I assume you mean heat distortions which is what the use of the Scene Color node was for. It works fine in URP, just only with the Forward Renderer, not with the 2D renderer.

You might be able to achieve a similar effect by offsetting the uvs of the sprite texture, though if the offset is too large & the sprite doesn't have padding around it, some parts of the sprite might go outside of the quad so won't be rendered.

grand jolt
#

Hum, Im starting with shaders and I barely understand what to do x)

amber saffron
#

You could try to switch to forward renderer instead of 2D. You'll have a bit less controll on rendering order of sprites, but is should still work

regal stag
#

Depends if you are using the 2D Lighting system that the 2D Renderer provides too

grand jolt
#

I have a 2D renderer

#

But an alternative way to get this effect is using this shader :

#

Problem is that it renders pink

regal stag
#

I assume it probably uses a grab pass which I don't think URP can do. That's what the Scene Color node replaces, but it hasn't been made to work with the 2D Renderer yet.

#

Something like this might work if you want to add some wobble to rendering a sprite (this isn't something you can overlay on multiple things like the scene color example though, it's on a per-sprite basis).

grand jolt
#

Could you send me the texture please? :3

#

Thanks so much for taking your time for me

regal stag
#

Texture? The sprite texture I'm using is just a default unity ui thing.

grand jolt
#

Oh okay thanks, good thing already is that I have something appearing

#

Now what should I do?

#

@regal stag What do I do with the shader now ?

amber saffron
#

You seem very lost here ... have you tried following some shadergraph tutorials to learn the basics ?

grand jolt
#

Yes but they doesn't work xd

#

What do I do now that I have a shader ?

regal stag
#

A shader usually goes on a material which is used on the renderer, in this case a Sprite Renderer.

grand jolt
#

I get the same grey square :/

regal stag
#

Are you saving the graph? There's a "Save Asset" button in the top left corner of the graph

grand jolt
#

Oh right xd

#

it works, but now I have this xD

#

Changed the texture, now I have this

#

please? x)

amber saffron
#

What is the sprite texture you assigned here ?

grand jolt
#

not a sprite texture

#

I assigned a normal map

#

That's not what I should do ?

#

I tried with a sprite but the tiling is weird

#

Y axis tiling works well, but x axis is not

regal stag
#

I feel like my suggestion maybe doesn't work well for tiled sprites like that then. You might have to leave this for now until the scene color node is supported in the 2D Renderer.

grand jolt
#

uuuh I hate unity ;-;

regal stag
#

or switch over to using the regular URP Forward Renderer as Remy mentioned before. Although even then, sprites probably won't be rendered into the opaque texture.

grand jolt
#

Already tried that, they get changed to a grey texture

safe tide
#

Does anyone know if it's possible to declare a shader function that returns an array?

float[16] myFunction()
{ ... }

This results in a syntax error

syntax error: unexpected token '[' at kernel main

amber saffron
#

Maybe not return an array, but modifying an array as inout parameter ?

#

@grand jolt I'm honestly confused about what you are trying to achieve here. A heat deformation effect, or something else, like a "wobble" on a single sprite

safe tide
#

will try thanks

grand jolt
#

@amber saffron @regal stag I found an alternate solution, I simply made the full sprite I wanted outside unity and imported it as a sprite in unity so the effect applies on everything :p

#

thanks a lot for your help ^^

atomic glade
#

My materials have a visible seam wherever they're split into multiple polygons. Is there anything I can do in ShaderGraph to fix this? The meshes are generated programatically, so I can't easily merge them into one polygon.

amber saffron
#

This seems to be UV related : either fix your mesh generation code so that the UVs match, or use work space mapping in your shader (ex : us world position XY as UV input of a texture sample)

atomic glade
#

It looks somewhat normal in one orientation, but perpendicular meshes have this stretched out look

#

And there's still some visible seam when it's not stretched, that I think has something to do with the lighting

shadow kraken
#

Looks to me like it's a soft edge

atomic glade
#

Is there anything I can do about it?

spiral agate
#

hello everyone, i need some help when transforming world position into 'view position'; which i got working fine, but there i realized its not the equivalent to 'screen position'
so the question; what do i need to do to get a world to view transform act exactly as a normalized screen position?
[i need this effect urgently]

regal stag
#

@spiral agate If you need the screen position you can use ComputeScreenPos(clipPosition), (where clipPosition is via the same UnityObjectToClipPos(v.vertex) you'd usually use in a vertex shader anyway), and in the fragment shader you need to do screenPos.xy / screenPos.w. This tutorial might also be useful : https://www.ronja-tutorials.com/2019/01/20/screenspace-texture.html

Ronja's Shader Tutorials

There are many techniques how to generate texture coordinates. Previous tutorials explain how to use UV coordinates and how to generate coordinates b...

amber saffron
#

I might be wrong, but it also look like you don't have coherent normals

#

@atomic glade ^

atomic glade
#

On the mesh itself? Definitely a possibility. I had to compute them myself so I definitely might have messed up the math

amber saffron
#

Any reason to not make it easy and let the recalculate normals do the stuff for you ? πŸ™‚

atomic glade
#

How would I do that?

#

Ah, okay, it's a function of the Mesh object, not a shader thing. I'll give that a go

#

Any fix for the North/South walls having their UV's stretched out?

#

I'd need some way of uzing the Z of worldspace if it's facing one way, and X if it's facing another way

amber saffron
#

Test world normal, and branch Z or X depending on it

#

(But imho, it's best to have proper UVs in the mesh)

atomic glade
#

When I generate the meshes, I don't really have much info about where they'll end up in world space, they're from an entirely different program

#

Honestly, it's not too bad even without the UVs changing now that I've got the normals recalculated

spiral agate
#

@regal stag when do i use Computegrabscreenpos?

#

basically what i am trying to do is transforming refraction into screenspace, so i can distort my grabscreen UVs
any idea?

regal stag
#

Uh, I think you'd probably use ComputeGrabScreenPos on the clip space position, and add/subtract something to offset/distort it. I tend to use URP/shadergraph so haven't really done anything with grab passes before.

spiral agate
#

hmm ok, either way, when transforming from world to object, then object to clip, then compute screen pos; or directly from OtoC, then copute screen pos
both do not look like they were in screen space

#

multiplying by view matrix and dividing .xy by .z gives a better result, which is what i had before i asked for help

regal stag
#

In the fragment shader you also need to divide the screenPos.xy by screenPos.w

spiral agate
#

oh right, forgot that wait

#

well, i have no idea but its still not looking right

#

ok, i used vertex position as an input and its looking good, therefore i think i messed up something before i transform

#

how do i transform and compute
refract( normalize( -worldViewDir) , WorldNormal , _RefractionIndex )
into normalized screenpos

#

@regal stag ?

atomic glade
#

@amber saffron

Test world normal, and branch Z or X depending on it

How would I do that? I've got the branching working, but I'm not sure what about the world normal I'd be able to use to know which is which

regal stag
#

@spiral agate Sorry I'm not sure, refraction is bit too advanced for my shader knowledge, someone else might be able to help though

spiral agate
#

solved

#

had to transform view into clip, then multiply and offset by 0.5

#

not sure if that was necessary, but got it alligned now 100%

regal stag
#

@atomic glade Branching on something like abs(worldNormal.x) > 0.5 might work. If the normal is pointing in the x direction it'll be true, so use position.zy, else use position.xy.

amber minnow
#

Hello, I am trying to implement vertex colours into my URP shader.
I've duplicated LitForwardPass.hlsl and added COLOR to the Attributes struct

But it is blank, does anyone have a solution for this?
Thank you

atomic glade
#

I was doing something similar, I was comparing to zero. Trying it with 0.5 gives me this odd shape here, and the perpendicular walls are still stretched

low lichen
#

@amber minnow How have you determined that it's blank? How are you using it in the shader?

amber minnow
#

@low lichen I added a Color field to the Varyings struct
Then I set it in LitPassVertex

To display it I multiply color.rgb in LitPassFragment

#

If I do output.Color = half4(0,0,1,1) it comes out as blue, so it does work

regal stag
#

Are you sure your mesh has vertex colours?

amber minnow
#

@regal stag Certain, I flicked over to another VC shader and it's there

regal stag
#

@amber minnow Okay, I take it you are also using the Varyings Color in the fragment shader?

amber minnow
#

That's right πŸ™‚ @regal stag

stone sandal
#

your caseing doesn't match

#

your struct uses color but your function uses Color

#

i would just double check that you have all of it matching

#

also where are you passing the attribute into your varyings? to make sure it goes through correctly?

#

oh sorry, my brain is very slow this morning 😴

#

ignore me haha

regal stag
#

They have color in attributes, and Color in varyings, and seem to be passing it through fine, so as long as there aren't any shader errors and it's actually being used in the fragment I assume it should work.

amber minnow
#

Ah, the case mismatch doesn't seem to make a difference.

stone sandal
#

are other varyings coming through fine or is it just color that isn't working?

amber minnow
#

Position, UV etc are all fine

regal stag
#

The case mismatch would only cause a compile error if you tried to use Varyings.color rather than Color.

stone sandal
#

yeah i see that now, my brain just wasn't parsing the text very well

#

i need some more coffee

regal stag
#

Can you show where you are using the color in the fragment shader?

amber minnow
#

Sure πŸ™‚

#

Adding input.color = half4(0,0,1,1) before that, makes it blue, so it seems to be working

stone sandal
#

oh no you need Color

#

because your varyings use Color capitalized

regal stag
#

Ah yeah

amber minnow
#

I have changed them both to be lowercase πŸ™‚

stone sandal
#

what's the output you're getting vs what you expect?

regal stag
#

What if you just return input.color for debugging purposes, does it show the vertex colours properly then?

amber minnow
#

Let's see, one moment

golden crest
#

@meager pelican So I looked into using the stencil buffer to make an outline like you recommended and I managed to get this result. I still have a few issues i can't figure out though.

  1. I'd like to use the standard surface shader to render the original object (im thinking i might have to use 2 materials to get this to work)
    2. When the object goes behind another object it shows the full silhouette, I'd like only the outline to show. I figured this one out
  2. I'd like to blur the outline, from what i've seen this has to be done with post processing using 2 cameras like you or someone else mentioned.
stone sandal
#

@amber minnow have you tried multiplying the surfaceData.Albedo by input.color before it goes into the FragPBR function instead?

#

that's how shadergraph handles vertex colors /shrug might make a difference idk

amber minnow
#

Will give it a go, thank you

spiral agate
#

is there a way to blur grabscreen within a single shader?

#

how does grabscreen work? are mipmaps generated in real time?

pastel sigil
#

REPOST: Hey, I noticed that my build size has gotten quite big, so I checked the build report. Turns out shaders take 47.1% (61.2mb) of the complete build size. That's too much I guess. Any idea how to reduce the amount that shader (variants?) take up in the build? Btw. it's for mobile. Thank you very much πŸ™‚

meager pelican
#

@golden crest I've talked about so many outlines, I've nearly forgotten the original context. But thoughts:

  1. You can use multi-materials, just draw the outline second if you're in the opaque queue, so it can depth-clip and avoid the extra work. Then you can sue the Standard material on the first shader. I think.
  2. you don't need a 2nd camera for post processing, in and of itself. It's a separate pass or passes after all the other stuff is done.
golden crest
#

wont it blur the whole scene if i do it with the same camera? i dont really know what im talking about though

meager pelican
#

@spiral agate You can fake-blur it.
You'd sample and average pixels over some offsets as desired. I think the Unity force field demo might do that.

#

@golden crest Yeah it will unless you can write a custom post process, and just blur the stenciled area. Or fake-blur like I just to a.v. above.

spiral agate
#

yeah, i thought grabscreen was generating mipmaps so i could get some use of it, i guess i have no other choice than offset samples by myself?

golden crest
#

ok i will try to figure that out. you've been super helpful btw

meager pelican
#

IDK, but you could try sampling with LOD. tex2dLOD takes a mipmap level

#

IDK if that's in SG off top of my head.

#

@spiral agate

amber saffron
#

@atomic glade better for you if you don't want the hassle of mapping yourself : use the triplanar node

latent veldt
#

I am really tired over how I've done this cast shadow thingy, when the object is invisible

#

I've tried using Shadow Only

#

but it doesn't cast a shadow

#

How do I make something cast a shadow specifically by one certain light source?

#

So the monster only has a shadow when I use my flashlight but otherwise not.

#

That way I can have normal shadows but a "special" shadow for my monster design

#

Can someone DM or PING me so I can find it tomorrow, cause I gotta sleep got school tomorrow.

devout quarry
#

@amber minnow you remaking osrs?

amber minnow
#

@devout quarry Remastering yeah πŸ™‚

devout quarry
#

You have a website for the project or something?

amber minnow
#

Go to http://www.squarespace.com/sirpugger to get a free trial and 10% off your first purchase of a website or domain.

Totty's website (has link to discord there):
osremastered.com

What era of RuneScape graphics is your favorite? What do you think of the unity client's graph...

β–Ά Play video

First impressions of Old School Runescape OSRS Remastered

Best video editor for Youtube beginner #Filmora (Windows & Mac): https://bit.ly/3dACKCO
Video editing App: FilmoraGo (Android & iPhone) https://bit.ly/3fwoCMK
Professional video editor #FilmoraPro: https://bit.ly/3fFdS...

β–Ά Play video
devout quarry
#

ah damn so that's the one haha, okay cool, don't want to go too much off topic in here but nice project

amber minnow
#

Thank you πŸ™‚

rich flume
#

Is it possible to create a shadergraph in order to better control the density of the volumetric fog ? πŸ™‚

simple tartan
#

Hey Everyone! I needed some help with shader coding. Specifically, I am trying to implement an extended version of the GGX shader in Unity as per some data of materials.

#

Any help would be greatly appreciated!

meager pelican
#

As of 5.3, Unity's BRDF is already GGX, so if you're extending it I'd look to customizing the standard shaders and/or custom lighting models for whatever pipeline you're using.

simple tartan
#

@meager pelican Thanks for the response! I read about that on the manual. However, the data I am trying to fit doesn't exactly conform to the standard shader, so I am researching on extending it. However, I haven't found any source for the standard shaders (and whenever I try to create a new shader, Unity in URP/HDRP always returns a pink material no matter what). Am I always forced to use the normal 'Create 3D project' and secondly, is there a source available for the standard shader that's all in one place?

soft harness
#

How could i get the vector from the camera pos to the vertex pos

#

I'm trying to get the grass to part as the player is walking through it

meager pelican
#

Subtract them.

#

@soft harness

#

@simple tartan Unity's standard built-in pipeline publishes shader source here: https://unity3d.com/get-unity/download/archive (see the drop down box). The URP/HDRP I think are on git-hub here (But I've yet to dig into this like I should): https://github.com/Unity-Technologies/Graphics

Unity

Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.

soft harness
#

I did that but....

#
            v.normal *= dot(viewDir, worldNorm) > 0 ? -1 : 1;
            v.vertex.x = lerp(sin(_Time * 15) * max(0, worldPos.y - -3.379522), v.vertex.x, 0.99) + VertxVector.x / 5;
            v.vertex.z = lerp(sin(_Time * 15 + 5) * max(0, worldPos.y - -3.379522), v.vertex.z, 0.995) + VertxVector.z/50;```
ocean spade
soft harness
#

@meager pelican I subtracted them, but when i add the vector to the vertex, it doesn't give the desired result. Am I going about this wrong?

waxen jackal
meager pelican
#

Set the alpha to non-zero. (err....maybe it's already 1)

#

And not-black? as a test

#

Maybe expose the color property, and for emission check lighting settings. In some systems you have to add the emissive color to the albedo color for the object's base color.

winter sinew
#

Can I expose the input to a Sample Gradient Node as a property? It doesn't seem like I can. I'd be happy even being able to set it via script. If none of these are possible are there any alternatives to get the same functionality?

meager pelican
#

@soft harness IDK, haven't done this. I might be inclinded to displace it according to a distance calc from the player's pos that would be passed in, or from camera-pos. But then it would be radial. Maybe father is less displaced, closer is more displaced, up to some threshold.

#

But otherwise, you want something orthogonal to the vector you asked about.

soft harness
#

How would you do that?

meager pelican
#

distance?

#

there's a distance function in shaders and of course SG nodes. Maybe use an abs(distance(myVertex, theCameraPos))

#

And then maybe invert and/or scale it somehow. Whatever math you want to invent for it. Lerp between amounts if you want. IDK, I'd have to play with it.

vernal vortex
#

New to shader graph. Seems to be a lot of limitations. Does anyone know of any good examples PBR shaders with transparency?

#

Not looking to copy, only to learn.

gleaming moss
#

there is a master node for URP/HDRP out of the box that does this?

#

not sure what an example would even cover

vernal vortex
#

Well, there seems to be a lot of draw issues right out of the box. You can't do multiple passes for example, can you?

gleaming moss
#

no, but that's a fairly specific thing

#

no custom master nodes was a huge mistake, don't get me wrong

vernal vortex
#

I'm sorry, what do you mean? Using custom nodes is a mistake?

gleaming moss
#

no, being unable to create master/"output" nodes

#

covering things like multiple passes or custom lighting models

vernal vortex
#

Okay? I'm really new to shaders. I feel like unity is pushing this LWRP but there are so many custom things I can't do with it.

#

Maybe I should disable, and go back to learning how to script the things I want.

gleaming moss
#

sorry to vanish, phone call

#

one of the classic examples is folks asking how to implement cel shading and similar stylized lighting in shader graph

#

that's something the Unity solution falls completely flat on its face dealing with, and I'm amazed Unity project management thinks throwing a hacky custom node solution on the official blog is an adequate workaround

#

I can understand there being complexity in actually implementing a custom master node, but that really shoots a lot of asset store creation folks (and just plain tech art/programmers) in the foot

#

it's not like you can't actually write everything in HLSL anyway, you just need to tell your art team they can't use a tool they like and to Deal With Itβ„’

simple tartan
#

Hey everyone, quick question: Is it recommended to use the normals passed in from the vertex shader in the fragment shader or should we multiply it with the Object2World matrix?

#

and also could someone explain why this is being done:

float3 LightDirection = normalize(lerp(_WorldSpaceLightPos0.xyz, _WorldSpaceLightPos0.xyz - world,_WorldSpaceLightPos0.w));

vs

float3 lightDir = _WorldSpaceLightPos0.xyz; // Light Direction

meager pelican
#

@soft harness OK, so I was thinking about your question while watching a crappy movie, because that's what you do during crappy movies....think about GPU stuff...and I was wondering if you need it to be "sideways" or not.

But if you do, then take the camera's forward vector (or calc it), pretty sure it's a shader variable. And then project the vertex depth into the scene with that vector. So cameraPos + vertxDepth * normalize(cameraForward) and then subtract that from the vertex pos and you'd get a vector, normalize it, that you can scale by its distance to that first point. But it would point sideways at the right angle. I think.

#

Then you can decide how much of that to use as a vertex offset. And maybe scale that by distance too if you want so it doesn't part like the Red Sea all the way to the far plane. Or something. πŸ˜‰

#

So the closer it is to center, and the nearer, the further you "push" it either left or right.

#

Or do some math in screen-space, or view space instead.

soft harness
gleaming moss
#

your normal map is probably fine

#

your tangent space basis might not be

#

looks like problems with mirroring

soft harness
#

What does that mean?

#

also i think it's my custom shader

#
                fixed4 e = tex2D(_EmisionTex, IN.uv_MainTex);
                fixed4 b = tex2D(_Bump, IN.uv_MainTex);
                // Metallic and smoothness come from slider variables
                o.Metallic = _Metallic;
                o.Smoothness = _Glossiness;
                o.Albedo = c.rgb;
                o.Alpha = c.a;
                o.Emission = e.rgb* _EmissionIntensity;
                o.Normal = b.rgb;
                clip(o.Alpha - 0.99);```
#

When i change it to the standard shader, it works fine

gleaming moss
#

ah, disregard

#

you're at minimum forgetting to unpack the normal map in that code

soft harness
#

how do i do that?

gleaming moss
#

fixed4 b = tex2D(_Bump, IN.uv_MainTex) * 2.0 - 1.0

#

you might also need to rearrange the channels if you're using compression on the image

soft harness
#

still not working

gleaming moss
#

what does it look like

#

TSB stuff might still apply, the seam in the middle is one of the classic giveaways something's wrong in that dept

#

especially considering it looks like one side is inverted

#

handedness change from mirroring one side and then blowing up the tangent/bitangent when you import the mesh into unity could do that

soft harness
#
                fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
                fixed4 e = tex2D(_EmisionTex, IN.uv_MainTex);
                fixed4 b = tex2D(_Bump, IN.uv_MainTex) * 2.0 - 1.0;
                // Metallic and smoothness come from slider variables
                o.Metallic = _Metallic;
                o.Smoothness = _Glossiness;
                o.Albedo = c.rgb;
                o.Alpha = c.a;
                o.Emission = e.rgb* _EmissionIntensity;
                o.Normal = UnpackNormal(b.rgba);
                clip(o.Alpha - 0.99);```
gleaming moss
#

looking a bit better, actually

#

just because, are you using the 'import tangents' in the mesh settings or calculating them

#

could be worth hitting that switch just to rule it out

#

whoop, you're double applying the normal unpack

#

o.Normal = UnpackNormal(b.rgba); will probably render fixed4 b = tex2D(_Bump, IN.uv_MainTex) * 2.0 - 1.0; redundant

soft harness
#

yeah that sorta works!

gleaming moss
#

also is your custom shader designed to work with tangent-space normal maps?

#

the mostly blue kind

soft harness
#

I think?

gleaming moss
#

there should also be a matrix multiply on the (unpacked) normal if they're in tangent space. Not sure if you do that somewhere else in the shader

#

the relevance to the mesh normal/tangent might make more sense looking at that

soft harness
gleaming moss
#

Unity does that for you according to docs, so you're off the hook

soft harness
#

So, how do i controll the intensity?

gleaming moss
#

lerp the normal to (0, 0, 1)

soft harness
#

half normal = lerp(float3(0.5, 0.5, 1), tex2D(_Bump, IN.uv_MainTex), _NormalIntensity);

gleaming moss
#

would suggest doing that after unpacking for sanity

#

but that should work

soft harness
#

what do you mean, after unpacking?

gleaming moss
#

o.Normal = UnpackNormal(b.rgba);

#

you would also change the other part of the blend from float3(0.5, 0.5, 1) to float3(0.0, 0.0, 1) if you do that

soft harness
#

at some angles it turns black

shy spruce
#

i'm having a weird issue with bloom, i have a projectile that glows, and whenever i fire it the entire screen slightly illuminates, which i would like to alleviate

#

i tried reducing the blend distance as much as i could without completely dimming the object, but the effect was still there

#

it's only present for a frame or 2 but still noticable

molten halo
#

it makes sense for that to happen.

#

If it's close to the camera of course the whole screen is gonna light up for a split second as it flies away

#

it's called laws of physics.

soft harness
#

my normal map is making it dark

plucky bone
#

@vocal narwhal

vocal narwhal
#

it's already pinned

plucky bone
#

Oh sorry for the ping then

#

I tried checking but as soon as I opened the pins window my Discord froze πŸ˜…

latent veldt
#

Which Shader Plugin should I Use?

#

not a fan of writing things to get a Shader

#

I'm okay with writing code, but Shader is a no no

devout quarry
#

Start with shadergraph, see how far that gets you πŸ™‚

strange sonnet
#

is there a way to create a worldspace uv'd material with shadergraph?

dim sequoia
#

Hi,
I'd like to port a few materials/shaders from Unreal to Unity (Standard Pipeline), which would follow this basic pattern:
Textures are mixed, or have only certain color channels used, and the output is passed to something like the standard shader as inputs.

I assume this could easily be done with shadergraph? but any ideas how to do with the standard pipeline? Or tips how to approach this with standard shader code? It would be great to have something like: 1 shader that is basically the standard shader, but is included in all the other custom shaders. And the custom shaders are just responsible to changing the input that is passed to that shader code.
(Although this might not be possible or reasonable, since different materials sometimes have more or less texture and regular value properties set)
https://cdn.discordapp.com/attachments/438387938947235840/712224352015482951/Unreal_Material_M_Barrels02.png

regal stag
#

@strange sonnet Position node -> Split -> put the components you need depending on direction of uvs into a Vector2

strange sonnet
#

thanks!

amber saffron
#

Or use the triplanar node

meager pelican
#

@dim sequoia If you're working in the built-in pipeline, check out Surface shaders...they generate custom lit shaders. "Just" translate that graph to code in a surface function.

dim sequoia
#

thank you! I'm trying that now πŸ™‚
seems like the right node isn't really an equivalent of the standard shader (what I thought), but of a surface shader output like SurfaceOuputStandard, will use that now

do you have an idea if it made sense to have some reusable shader code with this use case, like with cg includes?
Maybe it doesn't make sense because difference might be too big,

meager pelican
#

Uh, IDK how to answer that, depends on your use case. But you can certainly do CG includes.
As to "the right node" you mean the master-node in a graph compared to the variables in a surface shader? They're actually not all that different for most of it.

dim sequoia
#

In the picture I posted above, the node called "M_Barrels02" - when you make a material in Unreal Engine - it seems like I had a misunderstanding, this is like the surface shader output,
somehow I associated the node with a full Standard Shader instance before

#

but yes, I guess it depends on the use case, I should check the other materials and see if there is repeating logic for modular code, thanks again

latent veldt
#

Dayum Unity Shading is so annoying, now the shadows aren't showing after I installed the Pipeline

#

I want an invisible thing, which cast a shadow

#

I know I could do it with Unity itself, but I had this problem where you could still see the object when you shine a light on it for some stupid reason

#

I guess I'll just remove the stupid Pipeline, and then try stuff around

#

else I'll just not care

#

Look at this, it shouldn't do it like that. It should only show the shadow on the walls

#

and floor

#

not itself

#

Unity it works perfectly fine

#

aka editor, but in the game it doesn't

regal stag
#

@latent veldt Unless I'm misunderstanding, It looks like it's working fine to me? Your light source and camera are close together so the shape of the shadow is going to look like the capsule in the game view.

latent veldt
#

Is there a way to only cast it onto the walls/floor?

#

or is unity just like that?

regal stag
#

I think it is already casting on just the walls and floor.

fervent tinsel
#

you can make invisible shader that casts shadow

#

@regal stag the intent is that the capsule itself doesn't show

latent veldt
#

I don't know how to use Shader Graph for that nor do I know how to do the Shader stuff

fervent tinsel
#

which SRP this is?

latent veldt
#

The Capsule shouldn't be seen

#

only on the floor and walls

fervent tinsel
#

yeah, I get what you want

#

you want only shadow, but not mesh rendering for the capsule

latent veldt
#

Ye, cause if I walk around it. It just looks like a completely black 3D Model you can look around

#

idk how to use Shaders at all, cause I only like to do the programming part

#

but cause I am working only with me as the main and then my friend is 3D modelling It's hard to do the other weird things.

fervent tinsel
#

I've never done this on SRPs but I know there used to be a sample shader in old Unity wiki for the built-in

#

you never said which renderer you use

latent veldt
#

I removed Pipeline and went back to default

regal stag
#

@fervent tinsel In the video they posted I think the capsule is already invisible though. You can see when they turn around it doesn't show where the skybox is. That capsule is the shadow? Right?

latent veldt
fervent tinsel
#

I did not watch any video

#

now I'm confused

latent veldt
#

the links

regal stag
#

From the camera's point of view, that shadow will just look like a capsule

latent veldt
#

I know

#

Cyan call me, I'll share screen

#

we will be muted so I can show my screen

#

Cause no one understands me, I've had the same problem yesterday

#

and people can't see what I'm seeing for some reason

#

my friend can doe

regal stag
#

I don't do calls, you'll have to try to explain it here

latent veldt
#

I literally did

#

in game view it's like a 3D model with the shadow when I walk around

#

but inside the editor view it works perfectly fine

regal stag
#

Your light is attached to the player + camera right

latent veldt
#

Attached to Player, Camera, Item Holder, Flashligt, PlayerLight(Light itself)

regal stag
#

Right, but with the light being at the camera's position, the shadow being cast is going to look a lot like the capsule.

latent veldt
#

Else, I guess that's how Unity works.

regal stag
#

You probably just need to adjust the light position so it isn't so close to the camera. It won't look entirely accurate in terms of where the flashlight model is, but perhaps that will give you a shadow being cast in a way you prefer

latent veldt
#

Okay, thanks :)

amber saffron
#

From what I see, the "black model" you see it the shadow projected from the "shadow only" capsule, right ?

low lichen
#

Yeah, you're just looking at the shadow from the light's perspective, which makes it look like the original capsule shape.

amber saffron
#

So this is somewhat expected

lavish sierra
#

I just want to share something y'all probably already know: the depth buffer used by shaders is not the same as unity's camera depth texture - the latter is controlled entirely by the shadowcaster passes of your shaders

#

This really helped me out for a postprocess outline effect on my 2d game where I want several things occluded for no reason

devout quarry
#

The new shader gui support in shadergraph is nice, but still I'd love to see an easier way of just splitting variables into groups with a header on top

#

just for organisation

simple frost
#

@devout quarry I think thats on our roadmap? I can double check

devout quarry
#

is it on product board?

#

I see this

simple frost
#

do you mean in the actual shadergraph or in the material inspector?

devout quarry
#

I mean the material inspector

#

This is nice, but would be cool if it would be the same in the material inspector

#

Just something basic like this

simple frost
#

I think the goal would be to have a basic material inspector that did that sort of thing

devout quarry
#

so just grouping properties and having a little lable on top

simple frost
#

as part of those two

#

right, we would like to have the basic material inspector be nice like that, but also pipelines override the inspectors often

#

so like HDRP would need a way to generate those as well, based on the info we provide

#

just gets a bit tricky

devout quarry
#

Ah right that's true

molten halo
#

Anyone know how sprites and shaders work together? I got a script that successfully assigns a texture to a material, but the actual texture isn't appearing on my sprite. I'm 99% sure it's something wrong with how I'm setting it up in the editor.
I'm using a sg shader.
I tried three things:

  1. A circle sprite with full opacity, and the custom material assigned to the Sprite Renderer. Nothing happens, sprite stays a white circle.
  2. Make a child sprite renderer for the circle sprite, make it have no sprite assigned, but the custom material (now unassigned from the main sprite object). Still circle stays white and nothing appears on top of it.
  3. Use the experimental Unlit Sprite Graph instead of the normal Unlit Graph. Same issue
amber saffron
#

Sorry to complain on a public chat @simple frost , but I already asked to the team some month ago the ability to override the material inspector using a custom scripted one. This could be as simple as adding a string field in the blackboard, to change the value set at the end of the generated shader (CustomEditor).

devout quarry
#

@amber saffron this works right?

#

on the master node you can provide a class that overrides the GUI?

amber saffron
#

Ok, sooo, my bad, I missed that apparently !

devout quarry
#

I'm on 2020.1

#

Haven't played around with it too much, but seems to work

amber saffron
#

Not clear to me why it's on the master node gui and not the blackboard directly

regal stag
#

@molten halo Shadergraph should use a texture with a "_MainTex" reference in order to obtain the sprite texture from the SpriteRenderer.

molten halo
#

I already stated it assigns the texture successfully

#

I have a _MainTex reference

#

when I double click the material instance on the Sprite Renderer (in play mode) the texture is there.

regal stag
#

Okay, you shouldn't really need a script to assign it though unless you are creating the sprite renderer at runtime I guess. You'll probably need to share an image of the graph so we can help

molten halo
#

I'm assigning one of two textures randomly, that's why I use a script

#

I'm also gonna be doing the same with the colors

regal stag
#

I see, are you assigning the texture using the material.SetTexture or SpriteRenderer.sprite?

amber saffron
#

Note that I suggest to use one of the channels (r) of the texture sample instead of the whole color, or might end up with weird results if you don't plug a greyscale texture πŸ˜„

molten halo
#

Well I'm only planning on assigning grayscale ones. Cause I'm coloring them inside the shader.

#

@regal stag SetTexture

amber saffron
#

But the sprite renderer overwrites it

regal stag
#

Yeah, the SpriteRenderer.sprite will override _MainTex, so you should set it on the sprite renderer if you want to swap the sprite out

#

If it's just to overlay a texture on an existing sprite, use a different texture reference

molten halo
#

like what?

#

Originally I was getting a warning in the Sprite Renderer cause I didn't have a "_MainTex" reference.

regal stag
#

The shader needs a _MainTex reference to pass the Sprite through from the SpriteRenderer, but technically you can still leave it blank and unused if you don't need it

molten halo
#

k, i'll try that

regal stag
#

If you aren't actually using a sprite (or it's sorting layers, etc), you could probably just apply the shader to a quad instead too

molten halo
#

works great, thanks!

#

Does it matter if my image file is Default or Sprite? Both seem to work.

regal stag
#

If it's set to sprite, then you could probably set the spriteRenderer.sprite variable instead of using SetTexture to pass it through to the shader. I don't know if there's any other differences though

molten halo
#

well I want the sprite to keep its circle shape.

#

the texture files are squares

regal stag
#

I see, but if the shader isn't using the sprite's texture surely it isn't showing as a circle though?

molten halo
#

right now I'm changing the texture like before, but using a reference different to _MainTex, and it works fine.

#

texture appears on circle, but doesn't change its shape

regal stag
#

Ah okay. Maybe the sprite renderer's mesh is still producing a circular shape from the sprite. If it's not using the texture in the shader it might look a bit jagged though. You could also sample the _MainTex and use it's alpha.

molten halo
#

k, thx again

grand jolt
dusky stirrup
#

Reposting my question here as I think #archived-hdrp was the wrong one.

Hi folks,

I've got two gameobjects which are sharing a material and shader.

I want to be able to enable a boolean property on the shader per game object. So I'd have one chair with outline and one without.

How can I do this? Or am I going about this completely wrong?

grand jolt
#

I'd make two materials, one with an outline, one without and swap the materials

#

instead of changing the value

dusky stirrup
#

Yeah that was my other idea

#

makes sense

grand jolt
#

ya, since the value affects all objects with that mat

thick fulcrum
#

@dusky stirrup I believe you should be able to make the material value instanced, is this custom written or shadergraph?

meager pelican
#

@dusky stirrup What outline method are you using? Multi-pass or not?

thick fulcrum
#

or is it just that he's altering the value in edit mode and seeing it alter on everything, while each object will be have an instanced value in play mode which will not alter everything?

dusky stirrup
#

I went with the approach to swap out the materials. I'm using shadergraph for the first time though.

#

Any idea how I could make the outline always render on top of everything else?

Is there an easy way to do this via shadergraph?

deft zenith
#

Antialiasing was set to SMAA for this but it reproduces with no antialiasing as well.

pliant finch
#

Is there a way to cast shadows of a 2D tilemap onto itself (assuming varying Z values)?

#

nvm, I think I'm in the wrong channel xD

amber saffron
shadow kraken
#

Sounds like what @grand jolt was asking about earlier today!

knotty juniper
#

Had some external tools for that kind of stuff but with direct preview in unity mmm that sound nice

manic rock
#

try setting the near clipping plane a bit further away

mossy grove
#

@grand jolt what are you using to texture? theres a mode in substance painter called tri-planar projection and it projects on the object rather than the uv

#

so it wont cut on the edges of the uvs

#

maybe theres a similar feature in whatever tool you're using

sonic bear
#

i am not sure if this is the right place, but why is the render texture showing a different thing than the camera?

sonic bear
#

i have no idea why this is the case

crisp trellis
#

does anyone know why shader graph gives me this for a custom function?

#

happens if there's just one line Out = ...

regal stag
#

@crisp trellis Have you added the "Out" to the outputs list on the node? It doesn't look like there's any output connection on the node

crisp trellis
#
    Out = A + B;
}```
#

the output connection is hidden if you don't press that tiny arrow

#

<

#

btw I'd really appreciate any help

#

I did read the forum posts on this searched for youtube videos that explained that

#

it seems like the docs are messed up idk

regal stag
#

I'm a bit confused as to why your image has a uv(2) input but your custom function has a float3 and a float

crisp trellis
#

cause i already tried a thousand different things πŸ˜„

simple frost
#

also does + work with a float3 and a float?

crisp trellis
#

that's the tutorial

simple frost
#

guess it gets cast to a vec3

crisp trellis
#

I'm pretty sure i did everything right by now (as in the tutorial)

regal stag
#

Does anything change if you save, close and reopen the graph?

crisp trellis
#

i tried

#

nothing

simple frost
#

your file is a .cs

crisp trellis
#

ya

simple frost
#

needs to be a .hlsl

crisp trellis
#

i tried txt too

#

oooh

#

rip

#

really? πŸ˜„

regal stag
#

Well spotted

crisp trellis
#

says text file in that tutorial i think

simple frost
#

that should probably be updated then

crisp trellis
#

err ok maybe it doesn't say text file

#

nvm ignore that

#

give me a minute i'll tell you then

#

ya awesome @simple frost

#

it's gone now thanks

sonic bear
#

i still have no idea why camera and the render texture

#

are duifferent*

crisp trellis
#

i would like to know that too

#

and ya it actually says hlsl file. but it's not clear that this is about the file ending

#

if the file ending is that important i think it should be clear

#

also thanks @regal stag for helping as well

#

@sonic bear what do you get when changing to "game" window

#

does color change?

stone sandal
#

HLSL is the shader language that you're scripting in, so when writing the docs we assumed that it would clear enough it needed to be a file of that script type. You can't put valid HLSL into a .cs file c:

sonic bear
#

@crisp trellis when entering runtime the render texture remains the same, different than what the preview shows

crisp trellis
#

I'm not trying to be confrontational here. I named it .txt before because there is no reason to assume that file ending matters.

#

make with that information what you want

#

but if looking for the needle in the hay stack that information would be valuable : )

sonic bear
#

@crisp trellis file extension matters a decent amount

crisp trellis
#

@sonic bear I just mean game window

#

so not pressing play

#

(btw sorry if I triggered someone by saying the docs seem messed up. I take that back)

sonic bear
#

@crisp trellis yes, changing what camera is rendering, changing culling settings, changing clipping plane distances, and switching to the game window changes nothing

crisp trellis
#

"changes nothing"

#

which color does the background have?

sonic bear
#

what?

#

the background is black, solid color

crisp trellis
#

i see skybox colors - left side

#

and i see blue - in the camera preview

regal stag
#

What part is missing from the render texture?

sonic bear
#

the level, you can see the difference in the camera preview and the texture right?

#

that is the level

crisp trellis
#

oh that

#

perhaps it's culled?

#

hm 0.01 - 70 prob not

#

or is it "inside the camera" perhaps?

regal stag
#

If it was being culled I don't think the camera preview would show it either

crisp trellis
#

ya

sonic bear
#

yeah i am clueless

simple frost
#

background color?

#

scene camera and game camera are different

sonic bear
#

solid black, you can see it in the camera settings

crisp trellis
#

is there a reason you have different settings for those than the default ones?

#

(those are my defaults)

sonic bear
#

becuase i am trying to cut the resources taken by the minimap camera, the main camera uses one for shaders

crisp trellis
#

ok

regal stag
#

Yeah, usually for a second camera you might not want it to create a opaque & depth texture if it's not being used

crisp trellis
#

your culling mask πŸ€”

#

why is it mixed?

#

default is "everything" lol

sonic bear
#

the minimap requires blips to be shown, but they are on their own layer that the main camera culls out,
and also i dont want all the blood splatters to show on the minimap.

but again, if the camera was culling it out, why would t show in preveiw?

crisp trellis
#

i mean you can have it mixed. but at that point i'd assume you cull some layers out

#

ok

#

no idea

regal stag
#

Maybe it's something to do with the material/shader the level is using?

crisp trellis
#

can you send the file?
only if you want
and if it's small

regal stag
#

Certain parts like the red (doors?) are appearing fine on the render texture

sonic bear
#

no, the proget is like 0.5 gb

#

annd that is true! they are on the same layer and use the same shader as the rest of the level

crisp trellis
#

ok. if you can and want to simplify the part that doesn't work that would be an option

#

honestly chances are some faces are wrong direction @sonic bear

#

perhaps camera preview and what you see in scene handle that differently

#

is the mesh created outside unity or a dynamic one?

sonic bear
crisp trellis
#

to check the face thing move the camera on the other side or turn the object around

regal stag
#

Interesting, the icon for the render texture looks like it's capturing the scene fine. Perhaps it's just the shader that's rendering it to the UI?

#

And by "capturing fine" I mean it looks the same as the camera preview, but perhaps there's some unwanted alpha that's somehow there too

crisp trellis
#

so it wont be backface culling - preview seems to do that as well

sonic bear
#

that does make sense, let me check

#

i dont know what is cuasing it

regal stag
#

Maybe it's some kind of bug? Perhaps update lwrp/urp? I'm not too sure what else to suggest.

sonic bear
#

let me try changing the image or something

#

nope! nothing has changed

#

i am going to havea stroke

crisp trellis
#

still dealing with it?

sonic bear
#

yep! why is the render texture in file veiw different from what the canvas shows?

crisp trellis
#

i wish i knew

#

i'd try reproducing with simpler stuff if i was you

#

until you can isolate what's causing the bug or whatever it is

sonic bear
#

it's something with the canvas

#

that is the only thing not acting right

crisp trellis
#

in any case i'd be curious what it was once you found out πŸ˜› please ping me

#

ok

sonic bear
#

i had to change it to using a material rather than the render texture and now it works

#

i am angery

#

what is wrong

crisp trellis
#

hmmm

sonic bear
#

hmm?

crisp trellis
#

I see and I don't see

#

kinda

#

Are there currently any known bugs to shader graphs custom functions?

#

I am getting some error with undeclared identifier MyFunc_float

#

I can refactor my code though in a way that it goes away by inlining all helper functions and using it as string. which makes me think it's a bug

sonic bear
#

and the map in front of the camera both use the same material

#

why is this broken

sonic bear
#

can anyoe help?

#

anyone*

winter sinew
#

Can I expose the input to a Sample Gradient Node as a property? It doesn't seem like I can. I'd be happy even being able to set it via script. If none of these are possible are there any alternatives to get the same functionality?

meager pelican
#

OK, this is going to end up with egg on my face, I'm sure. But can someone help me debug this SG issue I hit? I was confirming a point

also does + work with a float3 and a float?

guess it gets cast to a vec3
@simple frost
and she's right and it does; it gets propagated into all the left-hand "slots". But I decided to play with it in SG, right? Because SG = fun, and I was bored, so I did this: