Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Fletch on June 20, 2013, 11:10:46 AM

Title: Sun & Skybox Blending Over Time
Post by: Fletch on June 20, 2013, 11:10:46 AM
I'm trying to make a skybox and a sun change over time.

I've got the sun going round my scene, which effectively simulates the sun rising and falling, but I'm looking for a little guidance for making the sun intensity and color change over time. 

The next step is to get two light boxes, (day and night) to blend so that the sky becomes dark at night and light in the day.  Profound, I know.

What is the basic outline of how this might be done?
Title: Re: Sun & Skybox Blending Over Time
Post by: jeanfabre on June 21, 2013, 01:29:59 AM
Hi,

 Have you searched on Unity forum? if you find a solution, share it here and I'll see that can be done with Playmaker.

bye,

 Jean
Title: Re: Sun & Skybox Blending Over Time
Post by: Fletch on June 21, 2013, 11:19:08 AM
Here's a solution I found.

The sun and brightness are pretty simple.  I created a directional light and added a flare  I rotate the sun around the game area with a Rotate Around action.

The brightness is controlled by the angle of the sun.

The skybox is the hard part. 

I've found this tutorial and the linked code that blends two skyboxes together in a shader.  Then he uses code to shift the blend between the two.


http://wiki.unity3d.com/index.php/SkyboxBlended

Title: Re: Sun & Skybox Blending Over Time
Post by: Fletch on July 02, 2013, 09:09:14 PM
Any movement on this one?
Title: Re: Sun & Skybox Blending Over Time
Post by: escpodgames on July 03, 2013, 01:55:18 AM
Have you looked at the texture blend shader .. just blend the two skybox textures, I have setup a custom system for mine which changes the sky color based on a gradient .. but it's pretty advanced :P

http://wiki.unity3d.com/index.php?title=Blend_2_Textures
Title: Re: Sun & Skybox Blending Over Time
Post by: NinjaX on August 11, 2013, 04:26:04 PM
I too would like to see this happen!    :o
Title: Re: Sun & Skybox Blending Over Time
Post by: jeanfabre on August 16, 2013, 04:45:40 AM
Hi,

 It's simple then:

 use the action "Set Material Float" and set the "Named Float" to "_Blend" then adjust that value from 0 to 1.

 Bye,

Jean
Title: Re: Sun & Skybox Blending Over Time
Post by: Gua on July 01, 2021, 08:52:33 PM
Hi,

 It's simple then:

 use the action "Set Material Float" and set the "Named Float" to "_Blend" then adjust that value from 0 to 1.

 Bye,

Jean

There's a problem with this approach. Material stays changed inside game project when I exit play mode. Is there a way to avoid this?
Title: Re: Sun & Skybox Blending Over Time
Post by: strawberryblur on January 02, 2022, 12:30:16 PM
Hi ,
i found solution.

First 0/1 type solution is to use "Send message" and add script to directlight for example:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class intencje : MonoBehaviour
{
   
   
   public void intencjee(float ile){
      
   RenderSettings.ambientIntensity   =ile;   
      
   }
   
    // Start is called before the first frame update
    void Start()
    {
      //RenderSettings.ambientIntensity = 0.0f; 
    
    }

    // Update is called once per frame
    void Update()
    {
       
    }
}


But bettor one was to duplicate action : Float Interpolate , and update instead of "store result" -> RenderSettings.ambientIntensity   =........ ( liner or EaseInOut).  Photo and file in attachment.

Best Regards
strawberryblur