#archived-shaders

1 messages ยท Page 34 of 1

lunar valley
#

but yes you can

grizzled bolt
#

I think compute shaders are specifically intended for that kind of purpose

low lichen
#

You can also use Blit for this.

reef osprey
#

I just got the shader from a big popular sprite shader store-package, I don't actually know what it uses to work.

burnt juniper
#

I'm new to Unity. Why's my shader graph material pink?

grizzled bolt
burnt juniper
#

How do I know if URP is misconfigured?

#

Or how do I know I have an invalid graph target?

grizzled bolt
gusty marten
#

Hey folks! I have a question on how I can store an attribute on mesh in maya and use it in shader as a mask?

grizzled bolt
gusty marten
#

I don't want to use textures but I vertex colors work. How do I set them up? I have no idea where to begin

grand jolt
#

Hello Everyone i have a texture that i want to apply to all my walls. But the tilling needs to be different on each wall how do i go about that? I tried looking online but most of the post were over a decade old

strange basalt
#

most materials expose tiling and offset controls

#

also can control that in the models themselfs when creating them with UV's

grand jolt
#

Yeah i tried messing with the Tilling offset on a specific wall but that changed all the walls at once

#

I figured i have to go the UV route

lunar valley
grand jolt
#

They do have the same material

#

I ended up just make a script that changes the tilling

#

Idk if thats best practice tho

lunar valley
grand jolt
#

Yeah that makes sense

#

I wanted to know if i can just the specitic material props on specific walls if they have the same material

#

It seems weird to have to make a material for each wall

grand jolt
#

Yeah which is insane to me

#

The script ended up working so i wasnt too stressed about. I appreciate u talking to me tho friend best of luck to u on ur game dev journeyUnityChanClever

strange basalt
#

the script is working since its creating a new material instance per object and modifying it

grand jolt
#

that sounds bad for performance....also i ended up just making the thing i didnt want to in the first place lmao

#

i was trying to avoid making multiple materials and ended up doing that anyway lmao

#

F@)# i thought i had it figured out

#

Oh i see it in the inspector now.... It says Texture (Instance)

#

Ill do some research on the instance part

strange basalt
#

accessing .material creates a instance

#

.sharedMaterial uses the existing mateiral asset

#

other way of doing it per object but not creating new material instances would be modifying the mesh data and adjusting the UV's there

grand jolt
#

How would i be able to access the mesh data in unity tho? Im sorry i dont mean to ask alot of questions but im not super familiar with UVs

lunar valley
grand jolt
#

Aaahhh i see

zealous thicket
#

in a shader graph, is there a way for it to grab data from somewhere in code? like, for example, an array that represents squares for paths to be placed. can a shader on a terrain grab that data from the script somehow?

grand jolt
#

Gonna figure out the difference between Mesh and Mesh Filter ill look at the documentation and come back if i need anything thank u both so much

lunar valley
zealous thicket
#

how would I start to do that? I'm still new to shader graph

lunar valley
zealous thicket
#

in this case I worry I'd have to make like 4 million floats to represent the array of size I want

#

my array is 500x500 atm so not quite 4 million but still

#

unless there's a data type in a shader that an array can map to?

lunar valley
zealous thicket
#

hmmm

#

maybe there's a better way of storing that data, then

#

I am trying to make it so that the player can place paths on a grid, and the shader respects the paths placed and draws the appropriate texture

#

so my first inclination was "make an array the size of the terrain size" and have the shader read the array values and sub out the texture I need

#

but if there's a better way I'm all ears

lunar valley
zealous thicket
#

mostly because I am using a shader to do the rest of the texturing

lunar valley
zealous thicket
#

what does "do that on the cpu" mean in this context?

#

sorry, I'm a little out of my depth here. do you mean just apply the texture using standard terrain stuff and forget the shader?

lunar valley
#

like a 2D grid

zealous thicket
#

well, sorta - the paths are on a 2d grid because its a top-down game and storing that info in a non-overlapping way means a 2d array of ints where the values represent predefined paths and 0 represents no paths

#

the terrain itself is sculpted during my terrain generation, a shader handles the texturing, and then I wanted to be able to walk around in-game, place paths, and see them visually show up, yanno?

#

so my thinking was there might be a way to translate the array of paths to some sort of data the terrain shader could read, I could grab the rounded x/y of the world pos, associate that with the path index, then display the texture that fits

#

but it seems like shaders might not handle that kind of data well? I dunno. not really my area of expertise

lunar valley
zealous thicket
#

what does "on the cpu" mean?

#

ohhhh

lunar valley
#

c#

zealous thicket
#

that's an unconventional route, I like it!

#

ah, hmm, but how would the shader know which texture to grab?

#

like, I translate my array of ints to an array of textures. how does the shader know which texture cell to read from?

lunar valley
zealous thicket
#

how does the shader know where to place them?

#

the shader handles my other textures by reading data from the world position - angles to do cliff textures, heights to do grass vs sand, etc

#

I'm not sure how to get the data I'm looking for in a place where the shader can read from it

lunar valley
#

actually

zealous thicket
#

like, to be clear, if this is literally impossible for a shader to do, that's also an answer, I'll figure out another way of handling this

lunar valley
#

to me it sounds like you are making some sort off texture painting tool.

zealous thicket
#

yeah! sorta!

lunar valley
#

well thats a thing you can research about now, how people do these tools, cause they can be quit specific on their own

ember scaffold
#

Lmfao just looked up a tutorial and made one from scratch

#

Is there a way to add shadows from multiple lights?

sharp hinge
#

Hello, could someone help me converting it to URP?

// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'



Shader "Hidden/SegmentationShader" {

    Properties {
        _MainTex ("", 2D) = "white" {}
        _CutOff ("", Float) = 0.3
        _ObjectColor("", Color) = (0, 0, 0, 1)
    }

    CGINCLUDE

    #include "UnityCG.cginc"

    uniform fixed4 _ObjectColor;
    uniform sampler2D _MainTex;
    uniform float4 _MainTex_ST;
    uniform fixed _Cutoff;

    struct input{
        float4 vertex : POSITION;
        float4 texcoord : TEXCOORD0;
    };

    struct v2f {
        float4 pos : SV_POSITION;
        float2 uv : TEXCOORD0;
    };

    v2f vert( input v ) {
        v2f o;
        o.pos = UnityObjectToClipPos(v.vertex);
        o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
        return o;
    }

    fixed4 frag(v2f i) : SV_Target {
        fixed4 tex = tex2D( _MainTex, i.uv);
        if(tex.a < _Cutoff)
            discard;
            
        clip( tex.a - _Cutoff );
        return _ObjectColor;
    }

    ENDCG

    SubShader{
        Tags { }
        Pass {

            CGPROGRAM
            #pragma target 3.0
            #pragma vertex vert
            #pragma fragment frag

            ENDCG
        }
    }

    FallBack "Hidden/InternalErrorShader"
}
gloomy tendon
#

Hi in a shader graph can you not modify the UV in the vertex shader part, only in the fragment (per pixel?) part? Or does it work differently to that?

amber saffron
amber saffron
gloomy tendon
amber saffron
gloomy tendon
#

ok ๐Ÿ‘

stray rune
#

guys anyway to reverse this?
i want white part is black part and so on

lunar valley
stray rune
#

thanks

grand jolt
#

Hi all, here I have the texture I read to get access to the first 4 layers of HDRP terrain, I was wondering if they ever added a second control texture for the last 4? it would be great to be able to modify all 8 layers in HDRP...

stray rune
#

guys how to combine 2 this?

grand jolt
grand jolt
stray rune
grand jolt
stray rune
#

but how?

#

im new at this

grand jolt
stray rune
#

alright

#

not work xd

regal stag
stray rune
#

oh wait

grand jolt
stray rune
#

i forgot

grand jolt
stray rune
#

XD

#

not what i wanted xd

grand jolt
#

what texture are you rendering?

I might be getting confused when you say render texture, are you rendering the scope view?

stray rune
#

ah yes

#

sniper scope

#

im not using second camera to render

grand jolt
#

are you trying to render to this

#

or that

stray rune
#

with OneMinus XD

grand jolt
#

yeah, delete one minus

#

use that

stray rune
#

but it will became this

grand jolt
#

yes, that's where you render your scope

#

your camera

stray rune
#

no that look a like a dot

#

wait a bit i will capture something

grand jolt
#

ok

#

also i think you may have your size wrong somehow, as it seems offset to the left a little but im not sure if thats the camera angle your looking at it from

stray rune
#

oh you may right

#

still xd

grand jolt
stray rune
#

lemme try

grand jolt
#

im AFK anyway, good luck

stray rune
#

thank you anyway

grand jolt
#

thanks @amber saffron , about to check it out ๐Ÿ™‚

stray rune
#

unfortunately xd

prisma haven
#

