#archived-shaders

1 messages ยท Page 144 of 1

devout quarry
#

And that's really neat!

#

I do have one more question

#

so right now in my 'Execute' method, I'm using this right

#

And so 'CreateDrawingSettings' takes a 'ShaderTagId' to determine which shader passes to render

#

But with your proposed methods, I would render shaders passes with ANY ShaderTagId right? How would I do that?

low lichen
#

There's only a few lightmodes that the standard ForwardRenderer in URP will draw, which are these:

UniversalForward
LightweightForward
SRPDefaultUnlit
devout quarry
#

Ah so I'll make a list then

#

Okay that seems promising, will continue tomorrow. Thank you for the explanation and help

grand jolt
#

Hi! I have this setup. My question is why I have to use -.5 to make it all black instead of 0 if Im using a remap node?

lost prairie
#

Hey everyone,
I'm having a little trouble with unlit hdrp tranparent shader. I created a very basic one shown in the screenshot, but as you can see in the result, I'm not getting any transparency, just clipping. Anys ideas what I might be doing wrong?

#

@grand jolt I'm not sure how preview works (if that sphere is 1 unit) but is it possible that it's bigger than 1 so remap returns values below 0? can you try claming remap output for example?

grand jolt
#

@lost prairie Oh, the remap is on meters? I thought it was 0 the bottom of the model and 1 the top (in this case)

low lichen
#

No, it's not in that range necessarily.

lost prairie
#

@grand jolt remap is just units but you're using object space y coordinate. remap doesn't clamp itself though so it can return values beyond given output range.

grand jolt
#

And there is a node that gets the heigth? Or should I create a variable and with a script get the size?

lost prairie
#

@grand jolt you want to make it fade in from bottom to top? admittedly I'm not sure if there's an easy way if the center of the object isn't at bottom (as there isn't height as you asked). but you can always make an exposed field and feed that from outside/material by hand if that works for you

grand jolt
#

Yeah, what Im trying is a fade from top to bottom, and in the fade section (between transparent and opaque) put an emissive line (like its dissolving from there). But yeah, if there is not a node Ill expose it, it will be easier that coding probably

lost prairie
#

@grand jolt another thing you can do, expose a field not for sphere size or bottom point but dissolve level (like in height). then in shader, subtract current position Y from that. negative will be bottom/visible part, positive will be top/invisible part. then you can do some smoothing and glow at edge as well etc etc.

grand jolt
#

Sorry I dont think I undestand that about substracting, do you mean to this? (Being 0 in the substract an exposable value)

#

@lost prairie

vernal coyote
#

I have this shader from a tutorial that produces a distortion effect, but I'm having problems with it distorting objects in front of it too..
https://gyazo.com/d6a0a9f7b35a1e773daa72fc9ad3f91c

How would I go around making it only distort objects behind it? Only thing I see is scene depth, but it seems to act very weirdly..

#

Any ideas?

lost prairie
#

@grand jolt just to test, put a sign after subtraction and feed it into alpha channel. you'll probably see and udnerstand what I mean

grand jolt
#

@lost prairie Yeah! It looks like what I wanted! And sign works better than step here

#

It will depend still in the size but will work

lost prairie
#

@grand jolt sign might be overly sharp but you got the idea. now you can feed a value to change scan line directly which would help controlling it all ๐Ÿ™‚

#

by sharp I mean sharp transition

grand jolt
#

Thank you!

lost prairie
#

no problem! have fun! ๐Ÿ™‚

grand jolt
#

Got it ๐Ÿ˜„

lost prairie
#

nice! ๐Ÿ’ฏ

meager pelican
#

I can't read your pic very well, but that gives you the scene color BEHIND the object** (you want to do that object in a later pass, like transparent pass).

#

You'll want to clip it against the depth buffer.

#

** = it's kind of like a grab pass though, so it's more like "underneath what you're drawing when you draw it" and that could be something that is in front of your object if it was drawn previously. So you need depth clipping.

vernal coyote
#

@meager pelican This is the distortion part of the shader

#

I added the scene depth later but it didn't do anything

#

objects behind the shader appear completely black

#

Also, it fixed the problem too

#

so now if there's a way to make it not black behind th black hole

#

that would be great

vernal coyote
#

Just figured out what to do

#

It's good now

grand jolt
#

Hi guys! I don't know if here is the best place but I don't find a better one. I'm profiling the rendering performance of our game and it would be nice to have a good reference of some of my numbers as I don't find it anywhere on google. We are targeting on current gen consoles (ps4, xbox and a good tier pc).

  • Which number of setpass calls are acceptable?
  • Which number of batches are acceptable?
  • Which number of shadow casters are acceptable?

In some places we have more than 3k setpass calls, above 4k batches and 10k of shadow casters. Obviously the cpu cost there is huge. The are trying to reduce it but if we have a number to compare, it would be easy for us!

valid flax
#

What exactly is the difference between the Screen Position Node and the Position Node set to ViewSpace?

#

(HDRP ShaderGraph btw)

devout quarry
#

Screen position is what it says, position on screen

#

view space is position in camera space, so relative to the camera

#

that's my understanding but if I'm wrong I would love for someone to correct me

#

So you should see view space as the position of the object in the world

#

but measured relative to the camera (so camera as 0,0,0)

valid flax
#

OH

#

And thus the Z component is always Negative

#

That was the underlying question to my question but now that makes sense

#

Thanks!

low lichen
#

Positive Z means in front of the camera

fervent tinsel
devout quarry
#

Oh dear god this is nice

fervent tinsel
#

I nagged about lack of this years ago ๐Ÿ˜„

#

then they put it on some roadmap but it's now finally there

#

well, as a PR anyway

valid flax
#

And the scene depth (Eye Sampling) is a positive value based on how far away a vertex is from the camera?

fervent tinsel
#

