#archived-shaders

1 messages Β· Page 68 of 1

ebon basin
#

vertex manipulation

#

usually games that have some sort of grass system where characters can trample it is of similar concept

quasi quest
tardy crypt
#

I'm having trouble with my shader graph on getting it to lerp from full fledged particle to having it fade out from the center into a ring over life.

tardy crypt
#

Well, it doesn't work at all.

#

I wanted to essentially do something like this.

#

With a particle system using this shader on the material.

#

Where over its lifetime, it will fade out from the center.

#

I'm relatively inexperienced though and trying to learn shader graphs though, so not sure what needs to be fixed to achieve such an effect.

#

The top half of the graph works fine in order to let me control the color and use HDR in my particle system

#

but I'm struggling to make it fade out the center.

gloomy gust
#

is there a way to just make these values solid white or solid black?

grizzled bolt
#

@tardy crypt I'd plug Distance to a Step node (later swap for Smoothstep if you wish) and just connect that directly to Fragment Alpha for now
By adjusting the step value you should be able to make it disappear circularly from the middle

#

To get particle lifetime you'd have to use particle system's Custom Data to pass Lifetime property through a vertex stream, and then use that as your step value

tardy crypt
#

So this into the alpha directly?

grizzled bolt
#

For now, to confirm that the alpha works with fading from the center

tardy crypt
#

Yeah, that doesn't work.

#

😦

grizzled bolt
#

What do you see with Edge value of 0.5?

tardy crypt
grizzled bolt
#

In the node preview

tardy crypt
#

As opposed to

grizzled bolt
#

Node preview, not main preview

tardy crypt
paper egret
#

Anyone know why I'm getting an outline at the edge? This is a simplified example of my trying to write an outline shader, but I don't understand why adding a texture to itself, clamping, then subtracting with itself gives extra pixels

grizzled bolt
paper egret
grizzled bolt
paper egret
#

nm im dumb. this should work. thanks!

grizzled bolt
#

If you want outlines you'll probably want a texture (or just a color channel) that has an SDF of the sprite, or otherwise a gradient stored in pixels to represent the edge

#

Then you can easily and smoothly isolate a part of the gradient

modest orbit
#

hi, can someone help me understand why my UI is infront of my object shader here?

vocal narwhal
modest orbit
#

thx

lament scarab
#

Can anyone point me towards a built-in shader that works for alembic hair?
I think it needs HairVertex inputs.
Have a hard time finding anything about it online but my issue right now is that applying a normal material causes this:

#

i'm doing all this using unity's demo team's hair (strand based simulation)
and they say this:

#

not quite sure how to get around this in built-in but it should be supported
since it says the hair solution supports built-in

simple galleon
#

I was bought a sprite outline asset due to using my project. but, when I applied outline shader to square sprite. that dosen't work. but apply other sprite, It works! how to solve it?
(in picture, there sprites are has same material. and only right sprite has red outline)

tacit parcel
simple galleon
#

Thanks very much!

night heart
#

having problems with 2d outlines using URP + Shader Graphs

fallow herald
#

A game mechanic I am researching how to do:

  • Enemies only visible in light over a certain threshold.
    Basically want enemy models to be invisible in the game’s standard lighting, low ambient level lights throughout level. But when the player shines a flashlight or turns on the power in a room I then want the enemy models to be visible. Once I figure out how to do this I’d like to then have the models fade in and out depending on the lighting conditions. I have no idea if this is a shader question honestly.
grizzled bolt
night heart
# grizzled bolt You'll have to be more specific than that, but if I had to guess it looks like y...

i followed another tutorial (https://www.youtube.com/watch?v=84rZ-rCRsZk) and the problem now is that the outline fills a square area behind the sprite.

Create an outline effect in 2D for SpriteRenderers using Unity Shader Graph! You can also read this tutorial here: https://danielilett.com/2020-04-27-tut5-6-urp-2d-outlines/

πŸ’» Get the source on GitHub:
https://github.com/daniel-ilett/2d-outlines-urp
✨ Get the "Bandits - Pixel Art" pack on the Asset Store:
https://assetstore.unity....

β–Ά Play video
grizzled bolt
night heart
#

i did all the steps of the vid and even searched for comments that could help me but still nothing.

grizzled bolt
lunar iron
#

https://gdl.space/inujozebow.cs im completely new to shaders and i found a blurr shader on asset store but i want it to be black with an alpha of 155 but the material is just pure black when i add it to my image

vital token
#

Hi, is this the channel where I can ask for help about shaders?
Not even sure if my problem is related to shaders, but I can't solve it lol

halcyon panther
#

Don't ask to ask.
The channel banner says what this place is for. πŸ˜‰
Just ask your question and provide any relative context such as your code.

sick abyss
ebon basin
#

sorting issue? Make sure you're not using transparent shaders on geometry that should otherwise be opaque

#

or maybe some culling issues but that would be odd

primal night
#

Got a question for an upcoming project I have to work on:
Does anyone know good resources on how to achieve a Papyrus drawing/scribble, ancient Egyptian art style shading for 2D?
All I can find is Toon and Anime Shading. Which is a good starting point, but lacks a bit of that very niche "texture" feel.

I've tried doing something similar in another project. With wiggling toon lines. Was my first time doing shaders...
It worked roughly, but had issues so my team decided to leave it out.

So now I want to get it right.

sick abyss
latent mirage
#

hello devs ,can someone help me, have found this radial blur shader in github- works perfect. but i want to remove Blur effect from top border and bottom border . have tried multiple changes and seek solution at forums ,nothing helped, Build-in pipeline . Thank you in advance.
this one https://github.com/Dumble009/EdgeMotionBlur/tree/master

GitHub

Unity ImageEffect for some speedy effect, e.g. car race or something. - GitHub - Dumble009/EdgeMotionBlur: Unity ImageEffect for some speedy effect, e.g. car race or something.

tacit parcel
deep moth
# latent mirage hello devs ,can someone help me, have found this radial blur shader in github- w...

I'll bet you could just multiply that distance value in the blur shader function by some kind of code based mask like a smoothstep.

I would write the mask generally like this:

smoothstep(.4,.5, abs(uv.x-.5))

You might have to play with the numbers a bit. Moving the first argument in the smoothstep will make it smoother if lower or sharper if higher.

If you're just prototyping you could even use a texture to mask it. I would avoid doing that for the final version because having texture samples that are dependent on other texture samples is really slow.

deep moth
#

2d sounds like it would give you a lot more to play with than 3d for that kind of non photorealistic rendering.

#

There's something really nice about the splotchiness of ink on papyrus. The way it spreads out.

primal night
#

Well, the Idea is to make a game-based learing platformer on middle-egytian language. by exploring the Egyptian underworld, Duat, on a papyrus of death structure

deep moth
#

So you're looking for a way to handle lighting?

primal night
#

nothing tooooo special game play wise, but hence that is the idea, the aesthetics are key

primal night
#

reference.... good point

#

I need to try to find some.

deep moth
#

That's where I'd start! Then try to break it down based on what you can see there.

primal night
#

true

#

let's not discuss it like this here

deep moth
#

Ok no worries! Sounds like a cool project I'd love to brainstorm. If you have other questions about it feel free to @ or dm me.

lone basalt
#

Hello! Dunno if this is the right channel to ask about this but iv been trying to import a rather large FBX file into unity and it always ends up getting stuck on this

#

Anything I am doing wrong? Any ideas?

primal night
deep moth
#

Check out apotheon for sure! https://store.steampowered.com/app/208750/Apotheon/

I'll do some more thinking too.

The Gods of Olympus have abandoned humanity, leaving you to perish without their benevolence. Take up arms against the Gods, climb Mount Olympus, and take their divine powers for yourself to ensure mankind’s survival!

Price

$14.99

Recommendations

3042

Metacritic

78

β–Ά Play video
#

I think part of where I get caught thinking about how to look dev this is the 2d assets you're working with are pretty important. Would you be working with existing sprites and then animating them with a shader?

#

The main reason I bring apotheon up is because one way to think about sprites could be that they're like decals which wrap around the papyrus behind them. Some kind of gentle pixel displacement based on the background.

#

One way I see people do animated drawings prrty often is a simple shake with a random vertex displacement that changes at a standard animation framerste like 8fps. It makes it look like animation is applied when it's really just a shader.

deep moth
#

Then you could light the papyrus to bring out the surface details.

junior copper
#

i would like to make a "colored zone" using my character position

the idea is, all materials are rendered in black & white, but when the player is close enough, the colors are here

#

what would the node(s) to use in a shadergrpah to have a "sphere" for that effects

regal stag
junior copper
lone basalt
#

its been loading for over 3 hours ;-;

#

1GB ._.

grizzled bolt
#

Probably not an issue with shader creation directly if Unity's own shaders fail to compile in an import situation

lone basalt
#

Anything I can try to fix it or do you think the guy that send me the file got it corrupted?

#

Its the scematics of a building. I am working together with a architect that wants there objects to be VR-viewable but the architect I am working with barely knows how his own software works so its a nightmare trying to get a proper file that I can work with ;-;

#

I bet they have some really high-res furniture in the thing and it just cant load that many polygons and the baked in textures

#

When i tried loading it into blender, it crashed lol

#

But yeah, ill try that again on a faster machine ;D

#

uuuurgh... guess I gotta email the guy then. Thanks for confirming my suspicions and for the tips ;,)

