Simple way to make stars using shader graph in Unity

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ม.ค. 2025

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

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

    I love how you explain stuff and show what works and what doesn't and explain all the things in great way :)
    Keep up the great work buddy :)

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

      Thank you, comments like this is my source of motivation to keep going.

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

    Loved the tutorial, explained so well!

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

    I just learned about the Unity Graph Shader thanks for making this awesome tutorial

  • @91tj
    @91tj ปีที่แล้ว

    Awesome tutorial!

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

    Great Chanal 👌👌

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

    This is a great tutorial, but one drawback is if the camera is not moving, the stars won't twinkle. I would love to see a variation that has change over time for a static camera, as I just spent an hour or so learning how to implement that.

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

      Hey @bathtubanarchy, well you could use a "sine" node, "remap" it to 0 - 1 and then add it to our "Random range" node, then we will have values that goes from 0 to 2 in "Add" node just remap it again to 0 to 1 and then feed it into "sample gradient" node's time input. That way you will get the twinkle without moving the camera.

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

    Good

  • @ecogaming6084
    @ecogaming6084 ปีที่แล้ว +3

    heeey very nice tutorial....
    will you expand on this to part 3 and blend between day and night skybox

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

    Hey, it didnt look good for me at all with simplenoise, but Voronoi looks SO GOOD. I wish i could show you, it really looks like stars. Thank you for the tutorial though it really helped :)

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

    for some reason using urp im having an issue where the horizon is stretched on play mode. Camera looks fine in editor but as soon as i start the game the horizon is small when the players rotation is around -128. Also for some reason i had to switch the position node to object instead of world because world was still causing strange artifacts with the stars. I was able to see faint squares that stretched when looking straight up. I tried turning off all post processing on the camera but nothing seems to be working regarding the horizon issue

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

      I don't think object space would help, could you share with me the shader screenshot?

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

    Ive been trying to create a hsader like this without a horizon line but I cant seem to make the seam along the sides of the skybox disapear.

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

      Hey @antonclark608, you could do something like this to avoid the horizon part altogether!
      www.patreon.com/posts/skybox-shader-85136715
      If you still want horizon try to tweak the color and blend values for horizon!
      All the best.

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

    The big problem with these stars is that either with noise or Voronoi, the stars are too small, whenever the camera moves it's jittery and painful to the eye. I don't know how to cleanly make the stars bigger; it seems like the solution is to just use a texture.

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

      Hey,
      Yes the texture would work nicely. However if you want to control the star size, maybe use Voronoi, plug it into smoothstep and make sure to use a bigger value in Edge1 and samller in Edge2. The obvious drawback of that is you would get just dots as stars.
      There are also other ways to create procedural stars but it's more complicated and you have to write the shader to tackle that. For inspiration you can check out the "starfield" video, it is using Godot but the logic will remain the same.

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

    Great vid!! How did you figure out that dividing the xz coordinates by the y coordinate fixes the stretching? Really curious to learn why this works!

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

      Think of skybox as a sphere so in position node, at the center/origin we will have the highest Y value and as we move away from the origin Y value decreases so by dividing the Y it will kind of keep our texture flat on XZ plane.

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

      @@iDigvijaysinhG that makes sense, thank you!

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

      ​​@@iDigvijaysinhGhello, thanks for the tutorial.
      I also have the same question😂 but not quite understand the ans.
      Why the center/origin of the sphere skybox has the highest Y value? I thought the origin will be 0 with the normalized range of -1 to 1

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

      ​@@jamasheller224 No worries I will try to explain a bit with more clarity.
      Think of skybox as a Sphere mesh.
      Now we are using the position node, which returns position of each vertex of our sphere mesh.
      So at the centre if we would have two positions. One for very top vertex and we normalised it so it will be 0, 1, 0 and the bottom vertex will be 0, -1, 0.
      Now as we move away from the center, our vertices' Y will always be less than 1 and greater than -1.
      So at the end we will get kind of flat texture at top and bottom.
      And I am really sorry for the late reply, right now I am going through a lot of mess 😅

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

      ​@@iDigvijaysinhGThank you for your reply. Hope everything goes well for you and hoping that the mess is not about the current Unity runtime fee plan😂

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

    can you do it for Amplify shader?

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

      Hi,
      Are you talking about the Amplify shader editor?
      If so, I have never used that, but generally shaders are mostly maths so yeah it can translate easily even between platforms.
      You can follow similar logic in Unreal as well.

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

      @@iDigvijaysinhG yes sir

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

    poiyomiとかと共存させることってできるのかな?パイプラインを設定したらURPは見えるようになったけどpoiyomiとかの他のマテリアは全部ピンクになった

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

      Hello, if you are talking about Poiyomi toon shader, then I think it is simply not created for URP or HDRP, you might need to contact the creator on GitHub or discord maybe.

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

    I've been trying to figure out how to pan the stars across the night sky for hours and I'm just stuck. If there's any chance you know of a simple way to do it, I'd forever love you.

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

      Hi Brandon, you could try using Rotate about axis node in our sub graph, just plug our position node in it, and use Rotate about axis node's output and feed it into normalize node and hopefully it works.
      I have not checked it myself but I will confirm it first thing in the morning tomorrow and get back to you.

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

      @@iDigvijaysinhGThank you! I'm very poor with shader graphs, but I found something that *kinda* works: Tim and float variable feeding into a multiply, then that and a position feeding into a rotate about axis; position to In, a vector 3 variable to axis, and the previous multiply feeding in to the rotation. Main problem with this setup is that, with the way I have things setup, if any other axis besides the Y rotates, you see the polar areas of the sky that kind of pinch the stars together and it looks like a circle, which obviously kind of breaks the immersion.

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

      @brandonhohn245 please discard everything I said on previous comment, I was half asleep 😅
      To pan the stars, in the subgraph, just create tiling and offset node.
      Feed our divide nodes output into UV
      Then take Tiling and offset node's output and feed it to Simple noise node's UV.
      Now we can use offset to pan the stars.

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

    first of all thanks for the tutorial. And i have an issue with my project. I am working on a space rocket game project that i am flying up and stars/noise texture is very disturbingly goes crazy. what to do about it?

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

      also texture is stretching as the player get high. thats another issue for me

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

      Hey, I need to reproduce the issue myself and then I will be able to help you.
      I'll try my best to get back to you ASAP.
      Meanwhile, are you on HDRP?
      If yes, just change Position nodes' space to "Absolute world" because in URP world space and absolute world space are same thing but in HDRP world is relative to Camera for whatever reason and absolute world is the actual world space.