(I'm sure plenty of people requested this besides myself as well)

devout quarry
#

for scene depth

valid flax
#

oh god this is starting to make sense! ๐Ÿ˜„

#

thanks!

devout quarry
#

And yeah

#

@valid flax

#

I believe this is the output of scene depth

#

so objects closer to camera, are darker

#

this is the diagram for it

#

so transparent surfaces are ignored

valid flax
#

ye so close = 0 - furthest = 1
unless when in EyeSpace
than close = 0 and vertex = distance based on camera in units

#

right?

#

Also another unrelated question a Clamp node between 0 and 1 is the exact same as a Saturate Node, right?

#

or are there some differences?

devout quarry
#

Here is some more info that might help

#

Saturate is same as clamp01

#

I prefer using saturate

#

"Returns the value of input In clamped between 0 and 1." is for saturate so yes

valid flax
#

perfect! thanks ๐Ÿ˜„

devout quarry
#

@fervent tinsel do you know when the redirect is coming?

#

and will there be a 7.3/7.4, or straight to 8.0?

#

And ๐Ÿ˜ฎ the first commits are from July, they've been working on that node for a while

fervent tinsel
#

they have

#

bit like they've been working on URP deferred and SSAO for a long time

#

also no idea on the redirects target

devout quarry
#

Is 8.0.0 out yet on 2020.1?

fervent tinsel
#

it's totally possible to backport it all the way back to 7.x but it's another thing if they'll do it

#

yes

#

8.0.1 is on package manager

devout quarry
#

Okay neat, going to check it out then

fervent tinsel
#

and 9.x is about to release as well

#

9.x is still compatible with 2020.1 but I'd assume they'll make some hard cut for it working only on 2020.2 at some point when they need some engine API change that can't land on 2020.1 anymore

devout quarry
#

Hmm I'm excited for that roadmap talk then ๐Ÿ™‚

fervent tinsel
#

I think virtual texturing and dots hybrid renderer v2 are currently 9.x exclusive

#

but they might backport them, I wouldn't know

hallow shadow
#

hey, I am using the Universal Render Pipeline and I applied a texture on a game object. with the Standard shader, it looks fine. however, when I use the Universal Render Pipeline > Unlit shader, the game object appears pink

#

does anybody know how I can fix this?

low lichen
#

@hallow shadow Then you're probably not using the Universal Render Pipeline

#

How did you switch to URP?

hallow shadow
#

it was working perfectly before. then I removed some assets (separate assets, with no connection to the URP) and all of my game objects from the scene turned to pink

#

I switched to URP in the build settings menu

#

inside Graphics

low lichen
#

If the Standard shader works, you're using the built in render pipeline

hallow shadow
#

wtf

#

the universal render pipeline is selected in the graphics menu

#

might be some sort of unity bug?

low lichen
#

Not sure

hallow shadow
#

okay, I restarted unity, and inside the 'Graphics' window URP isn't selected anymore

#

I uninstalled URP and installed it again

#

but now URP doesnt appear in that menu anymore

low lichen
#

Do you still have the URP asset in your project somewhere?

#

It's just a scriptable object you have to create.

hallow shadow
#

forgot about that

#

it works

#

thanks!!

grand jolt
#

I wanna remake this shader in shadergraph

#

actually only one thing i want out of it is the color + 1 outline with color

valid flax
#

Outside of my sphere

#

Inside of my sphere

#

I enabled two sided in ShaderGraph

Why does it not look right?

#

I would expect my "inside of my sphere" portion to also be visible when i'm outside of my sphere

amber saffron
#

HDRP or URP @valid flax

valid flax
#

HDRP

#

@amber saffron

amber saffron
#

Check that your material doesn't have zwrite enabled

wanton shadow
amber saffron
#

No, the issue is how transparent rendering works in realtime engine.
I highly suggest that you separate the transparent and opaque vertices into different meshes/submeshes and thus, diffรฉrent materials

wanton shadow
#

I just wanted to make the whole car semi transparent for testing purposes. WIth the alpha channel being at max, you see weird stuff going with faces see through, I thought there was a problem with the model

amber saffron
#

What's the point ร  beeing transparent with alpha at 1 ?

#

Note that to fix your overlapping face issue, you can use "fade" mode

wanton shadow
#

What's the point ร  beeing transparent with alpha at 1 ?
@amber saffron

to show the transparency looks weird, there is something wrong going on, its not how I imagine the transparency to work with alpha at 1. In 3ds max its not like this

amber saffron
#

I don't remember how it looks in 3ds realtime view, but it's totally expected that in the rendering it doesn't look the same : because it's offline rendering with raytracing and not rasterization

#

Like I said, if you want for some reason to draw a mesh that should be opaque, with a transparent shader, set it to "fade" mode

wanton shadow
amber saffron
#

Is the mode composed of multiple separated meshes ? (body, tire guards ...)

wanton shadow
#

in Unity the whole body is one single mesh @amber saffron I can import the model to 3ds max, but I wouldnt know what to look at

grand warren
#

By default transparents don't write to depth buffer, what's the pipeline you're using?

amber saffron
#

That's built-in

#

And that's why I suggested to use "Fade" Rendering mode, as it's supposed to write to depth

grand warren
#

hum ๐Ÿค”

amber saffron
#

But seems it didn't resolve the issue, and that kind of surprises me :/

wanton shadow
#

I tried fade its the same

#

By default transparents don't write to depth buffer, what's the pipeline you're using?
@grand warren

idk what pipeline it is, I am just using standard materials and the transparency is weird

#

I am a noob who needs help with this simple issue ๐Ÿ™‚

amber saffron
#

This looks weird compared to real life or offline raytracing, but in realtime world this is kind of totally expected

#

And the usual fix for this is to split opaque and transparent objects into separated meshes

stone ibex
#

HDRP has a feature called 'transparent depth prepass' that fixes it

gritty linden
#

Whenever I create a new material, Unity assigns it the standard shader. Is it possible for me to change this? Kinda like how in HDRP/URP Unity assings the RP's default lit shader instead of the built-in one.

stone ibex
#

which makes sense that it would have to write to depth buffer before drawing any pixels

#

otherwise it could draw the back first

wanton shadow
#

This looks weird compared to real life or offline raytracing, but in realtime world this is kind of totally expected
@amber saffron

I am pretty sure any 3D modeling software package does this correct in the real time preview

#

I never seen this weird behavior in my life before. How can I fix it?

#

And the usual fix for this is to split opaque and transparent objects into separated meshes
@amber saffron

But I want my whole car to be transparent w/o weird clipping issues. I am sure Unity can handle that ๐Ÿ˜›

#

do I have to install HDRP shader? I think I dont have it

stone ibex
#

it's a whole new rendering pipeline, not just a shader

#

but you could probably take the idea and write a shader in the old pipeline to do it

wanton shadow
#

I just need a quick fix

#

๐Ÿ™‚

stone ibex
#

yeh i dunno then sry

wanton shadow
#

Its insane for me to learn to write sharders when this feature should come out of the box with any transparent material ๐Ÿ™‚

stone ibex
#

it's not as simple as it sounds

#

because the graphics card can't know if the back faces are gonna be rendered first

#

so just writing to depth won't solve it (unless the front faces happen to render first)

wanton shadow
#

games have proper transparancy for 30+ years, I cant believe Unity doesnt provide a proper shader for that

#

the pic above, how did you achieve that transparency effect? @stone ibex

#

did you write a custom shader?

stone ibex
#

transparent depth prepass with hdrp

wanton shadow
#

does one have to code a shader for that?

stone ibex
#

no, but you have to replace/update all your shaders

#

standard shader doesn't work with it

#

(you have to use HDRP Lit, etc)

#

that's the settings to achieve the above

wanton shadow
#

thanks!

#

do I have to install the HDRP from the packet manager?

stone ibex
#

yeah

amber saffron
#

The Fade mode is supposed to do all this like I said

wanton shadow
#

will it have a performance impact on my project or the run time?

#

The Fade mode is supposed to do all this like I said
@amber saffron
with HDPR right?

stone ibex
#

yes, most likely

wanton shadow
#

fade didnt work for legacy shader

amber saffron
#

No, in built-in renderer

wanton shadow
#

it didnt help

amber saffron
wanton shadow
#

exactly what I need

"Fade - Allows the transparency values to entirely fade an object out, including any specular highlights or reflections it may have. This mode is useful if you want to animate an object fading in or out"

#

its still have culling issues

#

as seen in the video

amber saffron
#

Yes, I see that, and that's what bothers me here, it shouldn't

wanton shadow
#

๐Ÿ™‚

#

is there a possibility there is some problem with the model / faces ?

amber saffron
#

Oh : is it one mesh renderer with multiple materials set in the inspector ?

wanton shadow
#

y

#

2 materials

amber saffron
#

The grey and red, or two reds ?

wanton shadow
#

lol, fade for the 2nd material worked!

#

yes, red and gray, let me show a video

#

I set both mat. to "fade", didnt help

stone ibex
#

fade doesn't even draw an opaque mesh correctly for me

wanton shadow
#

but you said it should? ๐Ÿ™‚

amber saffron
#

Is this model free to download somewhere by any chance ?

wanton shadow
#

yes, I can give it to you

#

Idk where I got it, its form Rocket League

stone ibex
#

i didn't say it should, remy did ๐Ÿ™‚

#

that's just default shader with fade

wanton shadow
#

yep, its bad

#

I cant belive Unity cant do a simple fade with standard assets, I am speechless

amber saffron
#

I'm only rephrasing the doc The hologram in this image is rendered using the Fade mode, because it is supposed to represent an opaque object that is partially faded out. ๐Ÿ˜„

stone ibex
#

yeah but that hologram has the same problem

#

just less evident because it's less details

amber saffron
#

hum, true, didn't catch that

wanton shadow
#

so no solution? I dont want to use HDRP, I have a simple project and need a simple fade transparency games use for over 30 years ๐Ÿ™‚

amber saffron
#

I'm importing the car (or at least a similar I found)

stone ibex
#

this surface shader fixes it

wanton shadow
#

an ultra stupid question, how do I apply this shader?

stone ibex
#

put it in your project, then it'll be under Custom > FadeSurfaceShader

wanton shadow
#

yes, I have it in my assets. I think just drag and dropping it to the material 3d previews applies it

#

oh yea, its where you said it is

stone ibex
#

yeah not sure, i just chose it from the dropdown

wanton shadow
#

omg its perfect now! I cant thank you enough!

stone ibex
#

it doesn't seem to have things like normal maps on that default surface shader though ๐Ÿ˜ฆ

wanton shadow
#

its fine, the fade is for debug / testing purposes

#

to see lines and stuff

stone ibex
#

yeh cool

wanton shadow
#

isnt it weird thought such a shader you gave me is not part of the standard shaders / materials?

#

I mean its pretty mind blown to me they dont have it

#

considering you changed only 3 lines of code

stone ibex
#

i dunno, a lot of things that are reasonably easy aren't built in

#

(there's so many combinations of what people want, it would be impossible to include everything)

amber saffron
#

he only changed 3 lines of code from the shader file template not from the standard shader

stone ibex
#

yeah that too, the standard shader is a lot more complex

wanton shadow
#

well I mean many people would want a non culling fade shader, its not like its smth exotic so I would expect it to be included ๐Ÿ™‚

#

anyway, thanks again for your help! @stone ibex

stone ibex
#

np

amber saffron
#

Hum, I was wrong, the fade mode only changes the global blending mode, it has nothing to do with z-write ๐Ÿ˜ฆ

#

And I don't think a lot of people have the use to a depth prepass for transparent.

#

Well, at least in HDRP it's built-in now ๐Ÿ™‚

stone ibex
#

it's useful for trying to make any kind of transparent 3d stuff really.. meshes look weird when you see some hidden faces

#

but yeah, it's not like it's impossible to implement (would be a bit more work to have normals and stuff but still viable)

amber saffron
#

Well, that's the point of transparent : you see what is behind the face. If you have a complex mesh with opaque + transparent : separate the materials

wanton shadow
#

its just I was using 3ds max more then 15 years ago with standard materials and changing the transparency would give you what you expect in my video above - no culling. Its what you expect from transparency, I would have never imagined one has to write a custom shader for it

simple frost
#

coming into this halfway through, I think you need to have transparency write to custom depth buffer

#

which should be a flag on the material

#

oh nope, that was suggested, let me read more

#

ah gotcha this is using builtin rendering

#

Complex transparent objects in front of each other are always a nightmare to draw. Normally you can sort objects by distance, but any non-convex object is still going to have places that break like above. Technically both results are "wrong" (depth prepass or draw order weirdness) in terms of how it should be rendered, but doing a depth prepass is more expensive and in most cases is not needed. I would be surprised if builtin didn't have a solution for this though

lofty gate
#

Hey peeps
Quick question
When you send a mesh into a shader (i'm making a run-time generated mesh in Unity)
Is it possible to send a single, small (a byte would be plenty) per triangle?

kind of like sending vertex colors into the shader
i just think it's silly to have to send 3 vertex colors for 1 tri, much rather encode 1 value per tri, can't really think of how to pass that data along with the mesh.

I really just need a performant way of sending a byte that can be converted into a color per triangle

#

Would i need to use a geometry shader just to be able to optimize, or should i just use the third value of a UV, or is there some way to pass custom data through?

#

My application for this is just that i want to make my run-time generated mesh have a saturation byte assocaited with each triangle. The triangle itself is shaded by the information of it's material, but the main colour is multiplied by my saturation value per triangle

low lichen
#

@lofty gate You might be able to use SV_PrimitiveID to get the index of the current triangle in the fragment shader and use that to access an array that you pass to the shader.

#

But since the UV is passed as a float4, you're not losing anything by passing in a custom value in the z or w component of it.

lofty gate
#

oh so i'm using that space regardless?

#

If it's allocated as a float4 in memory then having data in it doesn't change performance

#

Ohh hmm... i technically wouldnt have to use UV data at all if my solution worked

#

The SV_PrimitiveID seems to only be accessible from within a non-surface shader

#

dang it

dusk compass
#

Has anyone else had issues with the shader graph exposed properties not showing in the inspector?

#

Found it.... you have to hit "save asset" in the top left...

gritty linden
#

Could anyone help me with a normal map algorithm? There are some deformities in the surface's normal. To the left is how it should look with a neutral normal map and to the right is how it actually looks.

gleaming moss
#

bare minimum you're not expanding the normal value read from the normal map

#

also not sure what's going on with your TBN basis but that code doesn't look correct

gritty linden
#

Wait, could you please elaborate? I'm kinda new to computer graphics :s I was mostly following some tutorials

gleaming moss
#

Sure-- so generally Unity is going to have all texture data as unsigned normalized (aka UNORM for short) values, meaning they're always in the range 0-1

#

however you can (and often will) have negative components

#

the workaround is to convert the range by scaling the value by 2 and subtracting 1, thus changing [0 - 1] to [-1 - 1]

gritty linden
#

Okay, I get it

#

Where would I need to use this, then?

gleaming moss
#

you can just whap that at the end of your normal map load line

#

the second part (and this might be more subtle and/or your data is different from what I expect) but the way you send the tangent basis to the fragment shader looks wrong

#

I'm not sure why you're combining components from the different basis vectors

#

the tangent basis is actually the collection of the tangent, bitangent and normal vector

#

loosely the unit X, Y and Z vectors aligned to the surface of the mesh

#

fond of the mikktspace reconstruction since it's normalMap.r * tangent + normalMap.g * bitangent + normalMap.b * normal

#

really bop you over the head with it obvious

gritty linden
gleaming moss
#

is that with or without the basis fix

gritty linden
#
    surface.normal.y = dot(input.tspace1, tNormal);
    surface.normal.z = dot(input.tspace2, tNormal);
    surface.normal *= 2;
    surface.normal -= 1;```
#

Is this right?

gleaming moss
#

scale first

#

right after the load

gritty linden
#

And what do you mean with combining components?

#

Oh, right, after loading the texture

gleaming moss
#

unfortunately I have a hard time copying text since it's an image, but where you declare tNormal

gritty linden
#
    
    tNormal *= 2;
    tNormal -= 1;

    Surface surface;
    surface.position = input.positionWS;
    surface.normal = normalize(input.normalWS);

    surface.normal.x = dot(input.tspace0, tNormal);
    surface.normal.y = dot(input.tspace1, tNormal);
    surface.normal.z = dot(input.tspace2, tNormal);```
gleaming moss
#

yep

#

you can also toss that unpack in a helper function, it's pretty useful

gritty linden
#

Oh, it works now! Thank you so much :)

gleaming moss
#

Yeah there are a few ways to (heh) skin a cat on the normal map conversion. I like Morten's approach above but there are a few ways to do it

tall chasm
#

I have a question: My game object only has different albedo textures. Something like skins. So do I create multiple materials with the different albedo textures attached to it or do I swap the textures on runtime based on player's seleted skin so that I only have 1 material?

stone ibex
#

the latter would probably be easier to manage. they'll have separate material instances either way at runtime

lone stream
#

I'm wondering how they handle a dynamic object receiving baked shadow ๐Ÿค” . Those baked area shadow looks very nice

stone ibex
#

probes?

#

not sure

lone stream
#

hmm lppv might work, need a dense probes on shadow area

stone ibex
#

they could have some trick to just sample it from the ground too (hard to tell if that could be the case from that gif)

prime pasture
#

The object itself does receive shadows, just when I use the shader the shadows disappear

#

By the way, I am using the new URP, so maybe something changed there? I remember it working before in the previous pipeline

lone stream
#

@stone ibex ah that's make sense, using planar projection could work for this type of object

wraith wing
#

hi guys, how to make opacity map work on unity (the grayscale one)?, so need semi transparent material here (grey 50%)

remote mauve
#

I read that if statements are bad for shader performance, so should I rewrite things like these into using ? : instead, or does compiler handle it automatically?

if (abs(denom.x) > abs(denom.y)) {
    uv.y = (i.data1.x - i.data2.x * uv.x) / denom.x;
} else {
    uv.y = (i.data1.y - i.data2.y * uv.x) / denom.y;
}
gritty linden
#

AFAIK the difference isn't too considerable, at least for conventional programming languages. Not sure about something like HLSL/GLSL.

#

When importing a texture, there's an option to mark it as a normal map. What difference does it make in a custom shader code?

devout quarry
#

_SampleTexture2DLOD_RGBA.rgb = UnpackNormalRGorAG(_SampleTexture2DLOD_RGBA);

#

will be called

#

You can find those functions here

gritty linden
#

That link you sent has no function called UnpackNormalRGorAG

devout quarry
#

Yeah that exact function does not exist

#

UnpackNormalRG does

#

UnpackNormalAG does too

#

But I mean, a normal texture (here I mean normal, not 'regular') stores directions, albedo texture stores colors

#

So it would make sense they need to do some processing to extract the data from the texture in a different way than they would process another texture

#

So you need to mark it as a 'normal map'

gritty linden
#

Oh, right ๐Ÿคฆโ€โ™‚๏ธ my bad

devout quarry
#

and UnpackNormalmapRGorAG does exist on that page btw

#

so yeah a bit different name

#

but you can look at what it does

gritty linden
#

Hmm, it multiplies by 2 and decreases by one. In that case, marking it as normal makes that operation automatically?

devout quarry
#

Uhm I'm not sure exactly what marking it as a normal map does, I think it just sets a flag for that texture so that when it's used later in the rendering process, the correct data is extracted from it by calling some code

gritty linden
#

Hmm, okay

#

Now, another question - Yesterday, I believe, I asked here something about why my normal mapping algorithm wouldn't work. I just realized now that marking the textures as normal maps makes... Well, the result just isn't right

#

I'm pretty sure that if someone else were to use the shader I'm working on, they would probably use a texture marked as a normal map and it wouldn't work.

#

I just found out and yes, marking it as a normal map calls the UnpackNormal operation

#

The thing is, if I DON'T add a normal map the the surface's normal becomes all janky

#

oh, wait

#

How could I fix this?

#

Oh, nevermind, it's not UnpackNormalRGB, it's only UnpackNormal

gleaming moss
#

Yes, the *2 - 1 trick I explained earlier does the same thing

#

if you have both the manual version and the Unity-applied version then the effect will stack and your normal will behave strangely

gritty linden
#

Mhmm, I tried using that method but it was saying undefined

#

I didn't know I had to include a file, the tutorial on the documentation just slaps the function in there

shut swan
#

I've been messing with shaders and

gleaming moss
#

them's some aliased pixels

shut swan
#

lol

#

love the toilet

#

lmao

#

the toilet was the most effected lol

gleaming moss
#

I'm trying to come up with a joke about renaming the LOD biases or point filtering to Extra Aliasing

shut swan
#

extra polygons

#

lol

autumn tiger
#

you really been messing with em

#

it's a mess

cursive jewel
#

Hi,
I am new to shader programing. I was trying to write a shader in which when we select a _Color, that color becomes transparent.
.
I some how managed to write it, but its NOT perfect. How can I improve this code and add a tolerance so that colors almost identical to _Color also gets transparent

#

.
```fixed4 fragmentFunction (v2f IN) : SV_Target{

            float4 textureColor = tex2D(_MainTex, IN.uv);
            if(all(textureColor==_Color)){
                discard;
            }
            
            return (textureColor);
        }```
cursive jewel
#

Please help ๐Ÿ™

cosmic prairie
#

@cursive jewel I guess (abs(textureColor - _Color) < tolerance)

ocean kestrel
#

Hey , Er, I guess i'm in the right place :

I'm facing an error and don't understand how to solve it :

Assembly has reference to non-existent assembly 'Unity.Postprocessing.Runtime' (Packages/com.unity.postprocessing/Tests/Runtime/Unity.Postprocessing.Runtime.Tests.asmdef)

#

I imported a package and this error came out

#

Help please, if i'm in the wrong channel please tell me ^^

ocean kestrel
#

Okay I solved it with wtf things, unity is something bugged with postprocessing

clever dust
#

Just a green effect, but i'm having difficulty with the Image effect shader

grand jolt
#

Does shader graph work with 3d

stone sandal
#

shader graph is only compatible with scriptable render pipelines (like universal or high definition), but not the built-in 3d renderer

grand jolt
#

so yes?

#

If I have a SRP in my 3d game?

stone sandal
#

if you are using iether universal RP or high definition render pipeline, shader graph will work

devout quarry
#

I'm having an issue setting a SG keyword by script

#

I have this in my properties

#

And the output is switched like this

#

so between texture/color

#

In my C# code I'm using Shader.DisableKeyword("OUTLINE_TEXTURE_ON"); and Shader.EnableKeyword("OUTLINE_TEXTURE_ON"); but there is no effect

#

Using this (global + exposed)

#

Doesn't work either by switching it in the inspector

#

Local + exposed does work

stone sandal
#

did you try unexposed global?

devout quarry
#

Yup I did

#

But I am doing this in some custom render code

#

hold on

#

Hmm I think the issue is not with the keyword, my bad

devout quarry
#

@low lichen The technique doesn't seem to be working

#

I have this

#

With drawSettings allowing the shaderPasses with the lightMode "SRPDefaultUnlit" to draw

#

but it draws the material to the render texture as if the keyword was disabled, so not with the texture I want

#

I have no idea why :/

low lichen
#

Hmm, I'm wondering if DrawRenderers is maybe queued/async in some way

#

Then how about doing it in a command buffer and scheduling that with context.ExecuteCommandBuffer?

#

@devout quarry

devout quarry
#

How exactly would I do that? I have never used them

#

I mean wait

low lichen
#

@devout quarry The example on that page shows it. Instead of the myCommandBuffer.SetViewMatrix(myViewMatrix); command, you'd do myCommandBuffer.EnableShaderKeyword("OUTLINE_TEXTURE_ON");

devout quarry
#

succes!

#

Now I can set the outline texture (red one) in the shader

#

So how come the command buffer does work?

#

commandbuffer is a way to make things happen before DrawRenderers?

#

Ah right "List of graphics commands to execute."

#

Damn they seem useful, will read up on them. Thanks a bunch

low lichen
#

CommandBuffer existed long before SRPs. In the built in render pipeline, you can add command buffers to cameras to execute at certain events, like draw a mesh after rendering opaques. This was the basic scripting of the render pipeline that was possible before SRPs. Now they are mostly used as a handy way to create a list of graphic commands that can be executed some time later. You can also execute them immediately using Graphics.ExecuteCommandBuffer.

#

There are also some commands in CommandBuffers that aren't available anywhere else, like the CommandBuffer.EnableScissorRect. As far as I know, there's no other way to enable scissor testing in Unity.

#

It worked in this case simply because you were able to add that keyword enable into the internal SRP queue. Before, you were enabling the keyword, adding DrawRenderers into the queue, disabling the keyword, then sometime later the renderers are drawn, with the keyword now disabled.

merry rose
#

Any idea how to update vertex normals in Shader Graph, I can update them with vector values but it does not want to be updated with texture ๐Ÿค”

devout quarry
#

Use sampletextureLOD @merry rose

#

This is the key "This Node is useful for sampling a Texture in the vertex Shader Stage as the Sample Texture 2D Node is unavailable in this Shader Stage."

merry rose
#

Ouu yeah, I totally forgot about that, thank you so much

sharp verge
#

Hey so not sure if this the right place to ask but: I'm planning on eventually putting some materials up on the Asset Store, and I was wondering what people's expectations are in terms of support for the different pipelines. Currently I'm working on a shader graph that allows you to customise the materials a bunch of different ways and such, but as I understand it that isn't supported on the standard pipeline which a lot of people still use (I believe?), so I'm guessing it would be good practise to also offer a version that uses the standard material rather then the customised shader, right? Also, are HDRP and URP shaders compatible, in that I only need to offer a single shader graph for both pipelines, or would I need duplicate versions?

glacial parrot
#

Is there a way to tell why a replacement shader is just not applying? I'm trying a simple render to a depth texture.

#

For some reason it's just...not. The display is the same as if I wasn't doing anything to the camera.

low lichen
#

@glacial parrot Are you using URP or HDRP?

glacial parrot
#

Standard

#

Thing is, I have a far more complicated shader replacement working.

#

I really just need the depth texture, period.

#

And save that as a png.

#

Could I just access that?

#

That shader actually throws a warning that the output is not fully initialized in the vert function.

#

Okay, I think I'm getting somewhere. Manually setting it (outside of my export function) to use the replaced shader makes the camera preview completely black.

glacial parrot
#

Strange, it seems as though the macros don't do anything, and I have to to them manually.

#

No depth buffer, I guess?

glacial parrot
#

Okay, just using Linear01Depth on the z position seems to do what I need.

#

In case anyone else comes here and searches for the answer

outer whale
#

could someone help me convert this to rotate around a different axis? im good with matrix math and am just getting into shaderlab

{
  float alpha = degrees * UNITY_PI / 180.0;
  float sina, cosa;
  sincos(alpha, sina, cosa);
  float2x2 m = float2x2(cosa, -sina, sina, cosa);
  return float3(mul(m, vertex.xz), vertex.y).xzy;
}```
simply changing the last line to `return float3(mul(m, vertex.xy), vertex.z).xzy;` doesnt change anything
outer whale
#

oh thanks

#

how would i apply the float3x3 rotation to a float3 vertex?

gleaming moss
#

multiply them

outer whale
#

just like float3 rotated = vert.xyz * AngleAxis3x3(_DTime * 360, float3(1, 0, 0));? like i said, im horrible with matrix math and just got started with shaderlab

gleaming moss
#

should be mul(your_matrix, your_vector)

outer whale
#

thx

mortal sorrel
#

Hi all, I am trying to modify Unity's ProjectorLight shader. I would like to have a large orthographic size, so I can't affect a large area of GameObjects but also a "Scale" variable to control the size of the cookie it renders. I have tried applying a _Scale variable to the vertex positions but that didn't do the trick.

#

I have a grid I would like to have at a fixed size. When I increase the ortographic size the grid increases, which makes sense. However, I would like to apply a counter scale factor to it so it reduces in size. I have tried illustrating it with this gif:

low lichen
#

A projector is pretty expensive because it redraws all the geometry it hits, so it can easily nearly double your draw calls.

#

I assume you need this grid to get projected onto the surface instead of just being flat?

mortal sorrel
#

I rather have it flat honestly, so each cell doesn't get warped. Guess I could just go with a plane.

low lichen
#

Yeah, that makes more sense to me, just a transparent plane.

#

If this isn't for mobile, then you can get away with that overdraw.

mortal sorrel
#

Alright, thank you for screwing on my head ๐Ÿ™‚

#

Its a compliment if you were in doubt

fresh spire
#

@regal stag i found a solution to my problem about shader system, all i do is use 2 camera: one for the game and one for the ui part

#

lol.......

#

now i got an interesting weird bug XD

#

one moment

prime pasture
#

I try to render a camera using RenderWithShader, and I pass them a shader that should color a shadow, but I cant get any shadow details from the shader, this is what I did:

Shader "Leap/ShadowPlane"
{
    Properties
    {
        _MainTex("Texture", 2D) = "white" {}
        _ShadowColor("Shadow Color", Color) = (0.0, 0.0, 0.0, 1.0)
    }
    SubShader
    {
        Tags { "Queue" = "AlphaTest" }

        Pass
        {
            Tags {"LightMode" = "ForwardBase" }
            Cull Back

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

            #include "UnityCG.cginc"
            #include "AutoLight.cginc"

            sampler2D _MainTex;
            float4 _ShadowColor;

            struct v2f
            {
                float4 pos : SV_POSITION;
                float2 uv : TEXCOORD0;
                float4 screenUV : TEXCOORD1;
                LIGHTING_COORDS(2, 3)
            };

            v2f vert (appdata_base v)
            {
                v2f o;
                o.pos = UnityObjectToClipPos(v.vertex);
                o.uv = v.texcoord;
                o.screenUV = ComputeScreenPos(o.pos);
                TRANSFER_VERTEX_TO_FRAGMENT(o);

                return o;
            }

            fixed4 frag (v2f i) : SV_Target
            {
                float attenuation = LIGHT_ATTENUATION(i);
                float shad = (1 - attenuation) * _ShadowColor.a;

                fixed4 col = tex2D(_MainTex, i.uv);
                col.rgb = lerp(col.rgb, _ShadowColor, shad);
                col.a = shad;

                return col;
            }
            ENDCG
        }
    }
}
#

If you ignore everything but the lighting, what I did wrong that the attenuation is wrong?

#

I couldn't find any docs for LIGHTING_COORDS and such just snippets of code, if someone know where they are, please let me know, that would be great! (maybe inside AutoLight.cginc?)

#

Just for context: I render only a player and a plane under the player, for this question you can assume I only want to populate the alpha channel with the shad variable that is basically the player shadow

#

I get information from attenuation but not the player shadow

grand jolt
#

anyone know what a webgl build would go black screen after adding a new shader

#

why*

unborn orbit
#

Hey, does anyone know if the built-in URP Terrain/Lit shader supports height-based blending from the alpha channel? I have the "Enabled Height-based blend" ticked but as far as I can tell that only uses the singular height value that you can set in the layer properties

slate patrol
#

I'm finally starting to learn some compute shaders

#

So far, pretty straightforward once you know a bit how GPUs actually work and how the workload is distributed

#

However, I don't get one thing about them

#

Let's say that I'm doing some compute work that I perform before doing, say, shadowmaps.
There's your dispatch method (in commandbuffer, for example). I schedule it and the compute shader is scheduled to be performed in async (via CommandBufferAsync).
Then I do shadowmap rendering with traditional shaders.

#

Ideally, this will provide a scenario where the depth shaders are not utilizing compute units to their full extent, so the compute shader's warps are going to be executed when the GPU will spot some empty/stalled threadgroups.

#

Now, here's the problem.

#

How do I actually achieve that scenario? How do I schedule the compute shader in a way for it to be truly executed asynchronously (so it wouldn't finish forcefully the moment it was scheduled) and how do I later wait for this compute shader to finish if I have to?

wheat knot
#

Hey, I'm kinda new to the whole Unity Shader graph thingy. So I'm trying to make a shader that just simply mixes two texture sets together and I need to animate it from one texture set to another. So is there a simple mix node that I could control with vector1 node, kinda same way I did it in Blenders mix node like this.

shadow kraken
#

Lerp @wheat knot

wheat knot
#

Ah thanks :D

long rune
#

I have this weird shader glitch where the shader only becomes visible in the game view when im looking through the editor window, anyone see something like this before?

#

Works on multi pass rendering but not single?

long rune
#

No one?

#

Figured it out, thanks me

serene lintel
#

Hi, I would need an HDRP Shader like this:
https://www.youtube.com/watch?v=j4J2QHr-cB4&feature=emb_logo

I could not find one on the Assetstore. Any ideas? Can anyone create that(paid)?

The Caustics Generator software is a program for creating animated caustics light pattern images.
These images are ideal for use as textures in real-time applications and visualizations of water.

This video shows footage of a real-time example of caustics textures used in the...

โ–ถ Play video
grand jolt
#

hello, I was wondering how I could achieve that old nokia phone screen look

fluid pollen
#

Shader Graph question:
could anyone help me with what kind of nodes I would need for creating a splat map shader like one for a terrain to apply different textures depending on the height of the vertices/angle of the slope kind of deal

amber saffron
#

Normal vector in world space will be you friend here @fluid pollen

fluid pollen
#

I see thanks, testing with it now

#

is there a best way to layer the textures?

#

hmm actually let me test something

#

thanks for the advice!

devout quarry
#

Does anybody know how I can easily take a high-res image of a whole shader graph?

amber saffron
#

You can't

#

Last time I wanted a screenshot of a huge graph, I had to compose multiple ones in photoshop

devout quarry
#

Too bad

#

I submitted it as an idea to the product board. It's definitely a 'nice to have' thing for me, non essential but it would make sharing graphs a lot easier

shadow kraken
#

Yeah, Substance Designer has this feature, it's nice

serene lintel
#

Hi, I would need an HDRP Shader like this:
https://www.youtube.com/watch?v=j4J2QHr-cB4&feature=emb_logo

I could not find one on the Assetstore. Any ideas? Can anyone create that(paid)?
anyone?

The Caustics Generator software is a program for creating animated caustics light pattern images.
These images are ideal for use as textures in real-time applications and visualizations of water.

This video shows footage of a real-time example of caustics textures used in the...

โ–ถ Play video
devout quarry
#

@serene lintel

#

Here is a tutorial where they add caustics

#

maybe in HDRP you could use the projector component? But you could do the caustics as well in the shader and project them by reconstructing world space by depth (like in the tutorial)

#

When it comes to the visuals of the caustics, this might help

serene lintel
#

Thank you very much! I canยดt really do that myself because my technical skills are... not existing. But would you consider writing a shader like that for me? I would pay for it of course

devout quarry
#

The tutorial I linked is a start-to-finish tutorial, why not give it a try and see where you get?

#

I have a caustics shader but it's for URP only at the moment, could be converted to HDRP though I think but not sure at this moment

#

If you want to hire people to write this shader, you can check out Unity Connect https://connect.unity.com/

Unity Connect

The first talent marketplace dedicated to the full spectrum of Unity creators โ€” game developers, artists, programmers, VR/AR developers, and more. Find game dev jobs, source Unity talent, and post tasks to get help on your Unity projects.

serene lintel
#

If I had the time, I would try it myself but I am very busy with a production. So itยดs totally fine for me to outsource that

#

oh thanks!

#

I didn't know about unity connect ๐Ÿ™‚

devout quarry
#

@serene lintel

#

one more thing

#

Crest was released for HDRP, it's far more than just caustics obviously but might fit your needs

serene lintel
#

Thanks, I own crest already and they asked me to post the specific pool thing on this discord server. I have an ocean and a pool and need 2 different water types. Thatยดs not yet supported by Crest (but will be coming)

#

Thank you very much for your help ๐Ÿ™‚

devout quarry
#

Ok, goodluck

dire jolt
#

I am looking for some help to color my water within shader graph. i hoped using either a position node or the normal vector node but neither doesnt work for me. i want to make the top waves have a lighter color and the rest a darker color. but i am stuck on how to achieve this.

Can someone help/explain how i could achieve it?

devout quarry
#

How are you generating the waves?

dire jolt
#

with a sine wave

devout quarry
#

Alright, and in the master node, do you have anything plugged in there in the normals slot?

dire jolt
devout quarry
#

Personally what I would do is use a fresnel node to do the coloring

#

I'll show you what that gives, one second

dire jolt
#

Ty!

#

I hoped that i could have made them change color of the height useing the position node but sadly it didnt work like i had it in my head

gleaming moss
#

you absolutely can, you just need to change the space of the position node to something like 'Object' and isolate a particular height range

#

working in world space is probably not the best idea for that type of thing

devout quarry
#

This is the result of the fresnel node, it's not exactly the 'top' of the waves being colored but gives a similar effect

dire jolt
#

I tried that but it didnt work?

#

@devout quarry Okay yeah i get the idea. do u multiply that with the color or emmision?

devout quarry
#

I don't multiply in my case but I put it ends up in the color slot yes

dire jolt
#

Il try that

devout quarry
#

And this is with position node

dire jolt
#

huh

devout quarry
#

This is position node in object mode, and the y component of that

#

and then you can use that to lerp between color A and B

#

and so like InvalidPointer said you can remap/step whatever to get a certain range

dire jolt
#

thats something i would want

#

can u show me that setup?

gleaming moss
#

also try a pow() to get more contrasty peaks

#

or just huck it in a gradient for full control

dire jolt
#

do u achieve that by splitting the position node and using the G as a Lerp T?

devout quarry
#

This is the basics, without remapping the range or power

gleaming moss
#

again, gradients are also a good choice here

dire jolt
#

yeah oke lemme try this

devout quarry
#

Yeah but gradients are not exposable in the material editor so a pain to work with

gleaming moss
#

can probably just throw the position Y in there directly and ASSUME DIRECT CONTROL OF THIS FORM tweak to your heart's content

#

I don't think there's anything innately wrong with specializing the shader like that

#

maybe more of a problem if you're faking lighting

#

which, to be fair, we are

devout quarry
#

Modifying a gradient in the shader and having to compile the graph each time you want to see a change.. not for me ๐Ÿ™‚

#

I'd rather have a lerp between 2 or 3 colors

dire jolt
#

So for me this doesnt work ๐Ÿ˜ฆ

#

But i do have to say that i am on unity 2019.1 and in the LRWP ๐Ÿ˜ฆ its a internship project so i have to build it within these constraints

gleaming moss
#

did you change the space dropdown on your position node

#

since it does not look like you did

#

(could also be a range issue, but first things first)

dire jolt
#

changed it to object

gleaming moss
#

ok, so where are the bottoms of the wave in object space relative to the tops

#

are they all the way at the bottom of the object itself or is everything crunched around the middle

#

render pipeline should not affect this approach

dire jolt
#

its just a simple plane with extra subdivisions

gleaming moss
#

how are you making the waves

dire jolt
#

using a sine node and absolute + one minus

devout quarry
#

And so you plug it into the position slote

dire jolt
#

Might be hard to see

gleaming moss
#

so when you generate the color

#

are you taking the displacements you made into account

#

I now have a feeling you aren't

dire jolt
#

uhm no,

#

Facepalm

gleaming moss
#

they are not magic, btw

#

ok-- was going to say that node just reads the model value

#

so if everything is the same color mystery solved

#

plane mesh

devout quarry
#

No

#

in my graph I just use position node and it works fine

gleaming moss
#

grok, but that's not what raikuns is doing

dire jolt
#

in my head it should have worked like u said Alex but it doenst ๐Ÿ˜„

#

but i completly understand invalidpointer his logic

#

makes sense

gleaming moss
#

so if you were generating things and saving them in the mesh then you can do what Alex is doing

dire jolt
#

but doesnt the position node update live when u make changed to the normalS?

gleaming moss
#

nothing wrong with it, might need it for CPU physics, etc.

devout quarry
#

If you change the vertex position in the master node, afaik the position node will take that into account

low lichen
#

It depends if you're sampling the position in the vertex stage or the fragment stage. The position the fragment stage gets is going to be displaced by the vertex shader.

devout quarry
#

voila

low lichen
#

And I assume it depends where the nodes ultimately connect to which determines what stage they are in.

gleaming moss
#

actually, dumb thought

#

you have the displacement already

#

you can just throw that in the color blend directly

dire jolt
#

So after i use the combine node to add on the displacement. i feed the RGB into the position and the RGBA into the lerp. it works but not completly

low lichen
#

The T property should be between 0 and 1. How certain are you that the value you're giving it is in that range?

dire jolt
#

I should clamp them then?

pine arch
#

Anyone managed to do an outline effect for a given mesh on a scene using HDRP ? I looked at custom pass but it's a bit too complexe for my skills. I also tried looking at custom post process, but same problem...

dire jolt
#

or remap them into 0-1

low lichen
#

@dire jolt No, better to use the Remap node. You have to know what the minimum and maximum heights of the waves are so you can assign 0 for the minimum and 1 for the maximum

devout quarry
#

@pine arch Other than post processing or custom pass, you could inflate the mesh based on surface normal

#

won't do 'inside' lines though

gleaming moss
#

inside lines are a PITA ^

devout quarry
#

But definitely not my preferred way of doing outlines

gleaming moss
#

those displacements are... not good ๐Ÿ˜

pine arch
#

thank you, but i already watched this video and the result is too random i think

#

For some meshes i think the inflating technique won't work very well

devout quarry
#

Then I don't know any other techniques. I think you'll need a custom pass or post process effect

pine arch
gleaming moss
pine arch
#

but i can't figure out how to edit the shader to increase the ouline width

gleaming moss
#

need to consider more pixels

#

it's actually not a trivial edit

#

extremely straightforward for mesh approaches tho

pine arch
#

@gleaming moss what techniques are you using on your example ?

gleaming moss
#

hull inflation and some GPU warlock projection matrix tricks for constant sizing

pine arch
#

the warlock part scares me

#

:p

gleaming moss
#

also used MSAA for image quality

#

it's actually a one-liner-- just using the W component in scaling

#

note it is hand-written, though

#

all HLSL

pine arch
#

but this technique needs you to use a custom shader in all the meshes materials you want to ouline, right ?

gleaming moss
#

yes

#

not an issue in my case since you usually need that for cel shading anyway

#

it's an extra pass and URP magically makes the outline appear

#

literally no effort

pine arch
#

i see

#

but if you wanted to only outline one mesh

devout quarry
#

Use a rendering layer mask then

pine arch
#

editing the material would outline all the meshes using it

gleaming moss
#

yes

pine arch
#

@devout quarry i saw a Brackeys video about that but it was applying the same material to everything in the given layer

devout quarry
#

Ah yes MentallyStable, rendering layer mask, I implemented it and works perfectly, nice trick

#

Not much documentation on them though it seems

amber saffron
pine arch
#

i don't think this example worked on the last version of hdrp

#

or i just didn't figure out how to

low lichen
#

@devout quarry Yeah, I saw that. Happy to see you got it working. There's also a trick I'm using to give the layers names instead of the default LayerX

pine arch
#

i might need to try again i can't recall

devout quarry
#

Do you mind sharing how you achieve that? I'm interested

pine arch
#

about the rendering layer way, could you give me a few more details on how it would work ?

#

just the theory

devout quarry
#

In a custom render pass you use something like this

#

Where renderingLayerMask is a uint

pine arch
#

how ok you use rendering layer and custom pass

#

but you limit the custom pass to a render layer ok i see

low lichen
#

Basically the render pipeline asset has a string array property where it can define the names of these layers, but URP and probably HDRP too just return null, so it uses the default names

#

But you can inherit UniversalRenderPipelineAsset and override this property to give them whatever names you want

#

And you can also override stuff like default material that gets added to new game objects

devout quarry
#

Ah that's neat, definitely will use this

low lichen
#

It's important that you name it the same as the original class if you want VFX Graph to work, because VFX Graph checks the name of the class to determine what shaders to use.

#

So it's a bit of a hack

gleaming moss
#

ah yes, that excellent design decision

low lichen
#

It could be done without this hack if they made one internal method public, but they haven't yet.

#

There's some thread about it somewhere

gleaming moss
#

that's why I called it an excellent design decision

low lichen
#

@devout quarry Oh and you need a custom editor for it also if you want the serialized array field to appear in the editor
https://hatebin.com/vqfkanwbfy

#

Or you could use the debug inspector mode

#

Or you can hard code the names in the script

amber saffron
#

@pine arch The selection example still seems to work for me :/

fluid pollen
#

oh yeah just wanted to say thanks remy I managed to do it thanks to your tip!!

pine arch
#

@amber saffron oh nice, then i guess i just missed something in the configuration, or maybe i just didn't figure out how to limit the effect to a specific object, i don't remember very well. I'll try again, thanks for the heads up !

pine arch
#

just tried again @amber saffron, i'm having trouble reproducing the screenshot on github :

#

i have less options

amber saffron
#

The one you're showing is the fullscreen custom pass, that matches the one on the bottom. You need to add a draw renderers custom pass

pine arch
#

oh sorry

#

i though because i got a fullscreen shader i needed a fullscreen pass

#

i'm not really understing everything i'm doing ^^'

#

better with the other custom pass, right !

amber saffron
#

This effect is made in two steps :

  1. render the desired object in a custom color buffer
  2. compose the outline over the rendering in a fullscreen pass
pine arch
#

ok, makes sense.

#

perfect, i got it working !

#

thanks a lot @amber saffron ๐Ÿ˜„

amber saffron
#

Great ๐Ÿ™‚

#

Note that this is probably a very suboptimal method to do a silhouette, I didn't really try to optimize it ๐Ÿ˜„

pine arch
#

it's the only way i found working on a modern HDRP version so i'll take it ๐Ÿ˜„

#

oh ! i see what you did

#

๐Ÿ˜„

#

funny way to do a border

amber saffron
#

Well, yes, if you put very high width values, you end up with this :D
You can increase the number of samples tough

pine arch
#

perfect !

#

๐Ÿ˜„ i'm kidding, i just wanted to see how it worked behind the scene

#

i only need thin outlines so it'll be ok

amber saffron
#

Yep, ye old trick of dupplicating the object, and offseting it of X pixels ๐Ÿ™‚

pine arch
#

oh, i've a problem

#

it works fine in the editor view but when i play

#

i get the outline but the mesh disapear

#

same moment but in editor :

#

if i put a texture in the fullscreen material i get my mesh back but black unlit

#

@amber saffron any idea ?

amber saffron
#

Ow, hum, no, that's unexpected

#

I can have a look to this tomorrow

pine arch
#

i'll try to restart Unity maybe

#

oh really, thank you !

#

@amber saffron nevermind, i forgot to add my new outline layer to the camera culling mask... ๐Ÿ˜ณ

amber saffron
#

๐Ÿ™‚

#

๐Ÿฆ†

sinful ledge
#

hey guys, ive been trying to follow this brackeys tutorial for something a little different but have not had sucess with it yet: https://www.youtube.com/watch?v=WiDVoj5VQ4c&t=618s

In this video we create an awesome Glow effect for extra flare!

โ–บ Check out Popcore! https://popcore.com/career

โ— Download the project: https://github.com/Brackeys/2D-Glow

โ— Get Gothicvania Church Pack: https://assetstore.unity.com/packages/2d/characters/gothicvania-church...

โ–ถ Play video
#

im basically trying to make a weapon glow right before it is picked up

#

im very new to shaders and this is what i currently have

#

however it creates this blob for the axe:

#

while i would want for the axe to glow

#

any help would be greatly appreciated!

velvet elbow
#

i have no idea about the tutorial or the shader editor, but maybe the blob around the axe is good but just not "glowign"? e.g. a blending mode problem, additive? but i can only see black, then it would be 100% transparent and invisible.

If you want to do glow in 2d, i highly suggest you look into "bloom" post processing effect. it was expensive on PS2, but its very cheap on anything past 2010, including mobile phones.

#

bloom can work fullscreen (thats nice, too).

sinful ledge
#

right so thats what the tutorial was aiming for

#

essentially you could write some shader that told the bloom to highlight this object

low lichen
#

@velvet elbow I think it's a little misleading to call bloom very cheap.

sinful ledge
#

so im just trying to write a shader that gets this object above the bloom threshold

low lichen
#

@sinful ledge What does it look like if you connect the Main Tex sample node directly to Color?

#

Just to check the shader works properly without the extra emission stuff

sinful ledge
#

it is filled in black similar to how it looks without the shader

low lichen
#

I assume you don't expect it to be black, right?

velvet elbow
#

@low lichen why did you say that bloom is not very cheap? are you talking pixel fillrate performance? or the complexity of programming it?

#

@low lichen pixel fillrate, even a mobile phone nowadays has a lot of performance. overdrawing a full-hd screen 5-10 times is really okay in 60fps. so if you dont want to bloom and postprocess your full screen (then you would need render target derived from your screen target, etc.) but instead just render the objects into a secondary render target and finally add this as a texture ontop of the screen, then thats not expensive anymore.

sinful ledge
#

@low lichen correct

#

once the shader is on the axe i would like for the axe to glow maybe white for now

velvet elbow
#

@low lichen even blurring the texture is not expensive, if you resize it down to e.g. 20% and then make 8 to 16 taps of blur steps, then thats not to much fillrate eaten.

low lichen
#

I say it with experience developing for the Oculus Quest. There the fillrate is especially noticeable since the screen is high resolution and high refresh rate.

#

On that hardware, you're looking at around 4 ms just for bloom.

velvet elbow
#

@low lichen especially the oculus quest is a beast, and can handle it easily ๐Ÿ™‚ its actively cooled, and its shocking. i have now on the 2880x1600 pixels it has, with 4x AA my own "simple" shaders running, filling fullscreen (for tests). the shader does 8 shadow buffer samples to get smoothed shadows, then 5 texture samples + normal maping. and it runs at 72fps.

#

@low lichen in unity my experience is that the quest has rather issues with lots of draw calls with lots of vertices. so if you draw objects with < 50 vertices, dynamic batching works well and its easy to draw 40 objects. if you draw objects with > 1000 vertices, even though the total throughput of the hardware should be okay with 40k vertices, it will go way below 2nd frame, even down to 25 and less fps.

#

@low lichen what do you do precisely on the quest, that you say this takes 4ms? 4ms is A LOONG time and it sounds quite complex. do you have some kind of default foward rendering postprocess stack bloom? or have you tried doing things manually?

low lichen
#

Nothing custom, just the post processing stack.

velvet elbow
#

ah, that does a lot.

#

people usually say unity is "slow" when compare to other (custom, c++) engines.

#

thats bollocks. unity is very fast, but it does a lot of (nice and confortable) things.

#

you need to really do custom things to be sure it does what you need.

low lichen
#

So it would be wrong to tell developers to avoid doing bloom on the Quest?

velvet elbow
#

example: i have a space scene on oculus quest. what would you expect naively to be faster? a cubemapped skybox or clear color = black and then a very simple particle system that holds 9000 stars and renders them (tiny) as a sphere shape in the scene?

#

i think you are 100% right, that you can not have much fun on the quest by just using the forward rendering postprocessing stack. thats because this is (AFAIU) nearly always taking the current screenbuffer contents and then modifying this (e.g. for color grading). but exactly THIS is really slow on quest. you can google that, the retreavel of the pixels from the ram on the quest is slow here.

BUT bloom (fulslcreen) just means blurred colors additively put on screen, suiting to the existing screen content. it can also just mean what most PS2 era games did: you render twice, full content onto screen and then only (very few, basic) shapes into a black bloom texture. then you do your magic with that texture (shrink, blur, effects, temporal history, etc.) and finally you render that as a fullscreen quad (bilinear filtered, blurred) ontop of the scene.

thats what all FFXII etc. did already in 2002ish and it looked gourgeous.

low lichen
#

But you have to wait for the whole screen to resolve before you can begin blurring.

velvet elbow
#

no, not at all

#

in fact, you can render first into your to-be-blurred bloom render target.

#

(e.g. spaceship engine glow pfx)

#

then you can render your normal geometry

#

and while doing this prepare a quad fullscreen (e.g. camera aligned) with that bloom texture.

low lichen
velvet elbow
#

but honestly, i think with 2 eyes, in VR, you want to avoid a lot of traditional 2d full screen tricks. i havent checked yet, but it might be that bloom ALSO feels strange.

#

the problem with VR is that your brain can tell VERY WELL if something is 3d or not. real "glow" around objects would need to be 3d, too. so physically different for 1 eye than the other. full screen bloom behaves very identical (e.g. blurring by 20 pixels) for both eyes, and that will make it look odd.

#

i know other 2d effects are shit in VR, i am guessing bloom, too. (but i dont have that experience).

#

@sinful ledge back to your problem ๐Ÿ˜„

sinful ledge
#

๐Ÿ™‚

velvet elbow
#

@sinful ledge what you want, is that you have a predesigned glow around your object on the screen. maybe what you want is bloom. but maybe a simple PFX attached to the object is even easier, you have much more control AND flexibility?

low lichen
#

It would be different for each eye because you're blurring both buffers. I thought you said you've done bloom on Quest with no issues?

velvet elbow
#

e.g. with bloom it can be difficult to write temporal effects (fade in, fade out) but with PFX thats pretty easy, each particle has its lifetime and just dies slowly...

sinful ledge
#

oh interesting yeah that might work

velvet elbow
#

@low lichen it would be identical for both eyes, because you are blurring both buffers at once, with the same blur kernel. no, i havent done bloom on the quest. because in the end you are spending it from your "fillrate budget". and i rather spend it for other things (blurred realtime shadows, fake PBR, particle effects overdraw)...

sinful ledge
#

how do you make the particles spawn from only the inside of the weapon?

low lichen
#

Identical in what way? If you see something completely different in one eye from the other, the bloom would be identical still?

velvet elbow
#

@sinful ledge also with glow it sounds like it depends on an event. e.g. pickup glow. drop glow. etc. then you want to couple the visuals with a sound. this is easy to be designed in the particle editor. much more work to make your own bloom animation in a shader, etc. i wouldnt do that. bloom is really for fullscreen "athmospheric" effects, e.g. constant afterglow from a space engine. etc.

sinful ledge
#

nvmd figured it out

#

yeah that makes sense^

velvet elbow
#

@low lichen ah now, you got me wrong. if you see with your left eye a red object and bloom that and with your right eye a blue object and bloom that. then it would be correct.

but thats not the point, in 3d we are looking at something diagonally. a wall. on the left eye its much closer than on the right eye. now we bloom some glowy-lines textured on that wall. on the left eye the line is quite big and close to the eye, ont he right its small and far. now putting bloom ontop of that realistically you want 30pixels on the left eye and just 10pixels on the right. but bloom is quite uniform, as it depends on the bloom texture resolution, it has its minimum and a uniform blur kernel (e.g. fixed 32pixels) ... then you have it identically blurred in size on left and right eye.

#

so @low lichen lets come back to the conclusion you gave: lets not use bloom on a quest. but NOT because of pure performance issues, but because there are many other ways to spend the fillrate budget AND because 2d (fullscreen) effects on VR seldomly work visually well (it is unpleasing, tiring the brain and looks wonky).

#

@sinful ledge spawn particles from inside: google that, you need to attach the axe mesh as a spawner shape for the particle emitter.

low lichen
#

I haven't had any experience with bloom being wonky in VR and I'd say most PC VR games use it.

velvet elbow
#

FYI @sinful ledge there you nee to put the axe mesh

#

@low lichen interesting, care to point me to any youtube video where this is obviously visible? i have not played any PCVR to be honest, just PSVR and Oculus Go and Oculus Quest.

sinful ledge
#

right i found that

#

so my game is 2d so i chose sprite

#

dont mind the scale

#

but i guess how do i make that shape line up more with the shape of the sprite

velvet elbow
#

@low lichen basically, if you have a shitload of performance on a great rig on PCVR then obviously you can do bloom with a fine texture (e.g. 2048 texture to make sure you have a 1:1 on each eye). but if you sample it down in any way, then its quickly looking jaggy and that might be barely noticeable if you look at a full screen at FULL HD (1920) but if you have that resolution for 110 degree of VR and thus something like 15 pixels per degree, then any strange pixel artifacts will jump a lot in front of your eyes ...

#

thats the theorey, atleast.

low lichen
velvet elbow
#

@ionic brook have simply less blurry particles and control their position more, you just need to learn the particle basics and play with them a weekend i guess.

#

@low lichen great example, i will watch it now, give me a moment

low lichen
#

@velvet elbow So you're saying that the cost of resolve can be completely avoided?

sinful ledge
#

wrong luke haha

velvet elbow
#

haha ๐Ÿ˜„

#

@low lichen i dont know what resolve is. can you explain / link ?

sinful ledge
#

yes, but the sprite shapes dont match is my point like the shape of the axe at the top and the black wireframe dont match perfectly and i was wondering if there was a way to fix that?

low lichen
#

Because the tiled renderer wont draw the entire screen at once like a desktop GPU would, so in order to do operations like blurring the whole texture, you have to wait for all the tiles to finish before you can continue.

#

It's hard to find any official documentation mentioning it, but you see it all over Oculus developer documentation

velvet elbow
#

@low lichen watch the video at 2:12 and go frame by frame: the bottom right looks really really great, because the bloom is HUGE, quarter of the screen. so if that area is so big, i am sure even a low resolution + few blur samples will provide good results. but on 2:12 you can see that the bucket has a very small bloom area on top. there you can see that it starts to be not very precise and one would wish it to be nicer.

but i guess thats nit picking, definitely for this kind of reflection glare (sun into the eyes) effects that always want to be very strongly, this looks really good.

if i had that game, i would try this: find some glare bloomed, then slowly walk away from it, keeping the angle in a way that the glare should continue. i am sure they fade it out by distance /before/ the pixels get to little.

but you proved it right: this works and looks nice (in that 2d youtube video), not sure how it looks for both eyes, but i guess such a very rough glare bloom will look identical for both eyes AND it will just shine into the eye from similar angles, so its similar sizes... good example where i guess it would work well.

sinful ledge
velvet elbow
#

@sinful ledge it seems that the axe image is mapped on a rough shape. then there is nothing you can do. and to be honest, i would just go with it and make the whole effect less precise and more "glowing"

sinful ledge
#

oh

#

is there a way to get it onto a better rough shape?

low lichen
sinful ledge
#

or make it model the sprite shape

velvet elbow
#

@low lichen ah, good point. yes, Alyx for PC will most likely havesimilar tiling issues to solve. modern 2k VR capable gpus have tiling in one way or another, too. atleast some hierarchical things going on.

what you do here, is really do render into the bloom texture first, early in your scene. also this effect doesnt need to be precise, could even be 1 frame late.

#

then make the fullscreen bloomed quad be part of your normal rendered scene geometry.

sinful ledge
#

or wait i could probably just make a circle glow that rendered behind the weapon therefore you can still see what you are picking up

velvet elbow
#

exactly ๐Ÿ™‚

sinful ledge
velvet elbow
#

@low lichen thanks for the nice PDF, helps me a lot ๐Ÿ™‚ its clear, that if you want EXACTLY what is in your final screen buffer, to be then postprocessed, you have to wait for the resolve. ways to handle this is: effects that can work with the content from previous frame renderd, especially nice as with double buffering that surface is then free to render from. another way is to design your effects to simply NOT need exactly what will be in your final screen buffer ... and i am expeting this is what they do in modern (VR) games (like Alyx).

not using what is 1:1 in your screenbuffer has another benefits anyway, you will have 100% control over what you do.

#

@sinful ledge from a style point of view, i would use the sprite shape, offset the particles in Z to be "behind" the axe (black texture shape) and make them more "wide glowing particles" (very few, maybe 20, but 3 times as wide as the axe). then you get a roughly axe shaped glow, very big, lots of control AND your axe can be still visible without being obscured.

quiet shoal
#

Hello, I do mean to interrupt any current assistance taking place right now just wanted to throw a question out there. Is anyone aware if it is possible to do light attentuation in HDRP when creating shaders. I know I can go down to the URP to make it work, but I don't want to lose advantages that HDRP provides. If anyone knows anything about this please let me know

velvet elbow
#

(no idea, as a noob on deffered rendering / HDRP i would guess lights attenuate just the same as on forward rendering / LDRP ?)

sinful ledge
velvet elbow
#

@low lichen anoher good example in the alxy video is at 3:29 the explosion. the bloom is very helpfull here, but its fast and large and again looking at it with both eyes equal distance (such large things most of the time will have equal distance to both eyes). i bet that they render the pfx in a very simple way into a bloom texture and thats nicely helping the shitty pfx to "fuse" together to a real glowing explosion.

#

@sinful ledge yeah, i like that - make it a bit more precise and be happy with it ๐Ÿ™‚

#

if you pickup that axe as loot and it has rare or epic loot status, that kind of "over the top" glow would be exactly what you want to make the player happy ๐Ÿ˜„

sinful ledge
#

ooh good idea

sinful ledge
#

@velvet elbow ok im very close

#

how do i spawn particles when the particle system is initialized

#

since it currently rate over time

#

so it starts small and then gets to a good size like 2 seconds later

#

but i want for it to be at a good size when it is instantiated

low lichen
#

There's the prewarm option

sinful ledge
#

ah thank you

#

and would there be a way to fade the particle system in and out

#

like maybe fading the material in and out

velvet elbow
#

yes there is

grand jolt
#

any one having issues with URP and InputSystem? the debugger is using the old input system...

velvet elbow
#

@sinful ledge the particle system -> renderer -> material -> tint color (e.g. for shader: Legacy Shaders/Particles/Additive)

#

this will affect all particles being rendered at once.

#

but i wouldnt prewarm and wouldnt fade it like this, i would rather tune my glow effect in a way, that it starts slowly building app (over a second or two, not over a minute, obviously).

#

you can even make sparcles like that which appear slowly and randomly ...

sinful ledge
#

ok thank you!

midnight wolf
#

hey guys im thinking of switching my project from 2018.4 to 2019.3 specifically for the new 2d lights/shadow stuff. I was wondering how different the shader programming is between the two versions are (i have some shaders that are cant be automatically converted, ive tried before), thanks

astral turret
#

This is probably a pretty simple question - trying to display the outline of a mesh (a cube, for example) only. It doesn't have to be perfect, as long as its visible and can be seen through reasonably for debugging purposes. Is there a texture/shader/resource I should be using for that.

gilded portal
#

Hi! Is there anything particular to enable in unity shaders to enable rendering in both eyes for VR games? I have this issue with a shader that only renders in one eye. if it rings a bell to anyone..? thanks!

low lichen
#

@gilded portal Yeah, sounds like a single pass issue. Are you using Single Pass or Single Pass Instanced?

merry rose
#

Is there currently a way to make a translucent shader for URP with shader graph?

gilded portal
#

Thanks I have to see if I can change that if its a project thing as this is a mod for existing game :/

low lichen
#

@gilded portal Then it's quite likely that they are just using Single Pass and you just need to enable VR and single pass in your project

#

Unity will then compile your shader with single pass support

gilded portal
#

Okay so project already is set to that :/

sinful ledge
#

@astral turret if you look on the asset store for an outline script im pretty sure i've used one on there for something quick and dirty

vague kestrel
#

Is it possible to make a terrain shader using shader graph?

remote mauve
#

So I've done the bilinear interpolation shader for quads, but now it turns out that some quads might want perspective interpolation shader instead.

#

I'm currently thinking either:

  1. Having two separate shaders and render them separately
    However due to these quads having transparency and different depth values, it might need a large amount of draw calls.
    Eg: quad 1 = depth 0, biliner; quad 2 = depth 1, perspective; quad 3 = depth 2, bilinear
    This will require 3 draw calls as quad 1 and 3 cannot be batched together due to quad 2 in between.

  2. Having one shader that does both depending on input
    Which will solve the problem of first approach, but will introduce dynamic branching to both vertex and pixel shader.

Performance here is the obvious concern (targeting as low end mobile device as possible), I'm wondering which one is better?

plush bane
merry rose
#

Is it possible to make a terrain shader using shader graph?
@vague kestrel I've done some in older HDRP, allowing for Parallax mapping etc. but in the newest it bugges out for some reason.

vague kestrel
#

For me its the shadows that have issues, like building a big tower of terrain wont cast anything...

#

that tower doesnt cast anything, also that weird line shows up all the time

#

doesnt happen with the default terrain shader

plush bane
#

How do u think, the gradient noise node is expensive for Mobile?

plush bane
#

Scene color seems to be handy

restive rain
#

@plush bane dude, Unity has a whole particle for that made

#

lol

#

Check the Particle Effects in Unity Asset Store

regal stag
#

@plush bane Hey, What questions do you have in mind regarding that post?

rose remnant
#

I'm having a problem with a surface shader I wrote (for forward rendering). Everything worked great, but I wanted only the brightest / strongest light to influence a pixel, and not every light that the pixel is in the range of. So I found out about blending operations.
I added BlendOp Max to the shader, and everything looks perfect until something moves. It somehow seems to blend between previous frames and the current frame. What am I doing wrong?

restive rain
#

wth is that... LOW POLY?

#

nvm

rose remnant
#

it's a floor with a character walking on top of it. But because it blends previous frames everything looks smeared out.

low lichen
#

@rose remnant Are you using some kind of temporal anti-aliasing? I can't think of many reasons why you'd be seeing previous frames.

rose remnant
#

No? Or is that something that might be turned on somewhere without me knowing?

low lichen
#

No, probably not

rose remnant
#

Also, pausing and unpausing the game in the editor fixes it, but only until things start moving again.

low lichen
#

You mean it gets stuck like this? Not just for one frame and then fixes itself?

rose remnant
low lichen
#

Oh, that isn't clearing

#

What is your camera's clear flag set to?

rose remnant
#

It is set to Skybox

low lichen
#

What if you set it to a solid color?

restive rain
#

I'll tap out of this one, I can't do shaders for shi-

rose remnant
#

If I set it to solid color and make it completely black, it looks normal. Thanks!

#

Or is this not really how it should be?

low lichen
#

I've never used BlendOp Max. It seems like it's messing with the clear operation, like the environment is more important than the clear so it can't clear.

#

But then you get ghost pixels remaining on screen

rose remnant
#

But I guess this is a valid solution? Or could this have unwanted / unexpected results somehwere else? (setting the clear flag to solid black)

low lichen
#

It means you'll see black instead of sky wherever there is no mesh in the way.

rose remnant
#

hmm yeah I noticed that now

low lichen
#

If you want to fix that, you probably have to reset the BlendOp back to Add (I'm assuming that's the default value) on all the pixels on the screen

#

You could do that by drawing a big transparent quad in front of the camera with that blend op set, probably

rose remnant
#

I will try that. And I guess if I wanted another color than black as my background, I could also just have a huge quad behind the whole scene with a certain color.

rose remnant
#

Btw thanks again for the help @low lichen !

plush bane
#

@regal stag nm, figured it out by my self ๐Ÿ™‚

whole glacier
#

Hey, asking anyone that can help, I'm trying to make a sort of watercolor effect shader and I'm trying to sort of dissolve the edges of a mesh in screenspace sort of like this, im having trouble figuring out the edge detection part if anyone could point me to the right direction it would be really helpful! thanks

golden crest
#

When I change a shader property at runtime with code the changes do not show in game but they do show in the inspector. If i change the same value at runtime using the inspector instead of code the changes appear in game mode. What can i do about this?

golden crest
#

I had to enable keywords.

vague kestrel
#

@whole glacier I know you can do that with post processing effects, dunno about shaders though

devout quarry
#

I'm using this effect where I draw squares in a grid

#

I just use the base UVs

#

however when I rescale the quad, the squares stretch

#

so I tried multiplying the tiling with the scale of the object

#

but on a 3D surface this doesn't work too well :/

stone sandal
#

seems like you just need to tiling against triplanar UVs if you don't want it to stretch on object scale

devout quarry
#

Okay I'll try that!

real basin
#

you could use worldpos instead of UV to prevent stretching, and triplanar would help for rotation or if you use it on a cube. If you want to use worldpos but want the texture to move with the object you can offset pixel worldpos by object worldpos. You can get object worldpos either by passing through a script or calculating it in the vertex shader

simple frost
#

@whole glacier Thats a neat effect, but that masking on only the outline edge is going to be a bit tricky. It would likely also have to be multipass. I would draw an object mask to a buffer, perform a large radius blur, subtract the original mask from the blur so you are just left with the blurred outline, then multiply that by a paint-splat noise uv of some kind and sample screenposition using the output as a multiplier. Not going to be quite perfect but might be a good start

devout quarry
#

uhm it seems SG has some glitches with the enum keywords ๐Ÿ˜…

simple frost
#

ruh roh

low lichen
#

It's just connecting in the third dimension, you can't see it.

simple frost
#

@low lichen is correct

#

(can you please tell me version info @devout quarry ?)

devout quarry
#

7.3.1

#

But they don't seem to work at all

simple frost
#

I think I remember this getting fixed...ill look into it

devout quarry
#

I use it like this right?

stone sandal
#

ah, i just opened a PR recently to fix that bug

simple frost
#

I thought so

stone sandal
#

ref name and display name actually need to match

devout quarry
#

Ah, will do

stone sandal
#

because of a kink in the material system

devout quarry
#

Hopefully you'll change that in the future

stone sandal
#

well, we can't change the material system

#

the fix we have in PR is that you can't make the ref name and display name mismatch

#

so that they'll always work as intended

devout quarry
#

Perfect

#

it works ๐Ÿ™‚

simple frost
#

awww no more 3d connections then

grand jolt
#

Hello! there is any node that does that but going from complete black to white in each tile?

#

Or any way to tile it (im not using any texture)

low lichen
#

What are you using to control the original black to white gradient? Y position?

grand jolt
#

Yeah, its the Y position, green channel

vocal narwhal
low lichen
#

I think you'll also get the same thing if you modulo the Y position before using it

grand jolt
#

Thanks @vocal narwhal!

#

Or maybe im doing it wrong

low lichen
#

No, I'm wrong

#

I was thinking of fract to make tiling

grand jolt
#

I would like to offset this part so I can animate it, where should I start? I tried with math nodes, but I dont find out how if it goes beyond 1 goes to 0 for example

gleaming moss
#

try adding something to the inputs to see what that does ๐Ÿ™‚

whole glacier
#

@simple frost Thanks for replying! Yea thats sort of where my mind went but im not sure how to apply that ๐Ÿ˜…, are there resources on multipasses and mask buffers?

heady jewel
#

Hi, is there a node similar to the Color ramp in blender in unity ?

#

this

heady jewel
#

I found it, I put a gradient node connected to the input of a Sample gadient

#

And the Time input is working the same as the Fac input in blender

fluid pollen
#

is there a way to do a cut off shader where you render a texture at the intersection with shader graph?

gleaming moss
#

yes, but 'intersection' is not a helpful description just by itself

#

intersection of what and what

#

and likewise we need to know more about 'render a texture'

fluid pollen
#

hmm okay well I got it to work almost, let's take a sphere, I have it working rn so the closer an object is to said sphere or further away if I invert it, it begins to get evenly cut

#

with double facing turned on, instead of the cut being transparent, it's a solid colour, black atm

#

now I just need to figure out how to make that point where it cuts to be a texture

#

let me post a pic

gleaming moss
#

so you're doing an alpha test based on distance in that shader on the sphere

fluid pollen
#

it's doing a distance from cubes position and applying an alpha change yep

gleaming moss
#

and want it to instead display a texture but not change the alpha?

fluid pollen
#

I want it to do exactly what it's doing

#

is there any way to make the black there a texture instead?

#

it's only black because I enabled double face otherwise it'd be transparent

#

if there's a way to apply a texture to the double face that'd be great

#

other face*

gleaming moss
#

the 'black' isn't actually black, it's shading

fluid pollen
#

yeah

#

if I apply emission the black changes to match the colour

gleaming moss
#

see the top portion of the sphere

fluid pollen
#

it's casting a flat shadow down is it?

gleaming moss
#

so you really want to make the back faces of objects use different shading

fluid pollen
#

how would I achieve that?

gleaming moss
#

shader graph is going to make that kind of hard

#

since you can't really 'opt out' of lighting in specific cases

#

hm

#

you can put a texture into an emission node

#

or slot

fluid pollen
#

ohhh

#

let me try that

gleaming moss
#

the other piece is the Is Front Face node

#

I would have that connect to both the emission and the 'lighting' textures (diffuse, specular, etc.)

#

you can use that to lerp the shading textures to 0 if it's a back face (and kinda sorta hack out lighting)

#

and lerp the emission to 0 if it's a front face

#

and kinda sorta hack out the emission

fluid pollen
#

okay just tried that, it inspired me to try someth

#

thank you!

gleaming moss
#

yw-- don't ask to ask. The more info we have up front the faster the advice

fluid pollen
#

would it be possible to do a vertex displacement to create the textured plane where the cut is being done?

tardy spire
#

I'm trying to position vertices relative to another transform using the local-to-world matrix of the other transform assigned in a material property block, but am getting odd results. My approach is to multiply the local vertex position by the other transform's local to world matrix and then convert the new world position back to object space for the final vertex position. The vertex positions are scaled correctly but are positioned relative to the origin of the scene and appear to be rotated inversely.

Here's the script that's assigning the matrix to the renderer:

using UnityEngine;

[ExecuteAlways]
public class TeleportEffect : MonoBehaviour
{
    public Transform endTransformation;
    public Renderer renderer;
    
    private MaterialPropertyBlock mpb;

    private void OnEnable() => mpb = new MaterialPropertyBlock();
    private void Update()
    {
        if (endTransformation != null)
            mpb.SetMatrix("_EndLocalToWorld", endTransformation.localToWorldMatrix);
        if (renderer != null)
            renderer.SetPropertyBlock(mpb);
    }
}

And here's the shader:

#

And here's a video of the weirdness in case it helps https://streamable.com/ywq7i
tldr: Any idea why converting local vertex position to world space using another local to world matrix doesn't work?

simple frost
#

@whole glacier unfortunately there's not a whole lot of resources I can find on it. I may write something up this weekend tho if there isnt a lot on it

#

@tardy spire have you verified the renderer is correctly getting the _EndLocalToWorld matrix?

tardy spire
#

Scaling and rotating the "end" object scales and rotates the vertex positions of the start object so it is getting the local to world matrix, but other than that I'm not sure how to verify