#archived-shaders

1 messages · Page 105 of 1

atomic glade
#

Attempting to look up answers gives me such a colossal wall of meaningless jargon I cannot possibly be expected to understand any of it

delicate raven
#

Hi guys, i want to make a sprite sheet shader that can run animation of a sprite sheet texture, but i have no idea where to begin with.

I want to make it in shaderlab.

atomic glade
#

Maybe now that we've established the shader is completely fine but the render pipeline has shat the bed, I should move this question to #archived-urp , I'll go try that

#

Okay, actually, I've made a terrifying discovery because now it makes even less sense and it might be a shader issue after all:
If I intersect this with a plane, it works.

The shader absolutely shits the bed when it intersects specifically terrain. Which is, unfortunately, the thing I need it to do. The terrain is MicroSplat URP, and I am not touching that with a ten foot pole, that code is sacrosanct I'm not gonna cock it up. What can I do to this shader to make it work with MicroSplat terrain?

golden raven
#

well now my wall is fucked

#

when I change layers from wall to default

#

i hate this sm dude

low lichen
#

Because that suggests there are negative values involved with the alpha blending. And that is either coming from your output or what's already written there by the terrain shader.

atomic glade
#

Actually, this is without a Saturate node, but there is a Clamp before the color is multiplied that does the same thing

amber saffron
# golden raven well now my wall is fucked

It's quite hard to follow your setup with only these screenshots.
But that's how it must happen :

  • The exterior wall/ground etc ... are redered in the main view with the default layer
  • a first renderer feature renders the stencil mask using a specific layer and the "stencil only" shader shows in the tutorial
  • a second renderer feature renders the inside meshes, using an other layer, and with the stencil write to only display them where the mask was rendered.
golden raven
low lichen
#

You may have to remap the depth to a 0-1 range if it's in a weird range.

#

It's possible that the terrain is not being included in the depth pre-pass, which would mean it would be absent in the scene depth texture. But that would be surprising, as that would break many effects that depend on scene depth.

atomic glade
amber saffron
golden raven
#

transperent layer mask is also the same as the opaque one

#

this is my main renderer

atomic glade
golden raven
#

its on the correct layer

low lichen
atomic glade
#

Alpha is 1 in both cases

amber saffron
low lichen
atomic glade
#

Welp

low lichen
#

But it's extremely unlikely that this is an unknown issue. Maybe you need to update the asset, or the asset hasn't been updated yet to work properly for the URP version you're on. Or maybe there's a setting somewhere.

golden raven
atomic glade
#

Okay, I'll try to update MicroSplat. It's a fundamental necessity to have these splat maps so I haven't wanted to rock the boat but I guess that's what version control is for

golden raven
#

see it wont render back with the shader on the material

amber saffron
golden raven
amber saffron
golden raven
amber saffron
# golden raven

And the big wall here is in the "wall" layer used but the renderer feature ?
And the window is in the default layer ?

golden raven
#

and the window is in the default layer, yes

amber saffron
golden raven
#

on that screenshot

#

because it was invisible

#

wait you're telling me I setup this up the other way around? 😭

amber saffron
#

If what you've said just earlier is correct, you should be good.
The window that acts like the stencil mask must be in the default layer.
And the wall that is forced to be rendered after must be in the wall layer.

golden raven
#

i get what you say, but like, how tf could it be wrong if I followed the video 100%

amber saffron
#

Now, one thing to be also sure of : you've added the renderer feature to the "Ultra_PipelineAsset_Forward" : is this the current active one ?
If you have multiple quality levels in the project, each with a different render pipeline asset assigned, it might not be the case.

golden raven
#

i dont use multiple qualities I just use a main one

#

which by default is ultra i believe

amber saffron
#

Hum, well, if the wall disapeared when you removed the "wall" layer from the opaque mask, it should indeed be the current active one.

#

I'm out of ideas, should work from the informations I have 🤷‍♂️

golden raven
# golden raven

question, my wall needs the shader aswell right? when i had it on the wall, it became invisible

golden raven
#

well i removed it from my wall layer it just became like this (with the shader thats on my glass object aswell)

golden raven
amber saffron
#

Can you show the code of the stencil mask shader ?

golden raven
#

just like in the tutorial

#

then I applied it to my glass material and it worked, then onto my wall material and yeah

amber saffron
golden raven
golden raven
# golden raven

well its fixed now (normal shader in the wall), but i still persist with this issue

amber saffron
#

So, you have this rendering, the front face of the smaller "cube" is the glass window, it has the stencil mask shader, but it is not seethrough ?

golden raven
#

wait hold on, it might be something entirely different let me confirm

#

nope, its not something entirely different

#

well shit

#

ok im stupid 😭

#

it was infact something else

amber saffron
#

May I know what was the issue ?

golden raven
#

ok so the way i spawn my shopfront is through cloning a prefab, and the said prefab was 1 cube that i eventually seperated the front face (glass part) and the shop's inside (red and blue part) and put them both under a parent for easier movement in the scene, then my script did clone the parent like it was supposed to, but it set it to another random place with wrong sizes and when did put it on the right place in the editor, it wasnt working, because guess what, the glass material was not being dragged along

#

so now its only moving the glass part and i'm just going to add the shop behind (like I originally wanted because it'd be weird for a shop to be 50 centimeters tall and follow the window)

amber saffron
golden raven
amber saffron
#

(or just move the proper parent object 😅 )

golden raven
#

each face was a different material

#

but the same object essencially

#

not sure if my my explanation makes sense but yeah, im making a shopfront simulator as a pitch to my company that im interning, its in my interest to actually get hired and work here haha

neat orchid
#

Ok somehow the flipbook shader is making the particle animations less smooth. It jitters/flickers around. Why could that be happening?

#

is there any setting on the particle system that could be not jiving with it?

vocal axle
#

im trying to make a stereogram shader, and make it like duplicate to the sides to create the false focus effect but it doesnt seem to be working. can someone help?

amber saffron
dim yoke
# vocal axle im trying to make a stereogram shader, and make it like duplicate to the sides t...

There's definitely an auto stereogram there though not working properly (looks like it's partially duplicated horizontally, the axis symbol in the middle doesn't help seeing it though). Without seeing the shader it's impossible to tell what's going on. Have you checked papers like these: https://projet.liris.cnrs.fr/imagine/pub/proceedings/ICPR-2016/media/files/1621.pdf. That seems to pretty much provide the exact formula required to produce such effect

dim yoke
#

Now that I look at it, that link isn't maybe exactly what you are looking for but I'm sure there's ton more resources and even shaders available online (there seems to be multiple on shadertoy for example)

golden raven
#

while yes its does its job, but i wanna know if it can also look a bit like glass instead of only a cutout

ebon basin
#

Look up some refraction shaders

vocal axle
vocal axle
dim yoke
amber saffron
hardy juniper
#

omg this is a goldmine

delicate raven
#

after 1 week of selfstudy with shader lab, i did some simple shader i guess

dull meteor
#

Does anyone know the proper way to read triangles out of sprite geometry? I want to convert a sprite with custom uvs and geometry to a texture I can save to disk. I'm not overly concerned with how long it takes and I don't want to wait for and have to deal with callbacks for draw frames so I wrote this as a gpu shader-ish thing. Problem is taking the triangle indexes in groups of 3 like this just leaves me with a bunch of bottom rights and there appears to be repeats. In-Game the sprite renders like I would expect.

So A) Do you know what's wrong with this snippet?
Or B) Do you have a better way to instantly render a sprite to a texture2D, like Graphics.Blit but for sprites? As if they were in an Ui Image component

#
_texture = new Texture2D((int)sprite.rect.width, (int)sprite.rect.height);

for (int i = 0; i < sprite.triangles.Length; i += 3)
{
    var a = sprite.triangles[i];
    var b = sprite.triangles[i + 1];
    var c = sprite.triangles[i + 2];

    var vertA = sprite.vertices[a] * sprite.pixelsPerUnit;
    var vertB = sprite.vertices[b] * sprite.pixelsPerUnit;
    var vertC = sprite.vertices[c] * sprite.pixelsPerUnit;

    var uvA = sprite.uv[a] * sprite.rect.size;
    var uvB = sprite.uv[b] * sprite.rect.size;
    var uvC = sprite.uv[c] * sprite.rect.size;

    var minX = Mathf.FloorToInt(Mathf.Min(vertA.x, vertB.x, vertC.x));
    var maxX = Mathf.CeilToInt(Mathf.Max(vertA.x, vertB.x, vertC.x));
    var minY = Mathf.FloorToInt(Mathf.Min(vertA.y, vertB.y, vertC.y));
    var maxY = Mathf.CeilToInt(Mathf.Max(vertA.y, vertB.y, vertC.y));

    for (int x = minX; x <= maxX; x++)
    {
        for (int y = minY; y <= maxY; y++)
        {
            //I want weights based on vertices, and final values based on uvs
            var denom = ((vertB.y - vertC.y) * (vertA.x - vertC.x)) + ((vertC.x - vertB.x) * (vertA.x - vertC.x));

            var weightA = (((vertB.y - vertC.y) * (x - vertC.x)) + ((vertC.x - vertB.x) * (y - vertC.y))) / denom;

            if (weightA < 0) { continue; }

            var weightB = (((vertC.y - vertA.y) * (x - vertC.x)) + ((vertA.x - vertC.x) * (y - vertC.y))) / denom;

            if (weightB < 0) { continue; }

            var weightC = 1 - weightA - weightB;

            if (weightC < 0) { continue; }

            var finalUv = (uvA * weightA) + (uvB * weightB) + (uvC * weightC);
            _texture.SetPixel(x, y, sprite.texture.GetPixel((int)finalUv.x, (int)finalUv.y));
        }
    }
}

_texture.Apply()
steel notch
#

Hey so I've got a question concerning the Stencil Buffer. I want to be able to have a scene viewable from inside a card. I understand the logic behind the stencil buffer and comparing against some assigned ref value. My question is, when multiple cards ovelap, how do you prevent the "inner worlds" from overlapping as well?

#

Unity Sprite Masks seem to have the ability to be nested, and I know they use the stencil buffer behind the scenes. How do they work under the hood?

karmic roost
#

why is this happening with my triplanar shader material?

karmic roost
#

nvm i smoothed out some edges in blender and its fixed

rare wren
#

I'm trying to make a flow stream on a spline based mesh. But when I use tiling and offset to move the UV of the noise, it Becomes gibbrish and moves (to me) randomly

I send the shader and subshader as well

Does anyone know what goes wrong?

#

This is the world normal Y dir, which looks fine to me

regal stag
#

If the aim is to get some parts panning faster than others, then you can do multiple samples at different speeds and blend between them based on the normal

rare wren
#

Ah got it. I thought that just changing the speed would work, but guess not haha

I'll try blending 2 speeds after lunch, thanks!

hard moss
#

after upgrading to 6.1 the shader i use throws this error