bleak hedge
#

can we replicate any shaders that we can build in unreal in unity shader graph?

bleak hedge
#

okay thank you

grizzled bolt
errant kettle
#

How can I apply the coloring like (or using the same property) using the color property in the sprite renderer?

amber saffron
fossil cloak
#

Hello all,
i am playing Dungeons 4 atm and i am wondering how they could have done this nice texturing on the ground.
it looks way to good for a vertex painted plane PandaSquish

grizzled bolt
#

Grass could be the same way as it also sometimes sinks into the dirt

fossil cloak
grizzled bolt
grizzled bolt
#

Or see if vanilla decals are not actually too bad after all

ebon basin
#

Looks like texture blending similar to how you can do it using Unity's Terrain

#

Ah, actually maybe wrong about that. The opacity on the path does seem like it's rendered on top of the other textures.

quasi quest
#

imo just height based blending like what proposes microsplat

ebon basin
#

Yeah, doesn't seem like you can easily paint cutouts like that onto the terrain tool unless I'm missing something.

tight phoenix
#

What is the source of this red square in my sprite shader and how do I remove it?

#

the texture

#

looks like maybe the problem is you just cant put sprites in the ui?

regal stag
#

There's a new Canvas graph type in 2023.2 which should work
But yeah, for previous versions it's not well supported. Using Screenspace-Camera mode on the canvas was a workaround.

tight phoenix
#

yeah changing it to a screenspace w/ a camera instead of overlay fixed πŸ€”

thorny gale
#

Anyone willing to help with a shader graph problem? I'm a little new. I have a custom shader that creates this dynamic curved health bar but it only takes in the current pixel/fragment and outputs the relevant colour and alpha for that pixel (see out(4) and out(1)). This shader can be put on a image texture and replaces it with the health bar. The issue is, I want to apply a pixel art filter to the shape but that requires a texture2d to sample from. Is there a way (within shader graph) to take the Out(4) or Out(1) and convert it into a Texture2d which I can sample and then pass the sampled pixel into the master node? Thanks.

deep moth
#

You could do that with a render texture but you won't be able to rasterize it within the shadergraph.

#

Your best bet is to start earlier in the process. I'd look into ways you could pixelate your work using the UVs.

#

here's how Unity's UnityPixelSnap function works

#

screenparams.xy in that function get the width and height of the screen in pixels

#

so if you wanted to add more pixelation you could by multiplying that

thorny gale
#

Thanks, I'll take a look

autumn trout
#

I've been struggling with trying to make good grass textures. Specifically for the sake of making normal maps. This is what I'm using for the basic image:

#

Initially, I was trying to use this same image but converted to a normal map in Unity and created from Greyscale, but this is what the ground ended up looking like:

#

I suppose it's workable, but it definitely looks a little off, especially when you zoom in. Then it looks like this:

#

The normal map I created looked like this:

#

And the results weren't any better. Can anyone give me some pointers or help me understand what I might be doing wrong?

grizzled bolt
thorn epoch
#

How can I fix the lighting on this? it's the shader from legacy -> transparent -> cutout -> diffuse but edited so culling is off

rose plank
#

hey everyone, I don't know if this is the right place to ask but I would like to create a bloom/glow effect around my stickman character, something like the first picture:
On the second picture is my current result, which I am not too happy with. The outline is too thick and the intensity of the glow is too high, I have achieved this result by simply duplicating each limb of the stickman, put it in the background (order in layer), and scaled it slightly, lastly I added a glow effect following a brackeys tutorial (see third picture). Thing is, I am using simple shapes built-into unity (squares and circles) so I just have a sample texture 2D. This creates another problem where my characters circular head gets "blocky" as seen on picture 2. Does anyone know how I can resolve these issues? Any help is much appreciated! :D

jaunty flame
#

Hi everyone! I'm quite new to Unity and I need two transparent 2D textures to be able to overlap each other, but without combining the alpha value in the overlap. Would someone please give me an advice on how to achieve this?

lone basalt
#

Hello! Its me! The guy from yesterday that tried to import a 1GB FBX file. I had a chat with the architect and he confirmed my suspicouns. I got him to send me all the models extra and now I also know why the file was so big.

#

He had 30~ of these chairs in the file. Copy and pasted them all over the place which bloated the file size so much lol

#

Anyway, got it all to work now. Thanks for the help yesterday!

grizzled bolt
lone basalt
#

New issue I am running into:
When trying to export the fbx from Blender to Unity, all the meshes seem to be inside-out. Did i miss an option? :o

grizzled bolt
lone basalt
#

Alright! Ill try that. Sorry for posting in the wrong channel :)

fossil cloak
# lone basalt New issue I am running into: When trying to export the fbx from Blender to Unity...

i made a video tutorial for correct export from Blender to Unity. https://www.youtube.com/watch?v=v-dcBY1-YS8&feature=youtu.be
Would appreciate a like Wow

In this video we talk about the correct workflow to export your 3D models from Blender to Unity.I'll show you the right way and introduce you to common errors and show you how to fix them.

If you are interested in game design and gamedev, we are happy to offer you help on our Discord. You can also check out our Instagram or support us on Patreo...

β–Ά Play video
lone basalt
#

Will definitly check this out. I managed to make a temporary (arguably very scuffed) fix by making a shader script that just inverts the normals

fossil cloak
#

(ah i see its this chair?)

lone basalt
#

Nah, I got rid of the chair ;D

#

Its basically a 3D model of a building that an architect made that I now want to make viewable/interactable in a vr project

fossil cloak
lone basalt
#

You are a king for making a video like this. Thanks a bunch

#

Ill definitly try fixing my messed up meshes with your tips instead of relying on my very basic shader lol

#

Will try it tomorrow and ping you with the results if you want :3

fossil cloak
lone basalt
#

(already liked and saved the video btw) πŸ˜‰

fossil cloak
lone basalt
#

Legend 🍻

vestal dirge
#

I'm having issues making an object transparent. Every time I use the fade render mode my body no longer overlaps the visor. I can't find anything on google about it. I just want my player to become transparent but so far the only way I've found to do that is with the fade/transparent rendering mode on my material.

quasi quest
#

if you want you object to be transparent, well yes you need to use a transparent material

#

transparency is a big issue when several transparent object overlap eachother, it's strange that it does not work fine here, try to check the write depth box

#

if that still does not work you'll have to use custom passes

compact adder
#

hey guys, im currently trying to make my "volumetric" clouds shader to work better (in URP) and i have an issue. the clouds look goof from the top since i have a part in the shader that makes a line and blends the cloud color in the middle. however i want this effect not to be thru the middle, but everywhere. so for example if i look to the bottom of the clouds it should still have that differenty colored effect instead of whatever is in the third image

#

also this might be useful to know the clouds use a particle system to exist its not part of the shader

latent stag
#

thread time

frigid pond
#

hey is anyone having issues with shader variant collection assets? Im trying to add more, but the UI doesn't work and I can't add any new variants in the Editor...

I'm on 2023.2.3 atm

frigid pond
#

nevermind figured out the issue, variants only take unique combinations

#

the shadervariantcollection editor is pretty broken atm, so I was just trying to create an editor to bypass it...

deep moth
#

It would make a hard line so you might need to use something like smoothstep to ease into it

compact adder
deep moth
#

Subtract the height of the clouds from the world position

#

Then take the absolute value of that

#

For a mirrored position

#

Then use smoothstep

#

Which takes a little getting used to

compact adder
#

ooh ok

deep moth
#

Smoothstep is like the step function but lets you define a start and end to it

#

Instead of a hard line

compact adder
#

when i split what is height again

deep moth
#

Y value which is G

compact adder
#

yea but what is it called when splitting

#

R right?

#

sorry if i sound dumb im very new to shadergraph

deep moth
#

I think you could actually put it right after your subtraction

#

Abs here

#

No worries! Takes a sec to get used to.

compact adder
deep moth
#

You've actually already done it!

gloomy gust
#

how can i create a shader that makes objects fade out as they get close to the camera

deep moth
#

I realized looking at your graph

#

ColorDivideHeight is what you'll mirror from

compact adder
#

like this?

deep moth
#

What you had before was good!

#

Like that but use G instead of R

#

vectors in shaders are described as XYZW or RGBA

#

Oh! Also make sure you have that in world space not object

