Simple way to make stars using shader graph in Unity

Sdílet
Vložit
  • čas přidán 28. 08. 2024

Komentáře • 34

  • @ano7371
    @ano7371 Před 7 dny

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

  • @EpicGamer63637
    @EpicGamer63637 Před 10 měsíci +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  Před 10 měsíci

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

  • @bathtubanarchy
    @bathtubanarchy Před rokem +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  Před rokem +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.

  • @91tj
    @91tj Před 11 měsíci

    Awesome tutorial!

  • @ecogaming6084
    @ecogaming6084 Před rokem +3

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

  • @nileshalgotar1802
    @nileshalgotar1802 Před rokem +1

    Great Chanal 👌👌

  • @erikm9768
    @erikm9768 Před 5 měsíci

    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 :)

  • @vijaybhai1141
    @vijaybhai1141 Před rokem +1

    Good

  • @Magicstickperson
    @Magicstickperson Před rokem

    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  Před rokem +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 Před rokem

      @@iDigvijaysinhG that makes sense, thank you!

    • @jamasheller224
      @jamasheller224 Před 11 měsíci

      ​​@@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  Před 11 měsíci +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 Před 11 měsíci

      ​@@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😂

  • @JadenAllen
    @JadenAllen Před 6 měsíci

    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  Před 6 měsíci

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

  • @brandonhohn245
    @brandonhohn245 Před 8 měsíci

    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  Před 8 měsíci

      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 Před 8 měsíci

      @@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  Před 8 měsíci

      @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.

  • @regialurker8626
    @regialurker8626 Před 7 měsíci

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

    • @iDigvijaysinhG
      @iDigvijaysinhG  Před 7 měsíci

      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.

  • @kyroic6128
    @kyroic6128 Před 7 měsíci

    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 Před 7 měsíci

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

    • @iDigvijaysinhG
      @iDigvijaysinhG  Před 7 měsíci

      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.

  • @antonclark608
    @antonclark608 Před rokem

    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  Před rokem

      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.

  • @sureztv5836
    @sureztv5836 Před rokem +1

    can you do it for Amplify shader?

    • @iDigvijaysinhG
      @iDigvijaysinhG  Před rokem +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.

    • @sureztv5836
      @sureztv5836 Před rokem

      @@iDigvijaysinhG yes sir