Hello, i'm trying to figure out how to make a sprite outline be visible only on UI layer and excluded from other layers
Does anyone know how can i achieve that?
I was considering using SpriteMask, but it doesn't work on UI

  • I have an outline shader that is used for a material attached to a sprite renderer
  • Outline shader is "sprite unlit", switching it to "unlit" draws the sprite and outline on top of UI, which is not really what i'm trying to achieve;
    Should i make a separate sprite with that material (which theoretically should make it similar to a silhouette, which is nice too)?
  • Canvas render mode is "screen space - camera"
  • I'm using URP
scarlet crater
#

how could i make a grid of repeatable UV cells that can be translated around as a whole?
im attempting to recreate this pattern where the "pixel" is shifted up every other row

#

I've got it worked out but since im using the fractional component of the UV coords, it doesn't actually translate up properly, instead it just cuts it off where it wraps from 1 to 0

amber saffron
scarlet crater
#

That's what I'm doing

#

Unless I'm misunderstanding

amber saffron
#

Yeah, sorry, I've written before reading your code ๐Ÿ˜…

scarlet crater
#

Haha no worries, I appreciate you stopping to help either way

amber saffron
#

Ah, issue is : apply the offset BEFORE the fractional part calculation

scarlet crater
#

well that was simple ๐Ÿคฆ

#

Thanks so much

amber saffron
#

Need to also offset the display texture UVs ๐Ÿ™‚

scarlet crater
#

for this particular effect, i dont think i have to

I was basing the effect off what i learned from this video:
https://youtu.be/dX649lnKAU0?t=580

In this video we explore how we added color to everyone's favorite passive entertainment medium. Modern color broadcasting began in 1954 after years of experimentation, and this video will teach you the early history.

Technology Connections is a YouTube channel dedicated to exploring the history of technological innovation. You can support th...

โ–ถ Play video
#

i think if i were to replicate a more modern LCD display, i would have to "pixelate" the input texture

#

i may be totally wrong though

amber saffron
#

It's more that in you screenshot we can clearly see that some sub pixels are half illuminated, which doesn't make sense ?

lunar valley
prisma haven
#

i'm not sure how to do that
do i need to attach it to UI image?

prisma haven
sour grove
#

hola fellow coderz, i have a shader issue with my water plane. im using RGB to do vertex position displacement but the old format used G in RGB to connect to the input of the Combine but then i read it was swapped to B (blue) in the Y axis. when i have it in G the water plane appears but has no displacement. when i use blue the plane goes all scrunched up and flat. cant figure it out. can provide screenshots of my shadergraph if necessary

lunar valley
sour grove
#

Sure but the combine node has an output of RGB and it is not clear as to which is XYZ ๐Ÿ™

#

I'll grab a screen in a min

#

((Its shadergraph))

lunar valley
sour grove
#

Right that makes sense

#

Back in a short while with the ss

tranquil wolf
#

Hello, I am trying to follow this tutorial for creating grass: https://youtu.be/wbEn3PqX80c

However, when I go to paint, the tool seems to be selected on my player object and does not want to paint on the terrain. Any ideas? I have tried googling and couldn't find anything

#

it's like this

untold hazel
#

Is there some form of URP Shadergraph texture to get the Exposure of the Camera? I am trying to convert an HDRP Post Process over to URP and I need an Exposure node that doesn't exist.

autumn sigil
#

Hey, anyone know how to access the Volume and Slice and SDF features of a 3D texture in Shader Graph?

#

Is there actually a way?

chilly lava
#

Hi! I made a small water shader but when testing on my mobile phone the game is running in like 3fps when looking at water

tranquil wolf
regal stag
# autumn sigil Hey, anyone know how to access the Volume and Slice and SDF features of a 3D tex...

I assume you're referring to the visualisation modes for Texture3D assets in the inspector. You'd need to look up "raymarching" or "volumetric raymarching" techniques to replicate the SDF and Volume ones. You'd need to use Custom Function nodes to achieve those in shader graph as it requires a loop.
As for the Slice one, that's probably just 3 quad meshes, sampling with swizzled uvs & slice position passed in via property.

regal stag
autumn sigil
chilly lava
#

@regal stag It's better now, can i do other improvements?

grand jolt
sour grove
#

anybody have this problem before? i just want the water to be displaced so it wibbly wobbles

#

if i switch the out to B it has displacement but its squished, if i switch it to G it will display a flat plane but no displacement. cant figure it out

regal stag
grand jolt
#

hmm, odd, no dice

regal stag
# sour grove here is my shadergraph and the result im getting

Which axis you want would depend on the orientation of the plane mesh data - but usually Y/G is up.
Since you're doing displacement in object space, maybe check the scale of the plane object too as that would also be taken into account. Make sure the Y scale isn't set to 0 or something.

blissful marlin
#

any idea how I can add a custom float out on a shadergraph? or would I need to do a regular hlsl shader for that functionality

regal stag
blissful marlin
#

I have a script that flips a bool controlling which sprite sheet is playing, and I'd like to have the script know the index so the bool can only be swapped when the sprite index is currently 0

#

the sprite sheet is flipped as a function of time
ie if I had a getFloat("currentIndex") then it would be trivial to handle

regal stag
# grand jolt hmm, odd, no dice

I don't really know what part of HDRP enables that 8-layer keyword/feature. Maybe it's a setting somewhere on the Terrain component?

regal stag
regal stag
kind spear
#

Hi, do anyone know how can I blur a Texture in unity shader graph ?

lunar valley
kind spear
autumn sigil
#

just trying to figure out how to do a heatmap (like infrared goggles) shader from a RenderTexture with said 3d properties

#

like so but not flat:

shy fiber
#

Why do parallax occlusion mapping looks ugly at some angles?

amber saffron
amber saffron
shy fiber
#

with more steps it eats fps

amber saffron
#

Well, yes.

#

I mean, that's just how it works.
You can control the steps count depending on the view angle to have less steps when viewed vertically and more when the angle is near tangent, but this look is just normal for POM

winter timber
#

Tried to make a shader, that would flip through a sprite sheet, but the frame was different depending on the object's position. It works fine if viewed from top down, using an orthographic camera, but otherwise it looks like this. I don't know what went wrong, and I don't know how to describe it. (also sorry if the images cause the previous conversation to get knocked out of sight...)

amber saffron
amber saffron
amber saffron
#

Well, same, but with nodes ๐Ÿ™‚

shy fiber
#

Thank you

winter timber
amber saffron
winter timber
#

ok this should be easier to see what is weird (these should be a flat plane of these cubes using the debug texture)

amber saffron
shy fiber
#

@amber saffron is it fine?

winter timber
#

and sadly switching to object position did not fix it

amber saffron
amber saffron
winter timber
amber saffron
amber saffron
winter timber
winter timber
twilit jackal
#

I have a normal map that is updated when the texture is changed. How do I get that to update in the game after it changes? I can see it changing in the material as it changes but it doesn't apply to the game.

winter timber
amber saffron
twilit jackal
#

I'm using Normal Map Maker from the asset store. It generates the texture and then I apply it to the sprite renderer's material with set texture _NormalMap

#

It updates in the material but not in game. Very confusing how this works.

winter timber
#

Hmm just discovered another oddity with my shader. It seems the further away from 0 0 0 i go, the more the scaling part of the script breaks. (it is meant to stop pixel bleeding)

amber saffron
winter timber
twilit jackal
#

The bottom of the water should look like this.

#

I have an idea. Let me test a bit more.

amber saffron
winter timber
#

the nodes basically allow me to scale the pixels displayed, this allows me to stop the 2nd frame from bleeding into the 1st frame

#

does that make sense? Sorry I'm not the best at explaining lol...

amber saffron
#

Maybe some issue with the flipbook node ... try to pu a Fraction node between the UV and flipbook

winter timber
winter timber
#

I'll quickly try removing those scaling things, to make certain it is them, that is causing the issue

#

Aha, I was wrong! It is not the scaling stuff that is causing it to go weird! Fascinating!

#

huh, I have been bamboozled... For some reason changing one material of one object, affects how a bunch of other materials render

#

by having no opaque versions of the shader present in the scene, the issue of far places breaking rendering is fixed????

#

im so confused lol

amber saffron
winter timber
amber saffron
#

๐Ÿค”

winter timber
# amber saffron ๐Ÿค”

even weirder, the previous issue (the one with the cubes not rendering right, due to the transparency), gets fixed if i go back to an old shader (that is transparent), but manually lets me select the tile

#

Something somewhere is going wrong...

#

what the hell... turning shadows off in the opaque shader causes the transparent shader to display only a single pixel from the texture that is super stretched

#

Should I bug report this? As this doesn't seem like intended behaviour...

amber saffron
#

I have the feeling that something is wrong with your setup, but there is so many informations and unknown about what you did that it's not easy to decipher.

winter timber
pallid root
winter timber
hidden furnace
#

I'm new to shader programming just read The Book of shaders and shaders cook book. I'm getting shader error in unity. I initialized the _SunTint field and tried to use it in a method. But VsCode doesnt highlight titnt variable as others. And I'm getting error. Error message is on image.