compact adder
#

Im getting there thank you

deep moth
#

Beautiful 😊

#

So you can take that value now and ease it using smoothstep

#

And it'll have less of an intense color in the middle

compact adder
#

alr thanks

#

also one question

deep moth
#

Shoot!

compact adder
#

this is good for cloud formations like this one now right

#

since the underside is also in that color thing

#

how would i handle clouds that lie in other shapes like spheres tho?

#

i thought of using fresnel but it didnt work before

short galleon
#

I'm following a tutorial to make a shader, and they say to go to volume----> custom pass, but in the latest Unity, custom pass does not seem to exist under Volume. Can somebody tell me where to find it? Thanks

deep moth
#

It might kind of challenging if you're just getting into shaders but you could look into signed distance fields

#

There's a whole field of cg dedicated to what you're describing

compact adder
#

well thats a task for later

deep moth
#

Distance to a sphere is the easiest one

#

And distance to a circle is just that in 2d

deep moth
#

If you're in urp

short galleon
compact adder
#

hey @deep moth it doesnt work for some reason

#

i did everything like yoi showed me but theres no different colours

#

the absolute still shows the right thing tho

#

wait nvm i fixed it

deep moth
#

Nice! I thought about it and realized that makes sense

#

Bc it got rid of the line

compact adder
#

yea

#

also one thing

#

basically make the effect local

deep moth
#

Yep! Just switch from world space to local in the position node at the start.

#

You'll need to rework a lot of your numbers to get it to look right

#

But the same math should apply

compact adder
#

switching to object doesnt work

deep moth
#

It'll look crazy at first but you just need to adjust the numbers

#

To be 0-1 range

#

That should work if you're using a particle system

#

Because all of the spheres are batched together

#

But won't work for individual spheres in a big cloud

compact adder
#

uhh that sounds complicated

#

so i just set every value to be between 0 and 1 and if i need it higher i just multiply right?

deep moth
#

Nono

#

You just have your parameters like

#

The height value in the material

#

Is probably a big number like 1000 right now

#

To make it look right you'll just need to pull that slider down

#

Object space is usually from 0-1 sometimes -1 to 1

#

Before it's tranformed into world space

lean lotus
#

Is there a way to have a compute shader get dispatched on frame 0, and have it run throughout several frames, instead of holding up the rest of the shaders until its done?
I need this because I have 5 large texture atlas's, so I use a compute shader to write all the input textures into the spot in their atlas, but that can take too long and stall the game as it is(16k atlas's)

quasi quest
#

this might help

ebon basin
#

What would be some ways that I can obtain the object's rotation inside of the shader graph? The object node only seems to have scale and position of the object, and I require the rotation for rotational relativity with my camera. If I expose a field and send in rotational values, would that complicate the reusability of the materials because that's what I'm looking at right now.

#

Like, I see guides doing some inverse model stuff to obtain rotational values, but that's an operation per vert which I don't necessarily want to be doing if I already have those values.

#

Ideally I want to be doing this operation inside of the shader:

Mathf.DeltaAngle(PlayerCamera.transform.eulerAngles.y + 180, EntityTransform.eulerAngles.y));
#

EntityTransform being the object with this shader

ebon basin
#

Actually, probably not ideal to do some of this stuff on a per vertex basis. May just computer shader some rotations, and do some billboarding operations inside of the graph.

silk thicket
#

I followed a video, to make cel-shaders for my game, but it ended with a Lerp node, so can someone tell me how to use the shader? and what to do with the value i get output from the Lerp node?
https://youtu.be/rCvISlussGE?si=CSYQP9sX9jZYHLp8&t=55

Hi, I'm stealing the "Lazy Tutorial" naming from the great Ian Hubert. This is not a proper tutorial, more of a rundown of how I achieved this effect.
#indiegame #gamedev #unity
Please consider supporting me by following me over at https://twitch.tv/whateep

Custom Function node HLSL code:

#if SHADERGRAPH_PREVIEW
Direction = half3(0.5, 0.5...

β–Ά Play video
#

i followed the tutorial, now i am just left wondering what i need to do to actually see the shader in my scene...

ebon basin
#

into base color^

haughty topaz
#

Does anyone know how to make it so I can get a glowing effect on individual objects? I've tried to follow like 50 different tutorials the last few days and I can't seem to get anything to work at all and I can't understand why or what I'm doing wrong. This is for 2D, I've tried post processing volume, using a shader graph, one of the tutorials said to make a material and check the emission box but when I create a material there isn't any emission box at all. I know about global volume but I don't want it to affect everything on screen and I'm just completely lost as to why it works in 2 minutes in the tutorials I watch but when I follow them step by step it just doesn't

autumn trout
#

Do you know of any Mac alternatives to shader map 4? I don't have a PC.

main breach
#

Heya! I wanna make a shader that basically flattens any 3d mesh based on the direction of the camera to get a doom-enemy-esque effect but I'm having trouble when it comes to making the flatness follow the camera around.
Basically, I want you to not be able to tell that the enemy you're fighting is flat until you go above them in any way, where you can now see that it is, indeed, thin as a piece of paper.
Thus far I've made whats shown in the screenshot, with the "FlattenVector" value being equivalent to the right vector of the model.
If I set "FlattenVector" to (1,0,0), or (0,0,1) then the mesh looks perfectly flat as I want it to (as seen on the first gif), but as soon as I set it to a diagonal vector, like (0.5, 0, 0.5) it stops being flat.
Is there any way to make it so that its possibleto flatten characters from diagonal angles? Thanks in advance!

deep moth
#

Hi there! Not a super robust answer but I'd recommend looking into point plane projection. You can use the dot product to calculate the distance to the camera plane and then add that distance in the direction to the plane to flatten it. https://stackoverflow.com/a/9605695

junior copper
#

how can I tile my shader with x y z ? with tilling im locked with only vector 2

fossil cloak
junior copper
silk thicket
silk thicket
#

It looks like this when i put it in the base color..

amber saffron
silk thicket
#

sorry i am very new to the whole world of shaders.... I am using the URP Shader Graph

amber saffron
#

What targets do you have here ? (top right corner of SG window)

silk thicket
amber saffron
#

And are you in a project that is using the Universal Render Pipeline ?

silk thicket
#

I am fairly sure i am. is there a way to confirm that i am? :))) (thanks for the help)

amber saffron
#

Check the project settings :

#

(I'm in a HDRP project for my screenshots, but it's the same for URP)

#

Or, it can be in the Quality settings, the current active quality level can have a dedicated URP asset

silk thicket
amber saffron
#

Well, looks like you do have URP imported in your project, but not set up

#

If the grass material that I see in you screenshot uses the "Standard" shader, you are actually using the built-in renderer

#

So, you have two choices here : swith you project to URP, or switch your shader to target built-in

silk thicket
#

okay so i switched active targets in the target settings to "Built-In" and now i get the following errors

amber saffron
#

Ok, I didn't have the full context of you shader. So you are trying to make a custom lighting (toon) shader ?
I guess you have some custom lighting nodes in there, and they do not support the built-in renderer

silk thicket
#

aha, yes you are correct. I am guessing that the custom lighting node is this one:

amber saffron
silk thicket
#

okay im pretty sure i did everything correctly, however, now everything in my project is pink

#

and the shader graph looks like this

amber saffron
#

But the cube with this shader assigned is still pink ?

chilly parcel
#

hey guys how would you go in making a Sun like background/shader that moves like the 80's games? https://www.youtube.com/watch?v=YIT03mDqX5Y&t=1463s like this

http://www.longplays.org

Played by: xRavenXP

Axelay is a shoot 'em up released by Konami for the Super Nintendo in 1992 in Japan and 1993 in Europe and USA. Considered one of the best games in the genre Axelay was one of the first games to use the technique Mode 7.

Before each stage, you can choose 3 weapons to equip your ship a normal shot, ...

β–Ά Play video
amber saffron
fallen wedge
#

Hey! πŸ˜„

I have this sprite in my 3D project, I want to make it so it's visible no matter what's in front of it
I tried a bunch of shaders I found online, they work great with regular 3d objects but when I apply it to my sprite they won't work.
I've been trying to figure this out all day, but sadly to no avail.

Any ideas what I could do? I'm completely lost.

chilly parcel
silk thicket
#

the cube is the only thing that is not pink

chilly parcel
#

Problem solved. XD

amber saffron
# silk thicket

Yep, so this "expected" : the cube uses a URP compatible shader and shows like intended, and you need to fix the material of the grass plane

amber saffron
fallen wedge
#

Uh xD

#

Sorry, I'm quite new to unity, is that supposed to be saying None?

silk thicket
amber saffron
silk thicket
#

i am a shader idiot

amber saffron
fallen wedge
#

Oh, yep, I'm using the default one

#

Will that be an issue for me?

amber saffron
#