[Worker4] Shader error in 'Universal Render Pipeline/Custom/Lit Tessellation': unrecognized identifier 'FragmentOutput' at Displacement/Shaders/LitTessellationPasses.hlsl(188) (on d3d11)

Compiling Subshader: 0, Pass: GBuffer, Vertex program with <no keywords>
Platform defines: SHADER_API_DESKTOP UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_REFLECTION_BUFFERS UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_PBS_USE_BRDF1 UNITY_PLATFORM_SUPPORTS_DEPTH_FETCH UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS
Disabled keywords: DIRLIGHTMAP_COMBINED DOTS_INSTANCING_ON DYNAMICLIGHTMAP_ON INSTANCING_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADER_API_GLES30 SHADOWS_SHADOWMASK UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_UNIFIED_SHADER_PRECISION_MODEL UNITY_VIRTUAL_TEXTURING _DETAIL_MULX2 _DETAIL_SCALED _GEOMETRY_CUSTOM_ST _GEOMETRY_CUSTOM_UV_CHANNEL _GEOMETRY_UV_CHANNEL_0 _GEOMETRY_UV_CHANNEL_1 _GEOMETRY_UV_CHANNEL_2 _GEOMETRY_UV_CHANNEL_3 _HEIGHTMAP _HEIGHTMAP_BLUR_BOX _HEIGHTMAP_BLUR_GAUSS _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN _NORMALMAP _PARALLAXMAP _RECEIVE_SHADOWS_OFF _TESSELLATIONMAP _TESSELLATION_CLIPPING _TESSELLATION_DISTANCE _TESSELLATION_EDGE _TESSELLATION_PHONG _VERTEX_COLOR _VERTEX_COLOR_ADDITIVE _VERTEX_COLOR_DISPLACEMENT _VERTEX_COLOR_MULTIPLY _VERTEX_COLOR_REPLACE _VERTEX_COLOR_SUBTRACTIVE

any idea how to fix it?

hard moss
#

why cant i connect this to vertex position

regal stag
wild grove
hushed silo
#

Hi, I'm doing lighting/ao with a raymarching SDF system, and I'm getting this kind of weird artifact. Could anyone give me any hints on what could be causing it, what this kind of artifact would be called.... any clues really?

#

it seems to mostly happen when my light is near a flat surface like a wall or ceiling then this pattern emerges on the opposite side, ie if light near ceiling it happens on the floor

stoic flint
#

please suggest a way to make my terrain less pathetic? can you see something wrong/bad

stoic flint
#

I'm intersted in shader stuff. Not terrain placements.

grizzled bolt
#

The room for improvement I see is not really related to shaders

#

Mostly it's lacking in geometry detail like foliage, rocks and most importantly ridges
Height map terrain cannot really represent rough or vertical surfaces

stoic flint
#

Do you know how that works ? normal blending ? maybe you can help me here?

grizzled bolt
stoic flint
#

custom

#

dw, i'm a bit advanced, you can talk at any complexity you want i probably can understand you.

grizzled bolt
# stoic flint custom

Then it won't be a lot of trouble to implement custom blends as well
Unity's terrain shader can use heightmaps for blending, which aren't necessarily heightmaps but any data used as alpha bias to the blend operation, meaning some parts of the texture, like cracks between tiles blend more
This type of normal blending looks to be similar, instead I think it translates normal map to world space and determines the blend bias based on verticality
So in that example the grass favors flat surfaces and avoids inclined, or vice versa for rock

stoic flint
#

lol dude, i told you im a bit advanced

#

i already do that

#

i use splatmaps, color mask maps, triplanar blending

#

etc

#

but there, normal blending is not using slope

#

if you cannot tell, its a detail thing. no texture can reach that accuracy without beign at least 100kx100k.

#

i think he uses normal maps or sth im not sure

grizzled bolt
stoic flint
#

wym ? a splatmap is a map with 4 channels of heightmap

#

"translates normal map to world space and determines the blend bias based on verticality" can you describe this?

#

more

grizzled bolt
#

Technique 1 is "height blending" which uses an additional texture for each terrain layer to get a blend bias
Technique 2, this type of normal blending would read the world space result of applying the tangent space normal map onto your terrain geometry and get its verticality using dot product, and use that as bias when blending

stoic flint
#

yeah, he doesn't use that in there

grizzled bolt
#

Detail masking is something else, to be exact

stoic flint
#

wym? detail mask is adding a mask over the detail albedo, to taint it with another texture

#

our detail is the layer texturee here

stoic flint
grizzled bolt
#

This rather is introducing a map as bias to the blending of two terrain layers

stoic flint
#

a map on what? the whole terrain or the detail?

#

i'm not sure i understand you well

grizzled bolt
#

On the specific terrain layer

#

This shows that the cracks between the stone layer have a lower height (or "bias") so the green and brown textures blend more there

#

Normal blending would be the same technique, but not using a separate height map
Rather figuring out the verticality using a normal map

stoic flint
#

you mean something like a depth map with wich you multiply the splatmap channel of the said detail ?

grizzled bolt
#

Yes basically

stoic flint
#

you mean sth like this?

grizzled bolt
#

That resembles a height map that can be used for height blending, yes

#

Still, the normal blending in the video does not utilize an additional map like that
But the concept of introducing bias into the blend operation is the same

stoic flint
# grizzled bolt https://i.imgur.com/pv7py6x.jpeg

well, that's what i called detail mask map before tbh, but i do not think it will be able to do something like this, as using such a map will taint the entire "rocks" with that golden color you had here

stoic flint
grizzled bolt
grizzled bolt
#

Anyway, that's just two techniques to improve the terrain with shaders

stoic flint
#

yes, it was just an example.
honestly, that looks like an expensive step that will barely add realism in my terrain (in this exact terrain ecotype) (maybe in a snow environment)

grizzled bolt
#

Additionally what comes to mind is to potentially have some subsurface scattering / softer lighting for the grass/moss, and possibly tessellation for the rocks

stoic flint
#

yeah i thought about tesselation, i think imma try it and see if there's any improvement. but honestly will still be too far from the compared image.

#

subsurface useless there (and too expensive)

grizzled bolt
#

Though those options are usually considered after you've already been sprucing up the place with detail geometry
No matter how good your shaders are it'll stand out how simple and blocky the ground is

#

In fact if your shaders are not very photorealistic people will forgive the blocky and barren terrain more easily as well

#

But there's few reasons not to have some shrubs and rocks at least

stoic flint
#

just take a look here
this is a terrain.

#

no other geometry added.

#

it already looks photorealistic without need of rocks or vegetation.

stoic flint
#

not interested in placements

grizzled bolt
strange prairie
#

You’re not achieving that with Unity terrain. Need virtual texturing for that kind of detail

stoic flint
strange prairie
#

Mostly the splatmap but yeah that too

#

Right now having that kind of density just uses way too much memory since it’s all loaded at the same time

grizzled bolt
#

I think you can do this all with repeating textures and duplicate assets no problem

#

The example would look very barren without any meshes

stoic flint
#

maybe yeah, they are using another blended mesh into terrain

grizzled bolt
#

Here's just a few ridges that I believe are generic meshes on top of the terrain

#

The rocks and plants all over that look like meshes obviously aren't terrain either

#

Meshes can be blended seamlessly

strange prairie
#

Oh I didn’t get the full screenshot

#

Yeah you can see a clear difference in shading, even

stoic flint
grizzled bolt
#

Doesn't look like they're using much or any of that fancy mesh blending either

#

Probably height/normal blending, or the ridge textures have been baked with the same techniques

#

I think good looking terrain is like 80% credit of detail objects that cover up all the imperfections

#

The river pebbles and short grass for example effectively covers any terrain layer blending (or blending issues) there might be

#

Sometimes even texture repetition isn't necessary to avoid because a fully furnished environment won't have big plains where it'd become apparent
Even this game that's all about big plains is remarkably stuffed with detail

stoic flint
#

anyway, do you suggest anything i can do to increase realism without meshes or crazy expensive stuff?

grizzled bolt
#

With terrains it seems usually doing "more" makes it easier, contrary to how typically making something simple keeps the task simple as well

grizzled bolt
stoic flint
#

doing "more" makes it easier?

stoic flint
strange prairie
#

Could construct the whole thing with mesh shaders I guess

grizzled bolt
#

It's a bit hard to know if you're succeeding at getting better if the result is blocky and uncanny no matter what you do

#

But you do have the blending techniques to practice, and if it's for practice there might not be a reason to avoid the crazy expensive techniques either

#

Mesh details are good for practicing shaders too, when you've got foliage translucency, wind effects and blending rocks and cliffs with the terrain splatmaps

stoic flint
#

here i baked the splatmap at higher resolution, and changed slope a bit, and added whole terrain normal map, it looks just a bit better. i will try to add tesselation

#

anyway thanks for the helps! @grizzled bolt

marsh gorge
#

Does anyone have any idea on how to replicate this effect using shaders? When the user clicks on the image, a 1×1 area rotates revealing an image behind it, like this image

hard moss
#

i need to keep it in world space in order for the lighting to work correctly but the texture gets ruined how do i fix it

hot vector
#

I need help recreating this shader in Unity...
Image one shader setup - blender
Image 2 custom Shader - blender

#

Im completely new to Unity... so i have no idea where to start, unsure if its even possible

stoic flint
#

anyone got better idea please?

eager folio
strange prairie
#

We multiply the… light path? Of the 1x (first?) camera ray by a texture? What does that even mean?

hot vector
#

prob not the best way to go about it

strange prairie
#

It just makes no sense 😅

hot vector
strange prairie
#

That might be helpful

hot vector
#

should i dm you or send it here

hot vector
# strange prairie That might be helpful

Today I will show you how to make any render looks like a painting!


👇Parts👇

00:00 - Introduction
00:57 - Part 1 : Geometry | Aligning Instances to the Camera
02:36 - Storing Attributes and Final Touches
04:25 - Part 2 : The Shader Magic | Brush Texture
05:19 - Setting up the Transparency
05:54 - Fixing the...

▶ Play video
livid kettle
#

I'm trying to solve 3k0o_x's question but so far my attempt always has these weird curves.
This is probably due to adding/substracting UVs on each other, are they not perfectly linear perhaps? Graph is a stringy mess

livid kettle
#

This is the end result, i guess the curve isnt so noticable. You do need the tile as a separate texture tho, because it needs to go into texture sample which doesnt accept edited stuff.

steel notch
#

Can you not define an Array of floats in shader graph?

#

Or colors?

#

Or any arrays other than Textures?

livid kettle
#

i dont see how thats relevant, tbh, but im not an expert

arctic steeple
#

Hi all, what URP shader should I be using for leaves on trees? I am currently using speedtree8 because its the only one i could get to work how i wanted but its giving me a strange white gradient/fog effect on the leaves

tacit parcel
amber saffron
#