hidden furnace
winter timber
amber saffron
#

Indeed, makes no sense ๐Ÿค”

winter timber
# amber saffron Indeed, makes no sense ๐Ÿค”

Yup! I reckon that either there is a terrifying bug somewhere, or that I have mangled my setup so badly that these shaders have decided to give up! Thanks so much for all the help. Hopefully tomorrow I'll find a way of fixing this oddity.

floral fox
amber saffron
amber saffron
#

๐Ÿคทโ€โ™‚๏ธ

candid bane
#

how do I rotate a mask around the center of the uv?

amber saffron
lunar valley
leaden zinc
#

I wonder, how can i read vertex color on a terrain? I want to use them in a custom shader with shadergraph vertex color node, but im confused with terrain layers.

grizzled bolt
supple pendant
#

Hey guys, I have a problem where I have a shader that takes sprites and changes their colour. The shader works great and is visible in the scene view but invisible in the game view. The only way I found to fix it is to change the canvas that has the sprites on it to camera instead of overlay but that messes up the game a lot. Anyone knows if there is a different fix?

stray rune
#

hello guys im want to make an Texture 2d on my Rounded Rectangle but i dont know how

#

Add and Multiply not work

candid bane
#

how do I make the needle render above the dial?

#

the H should be hidden

amber saffron
candid bane
#

@amber saffron thanks again!

scarlet arch
#

how can i make something like that in Unity?

lunar valley
# scarlet arch

uv node pluged into split node, and the ping pong node is essentially a simatrical triangle wave which is then being combined

hasty depot
scarlet arch
#

I can only split colors that are contained in a vector, I can't use that for XYZ

amber saffron
scarlet arch
#

i get this :

calm aspen
#

What I need to look up in order to apply shader only to parts of a mesh surface?
I have a mesh constructed out of a height bitmap, and required parts can be based on the colour from the height bitmap or from a different height bitmap. Whichever is required for the implementation.

tranquil wolf
#

^I have a similar problem to the above. I got this amazing grass creation script tool that works in brush mode, but I want to change it so it generates the grass with the settings I implemented not with the brush but all over a specific terrain material I have

lunar valley
shadow locust
scarlet arch
#

ok I should rather explain to you what am I trying to do with this shader

#

I extracted a model from the game Animal Crossing on 3DS but in order to save space in the rom of the game, the developers made a texture that can be mirrored, so if I import a model from animal crossing without shader I have weird textures like this:

#

instead of this :

#

as you can see the furniture have some problem that i can fix by using this shader

#

(the seats are very weird)

lunar valley
#

right and I am guessing you want to recreate the shader and where is the problem when doing that?

scarlet arch
#

exactly

lunar valley
#

and where is the problem when doing that?

scarlet arch
#

my texture is not recognized, I simply have a red line and a green line which represents the RGB colors but I do not see my texture

#

Like this

lunar valley
#

show me the shader

scarlet arch
#

ok i can add one thing i guess

#

the texture at the right in the inspector is absolutely useless

#

and i will remove the other node "split"

lunar valley
scarlet arch
#

there is no texture

#

idk where i should use it

lunar valley
#

have you checked the uvs of the objects?

scarlet arch
#

how can i get this in a shader?

lunar valley
scarlet arch
#

the real uv

#

of the object which have the material

lunar valley
#

you are allready doing it but the uvs you are getting are probably shit

scarlet arch
#

oh

#

i see

lunar valley
#

you either need to fix the uvs of the objects or use the triplanar method

scarlet arch
#

triplanar?

lunar valley
calm aspen
prime shale
#

i.e.

float heightValue = tex2D(heightMap, uv).r;

if(heightValue > 0.5)
{
  //do A
}
else
{
  //do y
}
misty crown
#

Hi there,
does the : VPOS semantic return the screen space position of the vertex in pixels or in normalized device coordinates?

Would appriciate help here, as I am having trouble finding the right documentation

scarlet crater
#

let me double check

#

appears to be yeah

lunar valley
#

yes screenspace and sv_positon is clip space

scarlet crater
#

I have a question of my own now actually

#

so i've written a shader to emulate the effect of a CRTV screen, and in an attempt to mitigate the moire effect, I've used one of the screenspace derivative nodes to determine when to draw / not draw the phosphor pattern

#

generally it works great, but it introduces some aliasing artifacts

#

Without distance fade:

#

im wondering if there is a method of reducing those artifacts?

shadow locust
scarlet crater
misty crown
scarlet crater
#

No problem! Happy to help

misty crown
lunar valley
scarlet crater
#

It does for the most part

#

It's the jagged white lines that are turning me off

lunar valley
scarlet crater
#

they emerge from the fwidth() function

silent fulcrum
#

Can we change a shader graph's enum keyword programatically during runtime? I've tried Enable/DisableKeyword but it doesn't do it. Any help would be greatly appreciated

#

Nevermind, I was missing an underscore in my string reference, oops ๐Ÿ˜›

dapper heath
#

is anyone familiar with using CRTs? i keep encountering this warning with my implementation that more or less stops the coroutine from cycling through

#

        IEnumerator ProcessDyeTexture() {
            foreach (KeyValuePair<string, List<string>> skinPair in skins) {
                SkinDye skinDye = dyes[skinPair.Key];
                CustomRenderTextureUpdateZone[] crtZones = new CustomRenderTextureUpdateZone[skinPair.Value.Count];
                for (int i = 0; i < skinPair.Value.Count; i++) {
                    AtlasRegion region = atlas.FindRegion(skinPair.Value[i]);
                    if (region != null) {
                        CustomRenderTextureUpdateZone crtZone = new CustomRenderTextureUpdateZone();
                        crtZone.updateZoneCenter = new Vector3(region.x + region.width / 2, region.y + region.height / 2, 0);
                        crtZone.updateZoneSize = new Vector3(region.width + 1, region.height, 0);
                        crtZones[i] = crtZone;
                    }
                }
                dyeTexture.SetUpdateZones(crtZones);
                dyeMaterial.SetColor("_Red", skinDye.colors[0]);
                dyeMaterial.SetColor("_Green", skinDye.colors[1]);
                dyeMaterial.SetColor("_Blue", skinDye.colors[2]);
                dyeTexture.Update();
                yield return null;
            }
#

code for reference

#

dyeTexture in this case is the CRT, tl;dr is that it's cycling through a spritesheet texture, assigning various regions (so like 50x 75y might be a sword sprite) and running a dye shader on that zone

scarlet crater
dapper heath
# dapper heath

this is fixed without restarting unity by just saving the project? i don't fully understand what's happening here

lyric copper
#

Has anyone stumbled across a shader like the one in this video?

https://www.youtube.com/watch?v=JFn2kK8GhUQ

In this tutorial I show you how to create pixel scan logo animation in adobe after effects without using any plugins. With this method show in the video you can easily adjust the settings and if you want to use a different logo, all you have to do is replace a logo inside of logo composition and everything will automatically adjust to the new lo...

โ–ถ Play video
winter timber
#

Welp it seems that solution has other issues though. As now shadergraph refuses to create new nodes, instead giving me this error:

#

ok and trying to connect existing nodes together causes memory leaks, how fun

#

Why is it that whenever i use unity, i always manage to break it in the most baffling ways possible lol?

winter timber
#

oh and now both scenes are broken, how wonderful

#

I've tried googling everything under the sun, but nothing comes up! It really seems like I'm the only one to have this problem....

#

oh also minimising unity and then un-minimising it sometimes fixes it, but not often

#

what the hell

#

ok, creating new materials and assigning the shader to them, causes those materials not to break, atleast for a bit

stray rune
#

unlit shader cant use multi color?

meager pelican
# winter timber oh also minimising unity and then un-minimising it sometimes fixes it, but not o...

I'm sorry CK, but I don't remember the exact nature of the problem, and there's been several posts. The reason I mention this is because others may feel the same. I mean, it's hard to track a problem across several day,s, assertions, and changes. So if you have a situation like this ^^ where you can get a "sometimes fixed" image, and one that is messed up, maybe post both examples again. One where min/un-min fixed it, and the broken one. Maybe someone will have better understanding of what is going on.

One think I know is that if you're having MIP mapping issues, you'll often get "texture crawlies" going on in the distance too as the camera moves.

winter timber
meager pelican
stray rune
#

i only see alpha output

meager pelican
#

Maybe try putting a color into the color output.

winter timber
#

and this is what it should and sometimes does look like

#

the issue only ever occurs in the negative x direction when far away from 0 x

#

it seems that anything and everything can fix it, but only for a while

#

this makes troubleshooting near impossible

#

also shadergraph often breaks for no reason

#

does that help?

#

how do i even google that? "Shader breaks when far in the negative x direction, and everything fixes it"?

tacit parcel
winter timber
#

ok think i found what ya talkin about, ill try changing them, thanks

meager pelican
#

But that only happens when UV's go above/below 0-1, they need to "wrap around" so you can also check UV calcs.

#

Depends on what your shader is doing.

#

Also make sure your uv values are full floats and not halfs

winter timber
#

ok setting everything to repeat instead of clamp, has fixed all the textures with transparency, now only the opaque textures are broken

winter timber
meager pelican
#

You might try playing with Aniso filtering and AA settings in your setup.

winter timber
#

here is my shader, hopefully discord compression doesn't destroy it too much

meager pelican
#

So the gist is that you're selecting the flipbook page based on world position.

winter timber
meager pelican
#

what is the effective range of the worldpos in units? What's the "far distance" value that f's up?

#

Are you running out of significant digits in your floating point calcs?

winter timber
meager pelican
#

It was just a shot in the dark. 100's -/+ isn't that bad. If you were in the 100,000 range, I'd wonder.

#

Maybe re-work it (IDK what it's really doing and it's too early for me to do the math ๐Ÿ˜‰ ) with a modulo or something so that the math "is different".

winter timber
#

ok just got -62 to be a far distance, but it seems it isnt consistent, and since then i haven't gotten that little since

tacit parcel
#

where is this FPS input come from?
also is it inconsistent in editor or during play? Time node inside editor behaves differently than when running, I think

winter timber
winter timber
stray rune
#

how to reverse alpha color guys?

tacit parcel
#

ah I see... so it's a constant number.

stray rune
#

shader is hard xd

winter timber
winter timber
winter timber
#

atleast i dont think so

meager pelican
#

AKA 1-alpha

stray rune
#

i used one minus to reverse transparent spaces so...

tacit parcel
# winter timber ok so this is what it looks like when broken

seems like one of the uv members might be clamped to 0, either x, or y
my wild guess is that that the modulus node give negative number (?cmiiw), so maybe add an abs node or remap node between the modulus and the flipbook node
iirc, flipbook node expect 0..1 input

winter timber
#

if you have python, open it quickly, and use % as the modulus operator

#

anything%2 should be either 0 or 1

#

in general x%y == somewhere inbetween 0 and y

#

you can also have floats, that is fine

tacit parcel
#

how about -1.5 % 1 ?
I know it should be 0.5 but I'm not sure with modulus node in shadergraph

stray rune
#

damn it alpha is on top emission

winter timber
#

there will always be atleast 2 frames though

winter timber
# winter timber https://docs.unity3d.com/Packages/com.unity.shadergraph@6.9/manual/Modulo-Node.h...

https://www.skytowner.com/explore/difference_between_the_methods_mod_and_fmod_in_numpy seems fmod does handle negative numbers differently to mod. I'll try to put some nodes around to force it to be positive then

tacit parcel
#

it seems it does works differently than regular mod

winter timber
#

welp, so should i use nodes to force it to be positive? Or is there some way to get access to regular mod?

#

but flipbook shader can handle negative numbers

#

atleast it should...

#

if you manually type a tile index into flipbook then it handles negative numbers fine

#

something strange is afoot

regal stag
winter timber
gloomy gust
#

Hey guys, i downloaded this shader online that hides 2D sprites based off the amount of light incident to it. as you can see in the image, it does its job, but is there a way for me to make this completely transparent? it gets more transparent as it gets darker, and is completely transparent when its black, but that kind of defeats the purpose of the shader. anyone know how i can make it go transparent at this level?
https://cdn.discordapp.com/attachments/497874081329184799/1074731728557592697/image.png
https://forum.unity.com/threads/script-for-generating-shadowcaster2ds-for-tilemaps.906767/
this is the shader i downloaded, if it helps ๐Ÿ˜„

#

sorry i mean here

scarlet arch
#

how can i fix the lines on the nose of this character?

#

(everything in red are the lines that i want to remove)

scarlet crater
#

you can do that in with a toggle in the texture import settings
or you can access lower mip levels with the tex2dlod() function
eg.) tex2dlod(_MainTex, float4(uv, 0, 0));

