Тёмный

Stylized Geometry Grass Shader for Universal Render Pipeline Unity [Pt. 4] 

AJTech
Подписаться 8 тыс.
Просмотров 9 тыс.
50% 1

A fully functional grass shader that's made for the Universal Render Pipeline, it works without Unity's terrain system and comes with a bunch of features such as lighting, shadows, tesselation! This is the system I will be using in my open world game which I am developing on this channel as well, we will be coding everything ourselves so that you can understand from the base up how everything works.
PROJECT FILES (TEXTURES & MODELS) + COMPLETED PROJECT :
☢ github.com/AJTech2002/Grass-S...
☁ In this video we complete our journey by creating the touch ups of the shader. It will consist of allowing painting of the grass, wind movement, random height generation and finally ensuring that the grass gets registered into the depth buffer.
* NEWS : Welcome to the community!! I want to congratulate everyone on reaching 4,100 subscribers, this is a collective accomplishment and I thank you all for your support. *
Firstly I would like to apologise for the late upload times I know I announced this video a while ago, I really wanted to polish up the system before I shared with everyone :)
❤ 2020 calls for more social media & interaction with you guys so check me out on, also I hope everyone is safe during this time ❤ :
====================================================
✄ / codewithajay ✄ [TWITTER]
- Daily Game Development Content, tips, motivation, updates on the game & just about my very 'interesting' life.
====================================================
----- LETS TRY AND HIT : 40 LIKES ✌ ---------
★ Upcoming Videos :
- Grass Shader Part 3 ❤
- Open World Series Part 6 ❤
◕‿◕ The next part is even better and in order for you to see it you have to subscribe and tap that bell icon to be notified :
►► / subscription_. . ◄◄
☾ Stay tuned for the next episode, I will be releasing new videos once every 5 to 6 weeks discussing what I have done over the course of the weeks, always giving you some good entertainment with some knowledge on how you can tackle complex challenges in your own games! (◕‿-)
I'll see you next time ✌
✄ IMPORTANT LINKS YOU SHOULD CHECK OUT ✄ :
1. roystan.net/articles/grass-sh... (Grass Shader Blog)
2. gist.github.com/phi-lira/225c... (URP Sample Shader)
3. kenney.nl/assets/foliage-sprites (Grass and Leaf Textures)
OTHER VIDEOS
DEV LOG PART 1
☢ • Video
DEV LOG PART 2
☢ • Video
DEV LOG PART 3
☢ • Video
CUSTOM CHARACTER CONTROLLER TUTORIAL
☢ • (01) Stealth Game - Cu...
INVERSE KINEMATICS SERIES
☢ • (05) Stealth Game - In...
♬ MUSIC ♬ :
☮ Wayr - Follow the light
If any of these videos or music belong to you and you wish for them to be taken down, please email me at : ajays.workemail@gmail.com
Thank you, for watching guys :)
#unity #shaders #openworld #stylized

Наука

Опубликовано:

 

