2
\$\begingroup\$

I am trying to understand material and shaders in Unity. make my object glow like a sun. For the moment I do not care if it's not looking like a star, but I would like that it at least emit light.

How do I make something that look like a star, and emit light? Like this:
(And if possible, be able to change the light color)

enter image description here

I tried to play with the Standard shader, and add some emission like this :

enter image description here

I tried legacy self illuminated, but they look like 2d, and have no depth

enter image description here

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Ahhh, that's not a property of the object's material, at least not acting alone. That's a post-process effect called bloom, which takes bright pixels in the image and blurs them out to spread a glow over nearby pixels. It's not really "emitting" light in the sense used by the graphics pipeline, just smearing out the pixels where the light is captured. Have you played with the post-processing stack to try to accomplish this? You can also approximate the effect for an individual object by placing an additively-blended halo card in front of the object. \$\endgroup\$
    – DMGregory
    Commented Sep 29, 2019 at 6:21
  • \$\begingroup\$ No I have no idea how to achieve such an effect, I will use the keywoard you used to search a solution. thanks @DMGregory Take apart the effect, what material should I use ? Is there something that can emit / reflect light or act like a star on nearby environment ? Or do I have to use a light for each star I have in space. \$\endgroup\$
    – Crocsx
    Commented Sep 29, 2019 at 7:17
  • 1
    \$\begingroup\$ Yes, the component that emits light is the Light component. The material on one object will not illuminate another object. You can think of a material as a rule "how should I paint the pixels of this object?" — pixels outside the object never invoke this material's shader, so it can't directly influence them (except eg. via specular reflection maps/probes, but that's not the kind of illumination you're looking for) \$\endgroup\$
    – DMGregory
    Commented Sep 29, 2019 at 12:04
  • \$\begingroup\$ Note that an emissive material can provide static illumination to a scene for the purposes of lightmap baking, but not real-time lighting. \$\endgroup\$
    – Ed Marty
    Commented Sep 29, 2019 at 12:24

1 Answer 1

4
+50
\$\begingroup\$

In order for that shiny halo to appear around HDR-colored materials, you need to add a Bloom post-processing effect to your scene.

How to do that and what settings that filter has available differs a bit depending on whether you use the Universal Render Pipeline, the High-Definition Render Pipeline or the build-in render pipeline.

For HDRP and URP:

  1. Create a global post-processing volume in your scene with Volume -> Global Volume.
  2. Add a new Profile to that volume.
  3. Click on "Add Override..." and add the "Bloom" effect to that profile. Enable the "Intensity" property and set it to 1.0 for now. You can tweak it later.
  4. Select your camera and enable the "Post Processing" checkbox.
  5. Give your sun's material an HDR color for its emission property in the desired color, and crank up its intensity
  6. You can tweak the emission color of your material and the bloom effect on your post-processing volume by configuring it according to the documentation for URP Bloom or HDRP Bloom

For the Build-in Render Pipeline:

  1. Install the post-processing package via the package manager.
  2. Create an empty gameObject (your post-processing volume)
  3. Set the Layer of that game object to a new layer "Post Processing"
  4. Add the Post-Processing Volume Component to the game object (Rendering -> Post-process Volume)
  5. Check "Is Global" on the volume
  6. Add a new Profile to that volume.
  7. Click on "Add Effect..." and add the "Bloom" effect to that profile. Enable the "Intensity" property and set it to 1.0 for now. You can tweak it later.
  8. Select the game object with your camera and add the Post-Processing Layer Component to it Rendering -> Post-process Layer.
  9. On that post-processing layer, set the setting "volume layer" to your new layer "Post Processing"
  10. Give your sun's material an HDR color for its emission property in the desired color, and crank up its intensity
  11. You can tweak the emission color of your material and the bloom effect on your post-processing volume by configuring it according to the documentation for Build-in RP Bloom

From now on, remember to wear sunscreen while working on this scene :)

\$\endgroup\$
1
  • \$\begingroup\$ I followed this and now I have a great looking sun material! thnx! @DMGregory, adding this as an answer instead of a comment was an accident. \$\endgroup\$
    – Millard
    Commented Apr 15, 2021 at 20:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .