Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 /
avatar image
0
Question by Josh707 · Jul 25, 2012 at 09:11 PM · shadermaterialskyboxblend

Shader Blending Question

Scroll to bottom for quick version!

I know nothing about shaders so sorry if some of this doesn't make sense.

The BlendedSky shader lets you blend between 2 skyboxes. I changed it to have 4, for night, dawn, day and dusk.

In the SubShader section in a Pass{} thing there are lines of code that combine the original 2 textures for the transition

 SetTexture [_FrontTex] { combine texture }
 SetTexture [_FrontTex2] { constantColor (0,0,0,[_Blend]) combine texture lerp(constant) previous }
 SetTexture [_FrontTex2] { combine previous +- primary, previous * primary }

I know nothing, so I just repeated that replacing the names _FrontTex and the numbers to the ones I added in myself. It obviously does not work.

  _Blend ("Blend", Range(0.0,1.0)) = 0.5

That is at the beginning of the code, and I believe it is the slider. Does this need to be modified in any way? It is included in the SetTexture things

How would I go about having it gradually blend from the first to second to the third and finally the last one? I already have code written to control the blending process in-game, so I don't need any help there.

Quick Version

Is it possible to blend between 4 textures in a shader? If so, how?

Comment
Add comment
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
0
Best Answer

Answer by ScroodgeM · Jul 26, 2012 at 01:13 AM

in perfomance reason it's better use blending between 2 textures

  • so attach tex1 to slot1 and tex2 to slot2, then blend from 0 to 1

  • then attach tex3 to slot1 and blend from 1 to 0

  • then attach tex4 to slot2 and blend from 0 to 1 again

  • etc

i believe that you needn't blending between more then 2 textures at once?

anyway, you can try to make such blending

http://docs.unity3d.com/Documentation/Components/SL-SetTexture.html

if you still really need all-in-one shader, i can write one for you. but do you really need it? 8)

Comment
Add comment · Show 4 · 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
avatar image Josh707 · Jul 26, 2012 at 06:27 PM 0
Share

I was doing this for a skybox, so I wanted to have the yellow/reddish sky for when the sun is setting and rising. I have found my own work around for it, so you do not need to write a shader for me. Thanks for the offer though!

avatar image ScroodgeM · Jul 27, 2012 at 09:40 AM 0
Share

may be it's better to post your solution here to close the question? 8)

avatar image Josh707 · Jul 27, 2012 at 11:20 PM 0
Share

Well it's not really a solution for this, but it's kind of the same thing. I have my time script set up so it knows when the time is between certain points, and I have colored fog blend colors depending on the time. It does give the scene a nice look.

avatar image ScroodgeM · Jul 28, 2012 at 04:55 AM 0
Share

ok, close question then...

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.

Follow this Question

Answers Answers and Comments

6 People are following this question.

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

Related Questions

How to change the reflection according to skybox-material? 2 Answers

Blending one material/texture/shader to another 1 Answer

What happens if I use the wrong shader for a skybox? 1 Answer

Material doesn't have a color property '_Color' 4 Answers

Skybox blending 2 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