Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Every cloud needs a silver lining: edge glow mask

I am trying to create a sky system using polygonal clouds rather than volumetrics. It looks fairly good throughout the daytime.

alt text

But come 6PM clouds look opaque when we look at them through the sun:

alt text

So I hooked up a camera vector and vertex normal dot product, and got silver linings-- but of course, clouds had silver linings everywhere, even when you're looking away from the sun.

alt text

This is the desired effect (a composite in photoshop)

alt text

How do I make it so that we get this silver lining only over the sun, fading out as the clouds recede away? Maybe a mask?

Thanks in advance for any help on this!

Product Version: UE 4.22 Preview
silverlining1.jpg (234.8 kB)
silverlining2.jpg (224.9 kB)
silverlining4.jpg (272.6 kB)
silverlining3.jpg (240.5 kB)
more ▼

asked Mar 11 '19 at 01:26 AM in Rendering

avatar image

25 2 2 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

yeah you could scale the intensity with a sphere mask. the 'a' input would be world position and 'b' would be the position of the sun. hardness would be 0 and radius some fairly high value in the thousands i'd imagine.

you could also try running the dot product with the normal and atmospheric light vector for a of bit different effect.

more ▼

answered Mar 11 '19 at 02:51 AM

avatar image

1.4k 11 4 10

avatar image CorsairOfLight Mar 11 '19 at 06:18 AM

How would you go about getting the position of the sun's light vector into the material graph? That's what I'd have the most trouble with.

avatar image IndieGameCove Mar 11 '19 at 06:49 AM

if you have a directional light in the level then the "atmospheric light vector" node will return the direction it's pointing provided the directional lights intensity is over 0.

Alternatively, you could make a fake sun blueprint. Generally I would add a billboard and arrow components. Then make a material parameter collection and set a vector parameter to the arrow's forward vector in the construction script. Bring the fake sun into the level and add the parameter collection to the material. when you rotate the sun the light direction in the material changes.

avatar image CorsairOfLight Mar 11 '19 at 07:06 AM

I've got an orrery going atm-- the sun's on a card that rotates around in front of the sky sphere. The directional light is parented to the sun card. It all does a day/night cycle that works pretty well.

So all I have to do is use the atmospheric light vector node, which will return any directional light vector? What if there are two directional lights in the level, one for the moon if it's up while the sun is (though at a very low intensity)?

avatar image IndieGameCove Mar 11 '19 at 07:26 AM

I don't think "atmospheric light vector" node will work right with two directional lights. it will try to just swap back an forth as they run their construction scripts.

you could feed a parameter off of the directional light in your card, and swap the vector for the moon when one becomes more intense then the other. or you could use two dot products in the material if you would rather not swap.

avatar image CorsairOfLight Mar 11 '19 at 07:44 AM

Swap would be complicated, so two dot products it is. Or could you add the two sphere masks together, then multiply over the dot product?

Thank you for your continued attention to this, I may need to consult your help in the future when implementing this in the blueprint stage. Think you'd be game to help me out again in the future?

avatar image IndieGameCove Mar 11 '19 at 07:57 AM

I'm not sure what you're saying, I think you'll need two dots but it won't hurt try whatever it is you're thinking. I'll be around if you have more questions.

avatar image CorsairOfLight Mar 11 '19 at 08:03 AM

What are the dot products for in this case?

avatar image IndieGameCove Mar 11 '19 at 08:51 AM

dot(light vector a, pixel normal) * spheremask

dot(light vector b, pixel normal) * spheremask

then add together.

sometimes the light vector needs to be inverted, it will be obvious if it's an issue. vertex normal will work too its nearly the same as pixel normal.

avatar image IndieGameCove Mar 12 '19 at 12:12 AM

I've given it some more thought and since a directional light with a mask is basically just a point light, so you could use point light math. either way will work though.

alt text


pointlight.png (254.4 kB)
avatar image CorsairOfLight Mar 12 '19 at 04:37 PM

Your extra thought and continued attention to this is greatly appreciated! I'll get onto scripting this quickly so we can work on it simultaneously.

avatar image CorsairOfLight Mar 12 '19 at 04:47 PM

To make things faster, how would you set up the normal dot product(a,b) -->sphere mask on graph?

avatar image IndieGameCove Mar 13 '19 at 09:42 PM

it would look like this

alt text


lightexample.png (250.5 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question