How I Instantiated Grass For 3D Pixel Art in Unity

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 พ.ย. 2024

ความคิดเห็น • 37

  • @KianNightingale
    @KianNightingale ปีที่แล้ว +1

    Amazing work, looks incredible and very informative devlog

  • @baro5815
    @baro5815 ปีที่แล้ว +1

    Thank you so much for sharing

    • @Voyageonyt
      @Voyageonyt  ปีที่แล้ว

      No problem! It's a joy seeing all the positive feedback.

  • @JobeYT
    @JobeYT ปีที่แล้ว +1

    Nice job, looks great!

  • @samhausmann2859
    @samhausmann2859 หลายเดือนก่อน

    For billboarding, are you scaling your quads down to the size of the grass texture provided to the billboarding shader?

  • @stormyRust
    @stormyRust 10 หลายเดือนก่อน +1

    Hello Voyage! I was wondering if you could provide some more information regarding the node all the way to the left in your instancing shader at 1:46 and how you managed to replicate wind movement? I'd greatly appreciate any help on the subject. Thanks!

    • @Voyageonyt
      @Voyageonyt  10 หลายเดือนก่อน

      Hi!
      This node takes in the data sent from the calculated instances. Its a way to set them up in Shader Graph. For wind movement I just followed a Brackey's tutorial where the grass moves more with higher Y values and combined it with a billboard shader.

  • @selecteduser2375
    @selecteduser2375 10 หลายเดือนก่อน +1

    First of all, thank you for sharing this technique. I was able to get similar results thanks to this video. The only difference is that I used VFX Graph to instantiate grass blades, but it still operates on GPU if I am not mistaken. Anyways, I have a question: due to some circumstances I had to use Render Texture on my main camera as well and then project it to canvas using raw image and when I created another camera and assigned the terrain render texture to it my project started dropping FPS pretty hard. After I removed Render Texture from my main camera the lag was gone. So, are there any limitations to how many render textures can be used at once or is there something wrong with my project? I'll keep searching and experimenting myself, but if you have any ideas, could you share those too?

    • @Voyageonyt
      @Voyageonyt  10 หลายเดือนก่อน +1

      Hi. Great that your getting similar results!
      I haven't experimented that much with VFX Graph but with the render textures I could have some improvements. I have been moving away from the rendering the colors of the grass by having a camera above. I currently pass the instances a normal that gets sampled from the terrain which lets me calculate a color in the shader. This reduced my render texture amount and made the system much more modular.
      Hope this helps!

    • @selecteduser2375
      @selecteduser2375 10 หลายเดือนก่อน +1

      ​@@Voyageonyt There is another problem I ran into which is that grass doesn't change it's color in Build mode (all the grass instances share the same color), while in Edit mode everything is fine. I also checked if the problem was the render texture itself by displaying it with Raw Image UI component and it appears not to be the case (all the colors are matching those that I see from my main camera) but the grass colors remain unchanged.
      Do you have any idea on how that could be fixed?
      UPD: Ok i just had to enable read/write on my terrain mesh I exported from blender, RaycastHit.textureCoord was returning 0,0 only in Build mode for some reason

  • @katkollare809
    @katkollare809 7 หลายเดือนก่อน +1

    How do you render shadows from objects in a different layer than the Terrain to the TerrainColor texture? When I try to do that and disable the culling on the layers which cast shadows on my terrain, I get none of their shadows in the texture... :(

    • @Voyageonyt
      @Voyageonyt  7 หลายเดือนก่อน

      Currently I don't use the camera above the terrain anymore. It caused some constraints on how I wanted to instance stuff. Now instead I just give the instances the normal from the sampled mesh and use that for lighting calculations.

    • @katkollare809
      @katkollare809 7 หลายเดือนก่อน

      @@Voyageonyt That's neat! I suppose you're not using Unity's built-in Terrain system any longer and are using a custom mesh to sample it for lighting... But how did you go about the challenge of including shadows from other layers in the render texture in this video?

    • @Voyageonyt
      @Voyageonyt  7 หลายเดือนก่อน

      I still use and support Unity terrains but I don't recommend using an additional camera for this. If you still want to continue, I used the Opaque Layer Mask in Universal Render instead of the camera culling. @@katkollare809

    • @katkollare809
      @katkollare809 7 หลายเดือนก่อน

      @@VoyageonytDo you sample the opaque layer mask colour at the root coordinate of every single grass instance in the grass' fragment shader? If so, how do you access this root coordinate for every single pixel of every instance? Sorry, if I misunderstood your approach

    • @Voyageonyt
      @Voyageonyt  7 หลายเดือนก่อน +1

      Nothing to do with the shader but just setting up a URP asset to only render objects on a single layer.

  • @Kosro
    @Kosro ปีที่แล้ว +1

    Thank you so much for sharing! I was wondering, how do you ensure the special flowers & patches of grass render infront of the rest?

    • @Voyageonyt
      @Voyageonyt  ปีที่แล้ว +1

      No problem!
      Its just a simple trick which ended up working well. If I want to highlight an instance, I just place it above others; currently I offset the flowers by 0.5f on the Y-axis.

    • @Kosro
      @Kosro ปีที่แล้ว +1

      @@Voyageonyt Haha! I thought about doing that and checked it off as "that's never gonna work".. thanks for answering!!

  • @Havlark
    @Havlark 11 หลายเดือนก่อน +1

    Are each of these blades of grass a game object with a billboard/shader attached?

    • @Voyageonyt
      @Voyageonyt  11 หลายเดือนก่อน +1

      No. The grass positions are generated on the CPU and set into GPU memory. For each of these points on the GPU, the shader renders a dedicated mesh with a shader. This saves overhead of having all the Game objects processed.

    • @swankzilla
      @swankzilla 11 หลายเดือนก่อน

      @@Voyageonyt When you say mesh, is it 2D or 3D? I'd really like to know thanks for the great vid

    • @Voyageonyt
      @Voyageonyt  11 หลายเดือนก่อน +1

      These are 3D meshes made in Blender, however, all the points are on a 2D plane.@@swankzilla

  • @czou688
    @czou688 ปีที่แล้ว +1

    Great work!Its exactly the type of grass Instantiated shader I want to learn, and it's more natural and pleasing. I also watched t3ssel8r's video, but I can't find a starting point on how to begin.I really confused about the Instacing position part, how do you did it sir?Is it possible to download the asset ? I'm very willing to pay to learn this!

    • @Voyageonyt
      @Voyageonyt  ปีที่แล้ว

      Thanks! Currently it is not up for download but we are working on creating an asset from it. The positions X and Z are calculated evenly on the terrain based on the the width and height divided by a density. These positions are randomly offset to create a more random pattern. The Y position is sampled from the height map. Hope this helps :)

    • @czou688
      @czou688 ปีที่แล้ว +1

      @@Voyageonyt Thanks again,I will try it!

  • @ebigiman5146
    @ebigiman5146 ปีที่แล้ว +1

    great work sir, is that grass colored with only one color? how you made it sir?

    • @Voyageonyt
      @Voyageonyt  ปีที่แล้ว

      Thank you! The grass takes it color from the terrain below it. The terrain is cell/toon shaded which I explained in a later video. Practically it clamps the colors between a highlight color and shadow color based on the amount of lighting it has. The lighting is calculated in a custom lighting function.

    • @ebigiman5146
      @ebigiman5146 ปีที่แล้ว +1

      @@Voyageonyt ohh i see... you use camera to get sampling the terrain color and compare that with grass position? if its right i think it would be complicated calculation for me:'

    • @aeroniix1489
      @aeroniix1489 4 หลายเดือนก่อน

      @@ebigiman5146 I found an video with this thing :) th-cam.com/video/IjfBlUtJF_0/w-d-xo.html

  • @jamjam.100
    @jamjam.100 ปีที่แล้ว +1

    Great job! I look forward to your videos, so keep them coming. Also I was wondering, are you using URP? Also,because of how the cloud shadow and winds contribute to the over look of the grass, could you explain how you went about them? I'm stuck on terrain I've found it the most complex part. Really appreciate your advise, thanks.

    • @Voyageonyt
      @Voyageonyt  ปีที่แล้ว +2

      Thanks a lot :D. Yes I am using URP and currently I'm working on a video that goes over how I did the toon shading which includes the clouds (Should release today).
      The wind is done by rotating the vertices of the billboarded grass instances around the bottom center position with a bias that the higher it is on z-axis the more it rotates and at z = 0, it does not rotate at all giving the illusion of sway.
      If you'd like we are currently working on a unity asset store asset with these included and could give it for free to you once its finished if you wanna try it out and give some feedback.
      Good luck with your project!

    • @jamjam.100
      @jamjam.100 ปีที่แล้ว +1

      @@Voyageonyt ahhh, I see, it great to hear that your making this asset as most of us are more designers than coders, it will be a great contribution as your aiming to achieve the '3D pixel art'.
      That would be amazing! Of course, I'd love to test out the asset and give you feedback. Just drop me a DM, I'm actually working on a project that I can try implement on, looking forward to it!

    • @Wehaga
      @Wehaga ปีที่แล้ว +1

      ​@@Voyageonytwas this asset ever released?

    • @Voyageonyt
      @Voyageonyt  ปีที่แล้ว +1

      @Wehaga Not yet. We are still working on getting it polished. Sorry to keep ya'll waiting.

  • @VolumetricTerrain-hz7ci
    @VolumetricTerrain-hz7ci 6 วันที่ผ่านมา

    Good job, awesome terrain, I like it!
    Can you make a 3,5d game like following:
    A rhombus-shaped cube can probably be a four-dimensional cube viewed from a three-dimensional perspective.
    Let me explain.
    If we imagine a rhombus shaped hole in the ground,
    in which we try to get a cube through, we all know it won't work, unless we make the cube rhombus.
    But a four-dimensional cube can be rotated,
    to another perspective, so that it (from our perspective) becomes rhombus shaped and thus gets through the rhombus shaped hole which (from the cube's perspective) is square shaped.
    We can actually form a hyper cube, by using a cube and two rhombic cubes!
    By the way, AWESOME video!
    And thanks for sharing it!
    🙂