playMaker

Author Topic: Sun & Skybox Blending Over Time  (Read 8323 times)

Fletch

  • Junior Playmaker
  • **
  • Posts: 66
    • SneakOnTheLot.com
Sun & Skybox Blending Over Time
« 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?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Sun & Skybox Blending Over Time
« Reply #1 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

Fletch

  • Junior Playmaker
  • **
  • Posts: 66
    • SneakOnTheLot.com
Re: Sun & Skybox Blending Over Time
« Reply #2 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


Fletch

  • Junior Playmaker
  • **
  • Posts: 66
    • SneakOnTheLot.com
Re: Sun & Skybox Blending Over Time
« Reply #3 on: July 02, 2013, 09:09:14 PM »
Any movement on this one?

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Sun & Skybox Blending Over Time
« Reply #4 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

NinjaX

  • Full Member
  • ***
  • Posts: 113
  • XCO is the ULTIMATE IOS Ninja!!
    • XCOGAMES
Re: Sun & Skybox Blending Over Time
« Reply #5 on: August 11, 2013, 04:26:04 PM »
I too would like to see this happen!    :o
XCO is the ULTIMATE IOS Ninja, Beware for he sees Everything and Nothing all at once!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Sun & Skybox Blending Over Time
« Reply #6 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

Gua

  • Beta Group
  • Sr. Member
  • *
  • Posts: 309
    • Andrii Vintsevych
Re: Sun & Skybox Blending Over Time
« Reply #7 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?

strawberryblur

  • Playmaker Newbie
  • *
  • Posts: 1
Re: Sun & Skybox Blending Over Time
« Reply #8 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