• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
Question by BAKUZAY · Oct 26, 2020 at 11:34 AM · timerskyboxgradientchange colorchange material

Timing Skybox,Timer on Gradient Skybox Asset

Hi!

I've bought a gradient skybox tool and what I want to do is change the colours of the gradient every minute or so. Would anyone be able to help me with a code for this please. I would appreciate it so so much! This is the code of the skybox with the current gradient colours:

Shader "Colr/Gradient Skybox" {

 Properties {
     _Color2 ("Top Color", Color) = (0.97, 0.67, 0.51, 0)
     _Color1 ("Bottom Color", Color) = (0, 0.7, 0.74, 0)

     [Space]
     _Intensity ("Intensity", Range (0, 2)) = 1.0
     _Exponent ("Exponent", Range (0, 3)) = 1.0

     [Space]
     _DirectionYaw ("Direction X angle", Range (0, 180)) = 0
     _DirectionPitch ("Direction Y angle", Range (0, 180)) = 0
     
     [HideInInspector]
     _Direction ("Direction", Vector) = (0, 1, 0, 0)
 }

 CGINCLUDE

 #include "UnityCG.cginc"

 struct appdata {
     float4 position : POSITION;
     float3 texcoord : TEXCOORD0;
 };
 
 struct v2f {
     float4 position : SV_POSITION;
     float3 texcoord : TEXCOORD0;
 };
 
 half4 _Color1;
 half4 _Color2;
 half3 _Direction;
 half _Intensity;
 half _Exponent;
 
 v2f vert (appdata v) {
     v2f o;
     o.position = UnityObjectToClipPos(v.position);
     o.texcoord = v.texcoord;
     return o;
 }
 
 fixed4 frag (v2f i) : COLOR {
     half d = dot(normalize(i.texcoord), _Direction) * 0.5f + 0.5f;
     return lerp (_Color1, _Color2, pow(d, _Exponent)) * _Intensity;
 }

 ENDCG

 SubShader {
     Tags { "RenderType"="Background" "Queue"="Background" }

     Pass {
         ZWrite Off
         Cull Off
         Fog { Mode Off }
         CGPROGRAM
         #pragma fragmentoption ARB_precision_hint_fastest
         #pragma vertex vert
         #pragma fragment frag
         ENDCG
     }
 }

 CustomEditor "GradientSkyboxEditor"

}

Let me know if you need anything else!

Thank you :)

Aylin ,Hi :)

I am urgently trying to animate an asset that I have bought. It is a to make a gradient skybox within Unity. My question is, could anyone help me with a code that would change the colours of the gradient every minute or so? This is the code of the Skybox with its current colours..

Shader "Colr/Gradient Skybox" {

 Properties {
     _Color2 ("Top Color", Color) = (0.97, 0.67, 0.51, 0)
     _Color1 ("Bottom Color", Color) = (0, 0.7, 0.74, 0)

     [Space]
     _Intensity ("Intensity", Range (0, 2)) = 1.0
     _Exponent ("Exponent", Range (0, 3)) = 1.0

     [Space]
     _DirectionYaw ("Direction X angle", Range (0, 180)) = 0
     _DirectionPitch ("Direction Y angle", Range (0, 180)) = 0
     
     [HideInInspector]
     _Direction ("Direction", Vector) = (0, 1, 0, 0)
 }

 CGINCLUDE

 #include "UnityCG.cginc"

 struct appdata {
     float4 position : POSITION;
     float3 texcoord : TEXCOORD0;
 };
 
 struct v2f {
     float4 position : SV_POSITION;
     float3 texcoord : TEXCOORD0;
 };
 
 half4 _Color1;
 half4 _Color2;
 half3 _Direction;
 half _Intensity;
 half _Exponent;
 
 v2f vert (appdata v) {
     v2f o;
     o.position = UnityObjectToClipPos(v.position);
     o.texcoord = v.texcoord;
     return o;
 }
 
 fixed4 frag (v2f i) : COLOR {
     half d = dot(normalize(i.texcoord), _Direction) * 0.5f + 0.5f;
     return lerp (_Color1, _Color2, pow(d, _Exponent)) * _Intensity;
 }

 ENDCG

 SubShader {
     Tags { "RenderType"="Background" "Queue"="Background" }

     Pass {
         ZWrite Off
         Cull Off
         Fog { Mode Off }
         CGPROGRAM
         #pragma fragmentoption ARB_precision_hint_fastest
         #pragma vertex vert
         #pragma fragment frag
         ENDCG
     }
 }

 CustomEditor "GradientSkyboxEditor"

}

I would appreciate it so so much!

Thank you :)

Aylin

Comment

People who like this

0 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image

Answer by BAKUZAY · Oct 26, 2020 at 11:36 AM

Hi @MrSoad would you be able to help at all? :)

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

213 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Skybox Shader is shaking 0 Answers

Change material skybox in runtime 1 Answer

Change Materials On Touch 0 Answers

How to change the color of part of the plane that is directly beneath the cube? 0 Answers

Make a custom procedural skybox 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges