Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
2
Question by zachypin · Jul 18, 2011 at 06:06 PM · camerashaderskyboxskyboxesplayercamera

Dynamic Skybox

Hi,

So I currently have a skybox that gets rendered with six still images. I'd like to continue using this method, but with a little different way of getting the images instead of them being in my project. I'd like to have a website that has a picture constantly being updated. There would have to be six sites for this to transmit into a skybox, though for now being perfect images for a skybox doesn't matter to me, I just want the functionality.

So the code below I used on a plane to pull an image off of a website and apply it to the texture.

 // url of image;
 var url = "http://ETC";
 function Start () {
 
      // Start a download of the given URL
     var www : WWW = new WWW (url);
 
     // wait for download to complete
     yield www;
     
     // assign texture
     renderer.material.mainTexture = www.texture; 
 }

I'd like to use this same method, but the thing is I don't know how to apply code to the skybox considering these images are being taken directly from project.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Bunny83 · Jul 18, 2011 at 07:33 PM

When you switch your inspector into Debug mode you can see the texture parameters in list form. They are:

_FrontTex, _BackTex, _LeftTex, _RightTex, _UpTex, _DownTex

There are also _MainTex and _Tex but i guess they aren't used.

To set them just use Material.SetTexture.

 GetComponent.<Skybox>().material.SetTexture("_FrontTex",www.texture);

edit

You can load one texture at a time and load them one by one, or load them all at once. WWW-calls are asynchron so you can start all 6 downloads at once and wait for them to finish.

 private static var skyboxTextures : String[] = ["_FrontTex", "_BackTex", "_LeftTex", "_RightTex", "_UpTex", "_DownTex"];
 var url = "http://domain/path/to/skybox/folder/";
 
 function LoadSkybox(skyboxName : String)
 {
     var www : WWW[] =  new WWW[6];
     for (var i = 0;i < 6; i++)
     {
         www[i] = new WWW(url + skyboxName + skyboxTextures[i] + ".png");
     }
     var mat = GetComponent.<Skybox>().material;
     for (i = 0;i < 6; i++)
     {
         yield www[i];   // wait for all images to finish
         mat.SetTexture(skyboxTextures[i],www[i].texture);
     }
 }
 
 function Start()
 {
     LoadSkybox("desert");
     // Images should be named:
     // "desert_FrontTex.png"
     // "desert_BackTex.png"
     // ...
 }

Comment
Add comment · Show 1 · 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 zachypin · Jul 18, 2011 at 09:48 PM 0
Share

thanks for the helpful edit :)

avatar image
0

Answer by sistematix · Aug 26, 2014 at 04:23 AM

dont forget to clamp the textures, the famous white lines would appear on your skybox

Comment
Add comment · 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.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Camera: Possible to render partial skybox with no background color fill? 0 Answers

Unity 5 procedural skybox with working bottom 1 Answer

How to made a normal skybox with a rectangle part of solid color 0 Answers

function unity_SpecCube0 doesn't work (or problem with skyBox) 1 Answer

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


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