You can apply a 3D rotation to the position and normal before the triplanar nodes.

Note that if you have an other object somewhere that is not oriented like the one in the screenshot, it might be that other one who ends up with a bad orientation ...

#

Maybe the best here would be to use proper UV mapping instead of a heavy triplanar projection ?

#

More "Rotate About Axis", which is for 3D vectors.

#

Well, in your case it seems to be as simple as taking the Rotate About Axis node, input the position, use (0,1,0) as rotation axis, and find the perfect rotation angle (use an exposed float) to match your 3D asset.
Then use the same for the normal.

But because what I see in the screenshot is a float road mesh : why not simply edit the UVs to texture it properly ?

hardy juniper
#

a road can just be a normal material with tiling set correctly...

#

or using world pos to sample a texture uv in a simpler way

magic ice
#

I made a Full Screen Radial Blur Shader and assigned it as a Renderer Feature. but the problem is that the shader also affects my scene view :/ is there a way to make this Renderer Feature only affect the Game View?

amber saffron
heady pewter
#

so i dont really know how to properly ask this question but here goes.

i'm trying to erase, or transparent some colors from one node so i can add it ontop of a different node together to get a combined node together.

like in this picture for this case, i want to take the black part from this floor and make it gone when i place it onto another node, so only the white part is getting written on it

hardy juniper
heady pewter
teal lynx
#

Are shader graphs and shader scripts just two versions of making the same thing? Do they compile to the same script?

smoky widget
regal stag
gloomy fractal
#

i want to random between 2 colors so i have variations for my grass, how can i do that?

#

urp shader graph

gloomy fractal
#

ok i got it , just using the position and some gradient

#

it works

teal lynx
#

Hello. I'm currently writing a full screen post processing shader. I'm trying to sample the color of each pixel during a pass that way I can transform it. How do I do this?

little sedge
#

can someone help me fix this bug with the materials? it looks like the material is drawing on top of itself,enabled alpha clipping and transparent surface type,ive tried everything and it keeps doing this weird effect

#

the models worked fine when i used them on godot so maybe unity has a different way for rendering alpha clips?

terse grove
#

hello! I'm trying to create a grid system in unity, that shows itself to the player. Ive seen a couple of tutorials for applying a shader to a plane, but how do you apply a grid to a unity terrain? Does anyone have resources for learning how to accomplish this? for clarification the project is URP and im just using unitys default terrain

little sedge
kind juniper
#

I don't think there's such a thing as "cutout rendering pipeline"

hardy juniper
#

a simpler version can be done without smooth edges

terse grove
#

the unity samples does have a procedural grid that i was testing out. it works well, albiet a bit simplistic on the ground, but it was using a decal shader, and doesnt work well on slopes.

hardy juniper
#

you can use similar techniques like I did above to use world position to produce grid lines

#

slopes will still have this problem however because thats just how it works

terse grove
#

yeah, right now i was thinking of just clamping my decal projector transform's position to a place on the grid to keep the grid lines the same, but being able to use world position to produce grid lines seem better.

hardy juniper
#

you can get a decent result already using step with world pos

desert bear
#

I am extremely new to unity, as in I just downloaded it. I understand that I need a render pipeline but for some reason the default is none. I was able to change one manually in the inspector but I'd like to do it for everything. How could I set the default render pipeline?

desert bear
#

I deleted the one I had and re-extracted a new Unity Essentials . zip and now it works lol

amber saffron
strange prairie
#

But using one would be highly recommended

grizzled bolt
#

I recommend URP if you don't know what RP you need
None/BiRP if you know you need to use legacy assets or tech
HDRP if you know you know what you're getting into with it

torn cave
#

Sorry for the inconvenience.
I need to create a function that takes all the incoming lights and gives them to me as output to then apply nodes to them later.
Every time I create a hlsl file where I put the functions (made by AI) it always gives me errors on this function:
undeclared identifier 'GetAdditionalLightsCount' at Assets/prova/prova.hlsl(4) (on d3d11)
Can anyone tell me what I should do? I'm going crazy.

i'm using Unity 6

amber saffron
torn cave
#

if i include that, the project give me another error

hardy juniper
#

Its actually #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RealtimeLights.hlsl"

#

Lighting.hlsl does use the function it seems (i was looking in the src just now)

amber saffron
hardy juniper
#

Im on 2022 so there is a chance it moved in later unity versions

torn cave
regal stag
# torn cave Sorry for the inconvenience. I need to create a function that takes all the inco...

Custom functions for shadergraph can't have return types, they need to be void and use out params instead.
Include files specific to render pipelines need to be surrounded in #ifndef SHADERGRAPH_PREVIEW blocks (including them in previews will cause conflicts due to how shadergraph handles those). In this case Lighting/RealtimeLights is already included anyway.

I have custom lighting nodes here you can use as an example/template : https://github.com/Cyanilux/URP_ShaderGraphCustomLighting
(specifically AdditionalLights_float in the CustomLighting.hlsl file)

torn cave
regal stag
#

No

torn cave
#

ok sorry

amber saffron
#

If you want to ask help about shaders, here's the channel for it, so answers and solution are publicly visible and can be shared.

toxic flume
#

Hey dudes, how can I reference a shader existing in the package cache path in my shader code?

low lichen
junior copper
#

its been a while since i did some shaders, whats the node(s?) to tile a shape ?

#

for instance im trying to make a rectangle repeat indefintly, so i know i need the Tiling And Offset node at some point, but using it as a modifier for the input or output doesnt seem to give the desired result

#

nvm i found it back

#

Tilinge & Offset -> Fraction -> Shape

gloomy gust
#

im working with the unity toon shader rn, I want to try and programatically access the rim light toggle but im not sure how to. Using float = 0 / 1 for on and off don't work, how can i deal with this?

maiden apex
#

Is there anyone who speaks Arabic here?

amber saffron
junior copper
#

what should i do to make my canvas shader not scale withthe imahe container ?

gloomy gust
#

i assumed the underscore meant like

#

not tied to a keyword

amber saffron
#

So setting it to 1 should be enough 🤷‍♂️

#

I see in the source code that there's a lot of other rim light value that you might need to change ?

gloomy gust
#

the other values i've pre set

amber saffron
gloomy gust
amber saffron
gloomy gust
# amber saffron Can you show a bit of the code ? Looks like material duplication.

Yeah, so basically in the start function I cache the list of materials in the materials list, like this
characterMaterials = characterRenderer.materials;

and then in the update function i do this

if (characterEntity.intangFrames > 0 || characterEntity.invulnFrames > 0)
        {
            foreach (var mat in characterMaterials)
            {
                mat.SetFloat(RimLight, 1.0f); 
            }
        }
        else
        {
            foreach (var mat in characterMaterials)
            {
                mat.SetFloat(RimLight, 0.0f); 
            }
        }
amber saffron
gloomy gust
#

ohhh

amber saffron
gloomy gust
#

i forgot about that

#

yeah that works now, thank you 😅

hushed jacinth
lapis sorrel
#

so, im both new to the server and unity, I wanted a bit of help on this issue ive fallen into, i was following this guide about making a graph and it had a segment where it was making a standard surface shader, im using the built in pipeline, and my code looks like this.

Shader "Graph/Point Surface"
{
    Properties
    {
        _Smoothness ("Smoothness", Range(0,1)) = 0.5
    }

    SubShader
    {

        CGPROGRAM
        #pragma surface ConfigureSurface Standard fullforwardshadows
        #pragma target 3.0

        struct Input
        {
            float3 worldPos;
        };

        float _Smoothness;

        void ConfigureSurface(Input input, inout SurfaceOutputStandard surface)
        {
            surface.Albedo = input.worldPos;
            surface.Smoothness = _Smoothness;
        }

        ENDCG
    }

    Fallback "Diffuse"
}

but when i apply the shader to a material, its just pink, and i am really confused on what could be the problem

i downloaded unity recently, so my editor is v 6000.1.4f1

lapis sorrel
hot vector
#

Hey! Im currently working on trying to figure out how to make a shader, but i am very new to unity, ive watched tutorials and followed them but i cant figure out how to make what i want… would anyone be able to help out? maybe in dms?

hardy juniper
#

you can do something easy like use time to offset the uv used to sample a texture and it will make it animate!

hot vector
hardy juniper
#

blender kinda works the same way but you cant do everything there also in unity. Blender lets us do some cheaty things as it doesn't need to be realtime

hot vector
#

ohhh

hot vector
hardy juniper
#

Its better to share here so many people can help out at any time

hot vector
#

ohh good point

#

ok so im trying to make a shader that looks like this

#

(the pink is the light, base color is blue, i used a toon shader on top of some geometry nodes)

#

this is without the shader, the issue is im 95% sure that all those faces would be alot for unity real time rendering (the faces always face the camera)

hot vector
hardy juniper
#

you can draw lots of geometry cheaper with gpu instancing. lots of overdraw can be an issue however

#

unity also has functionality to draw geometry direct from code cheaper without gameobjects

teal lynx
kind juniper
echo moatBOT
turbid pivot
#

i was told the yellow slash could be a shader

#

i would like to recreate something similar

#

if it isnt a shader please direct me to the right channel

kind juniper
#

Could also be line renderers too.

turbid pivot
#

unless its part of his animation and im dumb

kind juniper
#

Meshes and line renderers can be modified at runtime. And shaders can be used to different meshes differently over time. It depends basically

junior copper
native dove
#

I have a question

#

Please help me out from my problem

#

I want to use shaders in my URP game but the shaders that I want to use are made for Built-in so

#

How I can upgrade them to URP.

tacit parcel
placid timber
#

I created a shader with 8 textures and one shader with 2 textures atlases. Which one with perform better? I'm not sure since the node tree with the atlas textures looks hella scary

kind juniper
#

My guess is atlas would be better due to possibly less cache misses.

astral pecan
#

Anyone tried using the Shader Graph UI Samples for UGUI?

#

Why doesn't this do anything

#

Its supposed to change button color to white when clicked.

amber saffron
golden raven
#

how can I fix my ambient occlusion going through walls and not break my glass stencil shader meanwhile?

golden raven
#

in case anyone runs into a similar problem

lyric hill
#

So long question

#

Im trying to mimic a very specific artstyle

#

Something like this

#

I figured the only way I'd get that look is painting the textures my self, and adding an outline shader at the end

#

What Im trying to do though is use two different lighting models for my textures

#

I have this, one with paint layer and one with outlines

#

Is it possible to only have the paint layer lit while making the outline layer unlit

#

I have them on two different images

astral pecan
#

This is the simple button sample

hearty obsidian
# lyric hill So long question

Of course! Basically you create an unlit shader and you compute the lighting yourself. There are many existing resources for this and it is actually very simple.

Then you interpolate between your result and outline color based on the outline texture's alpha

tacit parcel
prime coyote
#

Hey Yall how do I make a Rectangle turn into a trapezoid using only UVs?