scarlet arch
#

ik

#

but it doesn't change anything sadly

scarlet crater
#

try switching it to point maybe?

scarlet arch
#

already the case

scarlet crater
#

well damn

scarlet arch
#

i only the lines in game

#

not in the scene

#

(in the viewport)

scarlet arch
#

I removed the anti aliasing and it works

#

(not a big problem because i want to make a game with PS1 graphics)

scarlet crater
#

I have a geometry shader to generate billboards on each vertex of a mesh, and it works fine, except the quads seem to shrink pretty significantly when the camera is direcly overhead.

#
float3 center = p[0].pos.xyz;

                float3 up = float3(0, 1, 0);
                float3 look = _WorldSpaceCameraPos - center;
                
                look = normalize(look);

                float3 right = cross(up, look);
                up = cross(look, right);
                
                float3 r = right * _Scale * 0.5;
                float3 u = up * _Scale * 0.5;

                float4 v1 = float4(center + r - u, 1.0f);
                float4 v2 = float4(center + r + u, 1.0f);
                float4 v3 = float4(center - r - u, 1.0f);
                float4 v4 = float4(center - r + u, 1.0f);
scarlet pulsar
#

i created water shader and it has side effect on objects which im looking on from same side of water. Any advice how can i solve it?

tranquil wolf
#

trying to create a sky using shaders and there's this weird line that wraps around the scene- any ideas?

#

if I turn the camera around you can see it on the other side too

tranquil wolf
#

Probably being dumb, but I cant find that setting in the inspector for this material

scarlet crater
#

Oh I thought you were sampling a skybox texture

#

I don't think that will apply then

tranquil wolf
#

No I am creating a sky with a shader

shadow locust
# scarlet arch how can i fix the lines on the nose of this character?

Nothing can fix the deep creases in Tom Nook's face, carved there by decades of observing frivolous players coming in and out of his store, failing to pay their debts. The jaded nature of his character is etched into his very soul, into which his face is merely a looking glass.

scarlet arch
#

lmao

#

it's an FPS game so i can kill Nook

#

I WILL KILL NOOK TILL HE DIE ๐Ÿ˜ˆ

misty crown
#

Hi can smeone help me understand why we divide by scrPos.xy by W
float2 wcoord = (i.scrPos.xy/i.scrPos.w);

Is it to get normalized device coordinates? Or too fix the perscpetive, from my understanding the perspective was already fixed when converted into clip space?

Appriciate your help!

Thank you

regal stag
regal stag
serene creek
#

Hello, need help understanding why the Shader render queue keeps going back to its default value, I set it to 3010 but it will go back to 3000. Appreciate any help

regal stag
# scarlet pulsar i created water shader and it has side effect on objects which im looking on fro...

The common way to fix this is sample the depth texture (Scene Depth node in shader graph) in Eye space, using the distorted screen position, then compare it against the depth of the water plane (e.g. W of raw Screen Position). Can use a Comparison (Less or Greater) into a Branch node if using shader graph.

If the scene depth is smaller, the object is above the water, so if we distort the opaque texture (Scene Color) it'll result in this side effect you see. There's no way to really know what the pixel colour should be behind the object - but it's common to just use the non-distorted Screen Position. Won't be perfect, but should look better than the current result.
And if the scene depth is larger, then can continue using the distorted screen position. These would be the True/False inputs of the Branch.

Here's a simplified example (from https://www.cyanilux.com/tutorials/water-shader-breakdown/)

regal stag
serene creek
regal stag
#

Hmm I'm not sure then, maybe a script is overriding it?

nocturne gorge
#

does anyone know how to get the default nodes back into these? if i try to add them i just doesnt even show up

#

supposed to look like this yknow

regal stag
nocturne gorge
#

Oh, thank you very much!

serene creek
#

Anybody knows why every refraction shader is causing ghosting on objects in front?

gloomy gust
misty crown
#

Could someone help me understand how this makes repeating bars across the screen i am having trouble figuring out this piece of code. Thank you

`fixed4 frag(vertOut i) : SV_Target {
float2 wcoord = (i.scrPos.xy/i.scrPos.w);
fixed4 color;

            if (fmod(20.0*wcoord.x,2.0)<1.0) {
                color = fixed4(wcoord.xy,0.0,1.0);
            } else {
                color = fixed4(0.3,0.3,0.3,1.0);
            }
            return color;
        }`
regal stag
# misty crown Could someone help me understand how this makes repeating bars across the screen...

wcoord is a position on the screen here, (0,0) in bottom left and (1,1) in top right.
20.0*wcoord.x is taking the X/horizontal axis, and changing it to range from 0 to 20
fmod(x,y) is a hlsl function which returns the floating-point remainder of x/y. It looks like a sawtooth wave (/|/|/|/) when graphed, but ranging from 0 to y, so 0 to 2 in this case (but repeating, 10 times, I think).
Since that ranges from 0 to 2, comparing it to < 1 means each half gets a different colour.
I think frac(10*wcoord.x) < 0.5 would also be equivalent.

tranquil wolf
regal stag
tranquil wolf
#

changing it to unlit worked !!!

#

thank you so much

floral canyon
#