Hum, iirc sprites when used in 3D scenes are just flat meshes, so any regular material should work with it.
You don't need a specific shader, if you use the standard shader for example you should be able to change it's render queue to "after transparent" or something so it is rendered after everything else.

fallen wedge
#

πŸ˜“ Sorry for being a total newbie, but how would I do that?

#

Is that an option in the mat settings?

amber saffron
fallen wedge
#

I'm getting this error, am I missing something?

#

This is a new standard material I just created in my assets folder, I tried selecting transparent then the error occured

amber saffron
#

Ah, yes, I forgot this was added and doesn't allow to set any value you want anymore :/
You could set the Rendering mode to "Transparent", that should allow to increase the Queue value up to 3999

fallen wedge
#

I see!

#

Are my settings correct btw?

#

Doesnt seem to do anything

amber saffron
#

Hum, I was suspecting this :/

#

IDK what are the other shaders you have doing, but to make this work they need to :

  • Render after everything else : have a high render queue
  • No depth test : Z-Test Off
#

You should be able to spot this in their code

fallen wedge
#

I was able to get this to work

#

πŸ˜‚ but the color now looks abysmal, any ideas how I could fix this?

#

Hang on, let me share the code

#
    Properties {
        _Color ("Main Color", Color) = (1,1,1,1)
        _MainTex ("Base (RGB)", 2D) = "white" {}
        _OccludeColor ("Occlusion Color", Color) = (0,0,1,1)
    }
    SubShader {
        Tags {"Queue"="Geometry+5"}
        // occluded pass
        Pass {
            ZWrite Off
            Blend One Zero
            ZTest Greater
            Color [_OccludeColor]
        }
        // Vertex lights
        Pass {
            Tags {"LightMode" = "Vertex"}
            ZWrite On
            Lighting On
            SeparateSpecular On
            Material {
                Diffuse [_Color]
                Ambient [_Color]
                // Emission [_PPLAmbient]
            }
            SetTexture [_MainTex] {
                ConstantColor [_Color]
                Combine texture * primary DOUBLE, texture * constant
            }
        }
    }
    FallBack "Diffuse", 1
}
amber saffron
#

Which one of the screenshots it looking good for you ? the blue or purple one ?

fallen wedge
#

The blue is supposed to be blue, although I would prefer it to retain the original color while still being 'see through', this is just a random shader I found online

#

The real issue is that the original sprite I had was 255,0,255 (pink) and now it's very dark and the colors are messed up

#

I went from this

#

To this

amber saffron
fallen wedge
#

My final goal is for it to retain it's sexy pink look, even if it's obscured by something

#

The shader I provided was the only one that was working, I found it online, I actually have no need for it to be blue when it's obscured by something

fallen wedge
#

Now I just want to get rid of the functionality where it is blue when its occluded

#

Also from behind it is invisible, I'm trying to wrap my head around why this happens

silk thicket
#

@amber saffron thanks! you are so cool

amber saffron
# fallen wedge Also from behind it is invisible, I'm trying to wrap my head around why this hap...

Try this shader :

Shader "Unlit/AlwaysDisplay"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
    }
    SubShader
    {
        Tags { "RenderType"="Overlay" "Queue"="Overlay"}
        LOD 100

        Pass
        {
            Blend SrcAlpha OneMinusSrcAlpha
            ZTest Always
            ZWrite Off
            Cull Off
        
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            
            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

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

            sampler2D _MainTex;
            float4 _MainTex_ST;
            
            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = TRANSFORM_TEX(v.uv, _MainTex);
                return o;
            }
            
            fixed4 frag (v2f i) : SV_Target
            {
                // sample the texture
                fixed4 col = tex2D(_MainTex, i.uv);
                return col;
            }
            ENDCG
        }
    }
}
fallen wedge
silk thicket
#

@amber saffron would you know where this little point here comes from? :

amber saffron
silk thicket
#

nvm, i found out, it is from the compression on the texture image i used for the Shading Ramp

amber saffron
silk thicket
#

remy, now the big question is, is there a way to use this shader, and have different colors and materials on in game objects?

amber saffron
# silk thicket remy, now the big question is, is there a way to use this shader, and have diffe...

The shader/materials workflow is this : a shader is the code executed by the GPU, and materials bind properties with a shader.
So, you can have multiples materials, using the same shader, with different properties.
To use this single shader, on multiple object with different colors, create as many materials as you need, assign them the shader, tweak the colors and assign those materials to the objects.

#

Note that unity recently introduced the concept of "Material Variants", it is basically how prefabs & nested prefabs work, but with materials.
You can create a "Master" material from you shader, that holds the base color and ramp/fresnel settings, and then create variants for all the objects in the scene, only overriding the color.
That way, you will have a consistant ramp/fresnel look in your scene, and you can tweak it in a single place.

silk thicket
#

so if i wanted to make these shapes different colors?

lunar valley
#

multiply it by a color

amber saffron
#

@sterile rain You'll need to expose colors properties on the shadergraph to be able to edit it on the material level

#

So you replace those two constant color nodes by the properties :

vestal hill
#

!code

echo moatBOT
vestal hill
#

https://gdl.space/ibolulekad.cs This shader script makes objects come out with a toony style, and a toony outline. however the lighting only works from a single directional light, and any aditional lights do not affect the shader. Say i wanted to make a torch that would effect the area around it, how would i edit this shader to make that work

sage burrow
#

these 2 objects have the exact same material, why is the diamond showing up as a blur while the square has the correct display effect

#

this only happens when the game is built and ran

amber saffron
sage burrow
#

yeah

#

thinking of it now thats prolly why lmao

#

but how would i fix it

amber saffron
#

If you are changing a keyword on the material, you must be sur that the shader with the matching keyword variants is available in the build.
Ususally it is prefered to swap the material to one with the wanted setting that has been referenced in the script, that way Unity automatically generates the required variants based on the scene dependencies.

sage burrow
#

i get that but the value that is being changed is a float to control how much of the object should be transparent

#

so i cant really swap materials to create the dissolving effect

amber saffron
#

Only the float is changing ? Then indeed there shouldn't be a variant issue πŸ€”
Maybe check that the float is actually changing in the build and is not stock to it's initial value ?

sage burrow
#

How would I check in the build?

amber saffron
#

You can use OnGUI to display stuff on screen, or Debug.Log and enable development build to display the console in game

sage burrow
#

Okay okay thanks

#

found the issue nvm

#

the diamond just isnt displaying the material properly

#

im struggling to find out why this is only happening in the build though

amber saffron
#

Also, is the diamon in the scene already using the shader or do you maybe swap the shader at runtime ?

mellow hare
#

hey guys. is there a way to "apply" triplanar shader to a mesh so the texture stays the same wherever i move the mesh?

ebon basin
#

yes, triplanar node inside of the shader graph is as simple as it comes

mellow hare
#

yeah i have the triplanar shader. but my problem is that i want it to work like its baked onto a mesh. so when i move the mesh it doesnt look weird. is there a way to apply the triplanar texture in that way?

deep moth
#

Use object space position instead of world!

#

It won't help you make multiple neighboring meshes look like they're all one material - that's the only catch.

#

But if you're just trying to do quick texturing that will work

sick knot
#

On ShaderGraph, how would you make 'Camera' an assignable camera rather than always taking the CameraMain?

(and if that's not possible, how can I make an assignable variable on the shadergraph that can output a gameobject's Position and Direction? because on the blackboard, i see no option to add a 'Camera' or 'GameObject' variable)

ebon basin
#

you can send in a vector3 of coordinates (or matrix) probably

#

I wonder why the node doesn't give rotation but position and direction

regal stag
regal stag
sick knot
#

Would anyone know why literally just this single Node in a shadergraph causes my Plane to visually become bigger when i apply the material to it?

#

and i guess to add to this question, how can I have this shadergraph not cause the plane to get bigger when i apply it?

deep moth
#

yep! the reason is that position node takes a local position instead of a world position

#

click on the dropdown "space"

#

and set it to object

#

if you need world you can always transform it back at the end

stiff nexus
#

If I want to make a shader that affects the whole screen, how could I do that with shader graph? I want to create outlines and posterization.

#

Would I make a fullscreen shader?

deep moth
#

Posterization will be easier than outlines

#

since outlines you need multiple samples for

#

which can be kind of overwhelming in shadergraph

#

but totally doable

#

especially for outlines which only need a handful and not a loops worth

#

like some blurs

ebon basin
#

//Post
https://forum.unity.com/threads/problem-solving-2d-billboard-sprites-clipping-into-3d-environment.680374/

//Script
https://hatebin.com/woievujela

//Image
https://i.imgur.com/63G9QzQ.png

So I've been using one of bgolus scripts for a lot of my 2D objects in my 3D world and it works great beyond breaking some batching. Now, I've had some ideas on another project where I would like that top down view with some tilt on some 3D characters so I can actually see their fronts a bit more.