#

I want to make it so I can make something gradually pinch at the end on a Tex2d

#

Would anyone know how to do this?

dull meteor
#

Question:

In a multi-pass CGPROGRAM shader, my result gets smaller and smaller with each pass. I'm pretty sure it's because in my vertex I'm calling UnityObjectToClipPos() on each pass. Is there an alternative that will preserve the size? I'd like to call UnityObjectToClipPos() on the first pass then on subsequent passes keep the positions the same as the first

prime coyote
#

for instance making a rectangle into a trapezoid

dull meteor
#

then when it's rendered to the screen, it will still be a rectangle. The texture (etc) will be in the shape of a trapezoid, but stretched into a rectangle.

If that's what you want, in your vertex shader, modify the x uv based on the y uv.

If you want to taper the 'zoid to the center you need to define where the center is. That could be in your mesh if you're using one. I'll use 0.5 assuming it's the middle of the texture. Use a scaler on the uv.y to control how steep the sides are. A value of 1 should leave you with a triangle

float distFromCenter = 0.5 - IN.uv.x;

OUT.uv = float2(IN.uv.x + (distFromCenter * IN.uv.y * scaler), IN.uv.y);

You also will want to clamp your output between 0 and 1

dull meteor
# dull meteor Question: In a multi-pass CGPROGRAM shader, my result gets smaller and smaller ...

I figured it out, for anyone in the future https://docs.unity3d.com/560/Documentation/Manual/SL-GrabPass.html is a good ref (there isn't one for the current unity version which made it hard to find) Use ComputeGrabScreenPos on the texture coord to get the psudo-uv you need

placid timber
magic ice
#

i noticed a weird problem with renderer features. i made a test shader graph that is just Scene Color -> Fragment (Base Color), added it as a URP Renderer Feature and set the Injection Point to Before Post Processing. but when this renderer feature is turned on, it makes the screen slightly blurry and lower quality :/ what could be the cause? i don't think it's the shader itself because how could passing scene color back to the render cause blur??

regal stag
potent night
#

wont let me connect remap or sample texture to the multiply so i tried using split and vector 3 but still doesnt work im sure there is some notion that i dont understand about shader graph

potent night
regal stag
potent night
limber pebble
#

I know about the "SceneColor" node, but how do I do the same thing in a built-in shader?

regal stag
limber pebble
#

Thanks

#

GrabPass, copy the frame at that current point on every draw call or per frame?

#

Because if it is the first one I would prefer that he only do it once before drawing the transparent ones

regal stag
limber pebble
#

Ooooo

#

Thanks

naive scarab
#

Hi, im new in Graphics, i have coded this marching squares algorytm, but i would like to have a much nicer borders, really rounded or soft

#

something like this

ebon patrol
#

Is it possible for a shader (shader graph preferably) to dynamically change the color of Material A (colored in red) depending on each vertex's Y distance from the corresponding X-Z point of the Material B (colored in blue)?

dull meteor
#

Anyone have a reference on how to work with clip space coords? I've been looking for a few days but I can't find anything. I'm trying to make a shader to apply a guassian blur to the left and right n% of an area in a CGPROGRAM. So I start with a grab pass, use ComputeGrabScreenPos to translate the uvs and apply the blur which all works. But when trying to limit the blur to only the area I want my uvs are in screen space and end up bluring the sides of the screen, not the sides of the area. I'm sure there's an easy thing you can do with a projection or you can put something else through ComputeGrabScreenPos to translate it but tbh I don't really even know what ComputeGrabScreenPos is actually returning. xyzw is not very descriptive.

Anyone know how to do what I'm looking for or can point me to a resource on it?

dull meteor
# ebon patrol Is it possible for a shader (shader graph preferably) to dynamically change the ...

It's a little hard to know what your asking. It sounds like you mean to say mesh instead of material? A material holds properties that get passed to a shader which is the code that does the drawing. A mesh is just data with a collection of vertexes positioned in space with possible color/uv/etc info associated.

If you give your "red" mesh a material with a shader that has a property for your 'blue' mesh, that shader can sample the 'blue' mesh's coordinates and in the fragment shader change color based on the y coord. If that's what your asking I'm not 100% sure

ebon patrol
dull meteor
#

Is the mesh animated in any way? If it's static you could bake it into a texture and sample it that way in a shader, but if it needs to move around you could possibly use a compute shader? I only know enough to know you meant to say mesh rather than material, maybe someone else can help more

turbid pivot
#

potentially different noise calculations

astral pecan
junior copper
#

i got a simple shader graph that is moving using the time node, on android (didnt tested on IOS) the shader is working BUT without the "moving" part, like if the time node always returned 0

#

what should i check to debug this issue

final helm
#

Hi! 🙂 I'd like to sample a tile from a 4x4 texture atlas depending on current vertex color. I know from the color red channel the tile ID [0;16[ I need to sample from. With my current setup the whole row is rendered whereas it should only do so for the targeted tile, would someone have any idea on how to fix?

final helm
#

Fixed - missed a Fraction node on the output of my UV Scaling group at the top!

amber saffron
astral pecan
amber saffron
grand jolt
#

I'm just trying to make my textures follow the map using a splatmap system in an unlit graph, but I don't really know much about it, and the textures aren't being applied correctly.

forest wave
#

Anyone know how to use a texture as a mask for the position of an object in shader graph urp?

For example, having a glitch effect, which animates the objects vertices, affect only a certain part of an object

cold flicker
#

There's a world in Banter that has kind of a skeletal structure to the building. There are reflective surfaces in that world that reflect that structure, and move appropriately as you move around. My knowledge is really out of date, but I didn't think that was possible, or if it was you would have to use a shader that uses an auxiliary camera.

#

(I'm kind of describing "mirrored" surfaces)

#

Any clue how this is done?

#

nm.. baked reflection probes? won't show the character, but will reflect the environment. Or mirroring camera rendered to texture if you want to show the player?

ebon patrol
#

If it helps, the generated meshes are all in one layer

grizzled bolt
dull meteor
#

In a CGPROGRAM shader, after I do a GrabPass, how can I edit the uvs in object space to the drawing object? If I project the screen to object space it works, but once you modify the uv either before or after it becomes dependent of screen space again

//This is fine
return tex2D(_GrabTex, grabScreenPos.xy / grabScreenPos.w);

//Before doesn't work
return tex2D(_GrabTex, float2(grabScreenPos.x + 0.5, grabScreenPos.y) / grabScreenPos.w);

//After doesn't work
float2 uv = grabScreenPos.xy / grabScreenPos.w;
uv.x += 0.5;
return tex2D(_GrabTex, uv);

I assume instead there's some kind of projection I need to do, but I can't find what

#

I'm trying to render this sprite in a mesh with custom geometry and uvs. So I do one pass just rendering the geometry, then a grab then finally on my third I copy the center to the sizes mirrored over y (and tint green just so you can clearly see what was flipped). I try to move them by the width of the center region but the movement I'm doing is dependent on the camera causing these gaps

naive scarab
# turbid pivot higher resolution

yes, but it uses the cpu to calculate it, and i want a dynamic terrain, like those water and lava games where you have to dig with your finger a path for the liquids, so how could i render that with a shader? or to create the mesh with it

turbid pivot
#

by map i mean a scene

#

you want a large explorable area of which you can place/remove and the terrain changes?

naive scarab
turbid pivot
#

seperate it into multiple chunks

#

this will exponentially reduce the time it takes

#

its also scalable if you want to do that in the future

#

and with that you can do higher resolutions

naive scarab
#

but would it be possible to create the mesh with the gpu? so i can apply a dynamic texture o it or something like that?

turbid pivot
#

use a compute shader

#

look into those

#

runs on the gpu and is very parallel so good for repeated calculations

#

althought for now chunking it would be faster

turbid pivot
#

my transparent shaders which normally work fine stop layering when i put them in a particle system or vfx system

#

it'll overlap the other one instead of blending with it

#

how can i fix this

#

URP

low lichen
turbid pivot
#

or does it flat out not work

low lichen
turbid pivot
#

but if i add 100 of them in the same place it would would add to make a solid image eventually no?

#

due to the transparency

#

thats what i want to achieve with a little offset

low lichen
#

Depends on if it's actually transparent. Distortion shaders generally aren't transparent.

#

Is this a shader graph you made? Can you post a screenshot of the Graph Settings, where the transparency setting is?

turbid pivot
low lichen
#

And what does the "mask" texture look like? Is it transparent?

turbid pivot
#

this

low lichen
#

Is it transparent? Preview doesn't look transparent.

turbid pivot
#

it is not

#

actually it is

#

nvm

low lichen
#

Try changing the Depth Write from Auto to Off

turbid pivot
#

i just made some modifications fixing a small error but its functionally the same

#

depth write force disabled worked

#

although now you cant see particles behind it 😭

astral pecan
eager folio
#

For the exact same reason.

turbid pivot
#

i got it to work for something else dw

distant torrent
#

hi guys. im using a fullscreen shader graph in my project, but i want to exlude certain things. I assume i can do this using layers but i cant see any option where the fullscreen shader graph only applies to the main camera. any advide? thanks!

grizzled bolt
# distant torrent hi guys. im using a fullscreen shader graph in my project, but i want to exlude ...

You can render something on top of the first camera that includes your fullscreen shader with an overlay camera, and determine object visibility via the cameras' Culling Masks
If your fullscreen shader is applied as a renderer feature, your overlay camera needs a second renderer without it
If it's a custom post processing overlay, you can also use Volume layers to exclude it from that Volume override
It only works one way though, as fullscreen shaders and post processing are still 'full screen' per rendered image so objects will be composited on top of it

#

They can still use depth to not be rendered through other objects but they cannot avoid going over effects like bloom
So ideally those would be applied on the overlay camera

gloomy fractal
#

urp shader graph, is it possible to change the scale of my grass? i want to have variations not always same scale.

olive igloo
#

Currently my toon shader only reacts to main light source, anyone know how can I make the shader also reacts to environmental lighting instead?

hardy juniper
#

the unity toon shader has quite a few features so may be worth checking that first

lavish flume
#

Anyone if its possible to place a volume in the scene, and have it change the color inside of itself to what would be defined in it? Kind of like how reflection probes will only show its baked reflection in its own volume and nowhere else. For example i could have a red material, and place down a volume for it to be green in that area

grizzled bolt
lavish flume
#

That's not quite what im looking for cause im trying to change the material tint, not override the material, and i'm using a custom shader anyway which i probably should've mentioned first
and more specifically i want the volume to pass the color and its bounds to the hlsl shader/shader graph similar to how reflection probes do in GlobalIlumination.hlsl

#

I mean i think i have the right idea just dont know how to do it?

hardy juniper
#

If you have an array of min max bounds on the floor shader you can check if the pixel is inside this and change the colour as you desire.
Or use stencil to do it a bit differently (two floors)

calm crystal
#

I have a problem where my second camera is always rendering it's objects on top of all other objects. My setup is Player -> MainCamera -> NoPPCamera The main camera renders everything except the Revealable layer and has a post processing layer that sets the saturation to 0. Then my NoPPCamera renders all the objects on the Revealable layer. problem is that all objects on the revealable layer are drawn on top of everything else. I set the NoPPCamera clear flags to Depth Only and made sure that the depth is higher than the MainCamera.

ebon basin
#

otherwise ditch PP and do it local to the shader

#

Like, what you're doing is possible if you want to render it as an overlay, or say a custom skybox which you don't want PP bleeding onto

inland pike
#

I want to apply texture to my sprite. However Overlay does not work as photoshop Overlay. Output is almost black instead of colors.

amber saffron
dire galleon
#

how do i get rid of this slight shadow line

inland pike
strange prairie
dire galleon
strange prairie
#

Depends on render pipeline

grizzled bolt
dire galleon
grizzled bolt
amber saffron
wintry pelican
#

hey, i cant figure out why my water shader "starts again" if the same tiles are connected. If two different tiles like edge and middle are connected it works as intended. Does anyone have an idea?

midnight lily
#

When writing a compute shader to occlude Graphics.DrawMeshInstanced, can I change the same list I am iterating over? (I am not overly familiar with the terminology so I might call something the wrong name)

Say I have a "RWStructuredBuffer<uint> InstanceIDS"
Each thread will use the uint id : SV_DispatchThreadID to take from InstanceIDS what is the current ID being worked on
Then each thread will check it's position vs the camera frustum and then decide if they add it back to InstanceIDS or not
The new position in the current InstanceIDS will be defined by a InterlockedAdd (I already confirmed this works when not writing to the same list being read from)

The question I have is because I am not familiar with the exact inner workings of compute shaders

The image is how I think it would work. Group 1 will start and probably finish first, so group 2 can't possibly write to the array before Group 1 has already finished reading what it needs from it.
Would it work, or it's not impossible for Group 2 to start and finish before Group 1 can start reading from the array?
I am aware functions like "AllMemoryBarrierWithGroupSync" exist and they feel like they could or could not be required for it to work? Which further confuses me on how this scenario would play out.

kind juniper
#

If you're just writing to one unique index in each thread, this should be fine. If you're writing to different indices, you could get a race condition.

midnight lily
#

The idea is to take one index, check if it should draw (depth check, frustum, other conditions, etc), then conditionally write back to the same array it was read from

kind juniper
#

Write back to what part of the array?

midnight lily
#

the beginning I hope

kind juniper
#

And do other threads access that part that you're writing to?

midnight lily
#

the index is choosen by doing a InterlockedAdd on ArgsBuffer New

kind juniper
#

So you're adding to ArgsBufferNew?

#

Are you reading from it anywhere?

midnight lily
#

No, I read the index from InstanceIDS, the read index is the uint id : SV_DispatchThreadID, then write back to InstanceIDS, the choosen new index is based on a interlocked add to ArgsBuffer new

kind juniper
#

If order of elements in that new buffer doesn't matter to you, it should be fine.

midnight lily
#

This will 100% work on Group 1 without a doubt. The question I have is whenever or not Group 2 may start and end before Group 1

kind juniper
midnight lily
#

So it's not impossible for Group 2 to start and end before Group 1 has a chance to read it's ids from the array?

kind juniper
#

Not impossible. It depends on the hardware and other things. For all intents and purposes you should consider that all the threads are running simultaneously. There's also cache to take into account.

#

When shaders execute they don't write back to VRAM right away. they write to caches. These then need to be flushed at some point. And if several caches target the same VRAM address you'll get a race condition.

midnight lily
#

The threads don't race when writing since interlocked add ensures they all get a different, but consecultive ID to the array

#

my fear is that the writes may race with the reads, but if they write to cache, and only flush that after everything is done, then it should be pretty much safe no matter what

kind juniper
midnight lily
#

This is what I interpreted from your answer regarding the cache

kind juniper
midnight lily
#

I see, so it's inevitable that I will need two InstanceID lists just as much as I need two argbuffers

kind juniper
#

A read from the same address could trigger cache flushes as well. You should really avoid relaying on these things and just go with the safest approach.

#

If you're doing just thread 0 reads from index 0, calls interlocked add on a different buffer and writes to index 0, then thread 1 reads from index 1, calls interlocked add on a different buffer and writes to index 1, then this is safe, since each element in the buffer is only accessed by it's corresponding thread.

midnight lily
#

the interlocked add and subsequent write are conditional, but yeah, that's how I currently do

obsidian jewel
#

If anybody here went through Creative Core, does it overlap with Junior dev?

kind juniper
#

But if thread 0 reads from 0 and writes to somewhere else, like 1, and thread 1 reads from 1 and writes to 0, for example, that's defnitely a race condition.

midnight lily
#

all threads in the group should run in sync, no?

#

so all reads have long since happened before any writes go through

kind juniper
midnight lily
#

the interlocked add ensures that don't happen

kind juniper
#

And you still have the issue of 2 thread groups running at the same time.

midnight lily
#

the issue would be if a subsequent group were to write before the previous group had a chance to read

#

yeah

#

Would a "AllMemoryBarrier" solve that?

kind juniper
#

Possibly. But it might have a considerable effect on performance, depending on how many threads/groups you're running.

midnight lily
#

Oh well, I guess I will just have two buffers, it's not like they are all that big to begin with

teal lynx
#

How would I approach adding an atmospheric reentry effect to objects? I'd probably have some input float for the intensity of the reentry(based on speed and altitude) and a directional vector. I'd also probably, for every triangle, do a dot product between it's normal and the direction of movement to figure out whether they're in front or behind

#

Beyond that though, I'm pretty puzzled about how I could actually implement this

#

This is the sort of thing I have in mind.

ebon basin
#

I'd just use a trail/particle strip mesh

distant torrent
#

I created this cool little procederally generated galaxy 😄
But when i zoom out it looks like this and not really crisp. No idea how to go about fixing that D:

ebon basin
distant torrent
#

linerenderer , but im trying something rn, just going to increase width when zooming out

distant torrent
#

yeah, definitely helped

#

wait i broke something

#

yeah, its better i think

#

maybe too thick, but it works

tacit parcel
teal lynx
#

I was mostly struggling to figure out how trails would work

junior copper
#

i got a simple shader graph that is moving using the time node, on android (didnt tested on IOS) the shader is working BUT without the "moving" part, like if the time node always returned 0, or the shader renderer 1 frame then froze
what should i check to debug this issue

grizzled bolt
junior copper
#

ill try that thanks

junior copper
frozen flax
#
struct Attributes
{
    uint vertexID : SV_VertexID;
    float2 uv : TEXCOORD0;
};

struct Varyings
{
    float4 positionCS : SV_POSITION;
    float2 uv : TEXCOORD0;
};

Varyings Vert(Attributes input)
{
    Varyings output;

    float2 pos;

    switch (input.vertexID)
    {
        case 0: pos = float2(0, 0); break;
        case 1: pos = float2(1, 0); break;
        case 2: pos = float2(0, 1); break;
        case 3: pos = float2(1, 1); break;
        default: pos = float2(0, 0); break;
    }

    output.uv = float2( pos.x, 1.0 - pos.y);

    output.positionCS = float4(pos * 2.0f - 1.0f, 0.0f, 1.0f);

    return output;
}

Does anyone know what I'm missing with these UVs here? It's only covering half of the screen haha (I don't have too much experience with HLSL)
I'm not entirely sure if it matters but this is a renderer feature / blit material.

regal stag
# frozen flax ```hlsl struct Attributes { uint vertexID : SV_VertexID; float2 uv : TEX...

Likely either a triangle that's backwards (Cull Off in the Pass block would fix that) or the rendering command in the feature is only drawing one triangle (in which case you either need to change it to draw two tris or need different positionCS & uvs for that triangle to fill the screen properly)
If you're using the Fullscreen Pass Renderer Feature that URP provides would be the latter issue. Can use the Vert shader in the Blit.hlsl helper include file, for example : https://www.cyanilux.com/faq/#fullscreen-shader

frozen flax
#

Thanks! I'll look into the suggestions shortly. Didn't occur to me that the UVs might be backwards hahh

junior copper
grizzled bolt
junior copper
#

is _Time.y what the Time shader graph func use ?

grizzled bolt
teal lynx
teal lynx
# teal lynx

There's multiple elements to this, but rn I'm working on the glow underneath a heatshield(not the trails).
I'm simply just doing a vertex displacement of the selected mesh in the direction of movement and making the triangles facing the same way as the movement vector glow.

#

I'd like a more volumetric approach though... while I could just stack these with multiple displacement values, I'd like to have something that looks more "integral like" instead of summing layers

delicate crag
#

So looking at Common.hlsl inside com.unity.render-pipelines.core there's conditional includes depending on platforms. Now in my case it wants to resolve #include "Packages/com.unity.render-pipelines.gamecore/ShaderLibrary/API/GameCore.hlsl". So I install that package, and sure enough if I look inside Unity I can see that the package shows up, it has a GameCore.hlsl which matches the path of the include. Yet when I build this file fails to be included, I get a Couldn't open include file .... Now I imagine that there's some sort of magic going on here because the literal path for any of the packages are never correct, they instead seem to live inside Library\PackageCache where I have packagename@{some_sort_of_id}. My question is what could likely be wrong for the shaders to be unable to resolve correctly to this file inside what I assume is trying to look inside the PackageCache?

frozen flax
frozen flax
#

I also just noticed that it was your site hahah. Ive used it before as well, good tutorials!

quaint grotto
#

if i have a mesh with 3 submeshes each with their own material... how do I make an additional material which is just responsible for vertex manipulation

kind juniper
naive scarab
#

i managed to create this mesh via script, you can paint or erase on it, but now i want to create an outline where there is a hole, preferably inside

#

the texture is full, i mean, it has no transpartent sides

#

something like this

wispy wharf
#

Hello!! I wanted to get your opinion on this shader — do you think it’s more performant than the original HDRP Lit shader?

slender ore
#

Hi, I am trying to follow Ben Cloward's tutorial on Triplanar projection https://www.youtube.com/watch?v=tsE7Tqlv8DQ, and recreate it in HLSL on a custom engine and I am struggling to get it done. I have made this function that I am using instead of UVs to sample a texture and I am trying to modify it, compared to the video I am using world position to keep the texture tillable.

{

    float3 testNormal = pow(abs(normal), 8) / dot(pow(abs(normal), 8), float3(1, 1, 1));

    float2 testPositionX = float2(worldPos.y, worldPos.z) * scale;
    float2 testPositionY = float2(worldPos.x, worldPos.z) * scale;
    float2 testPositionZ = float2(worldPos.x, worldPos.y) * scale;

    float2 blendUV = lerp(testPositionX, testPositionY, testNormal.y);
    float2 blendUV2 = lerp(blendUV, testPositionZ, testNormal.z);

    return blendUV2;
}```

I am not sure at this point if I am missing something in the function or if I should dig deeper for an answer. Would appreciate any hints and clues

In this shader tutorial, we add the finishing touches to our triplanar projection shader in Unreal 5 and Unity - including ensuring that the projection is flipped and rotated correctly, and that it doesn't invert on the backside of each projection. We also turn it into a material function in Unreal and a subgraph in Unity - so we can use it as...

▶ Play video
zenith hatch
#

Hii ! Am I working on a game for a game jam with a team that work with Unity but I've never used unity before.. I am modeling in maya and then sending everything to Unity. My workflow for thtis game is that I first draw a Texture on Photoshop then a mask to hid geometry I want to hide so I can stay very very low poly. However, I've noticed that the transparent part are not fully transparent in Unity (They are in Maya)and have kind of a white film on them), I know NOTHING about Unity so I'm having a really hard time figuring out the problem

hardy juniper
#

When a model is imported it often has a default material inside it (generated by unity), you want to replace the material on the model once created or specify a new material to use instead in the import settings to correct the default mat

lavish plank
#

Hello I couldn't manage to make it with shader graph nodes really I tried everything but it doesn't work can anyone help me please

vast quiver
#

does anyone have any resources or anything on how to make distance fog? I can't use the built in unity fog for what im doing

vast quiver
strange prairie
#

Can you add a post processing effect?

vast quiver
#

yeah i can do shaders and stuff, just no scripts

grizzled bolt
#

No idea what kind of shader stuff beat saber eats, but distance fog is fundamentally just blending to a color by depth

vast quiver
#

yeah im not great at shaders, so im trying to find a resource of some kind to learn how to make it

strange prairie
#

Might be helpful to start at part 1 and work your way up

vast quiver
#

thanks

grizzled bolt
#

Beat saber might not be able to use shader graph shaders
But hard to guess

strange prairie
#

Unity 2021 so should work

#

In any RP

vast quiver
#

im using 2019.4.28f

#

since i have to build for an older version of the game that some people still play on, which uses unity 2019

strange prairie
#

HLSL it is then

toxic peak
#

Hi, Ive run into a bit of a problem that seems to be reoccurring around the issue of HIDING WATER INSIDE THE BOATS.

The issue is simple - you have a plane of water, your boat sits in it up to the waterline - if you look inside the boat - it has water in it. How to exclude the water from a boat. My findings/Thoughts up to this point:

1**. Depth Mask** method of creating a 'boat-insides' shape and then removing water based on Camera Depth is the simplest method, works with Shader Graph, blah blah. PROBLEM - if your character descends below deck and his camera clips INSIDE the 'Mask' shape mesh - you will see the water pop out again. Not viable. This is what most guides suggest/use and I've never seen it used for big ships where you can descend to lower decks... because you CAN'T.

2. Stencils - using Stencil Buffer but with pretty much the same principle, excluding the shape of the boat from the water mesh. Ive gone through some posts in this discord and found exactly what I needed, a quick and short guide by @amber saffron , Which I shamelessly copied, and it worked! To the same extent as the DepthMask method did... If camera goes inside the EXCLUSION shape - stencil mask does not work and you see the water in the ship.

2.5 Using HDRP and its Water System with Exclusion - nope, it works the same as previous examples. Meaning it doesnt

3. Cutting out The Hole in the LITERAL MESH - I have no idea how viable/performant this can be, how will it even work, but the idea is to somehow literally modify the mesh of the water to cut the BOAT-SHAPED-HOLE in it where the boat mesh intercepts the water mesh. This kinda stuff is called Boolean Operations, Ive heard, and Ive done so in blender, so... maybe its possible? But I dont even know where to start.

I am kinda stumped and in need of HELP! HELP!!!! DOES ANYONE KNOW HOW TO SOLVE THIS????

grizzled bolt
toxic peak
grizzled bolt
#

That too only really needs to be accurate up close as well
If the water is going not accurately conforming to the hull of a distant boat or letting it flood entirely it may be impossible to tell from most typical points of view

#

Unless you also need it to work with a bird's eye point of view, in which case the camera is not going inside the boat and you could use the stencil instead

toxic peak
# toxic peak Hi, Ive run into a bit of a problem that seems to be reoccurring around the issu...

In the meantime, I think Ive found some kind of halfway solution. Dunno if itll work fully, but here it is:

  1. Thanks to @Remy for the stencil approach after all, it seems to work against other textures for some reason, so it can even be applied against a shadergraph material
  2. Thanks to Tom Weiland, the guy who's making a foken MULTIPLAYER game with boats. Yes, he's insane, and quite capable, it seems. On his blog https://tomweiland.net/making-a-game-016-removing-water-ships/ I read that you can actually flip the stencil-exclusion-shape's normals and it will do EXACTLY what its supposed to do
  3. Thanks to @grizzled bolt cause god daym, Tesselation for water is actually a great foken idea, I will definitely use it now, Jesus Christ

So if anyone bumps into this problem as I did - this is how it CAN work

In this update, I finally got around to removing the water inside the ships! Unfortunately, my computer's power supply broke shortly after that.

toxic peak
grizzled bolt
#

Probably makes it simpler if the water has to be concerned about displacing for only one boat at a time too
Seems likely the camera can't be under the surface and inside more than one boat at a time

toxic peak
#

For a singleplayer game DEFINITELY

toxic peak
# toxic peak In the meantime, I think Ive found some kind of halfway solution. Dunno if itll ...

Also, the stencil mesh should be made in such a way that it acts as a sort of 'film' over the insides of the boat. If the mesh is hidden inside the boat (i.e. the wall of the boat covers it up) - it will not cut out water. It must be juuuuuust barely smaller than the inner side of the hull - then it will work.
Oh damn, now that I think about it - oh god... If you have any object inside the hull - it will overwrite the stencil exclusion mask and therefore water will be drawn over it again. damnit.
Well... You can put all of the objects inside the hull on the stencil layer... That will probably cause some problems at some point. Hmmm

teal lynx
#

I have this glowy shader effect. How do I draw it as an additional pass instead of modifying the object itself?

ebon basin
#

HLSL you make another pass, otherwise submesh it if you just want a standalone render of it

#

but usually you can modify it once, branch out the logic, then include it at the end of the shader

ebon basin
#

Not sure what I'm looking at here, but if you've a separate mesh you're still depth testing even if you're drawing it later

teal lynx
#

This is the Render Objects rendererfeature, I set it under "PC_renderer"(I'm using URP)

teal lynx
#

My capsule is under the "vehicle" layer, but it's not showing anything...

ebon basin
#

If you're trying to do an outline silhouette idea, then usually what you do is scale up this submesh a bit so it doesn't z-fight

teal lynx
teal lynx
#

So there shouldn't be any z-fighting, no?

ebon basin
#

What's the idea of the render objects then? Why not just submesh/secondary mesh and displace it?

#

Unless you've some reason you need to modify drawing order/stencil/depth test outside of the shader

teal lynx
#

equivalent in the sense that they lead to the same results

ebon basin
#

Still doesn't answer the question, but if you care about drawcalls then you do HLSL and do a subpass

#

as for laggier, a few extra drawcalls isn't going to dramatically decrease the performance of your game

teal lynx
ebon basin
#

I just mean make another pass inside of the shader code, yeah

#

similarly how you'd do outlines

teal lynx
#

That's a good idea, but I would be rendering an opaque mesh(the original object) and a transparent mesh(the blue glow) in the same subshader

#

Can I have multiple subshaders in one shader...?

teal lynx
# teal lynx

Otherwise is there a way to work with the different queues/rendertypes?

ebon basin
#

You can specify different queue/blends on the second pass

teal lynx
#

oh you can? Awesome!

teal lynx
#

*at the start of the pass

ebon basin
#

Yeah, you handle it as another shader, nothing too special. I would suggest the submesh idea though just cause you can break up the shader a bit more

#

Problem with muti-passes is you're kinda developing it for this specific shader, so it's not something you can slap on to another object that easily.

teal lynx
#

I'm not sure what you mean by the submesh idea. Do you mean that I clone the mesh under a child object but give it a different material?

ebon basin
#

If it's a single mesh and you add another material to it, it'll duplicate the rendering with that material setting

teal lynx
#

wait I didn't know you could add multiple materials

#

well now I feel very stupid awkwardsweat

#

...
Well thank you for listening to my useless rambling for 30 minutes 😭
@ebon basin

ebon basin
#

The render object idea is fine too honestly if you want to control it all at a higher level

teal lynx
ebon basin
#

but say you did have a mesh with multiple submeshes already, you don't want to be applying this outline shader to each submesh, so then you would probably use some full-screen shader instead

#

which then URP render features become useful

teal lynx
#

Could you explain to me what you mean about submeshes?

#

Objects only seem to have a single mesh.

ebon basin
#

If say you made a spaceship in blender and chopped it into 50 parts

#

that's 50 materials

#

Or ideally you make a invisible mesh like you're doing and apply it around the ship

teal lynx
#

kk

teal lynx
#

Does unity URP offer geometry shaders?

#

I was going to follow a geometry shader guide under a video and I saw this ominous message(it's from 2020. I'm using a mac)

teal lynx
#

turns out theyre dead

vast talon
#

Could someone help me find/make an overlay shader that reduces the quality of the screen (to look like pixel art) and applies the Pixel Scaler effect to it?
Any help would be greatly appreciated, thanks!

https://m.youtube.com/watch?v=QDExYoI4qu0

There’s a new pixel art filter tool that’s been going around lately; PiXel Scaler - let’s take a look!
PiXel ScAler: https://irokaru.github.io/pixel-scaler/
IroKaru (Twitter): https://twitter.com/IroKaru

#ぴくせるすけゐらぁ #PiXelScAler

————

0:00 What is PiXel ScAler?
0:26 How Does PiXel ScAler work?
1:47 Artwork Examp...

▶ Play video
strange prairie
#

I'd also generally look for a fallback option since with mesh shaders you're dropping support for a bunch of GPUs that could still run your game perfectly well otherwise...

hard nacelle
#

Its basicly a shader that animate a few textures based on world space and uv from a tilemap (the tilemap is basicly only uv coordinates) and it also gets a sdf texture as input that is calculated at runtime

#

The texure is set corretly so thats not the problem (the red in this gradient is the sdf for water)

#

But for some reason it most often doesnt show before i turn it on and of or changes a material, when I try to do the same in code howerver it doesnt seem to work

#

and it randomly ends up behind other objects

languid radish
#

in unity urp i'm making a shader in the shader graph to have a shadow on a character. however now the sprite doesn't flip anymore when flip X is triggered.

i thought it had something to do with UV, however i can't find any option that can help (or proper documentation about this problem)

hard nacelle
languid radish
prime coyote
#

Heya yall, when using a depth pass how do I make it so it doesnt cause artefacts on objects infront of it

#

In the context of water foaming

#

im basically trying to make a water foaming effect rn in a game

strange prairie
#

Why would it cause artifacts on objects in front of it?

prime coyote
#

but when having the player character

#

It causes these white artefacts of the depth picking it up

#

it's less noticable on higher resolutions but causes fighting on low resolutions

#

would anyone know if there's a solution for this?

strange prairie
#

Can you show the problem more clearly?

prime coyote
#

when not over water the outline has no white artefacts

#

Apart from the characer's white eyes

#

I'm using this kind of depth pass to render the foam around the shores of the water

#

but it seems to be picking up behind the horse and creating white pixels that fight over the edge of the horse

#

It's also being passed through this to step it and color it, and alter stuff

#

The last multiply is just a distance calculation making the foam invisible from certain distances

languid radish
ebon basin
prime coyote
#

Trust me haha, I've tried negotiating not doing the foam due to its issues

ebon basin
#

It's obviously some blending issue because you're working with depth, but both these objects are transparents

#

I was going to say just always draw the horse on top of the water, but then I'm not too sure how to handle the blending then

prime coyote
#

the water isnt transparent actually, it's an opaque plane rendered on the transparents layer at 3000

strange prairie
#

Is the foam just the edge foam or are you rendering the pattern in the shader too?

prime coyote
#

It's basically edge foam with a bit of noise on it

strange prairie
#

Shouldn't be necessary to have the water opaque then

#

Since you know the depth of what you're currently sampling even without writing it to the depth buffer

prime coyote
#

Is there another way to make the edge foam without a depth pass?

strange prairie
#

Not in Unity. Unreal has a much nicer way of doing this with SDF

ebon basin
#

I'd just alpha clip it and go on with my day

strange prairie
#

But as I was saying - the water does not need to be written to the depth buffer for you to sample its depth while you're rendering the water

prime coyote
ebon basin
#

opaque sprite

strange prairie
#

The fragment knows its own position

prime coyote
#

Ok so how can I achieve this

ebon basin
#

Using spriterender? You need to make your own shader for it and alpha cut it

prime coyote
#

Can you show me a visual example on how this could be achieved with the foam?

#

im having trouble understanding

ebon basin
#

Your horse, it's transparent. The problem is your softedges seem to have problems blending with the water so my idea is make the horse opaque and trim the soft edges

prime coyote
#

It's already opaque

ebon basin
prime coyote
#

The line-art is a seperate fullscreen shader that's seperate to the horse

#

that is transparent, but however the horse is opaque and when removing the line-art the horse still has artefacts the exact same way

grand jolt
#

Hi, does anyone know of a basic PBR HLSL shader for UPR that is public?

warm pulsar
#

I've encoded a tangent-space displacement into UV2. I convert it back into object space and apply it in the vertex stage. It's basically a blendshape.

I noticed that, when on a SkinnedMeshRenderer, scaling the entire prefab up and down doesn't change the length of the resulting vector.

Is there any way I can recover that factor in the shader, or will I need to pass it in as a property?

warm pulsar
toxic peak
# toxic peak Also, the stencil mesh should be made in such a way that it acts as a sort of 'f...

Following my prior sufferings:
I've managed to ACTUALLY get a bloody marvelous water cutout technique for the situations when you need to nor render WATER inside of the BOAT. I've tried:

  1. Depthmask - easy, but will not work if camera goes below deck
  2. Stencil cover - a bit harder than depthmask but gives pretty much the same result. Also can't be used with shader graph but CAN be used with Renderer features
  3. Stencil coating - a bit harder still. Basically you assign any material that exists inside the hull to the layer that is drawn over water layer. It is quite a weird hack and I abandoned it early because I suspect there will be a lot of problems with it. Also, cannot predict whether I'd have to use other layers for stuff inside the boat.

4. WINNER: SDF CUTOUT - Using things called SIGNED DISTANCE FIELDS to pass an approximation of the boat's shape into shadergraph and then compare the water plane vertices' positions against it. It was QUITE A BEECH to set up, making the 'hole' be of the correct scale and follow boat's position/rotation in the world was very unintuitive.
The con of this method is that you can pretty much have this work only for one boat... well... I mean you can pass data for any number of boats, but Ive no idea how to scale it dynamically.

???. I will maybe try displacing vertices below the boat shape like AC Black Flag did, but Im not sure about that.

If anyone runs into this issue and wants to be pointed in the right direction - I can share some thoughts, but rn its all such a mess - I can't make a legit guide out of it.

tacit parcel
jolly adder
#

Hey,
I've made a custom grass shader and I just noticed it is pink on OpenGLES3 but it works on Vulkan on android devices.
How can debug the issue ? Or what could be the problem ?

strange prairie
low lichen
jolly adder
#

Could be because of this warning ?
Shader 'Hidden/FoliageRenderer/AlbedoGen' uses 40 texture parameters, more than the 32 supported by the current graphics device.

jolly adder
# low lichen Yes

Because I retrieve TerrainAlbedo texture in one of my nodes ? Do you know how I can fix that if I want to use that texture ?

low lichen
jolly adder
jolly adder
low lichen
#

The device you're testing on supports a maximum of 32 texture properties in one shader. If the shader already has 32 textures and you're trying to add more, you can't.

runic oxide
#

Hey I made an shader for my UI pause menu. It should move but it just refuses to do so... Has anyone encountered the same problem per chance?

#

This is what I use for the movement in the shader (which works on objects etc but not on the UI)

#

This is the script that tells UnscaledTime what to do

#

This is a little video showcasing it works in the background on a sphere. But not on the dark slashes in de UI

runic oxide
#

If I keep on pressing ctrl+S compiling the shader, it also applies the new uv position to the ui

#

just doesnt do it normally

stone dagger
#

I'm very new to shaders, and recently followed a shader tutorial. When I apply it, I notice that I don't get shadows on the opposite side of the object from where the light is shining.

How would I apply this?

warm pulsar
#

or maybe it's a shader graph?

#

If every side of the object is getting lit by a light, that suggests that you aren't checking if the surface faces towards the light

stone dagger
#

Can I share it in a way which is not a huge image?

#

JSON or similar?

warm pulsar
#

oops, I just realized I'm in the Unity discord, not the VRChat discord :p

#

You could just share the graph asset

stone dagger
#

But i can't send files here right?

#

Guess I can upload it somewhere

warm pulsar
#

If it's an unlit shader, you'll need to be getting information about lights and doing all of the lighting calculations on your own

stone dagger
#

its just, I'm so awful at shaders, but trying to find a specific artstyle. The only thing left is the shadows not occuring on any object that has the material shader

warm pulsar
#

it's in the name :p

stone dagger
#

so, if this was copied over to a lit shader, would it work?

#

I'm not aware of the differences for URP

warm pulsar
#

a lit shader graph wouldn't have that logic in it either

#

you just tell unity what color the material is, how shiny it should be, etc.

#

All of the actual lighting calculations are done outside of the graph

stone dagger
#

hm. If it helps, I'm trying to get a cel shader effect. And I do get it, except the shadows that is

warm pulsar
#

I have a lot of experience hand-writing shaders for the BiRP now, but I do not know as much about URP or HDRP right now

stone dagger
#

alright, not really sure what to do then. Sad that no cel shader is as a asset on the unity store - I'd get it immediately

#

thanks anyways!

warm pulsar
#

I dunno if it's still being developed

#

i experimented with it a while ago

ebon basin
#

Is lit not good enough for cel-shading?

#

whatcha need vertex lighting?

#

Unity's toon shader is fine too, abit bloated though

warm pulsar
#

I vaguely remember seeing someone create graph nodes that let you access things like light direction

ebon basin
#

yeah cyans doing thjere

warm pulsar
#

ah yeah, and its Toon example uses the Unlit graph type

#

which makes sense: you're directly telling Unity what color each pixel should be

#

It looks like this only supports Forward+ if you want to support more than just a main (directional?) light

#

in BiRP with forward rendering, each extra light is rendered in a separate Add Pass

#

i don't believe you could express that kind of thing in the shader graph

grizzled bolt
#

Really sucks there isn't a "custom lit" graph type that exposes the lighting calculations as nodes
Would make modifications trivial even without full understanding

hardy mountain
warm pulsar
#

I’ve been in the BiRP trenches for quite a while now while working on VRChat avatars

#

It feels weird to not have a way to write my own lighting functions

#

(even surface shaders let you do that!)

hardy mountain
#

oh nvm got it

#

smth like this

warm pulsar
#

It gives you a shader you can assign to your materials

quaint grotto
#

suppose you mask a hole in a wall with stencil so you can see through the wall - how do you get it to support lighting so the light will go through the hole ? would i have no choice but to alter the mesh geometry ?

#

or is there a clever solution around it

kind juniper
# quaint grotto suppose you mask a hole in a wall with stencil so you can see through the wall -...

Assuming we're talking about deferred rendering, If the hole renders to the stencil before the wall itself(so if it is right before the wall in the queue and assuming stencil is written during the depth pass), you could modify the depth pass of the wall to check the stencil in the depth pass. This way the depth buffer would have a hole in it as well, so the light calculations would naturally lit the objects that are seen through.
This would also need to happen in the same order for the lightmaps rendering.

Now, how to do it in unity is a different question. If you're lucky, all the things that I mentioned as I explained or are possible with minimal configuration. If not, it might not be possible without modifying the render pipeline.

quaint grotto
#

well, if it is potentially possible i shall do some research in to it for urp

pseudo ravine
#

Anyone got any resources for ortographic camera water shaders ? Im having issue with the depth calculations

ebon basin
warm pulsar
#

notably, depth in an orthographic camera is linear

#

rather than having a 1/x curve

#

so you can reconstruct a world space depth by just lerping between the near and far clip planes

weary veldt
#

Can anyone help and explain to my why the rightmost orb is black at the top and not dark brown ?

Nevermind, figured it out. My monochrome part came from a divide and was bigger than 1 at the top part. Using a Clamp node fixed the issue

regal stag
#

Using a Saturate node on the Divide output(s) would clamp the values between 0-1

weary veldt
weary veldt
regal stag
#

If clamping between 0-1 yes, Saturate should be more performant. Though after compiling it might end up the same anyway

weary veldt
# regal stag If clamping between 0-1 yes, Saturate should be more performant. Though after co...

thanks for the insight. Will use Saturate. I jsut build a shader last night thats a giant mess and after looking at it this morning i figured there might be an easier way ...

And since i have you here right now, i am a bit stumped on how to do this:
There is an area where my color smears into each other, i mean the gradiant part in the middle, i would like to add a noise to it so its not a clear edge anymore, but i have no clue how to do this, i am certain its super simple i am just not seeing it.

regal stag
weary veldt
regal stag
weary veldt
hasty lagoon
#

hey trying to make a shader here but its generating much brighter than it should be and without the noicse

#

im stupid I forgot to save

stray orbit
#

Hello, i am trying to pass the UNITY_MATRIX_I_P and UNITY_MATRIX_P myself to a shader.
I want to do this so i can assure the matrices are not affected by TAA.
When i passcameraData.camera.projectionMatrix or cameraData.camera.projectionMatrix.inverse i do not seem to get the correct result.

Is there anything i am forgetting? this is a full screen shader with render graph.

regal stag
stray orbit
#

that seems to give a better result already but it's not correct yet, maybe i am using the wrong matrix.
Yeah, i changed that already, cameraData.camera.nonJitteredProjectionMatrix.inverse;

#

ok i almost got it

#

cameraData.GetGPUProjectionMatrixNoJitter(0);

This one seems to be correct

#

but i am getting a different error now

#
You can only call cameraColorTargetHandle inside the scope of a ScriptableRenderPass. Otherwise the pipeline camera target texture might have not been created or might have already been disposed.
UnityEngine.Rendering.Universal.UniversalCameraData:GetGPUProjectionMatrixNoJitter (int)
dapper heath
#

heya, I had a bit of a newbie question in relation to texture packing-
I have a pretty simple terrain system and I'm trying to implement frozen/burning/cut grass/etc. states in the form of a grid. that's all working and fine, but the part I'm struggling with wrapping my head around is making this extensible to 4+ states. atm it renders distances to grid cells into a custom render texture that's then passed to the grass + terrain shaders for rendering

my thought is that I could make the CRT a RGBA16 Float format texture, then store extra information in R0-1, R1-2, R2-3, etc. rather than packing and using a second or third texture. but then I'd need to do comparisons & branching in the shader to check "is red > 1, is red > 2, etc." which seems inefficient. then again, so does passing 3-4 textures to shaders and doing a ton of checks there anyway. do any of you guys have experience/tips for something like this?

#

another idea I had is to store the cell type index (fire = 0.1, frozen = 0.2, charred = 0.3, etc.) in the alpha channel, then use that to inform what to do with the rgb channels. still not sure though

lapis cedar
#

hey, could someone help me with this problem? I would like to make the spell indicator render above the map mesh, I've already tried using sorting layers and even a custom shader, I'm using the Image component but I've tried with Sprite renderer too, the result is the same

hardy juniper
#

Or you want a shader that draws very late and ignores depth

#

layers affect draw order too but if it still tests depth it wont work

fallow geode
#

Does anyone know an easy way to fix a prefeb I imported that is rendering in pink? If I change the shader to use standard instead of URP I can see what it's suppose to look like but not when I set the shader to URP -> LIT it goes back to pink

kind juniper
fallow geode
#

I'm using unity 6, URP 3d but maybe the assets I used were using the old pipeline. I'm not the best at this stuff but maybe there's something I can do to convert the assets to be compatible with urp

kind juniper
#

Not urp

fallow geode
#

Maybe when I imported the assets it automatically switched which pipeline I was using

#

Since I've never manually changed it in setting

kind juniper
#

Never heard of something like that. Make sure your project is configured to use urp and it should work.

fallow geode
#

Will get another chance to look at it tomorrow, thank you for your support on this

brisk escarp
#

Hello, i would like to ask how to implement height maps in the shader graph🙌🏻. Im using some textures but idk how to implement the height map

daring cobalt
#

Hi, i am using unity's toon shader 0.10.2 version. And i want the objects to cast shadows to the table. I tried to play with settings but i dont really know much about shaders. Here is the table's material settings.

daring cobalt
main isle
languid radish
main isle
#

Are you talking about any light other than directional?

main isle
regal stag
#

Easiest way would probably be to manually create a mesh of the river but UV map it straight so the scrolling just follows that geometry.
Could also look into the flowmap technique which could let a texture or vertex colours control the direction the texture flows in.

languid radish
#

when i'm back at work i need to take another look. the main goal was to add shadows, so maybe i'm missing something

main isle
#

lol, trying to position the sprite to receive all light types at once as well as a shadow from another sprite
(while demoing that I can flip the sprite now thanks to you 😄 )

languid radish
main isle
#

The material is the default, new material.
Then I had to enable Debug view in the Inspector on objects that have the Sprite Renderer with the material and check Receive Shadows and set Cast Shadows - On. I'm trying to remeber if I did anything in the URP settings, but I don't think so

teal igloo
#

how do i make elipse repeat?

#

also how can i make the black background invisible?

regal stag
regal stag
teal igloo
#

and i want that line to be inside of the elipse , why i need 2 is because im trying to mimic something like eyes

#

idk how i could explain it visually but i think i could find something

#

okay i seem to cant find anything on the internet 😭

#

something like this im guessing

regal stag
# teal igloo

Probably not easy to do that procedurally. Easiest way would be to draw a texture similar to a flipbook (typically used for animated textures, but each frame could be completely different if you want)
In graph that would just use the Flipbook node with Tile port based on Time. Put into UV port on Sample Texture 2D

teal igloo
#

never tried the flipbook node before, hope diving in with no doc would be succesfull xD

teal igloo
#

never mind, i think this looks fine for me

#

and it imitates something similar

karmic hatch
# teal igloo

Might be able to do something like this with Lissajous curves or by looping around with slowly-varying eccentricity, radius, and offset

#

though would be difficult to translate into shader...

fair vessel
#

Hello there lads, I tried to make AoE indicator shader, but... shaders so far are magic to me 😅
What I want:

  1. Highlight intersections of other objects that are inside of my mesh with my shader with color
  2. Highlight borders of intersections with color
  3. Shader should work on cubes, spheres, cylinders and cones
  4. Objects with same material should merge
  5. Highlight should be scalable with object

So far I managed to do highlight, but works only for spheres, but at least it can scale with objects somehow.

Any help and advice is welcome! :)

ebon basin
#

Not a bad idea, but you could always just use decals too ;)

robust acorn
#

Does anyone know why a shader will look incorrect when applied to a sprite, but if I modify literally any value on the SpriteRenderer via the editor, it will refresh and the shader looks correct?

#

I'm assuming the shader/material is doing some sort of caching which results in the incorrect look, and modifying the game object causes it to force redraw. But I'm having trouble figuring out how to force a redrew at runtime

quaint grotto
#

how large can 2D texture arrays be ? i was going to use a texture atlas but i need to be able to add/remove with modding so im thinking texture array is better option i can compile them far more easily when loading textures

#

there must be an upper limit to how many it can store right?

hollow fractal
#

Im making a color replacement shader.
this feels pretty inefficient, but I dont really know GPU efficiency all that well.

This is just for the eyes, but I have 12 other colors to replace as well.

Do I really have to do all of this to safely replace the colors?

Color Mask -> Invert B to W -> Replace W with new Color -> Add to new Texture.

#

it works really well, it just looks like "a lot" lol

inner plover
#

Hey, does anyone know why my water shader is in a grid like pattern in URP? Haven't been able to figure it out. I have a Vector2 (WindDirection) which controls the direction of the waves, but they seem to move in a grid instead of a wave.

low lichen
stray gorge
#

my shader gets weird when i tilling the texture too much, how can i fix it ? Applied no mipmap, filter mode = none in texture import setting

low lichen
#

For the best quality in this scenario, you want mip maps enabled, trilinear filtering and anisotropic filtering set to something high.

stray gorge
low lichen
#

Do you have trilinear filtering on there? That gets rid of the bands that I'm seeing in this screenshot.

humble geyser
final helm
#

Hello, there's currently no way of using stencils in ShaderGraph in URP right? 😁

manic niche
#

any good way of getting a per object random number inside a shader that isnt derived from the objects transform?

ebon basin
#

Hmm, maybe not possible with the custom HLSL block idea. You can create functions, but usually the stencil stuff lives in the header space

floral arch
#

alr

slate compass
floral arch
#

i also have a better reference image

#

u see the glow on the item

slate compass
#

ahjh okay i see now

#

a pixelated glow

floral arch
#

im trying to do smth similar

#

well thats not the part that matters cuz i can do that with my shaders

slate compass
#

to be honest.. u could probably just use a flat 2D image.. w/ a gradient edge..

#

and let the PSX shader ur already using pixelate it

floral arch
#

ye

slate compass
#

position it over the object and drop the opacity a bit

floral arch
#

thats what i was thinking i just dont know how to apply an image to the object

slate compass
#

a 3D Canvas object

#

and a sprite

floral arch
#

3d canvas?

#

sec

molten geode
slate compass
floral arch
#

like as a child

slate compass
#

it would be a prefab.. or u could put it on the gameobject

#

i would just position it where the gameobject is

floral arch
#

yea how would i put it on the gameobject?

#

like constantly

#

sec

#

ima tryto figure it out

slate compass
#

and then 2. it would rotate to align itself to the camera

#

so its always facing the camera

floral arch
stone mantle
#

hey so i just learned about MaterialPropertyBlock and it seems to be really good and I can't really find any proper downsides to it, im just wondering if its a thing that's too good to be true because that's kinda how it feels, I saw a reddit post that mentioned it is bad for HDRP, which is what my project is using, but no explanation as to why they say that

floral arch
#

acc theres an easy way

#

if it doesnt work

slate compass
#

so u can probably not worry abotu the pixelation and all that

#

and use regular stuff

floral arch
#

yeah, im trying it rn

slate compass
#

wait better yet, its more refined if u actually draw it between the camera and the target..

#

so its always between u and the object ur lookin at

floral arch
#

i very much see

#

also why make your player model blue?

#

just curious

slate compass
#

no reason really

#

to make my screen-grabs pretty? ¯_(ツ)_/¯

floral arch
#

ah

slate compass
#

you don't actually see them..

floral arch
#

yea ik lol

slate compass
#

they're only rendered in scene-view

floral arch
#

i was just curius

#

i jsut forgot

#

how to spell curious

slate compass
#

b/c Colors make the world better

floral arch
#

for a second

floral arch
#

😭

slate compass
#

lol.. it depends..

#

i also like Blacks and grays

slate compass
#

creepy. horror vibes

floral arch
#

you know why ie ven made it like that

slate compass
#

jumpscares?

floral arch
#

theres a game called IMSCARED on steam it basically the exact same theme

#

and i took huge inspo from it

#

even tho that game uses 2.5d

#

its

#

ok

slate compass
floral arch
#

lowkey im kinda stuck

slate compass
#

you'll get told that by someone else anyway

floral arch
#

can u help me continue with gameplay ideas?

#

i can tell u what ive made so far

slate compass
ebon basin
#

but it's still probably useful for things which don't use the SRP batcher

stone mantle
ebon basin
#

SRP batcher should be on by default for URP/HDRP but you can check the pipeline asset to see if it's toggled. As for changing material properties, really you're not expected to work too hard to get things to batch which was a large feature of this 'newer' pipeline.