Does anyone here who has a singular clue as to what a shader is/does/works can help somebody that knows absolutely nothing T o T ! I am currently running into a problem with my first ever unity project and im a little clueless to say the least, and now I am stuck on some shader/lighting issues! Any help will be appreciated :))

prime shale
#

there we go, job done ๐Ÿ˜›

floral canyon
#

thank you for sharing your wisdom wise one ๐Ÿ˜Œ

prime shale
#

but on a little more elaborate note shaders are GPU programs, that are solely responsible for shading all the objects that are in your scene

floral canyon
#

Would there be any reason a specific would cause an object to light up entirely, even if only part of a light is touching it?

prime shale
#

yes, but the problem with that question is that it could be due to a multitude of things

floral canyon
#

NooOoO T _ T

prime shale
#

I would ask first what kind of lighting you are using, and what render pipeline

floral canyon
#

I'm not using URP or HDRP so the standard pipeline I assume, and the lights are also standard unity pointlights :/

#

the shader in question is using some form of vertex lighting if that helps at all ๐Ÿ˜ญ

#

*spot lights not point ๐Ÿ˜ฐ

prime shale
#

well right off the top of my head

#

sounds like the issue you might be running into is about per pixel light limit

#

by default its at 4 usually for built in pipeline but you can increase that number

floral canyon
#

interesting ๐Ÿ˜Œ

prime shale
#

you'll find the option on quality settings

floral canyon
#

I gave it a quick try but it didn't seem to resolve the issue unfortunately :/ I greatly appreciate the help though ๐Ÿ˜„ ! I am sure I'll inevitably get too the bottom of this >:)

kind juniper
floral canyon
#

sure just one second ๐Ÿ™‚

kind juniper
#

Ah, well vertex lit shader would be lit by the vertices. If you want pixel lights working, you'll need to use a different shader.

floral canyon
#

If you have the time, would you try dumbing down the difference between the two :))

kind juniper
#

You'd need to look into the shader code for details, but basically vertex lit shaders apply light in the vertex shade(per mesh vertex that is). Shaders like Standard shader, apply light per pixel drawn on the screen making them quite a bit heavier than vertex lit shaders.

floral canyon
#

I think that makes sense ๐Ÿ˜„ thank you for explaining it to me ๐Ÿ˜Œ I've learned something today

kind juniper
#

That being said, vertex lit shaders still shouldn't be "lit as a whole" it's supposed to be less precise.

#

So maybe take a screenshot of how it looks like.

digital gust
#

Is anyone here firm with a shadergraph of water ripples affected by an object? I am currently testing around and can not find the best way of approaching this. Should I feed a texture that is updating the points where ripples are or is there some kind of array I can feed into shadergraph to examine positions I can create ripples from. Any insights and ideas are very welcome, thank you ๐Ÿ™‚

tacit parcel
#

I don't think it should be handled by shader(not entirely at least)
what I can think of is using a look up texture, usually a render texture, for the water mesh vertex displacement. then you blit a wave pattern in the object position into the render texture which largen and fades overtime.

digital gust
#

Like this is already generating an animated wave I could control. But its just one

tacit parcel
#

using render texture, you can have a lot of impact point with minimum impact

digital gust
#

Hm, gotta look into this I guess. trying to understand how to use the rendertexture and add impact points to it, thanks for pointing it out ๐Ÿ™‚

#

This is what it currently does, basically having the effect I want (ignore resolution and blockiness)

digital gust
#

is there a smart way to "lerp" in shadergraph from like a stored position to the new one?

toxic ore
#

How can I control the position of the lighter-coloured rectangle projected on the larger one?

harsh aspen
#

Hello,
I am working on a 2d platform type game,
I wanted to make the texture for the platform look uneven,
No change in colliders needed only the look i want to change to uneven like a uneven rock type thing.
How can i do this. If it is possible

regal stag
toxic ore
#

Thanks a lot!๐Ÿ˜ƒ

ionic oak
#

It should be "zFailOperationBack and zFailOperationFront", right?

low lichen
#

Yes

gloomy gust
toxic ore
#