16 ноя 2020

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 56   
@nicolasL009
@nicolasL009 3 года назад
Watched all of the series, thanks a lot man, keep up the good work!
@normalaccount1882
@normalaccount1882 3 года назад
Bro I’ve been watching you for almost a year now, back when you were first popping off. Your videos are so awesome and are very helpful and engaging. Watching your videos just makes me think of the potential I could have as I just started programming. The fact that you are this good at your age is outstanding. I am really exited to see how your open world game ends up and I plan on continuing to watch your journey for as long as it takes. I understand that you might never release the game to the public but just experiencing it through your videos is already plenty(of course I would be more then happy to play it if you released it). None the less, you are amazing and one of my favorite RU-vidrs at the moment, so continue doing what you enjoy and stay coding!
@batchprogrammer108
@batchprogrammer108 3 года назад
This is one of my favourite comments, thank you so much, your support means a lot to me :)
@DhrumitMehta
@DhrumitMehta 3 года назад
dude.....this was the best tutorial series! Do make more :)
@surrogatpappan
@surrogatpappan 2 года назад
I can remember the last time I actually got something (and this much!?) from a tutorial. Most of them just repeat each other so this is a very welcomed change! Thank you!
@NinitoPh
@NinitoPh 3 года назад
Thank you for your work, AJ, it's people like you who make game development accessible to everyone.
@batchprogrammer108
@batchprogrammer108 3 года назад
Thanks Ninito, it means a lot :)
@Felloggs
@Felloggs Год назад
You're incredible, I love you
@jared4080
@jared4080 3 года назад
nice
@justin1111able
@justin1111able 3 года назад
This is great, 1 question tho.When will the series of making your game come back?
@maxeerdhuijzen
@maxeerdhuijzen 3 года назад
Hey man, I have been splitting my hairs on trying to get the bottom color of the grass to be the same color as it would have been if it was lit like a normal surface shader with my own custom toon shader and then lerp between that color and the grass color to achieve a smooth transition between grass and ground. Any pointers?
@johndeleon8741
@johndeleon8741 3 года назад
@AJTech - A thing I don't quite get, why do you need a different pass for the depth buffer? Can't you just enable ZWRITE on the grass pass itself? thanks :)
@zachfinch9356
@zachfinch9356 3 года назад
Hey AJ, quick question for you. In my game I have an orthographic camera view. With this angle you can really notice the gaps between the grass and angle of the grass. Is there a way I can rotate the grass to face at a better angle for the camera while keeping it in place on the mesh? Thanks for the wonderful tutorial :)
@zachfinch9356
@zachfinch9356 3 года назад
Slight bump, but was also curious; How might you approach changing the density of the grass, without having to manually subdivide the base mesh? Do you think this could be done programmatically? New to hand coded shaders so I appreciate your help!
@cryptojanne1134
@cryptojanne1134 3 года назад
Great series man! Im definetly implementing this in my game. I got a question though, i want my grass to be reactive to my character. Is that possible using your technique, and if so, could you point me in the right direction? You got a new subscriber btw ;)
@batchprogrammer108
@batchprogrammer108 3 года назад
Im happy to hear it! So to make the grass react you could go the approach of have a separate camera directly above the player and create a render texture that is white where the player is and black everywhere else. Next, you will have to write a script that passes this render texture into the shader and then use the texture to affect the rotation. I will add amother comment linking to a video that uses this technique, however it is for snow, the same principles can be used however :) Good luck !
@batchprogrammer108
@batchprogrammer108 3 года назад
ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-z7kQpUZXXhw.html This video should help :)
@p3rk4n27
@p3rk4n27 2 года назад
easier way would be to constantly send player position to shader where you calculate vector of distance and when the absolute value of distance gets smaller, you lerp the vertices in direction opposite of that vector (make sure you multiply it by object position in y direction so that the base of grass gets no movement, and top of the gras gets most of the movement)
@p3rk4n27
@p3rk4n27 2 года назад
If you want to optimize process, add a trigger box that contains grass area and bool value that decides wheter to calculate all of above or skip it
@ellarddekoeijer9886
@ellarddekoeijer9886 3 года назад
It is actually possible to vertex paint onto the plane by using polybrush from within Unity
@CloudlessRa1n
@CloudlessRa1n 5 месяцев назад
Is there a way to make the grass blade more bendy (less stiff)?
@glitchdev
@glitchdev 4 месяца назад
Did you get it working in Unity 2021 or higher?
@Revy8
@Revy8 3 года назад
can you show how to collect all world lights?
@olorin8307
@olorin8307 3 года назад
What happened to your Development Log Series? The videos are gone
@divyanshu7869
@divyanshu7869 3 года назад
I too thought to comment about that.
@mrforgetable1
@mrforgetable1 3 года назад
hmm, currently I'm getting two issues that I can't seem to track down, the first is some artifacts at the top of the blades of grass (looks like the texture wrapped around to the top?) and the second is that the wind distortion map doesn't seem to be scrolling, I can sample it and have it shift the grass around based on my Wind Strength but the texture doesn't scroll so they just stay still. Any ideas on what might cause these issues?
@mrforgetable1
@mrforgetable1 3 года назад
Oh actually, on the artifacts issue, I simply changed the textures wrap mode to clamp and it fixed it. A hacky solution, perhaps but, it works. Still, no wind though unfortunately :/
@mrforgetable1
@mrforgetable1 3 года назад
Ah, I figured out my other issue, I simply spelled the "WindFrequency" variable differently in my hlsl file than how it was spelled when creating the property. This resulted in my WindFrequency that was being used in the HLSL to just be a zero vector all the time. Silly me hahahah
@Flaroon
@Flaroon 2 года назад
Hi aj. The Based on vertex color is not working for me. Do you know why?
@batchprogrammer108
@batchprogrammer108 2 года назад
Not sure Flaroon, have you encoded the vertex colors correctly through Blender?
@Flaroon
@Flaroon 2 года назад
@@batchprogrammer108 No, Well im actually using your shader on a procedural terrain. I have several different biomes with different vertex colors. its just not that goood looking to have green grass in a orange biome. i was wondering if i could edit the shader to allow for grass color based on vertex colors?
@AmgedAlfakih
@AmgedAlfakih 3 года назад
now how to use it with unity Terrain System
@ayushkatoch5494
@ayushkatoch5494 3 года назад
lemme know if you find anything. ^^
@casualhangoutcrew8982
@casualhangoutcrew8982 3 года назад
this is great, but how would i add LOD?
@batchprogrammer108
@batchprogrammer108 3 года назад
You can get camera distance and reduce density based on that
@migfus-codes
@migfus-codes 3 года назад
Can grass go into chunks to make LOD.
@batchprogrammer108
@batchprogrammer108 3 года назад
Since the grass is made in a shader there is no LOD as it is simply a 1 face plane, however as distance increases you can decrease the grass count
@zeroacid0
@zeroacid0 3 года назад
Will this be heavy on resources for a mobile device?
@batchprogrammer108
@batchprogrammer108 3 года назад
Most likely this shader won't work on mobile sorry.
@zeroacid0
@zeroacid0 3 года назад
@@batchprogrammer108 thanks. Excellent work btw. Keep it going.
@ZachAbueg
@ZachAbueg 2 года назад
wait why?
@austinc2997
@austinc2997 3 года назад
Hey guys is this still working with URP? I followed part one and unfortunately could not get the GrassPass.HLSL to open up. It was throwing an error code. I thought maybe I just coded something incorrectly so I imported the HLSL file he provided on github. Long story short I never made it our of part one and I was curious if this method was still supported in the newest version of unity?
@batchprogrammer108
@batchprogrammer108 3 года назад
Hm this is wierd, what was the exact issue you were getting?
@austinc2997
@austinc2997 3 года назад
@@batchprogrammer108 hey thanks for your quick reply! Great tutorial by the way. It was just calling back line 56 of the shader script saying, “it was unable to launch my grasspass.hlhs file”. Unfortunately I deleted it all last night, so I could try again. But I was getting the same error with the git file provided. The only reason I am questioning the compatibility and not my own error, is because I saw another user in part 1 with the same problem. Again this could all just be me following the tutorial incorrectly, especially considering it’s my first time working in hlhs. Thanks!
@batchprogrammer108
@batchprogrammer108 3 года назад
@@austinc2997 Yeah it might be a compatability issue, just to be sure can you clone down the entire repo and just run the project and see if it works with your editor version?
@austinc2997
@austinc2997 3 года назад
@@batchprogrammer108 You know I bet you’re right, I tried to open it in another project and it was telling me I needed to download it in a different editor.
@austinc2997
@austinc2997 3 года назад
For what it’s worth this grass-shader looks incredible. 👍🏻
@rizzmaker
@rizzmaker 3 года назад
Why can't I see grass on my mobile phone ?
@batchprogrammer108
@batchprogrammer108 3 года назад
Geometry Shaders are not supported on most mobile phones, sorry.
@lesarch
@lesarch 3 года назад
Awesome tutorial as usual! I have a question regarding how this is rendered on top of water with depth effects (water foam depth). I noticed that by default, when these grass are placed near the water I created (with foam shader effects via screen depth), the grass triggers the foam effect thus making the square spaces around the grass filled with white. Even simply moving the camera with the water behind the grass triggers this effect. But when I change the render queue to around 2600~3000 (alpha +150 and transparent), the grass no longer triggers the scene depth effects from the water... but at a cost of a LOT of frames :( would you know a workaround on this problem? Here's a sample screenshot of the problem: prntscr.com/vko11g
@batchprogrammer108
@batchprogrammer108 3 года назад
Oh I think I know what the problem is, when we are registering the shader to the depth buffer we are not taking into account the alpha clipping of the grass, we are registering the entire square of the grass into the depth buffer. I will make changss to the code to fix this on the Completed Project.
@lesarch
@lesarch 3 года назад
@@batchprogrammer108 Wow you are awesome! Thanks for looking into this. I would also like to add just in case this would help: I noticed that when I turn off ZWrite on the Depth Pass, everything works properly; no white backgrounds. Not sure if this will cause any visual glitches since I don't completely understand shaders as I'm a complete newbie but so far it works.
@batchprogrammer108
@batchprogrammer108 3 года назад
@@lesarch I just looked into the Unity Docs a bit more and I think you may be right, ZWrite should be Off for Semi-Transparent objects; I guess this applies in our case! Thanks, this will help everyone else out :)
@Noximous
@Noximous 3 года назад
@@batchprogrammer108 It's interesting this, i had this same problem. turning off zwrite does indeed make the foam stop triggering on the plants.. but it would be nice to actually have some, just not the whole box around it, yknow? xD
@kingbling7571
@kingbling7571 3 года назад
Isnt doing this with Shader Graph like x2 times faster?
@batchprogrammer108
@batchprogrammer108 3 года назад
You cant do geometry shaders in ShaderGraph
Далее
How Do Games Render So Much Grass?
15:52
Просмотров 323 тыс.
Best Toilet Gadgets and #Hacks you must try!!💩💩
00:49
Unity | I made an Interactive Grass Shader + Tool
8:26
Coding Adventure: Portals
16:06
Просмотров 1,3 млн
How we built the toon shading | Open Projects Devlog
10:08
Making a First Person Shooter with Thomas Brush!
4:50
CREATE YOUR OWN RENDERER WITHOUT CODE in Unity!
10:32
Просмотров 274 тыс.
НОВЫЕ ФЕЙК iPHONE 🤯 #iphone
0:37
Просмотров 97 тыс.
Samsung laughing on iPhone #techbyakram
0:12
Просмотров 2,6 млн