Interactive Foliage Shaders for Unity
HTML-код
- Опубликовано: 1 июн 2024
- Check out the package:
github.com/aarthificial/pixel...
Play the demo:
aarthificial.itch.io/pixelgra...
Source code:
github.com/aarthificial/pixel...
Consider supporting the channel on Patreon 🖤
/ aarthificial
Timestamps:
0:00 Intro
0:38 Package overview
2:06 Customization
3:00 Trade offer
You can now support this channel on Patreon!
patreon.com/aarthificial
You don't have to tho. I'll love you anyway 🖤
17 hours in and already at 86$
congrats, you broke the record
Would give, but dont really have the money for it atm. But hopefully will later!
>Makes top quality videos for over a year, each of which can send you down hours long research rabbit holes
>"Ive decided to become a sellout"
The fact that you reached your initial goal within 2 hours of opening the damn thing is not a surprise
Thank you aarthificial for this great shader.
The Shader works perfectly fine in Unity 2021, but for those of you trying to use the Shader in Unity 2022 you will find 2 errors. I will explain you how to fix them in a detail way.
The first error is:
"You can only call cameraColorTarget inside the scope of a ScriptableRenderPass. Otherwise the pipeline camera target texture might have not been created or might have already been disposed."
This error happens in line 47 of the VelocityRenderFeature Class. To resolve it, you need to comment out the line of code in the VelocityRenderFeature Class (line 47 for me), override the SetupRenderPasses function, and then add the line in the new format as shown below:
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
//_pass.ConfigureTarget(renderer.cameraColorTarget); //COMMENT THIS LINE OF CODE
_pass.Setup(settings, simulation);
renderer.EnqueuePass(_pass);
}
//ADD THIS OVERRIDE FUNCTION
public override void SetupRenderPasses(ScriptableRenderer renderer, in RenderingData renderingData)
{
_pass.ConfigureTarget(renderer.cameraColorTargetHandle); //ADD THIS LINE OF CODE
}
The second error is:
'Hidden/PixelGraphics/Velocity/Blit': Couldn't open include file 'Packages/com.unity.render-pipelines.universal/Shaders/Utils/Fullscreen.hlsl'
This error was mentioned in the comments below. This happens because Unity 2022 no longer has the fullscreen.hlsl shader in the given path.
What I did was to open a project using Unity 2021, then I went to the given path:
'Packages/com.unity.render-pipelines.universal/Shaders/Utils/Fullscreen.hlsl',
then I copy the Fullscreen.hlsl shader from the Package folder to the Asset folder and export it as a Package.
In Unity 2022, you need to import the custom package, and in the Blit Shader, you have to replace
//#include "Packages/com.unity.render-pipelines.universal/Shaders/Utils/Fullscreen.hlsl"
With the new location where you place the fullscreen shader:
#include "Packages/com.luvagames.fullscreenshader/Runtime/Shaders/Fullscreen.hlsl"
unfortunately there are plenty more errors and even after some extra bugfix spree I couldn't get it to work neatly
Oh my god your quality of videos is amazing, hope this channel receives the attention it deserves. Keep up the good work my man!
Thanks so much!
You are a very special game developer. A kind I haven't seen before. One that implements ideas and creativity perfectly into an art piece. When I found your channel, I watched through every video you made, and enjoyed and learned from all of them. For that, I thank you. Please continue to inspire and teach many others, and don't give up!
-Alex
Thank you so much, it means the world to me!
It would be cool if patrons got early access to buggy/unfinished versions of upcoming systems, like the save system or the next-gen pixel perfect renderer
ADDING THIS TO MY GAME!! you're a life saver, the current method i was using is much more expensive! thanks!!
man, just looking through all your past content, I have to say, your vids have amazing quality and are super cool
Can't believe I JUST now found your channel so many great insights
Awesome work!
Your coding heavy stuff really motivates me to get better at coding myself
The clouds in the background look professional. Good work.
As always, amazing video and ideas! I really enjoy the look and feel of Astortion. Can't wait!
Holly you finally made it! Thank you so much for sharing the code! Gotta join the patreon now
Thx a lot for sharing. Its hard to find people willing to share how they did something of this level of difficulty for free. Great work!
The fact that you made this free for everyone is just amazing. Thank you!
Wow that is very generous of you!
Im sure you'll smash your goal in patreon. Great work as always.
The shader and the outcome look super at the end! Awesome stuff
Thanks!
it is such an amazing video! Many creative and useful ideas here
You’re a legend, my friend
I love you content man, thanks for sharing this ❤️
WHAT! This is incredible, THANK YOU!!!! I can't wait to dig into learning how you this was made.
Patreon subbed!
Thank you too!
Very cool! Thanks for sharing
stunning content as always!
Keep up the best work on the platform!
That pixel art looks beautiful
Yoo first time catching an upload early!
I really love your content! Clean, simple and it really fills me with a sense of wonder to see the projects of others slowly evolving!
Glad to hear that!
You're incredible, love your work!
Thank you!
This looks fantastic! I'm also curious if you'll ever make a package for your custom renderer because that looks great too.
Thanks!
I'm planning to do so but it will probably take a while
You are an absolute legend. This is a godsend
I really know nothing about the behind the scenes of the creation of games (and tbh it's not my cup of tea) but mate let me tell you, you manage to keep me watching the. video..good job
i will try to implement this on my 3D game
lets see if i can figure it out 🤗
Can't really donate as i don't have the funds but I saw the patreon, congrats on making the channel self sustaining!!
No worries!
Thanks so much!
Nice video, will continue watching
You're amazing friend. Greetings from Brazil
When I see a great video like this one, it just makes me happy, but on the other hand, I'm sad because it doesn't get the attention it deserves.
Anyway, keep up the great work.
You made my life easier, Thanks!
This video helped me so much
RUclips algorithm is the best, very cool person and channel. How long you have been coding can i ask? I have mad respect to your skills. I will be looking forward to your future content.
Thanks so much!
It would be around 7 years now, 3 years professionally, not in Unity though.
My experience with Unity started when I started this channel (~1 year)
lit, ima have to yoink that, also that whole running the channel at a loss is a familiar feeling. :(
Looking forward to see Astortion!
@@HaydenTheEeeeeeeeevilEukaryote You caught me 😅
you are a rock star! thanks for the share.
ANOOTHER VIDEO LESSS GOOOOOOO
You should check out a game Machinarium, and make a dystopian world like that, it looks amazing.
I love this man
Bro lmfao you’re absolutely amazing
thank you, i would never be able to do this on my own🤗
You are my hero!
So amazing!!!
Thank you, very nice.
I found that it doesn't sway if the camera is in perspective mode and follows the player, and works if static. When camera is orthographic all is good. Do you know why that happens? Thank you!
This was very cool
I don't completely understand, but the effect is very beautiful!
You are so inspiring
Wow... the shader looks amazing! If u don't mind me asking, how long have u been doing programming?
Thanks!
~7 years in total, one year in unity/c#
@@aarthificial Awesome. Which language were u using before that?
I played around with C#, C++ and Java for a few years, then I settled on TypeScript which I do for a living to this day
Well I can't afford to support you on patreon, yet. But I definitely can leave a comment for the algorithm uwu
yess goodluck!!
Thanks!
Just a quick question: I'm making a fullscreen shader effect using renderer features for the forward renderer data. But I'm also using the 2D renderer data for 2D lights and stuff. I see that you also have the same problem and solve it by using the VelocityCamera. Can you explain to me your solution?
if your guys found it don`t work ,can try change object named "Velocity Emitter" porperties "Mode" be come "Translation" but not rigidBody2D and i still dont know why , but after i changed the type of "Mode" it become useful : )
Bro you made it! No words can define you - an out of bounds index.
So this Velocity Emitter could be applied to multiple objects for multiple object interaction?
Thanks!
Yes, you can have multiple emitters
you're brilliant
Hi! I tried to add it to my project, but it seems like it does not work with Cinemachine VCams. I added a velocity camera component to the Main Camera, which also has a cinemachine brain, it kinda works, but the buffer is behaving weirdly (sway for first few grass GO, but doesn't for others). I tried it with the cinemachine brain off and it works flawlessly. Nevertheless, this is a really awesome shader package!
It seems that my problem wasn't actually the camera moving, but for some reason the shader that gives the velocity seems to be making everything yellow. I got you demo and tried it out. On your demo it doesn't seem to me that when I put the debug shader on that everything is yellow except the emitter. Is there any solution to this. I can't figure out the difference. What is causing my shader to be all yellow except for the emitter.
This is briliant! Does it support also URP? Would look awesome in our game, thanks so much for sharing everything!
Thanks!
Yes, it should support any scriptable pipeline, including URP.
The demo, for instance, uses URP with a 2D Renderer
Sick 👌
What about a Patreon-only discord as a perk? kinda like how channels like GMTK do it
Interesting idea! I'll look into that
Was just looking to see if anyone else has commented this already. Definitely seconded!
So I fixed the black grass problem. Now I have to figure out how to make the body and branches of a tree stay completely still while the foliage move. I paint the body and branch black but it still moving, did I do something wrong?
Thank you for sharing, much appreciated! I think there''s an issue with the pixelart_shader, I can not get it working smoothly with 8 ppi and no upscaling. If I try it in your demo scene, I get the same error, the bush get's distorted like crazy.
did u manage to get it working?
Is it possible to make this work with the Perspective Camera? only seems to work with the Ortographic for now
Is there anyway to make this work in a perspective projection. I've managed to make it all work, I just can seem to make the camera move with the player and show the velocity correctly because it's in a 3D space. if anyone has an answer to this feel free to share your thoughts. I don't even know where to begin to calculate the math for this.
Wonderful work =]
I'm trying to follow along yet I'm confused by the demo project - it throws aplenty warnings about missing audio and all sprite PNGs are invalid files, 128 bytes in size, smaller than their meta information
Thanks!
To quote the README file:
"This repo uses Git Large File Storage to store image assets.
If you want to clone the repo, make sure that you have lfs installed on your machine.
Otherwise the sprites may be missing."
You would need to clone the repo using git with lfs: git-lfs.github.com/
@@aarthificial thanks:3
Awesome! Is there any chance you might do something similar with your fog shader?
Thanks!
That's the plan. It's called "PixelGraphics" cuz I'll be adding more pixel art shaders to it over time.
Like the fog, or the line shader
Hello I have a question. I don't know if it's me but it looks like your grass deosn't move at the base. But when I try this on a random foliage, all the sprite wave. Is there a way to keep the base steadi with your shader? Great job, i've been looking for this kind of video for a while!!!
It's done using a displacement mask:
github.com/aarthificial/pixelgraphics/blob/master/Documentation~/shaders.md#displacement-mask
In this case it's a gradient - from black at the base to white at the top:
github.com/aarthificial/pixelgraphics-demo/blob/master/Assets/Terrain/Sprites/plants_displacement.png
@@aarthificial Thank you !!!! That was a fast answer ^^
@@aarthificial Hey this is the problem I'm having right now. I do not have _DisplacementMask popping up at the secondary textures. How do I get it to be an option? Thanks!
I've been trying figure out why the package just didn't seem to work for me and then I used the velocity debugger and realized that everything was messed up because the velocity doesn't really show correctly when the camera moves with the player. Is there anyway to make this work while the camera is moving with the player?
i've installed the package in my unity project and it seems to work fine with a static camera but it stops working when the camera is moving it jitters and moves when the player is not near the object. i hope i can find a solution for this. anyways thanks for the cool package and i will playtest this for potential fixes.
Hi There!
When I apply the shader to the sprites, I see them on the scene and game view, but when hit the play button the sprites with that material disappear.
Could someone help me please?
this is really cool
i wanna try to port this to godot but i'm not great at shaders or untiy
How did you know what's the correct pixel size to make it pixel-perfect?
There's a "Pixels Per Unit" setting:
github.com/aarthificial/pixelgraphics/blob/master/Documentation~/velocity.md#pixels-per-unit
@@aarthificial thanks! the shader looks so good
In my case when installing the package on unity 2020.1 it says 'GraphicsDeviceType' doesnot have a defination of 'PlayStaion5'. What should I do?
Hey I replied to one of the comments in here, but I do not know if it shows up for you or not.
This is absolutely amazing, it works wonders, but I have one thing I can not fix: The bottom of my grass sprites are also swaying. I know that a _DisplacementMask is needed, but it is not showing up for me in the secondary texture editor. Why is that? Is there a way to fix it?
Thank you in advance, and keep rocking the awesome videos!
Update: nevermind, I am just very new to Unity, I did not know that I just had to write _DisplacementMask in the name field. I got it. Works like a charm.
Hay man this Video is awesome, I tried putting it in my scene and everything works perfectly! the only thing that I couldn't figure out was how to get the grass to only sway at the top, I am using the grass_shader but it doesn't quite look or move the way yours does? Thanks for the video!
You need to use a displacement mask to limit which part of the grass you want to sway. In this example it's a simple gradient - black at the bottom, white at the top
Here's more info:
github.com/aarthificial/pixelgraphics/blob/master/Documentation~/shaders.md#displacement-mask
Why when i use the pixel art grass shader my spirte got transparant and i cant see it
"Nothing special here", he says, as the *best running animation ever* plays on camera
Thanks for sharing the code :D
I am definitely going to pay for a set of tutorials on how to make this shader lol
Just wondering, what code editor and theme + font are you using?
Awesome
Прикольно
А как сделать платформы, которые меняются при соприкосновении? Как в трейлере силксонга
Hey, is there any means to send you a bug report with screenshoots and info on what it might be? I found a small problem when testing it, And it would be easier to send you somewhere specific then trying to type it in a comment. And once again, thx for sharing this amazing shader.
Hi! It would be best if you could create an issue on github:
github.com/aarthificial/pixelgraphics/issues
I downloaded the demo, and tried it on macbook, but velocity emitter doesn't have any effect. Do you have any idea why? Also package doesn't import from url, I imported manually
Is there a way to make this work using the Built In render pipeline ?
Hey! I am working with this one and it seems the Pixelated shaders don't work for me? They basically make any sprite with them on look like there's 'scanlines' on them every once in a while instead of... pixelating... the whole image. Any idea what might be the cause of that? Using UNity 2020.3.14f1 and URP!
Hi! I'm not sure if you've removed your previous comment but I can't view it anymore.
Could you create an issue here: github.com/aarthificial/pixelgraphics/issues ?
Ideally, with some screenshots of these scanlines and of your Velocity Camera / Render Feature configuration
@@aarthificial My previous comment reply got deleted so to avoid confusion to others I removed the initial comment as well!
I'll check it out!
Is there any difference to setting up the pixelation to how the 'normal' shader works?
Alternatively- is there a way of managing pixelation 'layers' in URP to pixelate specific layers of objects? Like a pixelation shader that takes a PPU that you can then apply to a (sorting) layer globally? If ANYONE on RUclips could give me a solid answer on that it'd be you!
Does this work with Cinemachine 2D ? After configuring the velocity camera onto the Main Camera the foliage disappears from the game window on Play.
I tested it just now and seems to work correctly.
Does it work for you without cinemachine? Perhaps something else is a problem
@@aarthificial it wasn't working with the velocity camera component from your package but I just used the forward renderer and it worked as now they support the layer masks so no need for the custom velocity camera component anymore! I'm using the latest unity version
how do i down load it, its in my project as a folder but it doesnt do any thing
I've tried importing using git link, but it always fails, is there any other way to import it into my project?
I would pay for this package if you could do a perspective version. Also, even with an ortho camera I can't get the renderer feature to work with 2021.2 URP. The camera works in ortho and persp but obviously has very strange movement in persp
I would pay for a perspective version too. Please make this possible
Is there a place to get some help for setting this up? I'm having trouble getting the grass_pixelart_shader to display...
Edit: Updating Unity version to 2020 and using the 2D pipeline renderer has seemed to fix the problem
Unfortunately, I tested it using 2020.2
What version were you using before updating? I'll check it later, maybe there's some easy fix
@@aarthificial hey there. sorry to bother but im trying to get it to work in my project right now and got some problems and i dont really know where to ask... i have a pixel art game and wanted to use the pixel art grass shader but its invisible. it seems to work in the preview window but ingame the sprite is either gone or just some middle alpha grey lines are visible. im using the 2021.2 beta version and URP. the normal one (non pixel art version) works though
edit: seems its starting to work now. i exposed the pixel params property of the shader and then it appeared. after some more testing it seems that the parent object having a non null vector position was responsible for this. unexposing the parameters has weird effects though. i think he gets the values wrong or something. like i can see how the effect is only visible in a round area where it looks like someone goes over it with a magnifying glass and only in there is the effect. and i still cant get the displacement / emitter stuff to work.
i also tried the renderer mode and its preview feature but it doesnt change anything when turning it on and the emitter circle is always visible, no matter what layer mask or rendering layer im using
@@aarthificial I have no idea why I didn't receive a notification for your reply, but here I am rewatching the video a year later and feeling guilty for not answering.
Sorry about that
(Btw, it was 2019.4.0f1 I think but it doesn't matter at all, I've long since updated)
Hey, I tried to download this Shaders, but every time I put the Material in Sprite Renderer, it leaves the object purple and does not work, how can I solve this?
Is there any way to turn off the effect in editor?
I want to use this but I can't seem to get it to work right. everything else works but the velocity is weird. I have a emitter on the player and it seems to only work vertical. the foliage wont move at all when walking but when I jump it sways.
I need some more info:
1) What's your Unity version?
2) What's your OS and graphics card?
3) Is the demo on itchio working on your machine?
@@aarthificial
1 2021.1.12f1
2 windows 10 and 1660 gtx
3 I cant get the demo working even though I installed git and git lfs
@@eliaslamsa6541 That's wierd. I have a windows 10 with 1660 ti and everything seems to work correctly on 2021.1.13f
You could try building the game to see if it's gonna work outside the editor.
I know for a fact that sometimes other editor windows can mess with the velocity buffer so maybe that's it?
For example, when you have a shader graph window open or the scene view visible when playing the game.
I wish I could support u but as I dont have my own income I cant
Cuz u make great videos:DD
No worries, thanks so much!
Just found out about this now
:o A NEW VID WUT