I have a noise node and I want it to act like alpha (so I want the black regions to be transparent and the white regions to be white (and then I'll eventually multiply this by a color)). How can I do that?

low lichen
# gloomy gust can someone help me with this pelase?

My guess is that you have some global light that is adding a little bit of light to objects in shadow, so they don't become fully transparent. What method are you using to add that bit of light to the shadows?

dry solar
#

Hi, I'm trying to create a Shader for this Planet so that there are different textures on different parts of it. Right now i'm controlling it through Noise but I'd like to texture it based of the height of the terrain so I can have snowy mountain peaks. How could I do that?

low lichen
toxic ore
#

Here is the thing: I want the output to be blue where the noise is white and red where the noise is black

dry solar
#

use a gradient with a sample gradient node

toxic ore
#

How exactly? Instead of the color node?

#

ohh, got it

#

Thanks!!

low lichen
dry solar
#

oh boy

#

I do not have a heightmap

low lichen
#

If the pivot point of the mesh is in the center, then to calculate the distance, you can just use the Length of the Object Position.

dry solar
#

I see

#

It is so I'll try that thanks

low lichen
#

The value you get could be in any range, depending on the size of the mesh (unrelated to the size of the renderer/game object). Maybe you're lucky and it's already between 0-1. But most likely, you will need to Remap it.

dry solar
#

yeah, that it ussually doesent work first try so i'm expecting that

toxic ore
#

For some reason I can't show that gradient from above as a property in the editor

#

The Expose checkbox is greyed out

regal stag
regal stag
toxic ore
#

Ok, I'll try that

gloomy gust
#

i have the shadow strength not fully 1

low lichen
gloomy gust
#

do i just do like 0.5 and 0.5?

#

or just different target layers

dry solar
digital gust
#

Hey everyone, I am trying to use my vertex displacement to also get some refractino going in shader graph. Anyone got a good way of recalculating the normals from that displacement?

slim yew
#

I have a geometry shader that's used to render grass on a mesh

#

would there be a reason for it not showing up in the scene view?

#

and now its not visible in either game or scene view

tender valve
#

Hello guys I copy shader graph code to shader but its give me error and i cant avoid it , what can i do??

lunar valley
regal stag
lunar valley
low lichen
# gloomy gust do i just do like 0.5 and 0.5?

Yes, you'll have to decrease the brightness of the spot light, since it's being combined with the global light. Also, it looks like the global light is too bright. The shadow brightness doesn't match before.

tender valve
low lichen
lunar valley
lunar valley
slim yew
#

alright

#

recommend me away

#

how would you render grass

lunar valley
#

you will need to give us more info

gloomy gust
slim yew
#

what info, I need to render grass, that sways, and that I can change the color of

lunar valley
tender valve
dry solar
lunar valley
misty crown
#

Hey can someone help me understand as to why TEXCOORD0 is described as 'first texture coordinate input' Does it provide the UV Coordinates for a specific vertex / can a vertex have multiple uv maps?

            `float2 uv : TEXCOORD0 // first texture coordinate input`

Thank you!

merry rose
tepid valve
#

ive got this planet in unity 2D and I want an atmosphere around it and it seems that shaders would probably be the best way for it
I can create a mesh in the right shape but i cant figure out how to get it working
the second image is a sort of attempt at getting it working but it just doesnt seem to do what id expect with 2D meshes without sprites or anything

grizzled bolt
#

Could plug UV node into color to see what we're working with

tepid valve
#

yes will give that a go

#

its possible that im generating the UVs wrong

#

ah seems theyre all (1,1)?

#

its got vertex colours also but can just ignore them

#

the final thing wont have them just while im checking out shaders

grizzled bolt
tepid valve
#

uh hm i evidently did not expect to have to use them in the future

#

nice

#

i guess the next issue is how on earth do i generate the UVs for an arbitrary polygon - would the edges need to be along the sort of (1,0), (0,1) edges of the UV, or would i just be able to divide vertex position by bounds?

#

not really a shader question at that point i suppose

tranquil wolf
#

Anyway I can draw clouds using shaders in the built in pipeline? this is my first unity project and every tutorial seems to use another pipeline and Im afraid if I change pipelines it will screw up what I already have

tranquil wolf
prime shale
#

nothing wrong with being a weeb ๐Ÿ˜›

#

but just to preface real quick technically you can do whatever on the built in pipeline, the difference with the other render pipelines is most of those features/effects are built in.

#

I'm not to familiar with genshin impact but looking at images, the sky looks to be heavily artist driven

#

most likley just simply hand drawn clouds that are overlayed on a skydome mesh that rotates/animates based on weather conditions/time of day etc

tranquil wolf
#

ahhhhhh sweet

#

hrm. do I want to draw clouds? was kind of hoping to mess around with shaders more

prime shale
#

well there are many ways you can achieve it, I'm not familiar with the game and seen it fully in action but you could certainly achieve it in many different ways

#

the simplest and fastest way I could think of is having artist textures, but you could achieve it with shaders and procedual textures

#

not quite the same as the style of genshin of course, but its a starting point

tranquil wolf
#

thanks !!

lunar valley
dusty peak
#

How is it possible to import a model with the custom shader too?(Use Nodes enabled and from Blender)

grizzled bolt
dusty peak
dusty peak
#

dam, thx

modern yacht
#

Hey guys, is there anybody familiar with shader graph and can help me with some 'simple' shader which turns out not that simple

#

The idea is to make a shader that will display a border around the mesh. It should be tilled with object scale.. I managed to did it, but it totally breaks when it comes to custom shape

#

These are same shader but one is just a rectangle and another is some complex polygon. I'm stuck for 2 days xD [*]

lunar valley
modern yacht
#

It's all done in shader graph. Here it is:

#

Sorry, this one:

karmic hatch
modern yacht
slim yew
#

hello again, I'm having trouble using geometry shaders

#

they won't render at all

lunar valley
slim yew
#

well its literally not showing up

#

I tried switching all my render settings, changing around stuff in the shader

#

inside this project geometry shaders are broken

#

if I open a new project they're fine

lunar valley
slim yew
#

the geometry that's supposed to be generated by the shader

#

let me show you

grizzled bolt
#

Hmm I can imagine what a shader looks like when it's not showing up

slim yew
#

oh its just not showing up

#

just gimme a second to show you what I mean

#

same models, shaders, textures, unity version, urp version

#

only difference is the project

grizzled bolt
#

Looks like I imagined it

slim yew
#

I've tried matching project settings, and that also doesn't work

#

any pointers?

#

should I just move my assets into a new project

gloomy gust
#

how can i make a trail renderer pixelated with a shader?

meager pelican
slim yew
#

I wish I was kidding when I say that it magically fixed it self

lunar valley
#

at least its fixed...

grand jolt
#

anyone knows how i can find in shader's code a function that makes it slowly dissapear pixel by pixel (possibly not literally)
when camera is at a certain distance, or the model is at certain screen height?
this shader is rather big and undocumented so its a bit hard

#

the reason is, theres a Billboard on last LOD, and it slowly fades to invisibility on a LOD before that

#

looks super poorly

meager pelican
tepid valve
regal stag
# grand jolt

Is the foliage here texture based? Under the texture's settings there should be a "mipmaps preserve alpha" which might help with this

tepid valve
# grizzled bolt What kind of UVs does the mesh have?

assuming i got UVs on all the points what can i do next? the UVs are just gotten by diving the vertices by the bounds so (0,0) and (1,1) are not necessarily on the shape

ive just got this applied on the ground itself but the hope was to use it as an atmosphere shader so id just apply it to another shape thats a bit bigge and behind this main one

tepid valve
regal stag
tepid valve
#

yeah exactly, just doesnt seem trivial to do that

#

im toying with the idea of passing in data into the shader through the normals

#

i suppose UVs work too

#

do UVs / nomals normalise the vectors they receive?

#

data seems to be going missing its not doing what id expect

regal stag
#

You're using shader graph right? That would be normalising normal vectors automatically. But UVs wouldn't be

tepid valve
#

ok ok so UVs are the way to go sure

gusty canyon
#

Guys would it be possible to make a tape measure shader that I can just stretch a small rectangular prism and it extends with the markings on it but also has numbers counting up(this is the part Iโ€™m unsure about)

#

Context: Iโ€™m making a VR game and want to add a tape measure that you can pull out

tepid valve
regal stag
# gusty canyon Guys would it be possible to make a tape measure shader that I can just stretch ...

Hmm well, Should be able to get the scale of the object through the model matrix. In shader graph it would be from the Object node. In hlsl should be able to use something like

float scale = length(float3(UNITY_MATRIX_M[0].x, UNITY_MATRIX_M[1].x, UNITY_MATRIX_M[2].x));

Though unsure if you want x, y or z axis as that depends how the object is orientated.
Could use that to scale your uvs (or object space fragment pos). Should be able to get lines/markings by doing something like step(frac(uv.x * scale), 0.05);
Getting it to actually display numbers would be a bit harder though. Maybe instead of doing it procedurally it would be easier to use a long texture. Can still sample it with scaled uv coords. Not sure what it would be off the top of my head though (float2(uv.x / scale, uv.y)?).

regal stag
tepid valve
#

ty anyway tho

#

think the plan is just loop over all the outside vertices and find the lowest distance from point to each edge

gusty canyon
#

Bro thanks for that in depth response, Iโ€™ll have to give it a shot when I get home, had to go get some food

wooden lake
#

Hi I might be off, but is this blue overlay over tilemaps usually done with shaders?

tepid valve
#

ofc doesnt look how it will but the datas there

regal stag
#

Yeah ๐Ÿ˜„

regal stag
gusty canyon
regal stag
gusty canyon
#

that just makes one color longer

gusty canyon
# gusty canyon

this would work if I could make them closer (meant to reply to the other one)

regal stag
#

Oh right, you'd want a Multiply before the Fraction node

gusty canyon
#

bro is a math wizard ๐Ÿ’€

#

how could I make the bottom and the sides not have the marks?

regal stag
#

Current graph result in True, Color node for sides/bottom in False

gusty canyon
#

bet

#

also is there an equivalent to this node from blender in shader graph?

#

found it

#

sample gradient

regal stag
gusty canyon
#

im going to use it to make the lines not go all the way across it

#

I just need to make it yellow now

#

I dont know what im doing facepalm

regal stag
gusty canyon
#

hey I did it

#

using step

#

I dont know how in the world I would ever put numbers on it though

#

so idk if I am

#

I might just leave it like that feelsShrugMan

prime shale
#

With digits from just 0 to 9

#

And using vertex positon and some fancy procedural math

gusty canyon
#

that sounds extremely complicated

hearty obsidian
#

@gusty canyon if youre just rescaling, then you can offset based on scale. If youre going to be wrapping this thing around stuff dynamically, and it wont keep a straight line, you probably will need to remap the uvs

gusty canyon
#

nah its not gonna be wrapping around stuff

#

ill see if I can get the offset to work

prime shale
#

But a number sheet I'm sure would be the route to go

#

Are you using mesh UVs or vertex position for the markers?

gusty canyon
#

this is the entire shader rn

#

trying to get the offset to work

#

I dont think im going to add numbers

regal stag
#

Or maybe 1 rather than 0.5, I'm not sure what the scale of the mesh here is

gusty canyon
#

and plug it in here?

regal stag
gusty canyon
#

its working but its coming out too fast

#

do I really gotta play with this value until its perfect ๐Ÿ’€

#

0.09217 is pretty good

#

idk what that number represents

#

now I gotta actually make it pulloutable

#

thanks guys pepedance

gusty canyon
#

that looks really cool

tepid valve
gusty canyon
#

thanks Dance

dense bane
#

Does Unity support texture array compression?

#

i think they added that in some later version but i don't see it

prime shale
#

<@&502884371011731486> @grand jolt

desert orbit
#

!ban 856146380052627497 spam

echo moatBOT
#

dynoSuccess king egg. (Skiku)#6265 was banned

vale wind
#

Question because I can't find it anywhere on google but what are the best practices for making say a low end version of a shader in shadergraph?
Say I have some triplanar mapping stuff going on, could I have a branch that checks if a certain global is true or false to do that triplanar mapping or not and would it save performance by not doing that or does it still have the overhead somehow?

prime shale
#

but the general guidelines that are said do apply

#

if you want a low end well performing shader, generally the less computations that you do, the better

vale wind
prime shale
#

hmm I would try to avoid branching honestly and look into shader variants with macros

#

but your using shadergraph which I don't think supports that...

#

i might be wrong, not familiar with shader graph, but generally advice for having well performing shaders. Keep the computations as simple as possible

#

less is better

#

which is why unlit shaders perform well on mobile, all its doing to shade an object is sample a single color or texture and that is it. you can add additional steps like ok I will sample realtime diffuse lighting. That is an extra step. Ok I will now sample another texture map for normal mapping, that is another step, etc.

regal stag
tender valve
#

Hello guys got a bit problem in blender i made tree with UV and Bake textures everything looks good there but when i import to the unity and set all up my textures all are stretched .... they cant find the right place why is this happening?

vague pilot
#

Hey im new to unity so im new to shaders (shader graph) to be honest i watched some videos about making something with shader-graph but there are no explainations why to use the nodes is there any video that shows all the nodes and their functions?

waxen herald
#

Trying to use a material with a custom shader. My project uses URP and has the renderer set in the quality tab in the project settings. I also cant convert the material to an URP material cause it says theres no converter

#

Anyone knows whats causing this/ what might we the solution

meager pelican
# vale wind So branching to skip doing triplanar mapping should work?

Branching will work, particularly if it is branched based on a Uniform (aka constant passed in for all drawing), but I'd check the generated code from shader graph. And like Cyan said, the best way is a shader variant.

That said, triplanar isn't all that bad, GPU wise. You could just try it without any branching options, benchmark it on your lowest target vs doing the other thing, whatever it is.

meager pelican
#

Or duplicate the functionality in shader graph.

waxen herald
#

Checking this out for sure, looks really helpful

#

thanks

sly tapir
#

why does my skybox change the color of everything to a bit of a tint? the original didn't do anything

#

i dont have any post processing enabled either

frigid yarrow
sly tapir
#

nope

#

its the same as it was

#

like i didnt change anything I just applied it

frigid yarrow
#

yeah for some reason changing the skybox effects lighting

#

not just a thing with this skybox

sly tapir
#

damnit

#

how can I fix that?

frigid yarrow
#

Under the lighting tab, change the Environment lighting source

#

change it from skybox to color

frigid yarrow
sly tapir
#

aight thank you. Do you know what the color is for the original skybox like the one you see when you make a new scene

velvet turret
#

i know there's a way to shade an object to always be rendered on top of other objects regardless of being occluded - is there a way to do the reverse? IE put a shader on an object so it's always occluded by objects on a certain layer, regardless if those objects are behind it?

sly tapir
#

Something like this i would guess

#

but ill fiddle with it thanks for the help

#

also 1 more question regarding shaders

#

is it possible to make a camera filter/shader that makes it look water?

frigid yarrow
#

I havent done that yet so idk

#

the cheap and easy way would probably be to simple put a filter over the canvas

sly tapir
#

okay

#

again thanks for the help and thats all

scarlet crater
#

Posting this again because i can't seem to find a solution on my own:

I'm writing a pointcloud shader using geometry shaders, essentially the goal is to create a billboard quad on each vertex of a mesh and then apply a point texture to each quad.

I'm almost there, the last problem that I am encountering is with the billboard math (?)

The quads seem to shrink pretty significantly whenever the camera is directly above them, which is not ideal

#

i'm absolutely hopeless with math, so most of the math was sourced from a github example that I found. that makes it really hard for me to diagnose the problem though haha

#

if anyone has any input i'd be more than happy to hear it!

meager pelican
scarlet crater
#

essentially yes

meager pelican
#

Google "unity billboard shader" and dig in. There's a few methods.

#

Mostly applied in the vertex shader. But I suppose you can pre-gen them in the geometry stage too.

#

Also, I think the BiRP has a billboard shader for particles (probably shuriken), that you could check the source for.

scarlet crater
#

ill do a bit more googling then i suppose!

meager pelican
sleek skiff
#

Having some issues with a scriptable render pipeline
currently using the PSX render pipeline and i have a VHS Pro post process effect that i applied to the camera, but it doesn't seem to show
when i switch the render pipeline to none, it shows up
is there any way to get the effect to show with the scriptable render pipeline i have?
The project is a 3D built in render pipeline project

vocal narwhal
#

It sounds like you are using the wrong post processing

#

I'm confused what you mean by saying the project is built-in, but you're using a render pipeline

sleek skiff
#

that's the built in render pipeline right? not URP or HDRP

vocal narwhal
#

That's irrelevant now you're using a RP

sleek skiff
#

oh yeah, this one, the PSX render pipeline

vocal narwhal
#

you're using a custom render pipeline if you've overidden the graphics setting for render pipeline, no longer built-in

sleek skiff
#

ahhh i see ok

#

i don't see anything to enable post processing on the camera

vocal narwhal
#

I am not familiar with this custom render pipeline's post processing, it might be on automatically

#

the point is to use volumes and not PPV2

sleek skiff
#

i added the volume thing to the camera, but I only get one group of volume overrides, the one that came with the pipeline

vocal narwhal
#

you will only be able to use effects that are compatible with render pipelines, presumably the one that this custom RP is based on

#

custom render pipelines are not the most accessible things

sleek skiff
#

hmmm, i see, and there's no way to add other shaders? like the vhs one i got?

vocal narwhal
#

not without writing a whole bunch of custom code, no

sleek skiff
#

dang

velvet turret
#

question - i know there's a way to shade an object to always be rendered on top of other objects regardless of being occluded - is there a way to do the reverse? IE put a shader on an object so it's always occluded by objects on a certain layer, regardless if those objects are behind it?

frigid yarrow
#

So Im having this issue where the cel shader only uses the directional light

#

How do I make it so that it can use multiple lights?

#

I can't find a cel shader anywhere that does this

#

Anyone know how to make a cel shader use multiple lights?

#

I've been struggling all day trying to figure this out

lunar valley
#

I can recommend watching the videos from freya holmier, she covers handling multiple lights somewhere

scarlet pulsar
#

any advice how to fix problem in water shader when looking through water plane that transparent object doesn't rendering?

analog karma
#

is there any way to make a noise in shader graph pixelated?

safe elbow
#

How can I get a depth texture from a camera to put into a graph shader?

#

specifically from a render texture

calm mortar
#

I am using this XOffset variable to control the X UV offset

#

I'm trying to make it different for each instance, but they all have the same offset. Am I missing something?

#

The scriptmachine is attached to the object containing the material

regal stag
calm mortar
#

I just found out ! that's the problem indeed, thank you

#

Hmm changing the value changes it for All active objects having that material

#

Oh my test reference is incorrect probably

regal stag
#

That may be because you're setting the material asset, not the renderer.material, but I'm not that familiar with visual scripting

meager pelican
calm mortar
calm mortar
#

I have this fire material. If I scale my gameobject very wide , it just scales with the game object, but I'd like it to repeat itself. How would I do that?

#

It's a particle system witha material

#

materil looks like this

meager pelican
# velvet turret question - i know there's a way to shade an object to always be rendered on top ...

Another way, besides doing tricks in the vert stage of the mesh, is to render using stacked cameras.

So you could stack cameras, NOT write to depth, and render the skybox, followed by your forced-background object, into a render texture. That would put a "background" onto your render texture including the skybox and the forced-back object. You'd then render with another camera over top of that background.

This is inefficient, since you'd be overwriting pixels from the skybox later, that you'd normally not have to draw at all.

So the first camera would output to a render texture, draw the entire skybox, and then you'd draw your special object into it. These would set the depth to whatever skybox depth is normally set to, or not even set depth.

The 2nd camera would NOT clear, and would draw the rest of your scene on top of that.

grizzled bolt
gaunt ridge
#

Anyone have any experience with custom srps / rendergraph?

Trying to port a custom srp to rendergraph, and while I have it rendering, I'm having a strange issue with shaders drawn via DOTS/Entity Graphics specific batching not having any problems, but shaders drawn by the SRP Batcher outside DOTS in the same pass have what appears to be a corrupted read from its material properties on half the frames or so,

#

Not finding a lot of resources/docs on rendergraph, and dissecting the URP/HRP code has been somewhat helpful, but this issues kinda cropped up from nowhere, and I'm having trouble pinpointing why its happening. If anyone has any insight, I would be very appreciative of some direction

meager pelican
meager pelican
gaunt ridge
meager pelican
# gaunt ridge I have seen that bit, but its good to know thats about it for documentation, fou...

Yeah, IDK.
The only thing I can (guessing) suggest is a debugger to check the values coming in.
There's the frame debugger, RenderDoc, PIX, but really to fully check it I'd install vendor specific tools for your graphics card and run a debug test. You can capture frames, and mess with values, trace through shader code, etc. Very vendor specific, so see their docs.
Visual Studio has some tools too. But if you REALLY NEED to dig in, the vendor tools are the way to go.

raw walrus
#

I'm trying to get a vignette effect on my shader graph but I can't find any tutorials about it

gaunt ridge
gaunt ridge
slim yew
#

is there a way to manually add lighting to a geometry shader

#

since I can't add both #pragma require geometry and #pragma require surface in the same pass

raw walrus
gaunt ridge
raw walrus
#

I will send the shader graph later on, I'm afk now

slim yew
#

๐Ÿ‘ worked great, used LightingSpecular()

gaunt ridge
# raw walrus I will send the shader graph later on, I'm afk now

Funnily enough, I actually haven't really used shadergraph, however for a simple one I was going to suggest just use the distance from the uv maps center point as a progress to lerp from alpha to opaque target color, add in an offset distance if you want it to start sooner/later,

raw walrus
#

I have no idea on how to program shaders

gaunt ridge
# raw walrus I have no idea on how to program shaders

Gotcha, not quite sure how to translate this into shadergraph, but that is the math concept you would want to use for a simple adjustable one, but depending on the platform it may be cheaper to just have a alpha faded texture that does it instead,

dusk shell
#

Hey, this might be a loaded question but I figure I'll try... I'm trying to use Tilemaps with 3D lights (built-in & deferred). I'm using the Standard shader, which works - except the Color field on the Tilemap component doesn't work. Is there an easy fix for this or a resource anyone could point me to? Anything would be appreciated, thanks!

slim yew
#

what's the best way of applying multiple lights to the same pixel?

#

I tried doing this c for(int j = 0; j < 15; j++) { const half4 newColor = _AdditionalLightsColor[j]; if(distance(newColor, black) == 0) { break; } const half3 lightDirection = normalize(_AdditionalLightsPosition[j] - vertexInput.positionWS); const half3 viewDirection = normalize(_WorldSpaceCameraPos - vertexInput.positionWS); color = half4(LightingSpecular( newColor, lightDirection, v.normal, viewDirection, color, 0), 0); } but it doesn't work

#

I assume because I am using lighting specular wrong

gaunt ridge
slim yew
#

no but that doesn't change anything really

gaunt ridge
#

My first debug change would make that break into a continue just to see what happens

slim yew
#

oh, I must've switched up what break and continue do

#

it is supposed to be continue

#

is the _MainLightColor and _MainLightPosition part of _AdditionalLights?

#

it is

#

its index 0

#

I'm trying to apply attenuation now

frigid yarrow
#

even though it says _WorldSpaceLightPos0 float4 Directional lights: (world space direction, 0). Other lights: (world space position, 1).

#

Putting a 1 in WorldSpaceLightPos0 just causes an error

#

so how am I supposed to have a shader support other lights

#

typing "WorldSpaceLightPos1" doesn't work

#

And the unity documentation on this command is vague for some reason

frigid yarrow
#

nvm got it to work (kinda)

frigid yarrow
#

I say kinda cause when two lights shine on an object with the shader, this happens

gaunt ridge
#

I just need to express my deep DEEP existential frustration with trying to handle xr in a custom srp in any conceptual way. Nothing works like it seems it should, the documentation is worse then useless, and the existing "examples" in the urp/hdrp appear to require a team to reverse engineer in a way that is comprehendible.

Seriously, spend 10 minutes figuring out how to get a depth buffer down the the render-graph line from a custom shadow pass, spend 2 weeks rebuilding everything over and over on different hardware and software platforms trying to even get the InstanceMultipler method to work even once ever at all in this universe.

#

rage

glacial lotus
#

Shader/PBR material to make models look like tabletop miniatures?

I'm trying to create an aesthetic of a tabletop miniature wargame and make the characters look like minis.

I know one trick is to use a Tilt-shift camera, but I'm also trying to make the models look like miniatures from up-close, I suspect it made need some kind of material/texture/shader that looks like close-up acrylic paint or something of that nature?

Anyone has advice for achieving these visuals?

hearty obsidian
#

I am rendering certain objects on top of everything in a custom render pass.

My goal is to have a different shader behaviour depending on what is drawn underneath, at scene depth. Essentially, I want to do X if whatever's being rendered underneath is in a certain layer, Y if it's not.

I guess what I'm really asking for is ; Is there a way for me to have a texture, similar to the scene depth or the opaque texture, with custom data? I could bake the state in the vertex colors or the uvs, if the above is possible. Would appreciate direction in how I could tackle a problem such as this

acoustic agate
#

Hi everyone, I have some issue for projecting a logo on a sail. With a decal shader it works ok as in upper red area, but I need my custom shader which is below to do that as well. Right now, the custom shader doesn't have alpha transparency carried on the sail. If I use below shader:

        half4 tex2DFrontLogo = tex2D(_FrontLogo, uv_FrontLogo);               // Logo to project on sail
        tex2DFrontLogo * = _LogoTint;                                                                     // Giving the logo a tint color
        o.Albedo = tex2DNode85 * tex2D( _SailTexture, uv_SailTexture ).rgb; // Combining the logo and the sail textures

Any idea, how to include the alpha of the logo included in the projection?

meager pelican
#

The objects underneath would set the stencil with their own attributes. The final composite draw would go based on that...but it would require multiple passes. One for 0 and another for 1.

#

This is because stencil operations aren't variables that you send into the frag shader, they are filters for calling or not-calling the frag. So if you need to do two different things, you have two passes, one for each thing.

#

A completely different way would be to have all your shaders output to an additional render target using MRT. Then you could have a composite pass that reads the resulting render texture for data and make decisions based on that. But ALL your target platforms would have to support MRT, and you'll have to learn how to output to multiple render targets in the frag().

meager pelican
# acoustic agate Hi everyone, I have some issue for projecting a logo on a sail. With a decal sha...

Right now, this:
o.Albedo = tex2DNode85 * tex2D( _SailTexture, uv_SailTexture ).rgb; // Combining the logo and the sail textures
Is combining them with a multiply. What it sounds like you want is a blend, not a tint/multiply.

The formula for a traditional alpha blend is
float3 resultColor.rgb = baseColor.rgb * (1-topColor.a) + topColor.rgb * topColor.a;
And the alpha of the result color is 1 if you use a float4 for it. This is also assuming you're not using premultiplied alpha.

acoustic agate
meager pelican
gaunt ridge
# meager pelican Sounds rough, dude. Sympathy. Although I have to admit I'm a bit surprised yo...

Itโ€™s a minimal custom srp from scratch, shaders and all, which is funnily enough the easy part for me, in the end will be a single forward lit pass, and if I can get it working, instanced/multiview stereo support in it,

Whatโ€™s rough (for me) is trying to figure out what specific incantations need to be done to get the Unity side of the system to work with me, none of these xr or related apis calls in the render context seem to actually do anything, even when returning success values in debugging or on hardware

meager pelican
# glacial lotus **Shader/PBR material to make models look like tabletop miniatures?** I'm tryin...

IDK how to capture the exact look you need for the "close up acrylic paint"...but the PBR shaders SHOULD do that for you out of the box, I would think. If it's "just" modeling a material and not some special effect.

Have you tried looking up such things in a material database?
IDK if this is the best one or not, but just for example: https://www.cgchannel.com/2022/08/physically-based-is-an-amazing-database-of-pbr-material-values/

meager pelican
# gaunt ridge Itโ€™s a minimal custom srp from scratch, shaders and all, which is funnily enough...

You have to enable VR in your project settings, which I'm assuming you've done: https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@16.0/manual/VR-Overview.html. It is designed to use single-pass instanced mode from how it reads (you probably know all this, new to me).

There's an interesting chat about HDRP and VR here, it's 1.5 years old though:
https://forum.unity.com/threads/tips-for-hdrp-vr.1147205/
It includes a video where someone pulled it off, albeit a bit slow.

#

I edited that 1st link above too.

#

GTG, AFK, heading out to work. Good luck ๐Ÿ™‚ Sorry to bail, BBL.

gaunt ridge
meager pelican
#

What caught my attention was when you said "none of these xr or related apis calls in the render context seem to actually do anything, even when returning success values in debugging or on hardware", sounds like something isn't initialized.

sacred stratus
#

would writing your own shader inside a compute shader be much slower?

rare wren
sacred stratus
#

I wanted to make my own svg type format and because normal shaders make no sense to be I thought it would be easyer to write the whole math inside a compute shader instead

slim yew
#

but in urp

#

no documentation what so fucking ever

rare wren
sacred stratus
#

it's just easyer with computeshader

#

computeshader works buffer in buffer out, normal shader is like you give some imput and don't know what happens

rare wren
#

Or see how other svg systems work. Unity also supports them afaik

sacred stratus
#

I don t think that svgs are being calculated on the cpu at all
I think how it works is you have a screensize and for each pixel it checks weather the pixel is on the line

#

Like it s all on gpu
You send lines, colors in and you get out an image

slim yew
#

doesn't unity just compress it all to raster?

#

even already raster images?

sacred stratus
#

No I think unity is able to display raster svg images

slim yew
#

is there a way that I can frustum cull a geometry shader using the direction of the generated vertex and the camera?

#

I'm trying to think of how but I can't really figure it out

grizzled bolt
slim yew
#

float3 pos = input[0].vertex.xyz;
if (dot(_Camera_Direction, _WorldSpaceCameraPos - pos) > _CameraFrustumAngle)
{
  return;
}```
#

does this make sense or am I doing something wrong?

#

_CameraFrustumAngle is manually inputed

slim yew
#

well after some experimenting in C#, the dot between the camera direction and the direction from the object to the camera is some value between -1..1

#

and depending on the FOV the object must be visible if the dot is more than 0.4 for an FOV of 80

#

but this does nothing to performance

#

even when fully looking away from the object, and increasing vertex count, the fps drops

hallow plover
#

how do you get the direction of the main directional light source in scene in shader graph?

slim yew
#

world space position - main light space position normalized

slim yew
#

this is the result I get

#

you can see at the right bottom a grass blade popping in and out

hallow plover
slim yew
#

2022.1 and newer

lunar valley
#

what you are doing doesn't make sense

slim yew
#

no it isn't

lunar valley
lunar valley
slim yew
#

it is happening

#

but it has 0 effect on actual performance

slim yew
#

made the thing in desmos

#

green is camera, purple is camera direction, black is object you're trying to look at

rocky quarry
#

how can i make invisible cube mesh that will hide all meshes inside it but not behind it

digital gust
#

So, from thoughtful research and the simplest tutorials, I tried to get some refraction going, but somehow, my shader wont accept it/show it. Anyone got an idea? The opaque and depth texture is also set in the renderer pipeline

regal stag