Unfortunately, the shader doesn't work as expected considering that I do need ZWrite on for these complex character meshes otherwise I run into issues where pieces of the character would render over another incorrectly. I've tried experimenting with clip space with other than the z, but even though I understand the operations happening, the logic of how this all works still goes very far over my head.

So some ideas I have at this point: ditch the shader, lock the camera, change pivots of all 3D renders and sort by -zy. That's more of a last case scenario, but ideally if I could figure out a way to tackle this shader further I'd probably want to manipulate their coordinates but in 2D screenspace(?) or however I can go about applying this shader to this object after the object has sorted its own depth out.

stiff nexus
deep moth
#

I think that would be a really good shader to start learning with

deep moth
#

and I think in that situation if you had a 3d model you'd still want the depth to all be set to the one plane so you'd get the smushing.

ebon basin
#

Yeah, exactly. Would that be done in a single pass you think?

deep moth
#

Yeah that's a single pass approach but I think it also breaks batching.

ebon basin
#

Probably fine? Two passes probably creates similar problems, but I'd go with the easiest solutions honestly.

#

But yeah, how I'm thinking it is I need to squash it back into that quad format, then I can valuate it in clip space on those specific verts

deep moth
#

OKOKOK

#

what if you squished it but just a little bit

#

just enough that it tilts properly

#

and doesn't intersect

#

but still extrudes a bit also - enough that the zfighting goes away

stiff nexus
deep moth
#

I guess that's what you're pitching with the pivots idea

#

sort of

#

at some point i think the depth can't all be the same if they're zwriting

ebon basin
# deep moth what if you squished it but just a little bit

Right, well the two cases here is with ZWrite off then we've verts that are having problems sorting with each other on the same model which is what happens if you use a transparent detailed mesh without ZWrite On. With ZWrite off I do get the depth sort on the model itself, but I'm not entirely sure how it's being evaluated, but there does seem to be some z-fighting?

#

the defaults of the script do have ZWrite off, so apparently the sorting of it all is less relevant as I guess the clipping handles it all.

#

I should actually try it with a quad with ZWrite on and see if I get any z-fighting and whatnot

deep moth
#

sounds good! one other extreme approach would be to render them into rendertextures but you wouldn't be able to do that many and rendertextures can be really slow on some platforms.

#

im pretty confident this can be solved w/o that

deep moth
#

is that error coming up related to the post processing or something else ?

ebon basin
stiff nexus
#

I can open the shader fine, currently what ive done is create a shader graph, then made a custom post processing volume. Gave them the same name, then I added this to the graph.

deep moth
#

oh! you probably wont be using a texturearray named maintex for a postprocess

#

since that's where the color comes in from the scene

#

but that doesn't seem to be your problem

deep moth
#

its a headache

stiff nexus
deep moth
#

what's posterization.cs?

#

oh sorry!

stiff nexus
#

The custom post process volume

deep moth
#

yes ok cool

#

I understand what's going on

#

Posterization is going to be under

#

Shadergraph/Posterization

#

hidden/youreffect is where it would be if you made it in text

#

by default

#

you can check the path of the shader by making a new material

stiff nexus
#

The error is gone now :D

deep moth
#

sweet : )

stiff nexus
#

but now I am lost on how to get the rendered image for the shader and apply the effect to it.

deep moth
ebon basin
#

I'd give you my nice 2D version but half of it is me debugging stuff and it looks terrible lmao

deep moth
#

noo worries

#

im gonna make a little blender test model or something

ebon basin
#

sprite shaders in URP require a lot of extra fiddling because they use basetex or w/e instead of _MainTex

#

probably better off just skipping out on spriterender anyway since it breaks batching

stiff nexus
#

Do I not need to access the render texture or something to apply the posterization to it?

deep moth
#

OH This is for a rendertexture?

stiff nexus
#

I don't know

deep moth
#

if its a fullscreen post process we've gotta go through all of these steps but if its a rendertexture its a little simpler

stiff nexus
#

I want to make the game screen have a posterization effect. wouldnt I need to get a reference to the screen?

deep moth
#

yep so the way that usually works is it assigns the color of the image to _MainTex

#

but the naming might be different for HDRP

#

I'll check

#

yeah -- based on the docs it's expecting a Texture2D to assign to called "_MainTex"

#

make sure you have one of those in your blackboard

#

and that's what you should sample to get your color

#

you dont need to put anything in there

#

it will automatically be filled in by the post process

deep moth
#

It's not the same as Z fighting its related to the way the indices are ordered.

#

very frustrating

#

problem

#

im liking your idea more and more of going with multiple passes

stiff nexus
#

For some reason its throwing this error

deep moth
#

hm - i actually dont know about that one

#

is it blocking you?

#

one of the pieces of the documentation says that you need to set the shader to always loaded

ebon basin
deep moth
#

oh crap no

#

that is a built in feature

#

they took that out

deep moth
#

try this ?

stiff nexus
#

I did that, but I am still getting the error?

deep moth
#

tbh im not sure why that's happening. it might be unity issue if you've followed the documentation to a tee.

#

is it stopping you from entering playmode?

stiff nexus
#

no

#

but I have the shader intensity at 0 rn because the shader is pure gray.

#

nvm

#

its working fine i guess

deep moth
#

oh nice!

stiff nexus
#

I have this rn.

#

Its making this

deep moth
#

awesome

#

you're post processing!!

stiff nexus
#

I know I need to separate the value to lower the smoothness of it, but I dont know how to lower the smoothness of it.

deep moth
ebon basin
#

ill probably have to read more into the pipeline. Been a while and there seems to be a lot more as of recent so might as well get acquainted with it all.

#

but as far as solving the issue as is, even by experimenting I wasn't getting any results and I doubt I'll be understanding the logic any time soon

deep moth
#

ahh gotcha!

ebon basin
#

cool shader for when you don't some billboards clipping into your world

deep moth
#

very cool

ebon basin
#

it's just unfortunate that it breaks batching (which is another feature I'm not entirely sure how unity has it working)

deep moth
#

yeah I thought URP had its own batcher that was really flexible

ebon basin
#

spriterender is still in the past is the issue I think

deep moth
#

OH I understand its not just that

#

it doesn't work with batching because it needs a model matrix that isn't batched together with something else to billboard

#

i dont know if that's a problem for URP batching though

ebon basin
#

my understanding as far as batching goes is it glues everything together into one mesh or something to reduce it to smaller draw calls every update

deep moth
#

right -- in the process it can mess w/ your model matrix too

#

so sometimes you'll write an object space shader

#

that looks different in batching

#

and i think this one is very sensitive to that

#

i think that wisdom applied with the old built in pipeline batching but not sure if it applies to URP anymore

ebon basin
#

ah, ok I think I may understand if it has to do with cacheing

deep moth
ebon basin
#

static batching is pretty simple concept, object don't move then cache it and forget about it

#

spriterender forces dynamic batching no matter what, even if it may seem static

#

which is why it may just be better to use quads

deep moth
#

oh i understand what you're saying

ebon basin
#

still, stuff to profile but I can assure you that the srp batcher pretty good cause it beats my voxel batcher no matter what lmao

stiff nexus
#

I found something that limits the values between two edges, but it doesnt make steps of them, it just prevents values from being greater than or less than the 2 edge values I define.

deep moth
#

its so nice that it can batch different materials!!

#

that was a game changer for me

stiff nexus
#

Base Image 1st. after smoothstep 2nd.

stiff nexus
deep moth
#

smoothstep is great

#

but you're trying to posterize right?

stiff nexus
#

yes

deep moth
#

sometimes its helpful for me to try things out in graphtoy to see the shapes of different math functions https://graphtoy.com/

Graphing functions easily on the web

#

I'd recommend using something like round, floor, or ceil

#

to get a stepping effect

#

one pattern you can use is round(value * numSteps) / numSteps

#

which might give you something like what you're looking for

#

here you can see in graphtoy it keeps the values in the range from 0-1 but adds more steps

stiff nexus
#

I took what you showed me and applied it to the shader and this is how it looks rn.

#

It worked well on the sky, but it has this weird thing by the axe

deep moth
#

you mean around the handle ?

#

im not sure what that is -- it is a little strange

#

maybe its bloom related ?

stiff nexus
#

Its not bloom related, I dont have any bloom. Its being very sharp at some parts for some reason.

#

The sky looks really cool

#

Well, now that the posterization is working, how can I go about creating outlines?

deep moth
#

if i were going to do an outline with HDRP I'd try to do it from the depth buffer

#

and sample in a grid in depth

#

checking to see if there's any big changes in depth

#

where are you thinking you'd want the lines?

deep moth
#

sobel operator is the basic idea https://en.wikipedia.org/wiki/Sobel_operator

The Sobel operator, sometimes called the Sobel–Feldman operator or Sobel filter, is used in image processing and computer vision, particularly within edge detection algorithms where it creates an image emphasising edges. It is named after Irwin Sobel and Gary M. Feldman, colleagues at the Stanford Artificial Intelligence Laboratory (SAIL). Sobel...

stiff nexus
deep moth
#

wait rly quick what outlines are you trying to get

#

are you trying to outline characters?

#

or outline contours in your posterization ?

stiff nexus
#

I am making a horror game, and I am in LOVE with lethal company graphics.

#

I really want similar outlines to that

deep moth
#

ooooooo gotcha one sec lemme watch some footage

stiff nexus
#

np

deep moth
#

Based on the footage I can't tell if its post processed or just an inverted shell outline

#

I kinda think its a mix of inverted shell outline and then materials

#

rather than full screen post processes

#

just because its effected by blur sometimes

#

part of the reason this is taking me a sec is because I'm trying to think of a way to do this without throwing you too far out there since it seems like you're still getting familiar with shaders

#

but if you're comfortable exploring a bit this repo has some great examples that you might be able to modify to your liking to learn from

#

I tend to go here when I'm trying to figure out custom passes for HDRP

#

the basic idea I think I would try to keep in my mind while doing outlines is this pattern of edge detection:

sample up
sample down
sample left
sample right

was any sample very different from the others?

if so its probably an edge

#

and you can sample textures that way

#

or continuous functions like noise

#

there are more advanced ways of pulling all of that stuff out too

#

the easiest way to make outlines is to use the inverted hull method

#

which has some gotchas

stiff nexus
# deep moth Based on the footage I can't tell if its post processed or just an inverted shel...

Watch this video https://www.youtube.com/watch?v=Z_-am00EXIc. Goes into every detail on how its done

The first 500 people to use my link will get a 1 month free trial of Skillshare: https://skl.sh/acerola01241 ! #ad

Lethal Company has some very compelling visuals, but how much of it did the developer make themselves? And how does it all come together?

Topics covered: Frame capturing, fixed resolution rendering, edge detection, posterization, ...

β–Ά Play video
deep moth
#

oh awesome!!

stiff nexus
#

It uses HDRP and shader graph just like I'm doing

deep moth
#

are there specific parts of this you're having trouble w/?

stiff nexus
#

The outline

#

everything else is already done

#

practically

deep moth
#

there it is!!

#

thank u acerola haha

#

that's basically what i was just summing up above

stiff nexus
#

I love that guy!!

deep moth
#

you just need to figure out what to find the max local contrast of

#

in a lot of cases its the depth

#

i've gotta dip for the night unfortunately

#

so i can't help too much deeper but you've got some good tools to mess with!! hopefully someone else can pick up

#

oh cool actually this is more straighforward than I thought -- its checking the difference in normals between pixels

#

so you need to figure out how to get the normals into your post process material

#

and then use a sobel operator to detect the edge

#

and then color that edge

stiff nexus
#

Thank you so much for helping me with this, all of this info will help immensely.

deep moth
#

it grabs the camera depth texture

#

which at the step that you're grabbing the color should still line up

#

depth buffers are more complicated than color textures so it'll take some fiddling

#

oops sorry that's depth not normals

#

you'll have to figure out the normals part!! gotta dip hopefully someone else knows the answer

#

good luck!!

stiff nexus
#

thank you!!

stiff nexus
#

Hey just so you know in the morning, I couldnt figure it out, I cant seem to find how to apply Sobel edge detection via shader graph. As with lethal company the developer applied two outlines, one, a depth difference edge detector, and two, either a color difference or a normal difference edge detector.

#

This is sobel

#

This extra detailed stuff is either color difference or normals.

#

I'm gonna go to bed now.

vestal hill
#

https://gdl.space/ibolulekad.cs This shader script makes objects come out with a toony style, and a toony outline. however the lighting only works from a single directional light, and any aditional lights do not affect the shader. Say i wanted to make a torch that would effect the area around it, how would i edit this shader to make that work

wild marlin
#

hi i dont know much about shader editors but i just found about Amplify. can a shader created in amplify be easily recreated without it?

civic belfry
#

Hey guys, i have hardly any experience with shaders in gamedev, just a bit of HLSL, so my question may sound stupid.
I use hdrp, and often only have a roughnessmap texture for the metallic/specular shader workflow.
Let's say i just want the main/default specular shader with a small change, i want it to invert the roughnessmap so i can use it directly as specularmap, or any other small change... How do I do this? When I choose -> Create -> Shader -> Surface Shader this is basically a light version without bumpmap. Not what I want (as base). I tried to explain to chat gpt what I want but it didn't get my question. Whelp ^^

mental bone
#

How ever I would suggest to simply convert your maps offline. No need to waste the instructions in a shader

civic belfry
deep moth
# stiff nexus Hey just so you know in the morning, I couldnt figure it out, I cant seem to fin...

Hi I spent some time this morning mocking up edge detection in shadergraph for you! I haven't implemented a full sobel operator nor integrated it w/ the normals but I tried to make it as clean as I could so you could try to plug those in to learn yourself. Anything involving multiple textures samples is gonna be a mess in nodes.

I also came across this node which might be helpful for you:
https://docs.unity.cn/Packages/com.unity.shadergraph@16.0/manual/HD-Sample-Buffer-Node.html

#

Overall the shader is very simple -- it just looks crazy because everything needs to be done 9 times lol.

#

here's the filter on windows bliss

modest orbit
#

Hey, in my scene veiw my game looks fine, but when I open in VR, in game view half my map is missing/invisible

#

im not even sure how to debug this

#

its more a setup issue/camera issue/vr issue/xr plugin issue i think

#

Anyone know how to go about debugging this? Its not clipping plane, its not render distance

#

No errors in the console

stiff nexus
fossil cloak
modest orbit
#

idk what that is, need to google one sec

#

oh i see

fossil cloak
modest orbit
#

Will check on that one

#

I did way too many things at once, so idk what messed it up.
But i upgraded my oculus SDK, upgraded unity version, and changed some render settings (although I think I changed them all back with git diff)

stiff nexus
#

my graph uses Texture2DArray because it throws the same error if I don't.

fossil cloak
modest orbit
#

classic mistake

#

anyways, I can roll back if i need to

#

trying to debug it first

#

so if i toggle mesh renderer off and on, itll render fine

#

but on init, it doesn't show up

#

πŸ€”

#

and then when I deselect it, it will disapear again

fossil cloak
#

Hmm, sadly I have no clue what causes this. VR is magic sometimes πŸ˜‚

modest orbit
#

im not even in VR. This is just the main camera. It may be affected by the vr setup tho yeah

#

oh maybe if I make a new camera it will help me debug

#

ok I finally circled back to occulsion culling

#

apparently that was it πŸ˜„

#

thanks my guy

#

Ohhh, I moved my game objects around and didn't bake the occulusion culling

deep moth
fossil cloak
stiff nexus
#

Then it doesnt render

deep moth
#

You probably need to get rid of the texture2dArray node in the graph and replace it with a texture2d

stiff nexus
#

If I use Texture2D I get an error saying that unity is trying to assign a Texture2DArray to a Texture2D

deep moth
#

Oh interesting hm

stiff nexus
#

which means for some reason unity is using a texture2darray instead of texture2d

deep moth
#

I didn't realize HDRP used those for post processes that's pretty weird

#

anyway you can fix the issue by changing those nodes to sample texture2dArray instead

#

instead of sampletexture2d

stiff nexus
#

Texture Size node doesnt work with texture2darray

#

I cant make this work with texture2darray

#

It doesnt let me connect them

#

because TextureSize wants a texture, and there isnt a TextureArraySize node

deep moth
#

you might need to pass that information in the pass -- there's a way to get it from the shader but it might be a little more complex for texturearraysize

#

and require custom hlsl

#

I'd recommend going up a level

#

to the C#

#

and setting it in the material

#

so where it says
m_Material.SetTexture("_MainTex", source);

#

& m_Material.SetFloat("_Intensity", intensity.value);

#

make a new couple that are

#

m_Material.SetFloat("_Width", texture.width); etc

stiff nexus
#

Where would I get the texture variable?

deep moth
#

it's called source in the C# function

#

and its an RTHandle

#

so you'll have to read up a little on those

stiff nexus
#

Like this? m_Material.SetFloat("_Width", source.scaleFactor.x);

modest orbit
#

lmfao too much documentation

stiff nexus
#

or is scaleFactor a value between 0 and 1?

deep moth
#

does it let you grab the rendertexture underneath?

#

that's what I would try first

#

source.rt.width

stiff nexus
#

I converted it, here is with and without the shader.

deep moth
#

lets goooo!!!!!

#

hell yeah : )

#

from there if you wanted to put that outline over something the rest is pretty simple

stiff nexus
#

oh?

deep moth
#

yep

#

just lerp between the source image and what you have

