x

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"

How to dynamically change the light direction of a planet material.

Hey everyone,

So recently i've been following a tutorial on how to make a planet material but i wanted to take it one step further and actually change the incoming light's direction dynamically, because now the only thing i can do is change it manually from the material instance menu as seen in the screenshot below.

alt text

alt text

What i originally thought of doing was to somehow change the vector colour automatically from inside the material with maybe a material function and somehow parametrize the speed at which the colour would change, however i didn't really figure out how I could do that (still learning ue4), I also thought that this might be possible through blueprints and/or a parameter collection + timeline.

This is the part in the master material that i'm trying to automatically change.

alt text

What i was trying to achieve was to actually make the light follow the sun (which I would add later) 's movement and light the earth accordingly instead of just staying static as seen in the picture. I'm guessing this would be better explained with a gif but i didn't know how to upload one. I'm sorry if i didn't explain very well what i'm after but this is the best way i found to explain it.

Thanks in advance to anyone that answers.

P.S. Sorry if this is in the wrong section of the forum i didn't know under which category this should be posted.

Product Version: UE 4.16
Tags:
screenshot02.png (883.4 kB)
screenshot02.png (946.8 kB)
screenshot04.png (848.2 kB)
screenshot06.png (662.8 kB)
more ▼

asked Aug 31 '17 at 06:36 PM in Using UE4

avatar image

The 1llus1on1st
3 1 2 3

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

if the sun is object in the world, and planet moves around it, you can find direction by formula:

LightDirection = Normalize(PlanetLocation - SunLocation)

Now you need to pass this value to that material using DynamicMaterialInstance in blueprint.

more ▼

answered Sep 01 '17 at 03:18 AM

avatar image

redbox
4.2k 79 16 102

avatar image The 1llus1on1st Sep 01 '17 at 11:59 PM

Ok I'll try that out next time I work on the project, it seems like it should work, in the meanwhile I also got an answer from the creator of the tutorial giving me another solution as well. Thanks very much for your help. Much appreciated.

avatar image Bushey Sep 04 '17 at 04:11 PM

Could you provide any more info on what that looks like in the shader please?

(comments are locked)
10|2000 characters needed characters left

Hi,

can you share the other answer please?

more ▼

answered Sep 04 '17 at 04:09 PM

avatar image

Bushey
54 3 5 14

avatar image The 1llus1on1st Sep 04 '17 at 04:16 PM

Well it wasn't exactly an in depth answer, he suggested that if the sun is another object in the scene that's rotating around the earth I could get the forward vector of the sun and transfer that value to the earth material through blueprints by making it a dynamic material instance. I still didn't get a chance to try it out though. Althought i'm positive that it should work out that way. I can post a screenshot of the blueprint when it's done If you want.

avatar image Bushey Sep 04 '17 at 04:17 PM

Thanks for your reply. BTW what was the other solution you got from the original tutorial guy, was it DrunknPenguin?

avatar image The 1llus1on1st Sep 04 '17 at 04:25 PM

That was the solution from DrunkenPenguin, it's kind of the same with this one just explained differently :p, he told me he had tried it out back in 2015 but didn't exactly remember how he did it and didn't have a shader he could share so I should try it out to confirm it. I asked him in the comment section you should be able to find the comment if you want.

avatar image Bushey Sep 05 '17 at 07:59 AM

I've dropped him a message.

Thanks for replying :)

avatar image The 1llus1on1st Sep 05 '17 at 01:41 PM

You're welcome, glad I could help somehow. :)

(comments are locked)
10|2000 characters needed characters left
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