stiff nexus
#

what would be the T factor?

#

Um, well I tried setting it too lerp at 0.5, perfectly inbetween, and this is how it looks.

#

closer

#

much closer than yesterday

deep moth
#

play around with the inputs!! you're close

#

if you need a hint lmk

stiff nexus
#

Woah, even closer!

#

I did it :D

#

Black outlines :)

#

and I can change the color of the outlines by changing the value of B

#

How can I lower the threshold of the outline?

deep moth
#

wooh!!

stiff nexus
#

Hmm, it appears to be outlining based on color, which is good for the detaily bits

deep moth
#

yep - that makes sense because right now you're just outlining color

#

you can take what you have and switch it pretty easily to normals once you figure out which texture has them in it

stiff nexus
#

So its outlining based on when there is a large contrast in color

deep moth
#

exactly

#

in color value specifically

#

is the way I wrote it

stiff nexus
#

right

#

thats really cool

deep moth
#

: )

stiff nexus
#

thank you!

#

also

deep moth
#

for sure! keep messing around w/ it

stiff nexus
#

What is happening here?

#

this is the scene view

deep moth
#

whoa

#

i actually dont know

#

i haven't tested it as a post process

#

it might have something to do w/ the width variable ?

stiff nexus
#

That was actually happening before I applied your outlining to it.

deep moth
#

oh

#

ok haha hm

#

i dont know!

#

is it always half black ?

stiff nexus
#

It would just happen sometimes when I stopped the game.

deep moth
#

does your console tell you anything?

stiff nexus
stiff nexus
deep moth
#

did it start happening when you added the pass ?

#

& does it go away when you remove it ?

stiff nexus
#

Let me check rq

stiff nexus
#

It looks like its trying to make the visible area in viewport the same size as the game window, for some reason.

deep moth
#

Weird --
A couple of things to look at:
Order of operations, when does the post process get called?
The texture its pulling from -- maybe the width and height is improperly set

#

You could try sampling scene color in a different way

ebon basin
#

Any recommendations on toon shader tutorials / cel-shading? Looking for something a little more structured than usual.

deep moth
#

this node looks promising -- i think its mostly for objects and not post processes but its worth a shot

ebon basin
#

I assume toon shader means cel-shaded or is my terminology off

deep moth
#

I feel like they're pretty interchangable!! The other thing I see thrown around a lot is Non Photorealistic Rendering (NPR)

#

I feel like they're diff levels of specificity

#

Non Photorealistic Rendering <- Toon Shader <- Cel Shading

chilly parcel
#

https://www.youtube.com/watch?v=YIT03mDqX5Y&t=1463s Hey guys I would need some help with making the background/skybox or something similar like this. How would ya do it?

http://www.longplays.org

Played by: xRavenXP

Axelay is a shoot 'em up released by Konami for the Super Nintendo in 1992 in Japan and 1993 in Europe and USA. Considered one of the best games in the genre Axelay was one of the first games to use the technique Mode 7.

Before each stage, you can choose 3 weapons to equip your ship a normal shot, ...

β–Ά Play video
ebon basin
#

maybe a better term is over-saturated shaders and neat shadowing and outlining with specular reflections

deep moth
#

I don't know any off the top of my head so I wanna leave space for a sec for someone else to respond. I can think of a lot of nice outlining tutorials but less for cel shading.

#

but I know its a really fleshed out area

ebon basin
#

going for something like that

#

which is a followup to my previous shader problem

deep moth
#

wow this rocks

ebon basin
#

I ditched the z-depth idea and just doing it on the cpu

#

too big brain for me

deep moth
#

fair enough!! how did you handle it on the cpu ?

#

I remember a lot of people were changing the way they handled cel shading after Dragon Ball Z Fighters came out

#

instead of just making a fancy shader and trying to solve everything in code people started bending normals

#

and I feel like its been like -- leaps and bounds since then

ebon basin
#

some debugging garbo in there but otherwise just removed the x tiling

deep moth
#

OH Cool

#

yeah that makes sense

ebon basin
#

and it's basically like billboarding

deep moth
#

so this probably still has characters leaning into the wall right?

#

I think that's where I got stuck before

#

but this feels like a really elegant solution

#

I think that's why people put so much work into the z-depth thing

ebon basin
#

the shader would be nice for the sorting, but maybe I'll just figure a way to pivot shift stuff into view

deep moth
#

awesome

#

yeah I bet you can just raycast or something if your camera is orthographic

ebon basin
#

if you wanted tilt shifting, you do it like 2D top down and put the pivots lower

#

but in 3D that requires probably blender to rearrrange it all

#

and lock the camera

#

or do it the nintendo way and make all assets tilted by 35 degrees

deep moth
#

no way

ebon basin
#

best solution

deep moth
#

this rocks haha

#

I know a lot of league of legends characters are modeled to be looked at from above too

ebon basin
#

right, that's the problem with top-down. You can never see the character fully

#

you can get away with isometric, but you wouldn't allow camera rotation in that perspective, or from what I've been experimenting with

#

too jarring

deep moth
deep moth
#

wow people have gone so hard on cel shaders

#

I think a lot of them are for VRChat

ebon basin
deep moth
#

here's the talk I was thinking of

ebon basin
#

something like that. Still need a nice 2D/toon shader to really compare

deep moth
#

it's not a specific tutorial but breaks down their whole workflow

ebon basin
#

yeah guilty gear is pretty redic

deep moth
#

100%

ebon basin
#

not just the art fools you but the animation is a big part

#

as it blends in like a frame-by-frame instead of smooth transition to give you the illusion of 2D

#

kinda the idea of this shader, but more for camera rotating than the animation

deep moth
#

So it would snap at different angles like the one in the video you posted?

ebon basin
#

yeah, similar to 2D sprite games in a 3D world. There's usually like 8 different sprite orientations

deep moth
#

The other game I'm thinking of that does a lot of this is Prodeus.

#

It's a boomer shooter aesthetic too.

#

if you're looking for diff kinds of reference

ebon basin
#

always. I was just going to stick to the sprite idea, but easier to animate in 3D

#

and model for that matter

deep moth
#

I keep trying to find this article I found a while back where they had a bunch of these sprites for mobile

#

that they rendered in 3d offscreen

#

into a render texture

#

then cleverly chopped up

#

and placed in the scene on planes

ebon basin
#

right, that's what dead cels does

deep moth
#

oh cool!

ebon basin
#

on unity too

#

they've released their tools for it too

deep moth
#

wait that rocks!!

#

they've got a pretty good cel shader too

ebon basin
deep moth
#

is it performnce reasons keeping you from approaching it that way ?

ebon basin
#

that's my target right there, but keeping it in 3D world space

#

2D sprites in 3D world beyond the amount of work you need to get it to look good, just requires more work as 2D is much more demanding than 3D

#

drawing frame by frame is lunacy unless you're doing that "retro" pixel look

#

anyway gtg laters

deep moth
#

ttyl!

junior copper
#

how can i make my shader not affected by scale ?

deep moth
#

Hi -- what does your shader do?

#

and what part of it is being negatively affected by scale ?

junior copper
#

I usually use Object > Scale > Tiling and Offset
but it doesnt allow me to tile x y z

junior copper
deep moth
#

are you using shadergraph?

junior copper
#

but its a patern so you can see its scaling and tiling weirdly

junior copper
junior copper
#

i can only scale in 2 directions, i tried aother stuff but it didnt work

deep moth
#

oh sorry I misunderstood

#

could you use world space UV coordinates instead of object space?

#

if I understand correctly you want to set it up so that when you scale the object the texture doesn't appear to scale with it

#

I'd give triplanar mapping a shot first and see if that solves your problem

junior copper
#

okay ty

#

i never tested triplaner, 'ill try it

deep moth
#

oh! also make sure you have the coordinates in world space

#

instead of object space

finite wind
#

anyone has a shader that outlines objects? as if they are selected or something

stiff nexus
#

The extra detail outline is working well, however, to recreate lethal company graphics, I would need two edge detectors. One, the detailed color difference one, and another based on difference in depth.

#

Because while I have an outline here because of color difference.

#

I dont have one here because the colors are too similar

deep moth
#

I think the normals are also really important to that look. They might even cover a lot of what you're looking for.

stiff nexus
#

I can't seem to find anything to access the normals.

#

Using just the Normal Vector node looks like this

deep moth
#

There's a sobel operator in there that's a bit more fleshed out than mine -- it might not be shadergraph but its worth studying just to see how they're doing it.

stiff nexus
#

It has an edge detection shadergraph, using Robert Cross Sampling

#

Its a bit complicated though

#

Its also really messy to look at

deep moth
#

yeah those things really dont lend well to nodes

#

I've never used robert's cross sampling im pretty curious

#

looks really nice

stiff nexus
#

It uses the HD Sample Buffer

#

and works with materials if they have a normal map

deep moth
#

awesome

stiff nexus
deep moth
#

That seems consistentent with the lethal company details

stiff nexus
#

So I could use the way they got the normals for mine

deep moth
#

yep!

silk thicket
#

is there some way to make it change these values "locally"? or would i have to do something else?

stiff nexus
#

Wowzers!

silk thicket
deep moth
#

a couple ways i can think of:

  • use vertex colors in the mesh - that's how the particle system handles it
  • use GPU instancing with material property blocks (it requires a bit more shader work) and a bit of C# to set the block
#

if you're pressed for time you can also randomize colors using things like the object's world position

silk thicket
#

im not (pressed for time) hahah, but im thinking like, using brown color for a tree trunk, and green for the leaves

deep moth
#

oh yeah! try using vertex colors

silk thicket
#

ill look it up, it sounds fancy

#

im not sure its suitable for my needs in this project

deep moth
#

I think the best is probably separate materials in that case! People will also bake attributes like roughness into maps so that they can combine materials in meshes if having multiple is an issue.

#

So you could use textures too.

last pilot
#

Why can you a vertex seam in this sahder (it should be a perfectly round highlight)

Code:

Shader "Unlit/Surface"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
        _UVMap ("Texture", 2D) = "white" {}
        _Roughness ("Rougness", float) = 0.0
        _Metallic ("Metallic", float) = 0.0
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" "Queue"="Geometry" }

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            
            #include "UnityCG.cginc"
            #include "Lighting.cginc"
            #include "AutoLight.cginc"

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
                float3 normal : NORMAL;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                UNITY_FOG_COORDS(1)
                float4 vertex : SV_POSITION;
                float3 normal : TEXCOORD1;
                float3 world : TEXCOORD2;
            };

            sampler2D _MainTex;
            sampler2D _UVMap;
            float4 _MainTex_ST;
            float _Roughness;
            float _Metallic;

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = TRANSFORM_TEX(v.uv, _MainTex);
                o.normal = UnityObjectToWorldNormal(v.normal);
                o.world = mul( unity_ObjectToWorld, v.vertex );
                return o;
            }

            // GGX/Towbridge-Reitz normal distribution function.
            // Uses Disney's reparametrization of alpha = roughness^2.
            float ndfGGX(float cosLh, float roughness)
            {
                float alpha   = roughness * roughness;
                float alphaSq = alpha * alpha;

                float denom = (cosLh * cosLh) * (alphaSq - 1.0) + 1.0;
                return alphaSq / (3.14159365 * denom * denom);
            }
            
            fixed4 frag (v2f i) : SV_Target
            {
                float3 N = i.normal;
                float3 Lo = normalize( _WorldSpaceCameraPos - i.world );
                float3 Li = _WorldSpaceLightPos0;
                // Half-vector between Li and Lo.
                float3 Lh = normalize(Li + Lo);
                float cosLh = saturate(dot(N, Lh));
                float D = ndfGGX(cosLh, _Roughness);
                return float4(D.xxx, 1);
            }
            ENDCG
        }
    }
}

silk thicket
#

it seems to work if i just make a new material for every color

low lichen
last pilot
#

oh wow that works

#

shouldnt the normal still be normalized because its just interpolated

low lichen
last pilot
#

oh

last pilot
#

do graphics apis like opengl do slerping or does just unity do it

ebon basin
#

glm (math lib) may have stuff

low lichen
last pilot
#

ok

low lichen
last pilot
#

is there any way to disable interpolation for low poly models?

deep moth
#

solving it in a shader probably isn't the best way to go

#

but you can !

#

if you take the cross product of the derivatives of the position

#

it will calculate normals based on the change of the position across the triangle

#

making flat planes

low lichen
deep moth
#

I recommend just changing your import settings or solving it in blender though

deep moth
low lichen
#

But hol's method is most common. I'm not certain nointerpolation will work on all platforms.

stiff nexus
#

But I am experiencing an issue where the outline becomes permanently visible on the skybox when I look around and I don't know why.

ebon basin
#

wrong render queue?

stiff nexus
#

Maybe

#

It happens as a post process, so It occures after the sky is rendered

#

would I need to somehow render the sky over the post process?

ebon basin
#

oh you're doing pp outlining. I was just looking for some methods for that but wasn't feeling like I want to include it into all my shaders so maybe PP is the idea.

stiff nexus
#

I'm recreating Lethal Company graphics

#

The developer of LC used normal based outlining aswell as depth based outlines.

deep moth
#

I agree w/ Mao I think its a timing issue!

ebon basin
#

im looking for like thick outlines like cuttout

deep moth
#

looks like its not clearing

deep moth
ebon basin
#

praise be bgolus

stiff nexus
deep moth
#

Usually that happens to me when I'm applying the post process at the wrong step. Have you tried playing with the injectionPoint of the post process?

stiff nexus
#

These are the only options I have

deep moth
#

what happens when you move it to before postprocess ?

stiff nexus
#

It isnt an options

#

because its a custom post process

deep moth
#

oh! Sorry

#

gonna do some research rly quick

#

what do you have the alpha of the output set to ?

stiff nexus
deep moth
#

ok cool gonna keep digging

stiff nexus
deep moth
#

Actually I'm having trouble following my own instructions!! I mostly guided you through the tutorials on the HDRP documentation and followed my experience with other shaders and custom passes in HDRP. It's been a while since I've run through this and the process tends to change pretty often. How did you ultimately solve the shader not showing up?

#

Ah nevermind I got it haha just missed a line in the C# where it searched for it

#

OK This definitely has to do with sampling the buffers im just not sure why

#

I was able to reproduce the issue

#

on my end

#

It's definitely timing related - I wonder if its something we could change in C#

#

hm, this part is tripping me up, changing the injection point doesn't solve the problem. My best guess is sampling those buffers and then writing to the color buffer is causing an issue. I need to head out right now. Is there someone else in chat who would be willing to look at this? I think at this point we're mostly in the HDRP problem space.

If I could throw my question out there it's:
what's the best way to sample the depthnormalstexture in an HDRP post process?

#

oh nevermind lol

#

from EdgeDetection in the samples

#

ok should be fixed now

ebon basin
#

Been trying what shaders I've got and the unity toon shader is honestly pretty nice, but the outlines are pretty weak, but maybe that's just the limitation of vertex outlining. So I'll probably try some PP for it. The bigger issue, or question is, does the progressive shading between frames/sectors kinda break the illusion? I think if I did the billboarding via shader I may have more control over that, but I'm not too sure.

#

I'm actually not sure what the rotation matrix consist of if I were to do it in the shader to prevent x-tilting

#

actually pretty technical, but probably doable assuming I just do all the rotations inside of it instead.

deep moth
#

Oh yeah - it definitely makes it feel like it's still a 3d model but gives it a kinda old school feel too.

#

Like maybe a 2d image that has a normal map applied to it?

ebon basin
#

Ill probably try the outlining and see from there. I actually would prefer to just use the toon shader since there's actually a lot on here that would save me from implementing it myself, haha

stiff nexus
deep moth
#

Np!! 😊

ebon basin
#

how about making a secondary character that acts as the outline mask? Too heavy on performance maybe?

#

ill just render that first and the character after

stiff nexus
deep moth
#

Yep! Looks like mipmapping

stiff nexus
prime shale
#

that will cause alot of noise/aliasing to appear

deep moth
#

I'd recommend using less busy textures

#

The other thing you can do is start at a lower resolution

#

Oh! Also I noticed while I was in that shader that you're still comparing the hsv values between the normals from my original color based version. You'll want to come up with a different value to compare. I'd recommend using something like the dot product to compare outer normals to the center.

#

Then you can start adding your thresholding logic in between there too.

#

The dot product has a pretty helpful property with normals that is: when two normalized vectors are similar you get a number that is closer to 1 and when they're less similar they're closer to -1. This makes it really useful for these sorts of comparisons.

#

So one way to write it might be to look at the average dot product of the samples. If it skews negative then you're probably on an edge.

ebon basin
#

extruding from normals does seem to work ok, but can't seem to get that thick of outlines on more complex meshes

#

which is what I think the unity toon shader does

stiff nexus
#

also

#

I changed the texture of the platform and this is what it looks like with only the outline visible

deep moth
#

Nice!

stiff nexus
#

I don't understand what you mean by finding the dot product

deep moth
#

Yeah! Plug each into a dot product node and add those dot products together then average

#

Take the dot product against the center

#

So
Dot(center, top-right) + dot(center, top) + dot(center, top-left) etc...

#

Then average

#

Should be dividing by 8

#

Since you don't need dot(center, center)

stiff nexus
#

would I do the same for one based on depth?

#

and would I be replacing this with the dot product section?

deep moth
#

Calculate difference is useful for depth still!

#

Yeah that's what I was thinking!

#

Definitely replace the hsv section