• 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 lukephx · Mar 12, 2017 at 06:02 PM · texturematerialtexture2dcubemap

from texture2D to cubemap

Hi ,

I created a texture2D object from an image I pick from gallery (I'm working on an android app). I have a Material called "main" in my Resources folder , and it is a Skybox/Cubemap material. If I want to set the material texture in my script, I need a Cubemap texture, not a Texture2D texture. So, my question is: how can I transform my Texture2D to Cubemap? I post a piece of my code to better explain my problem (I don't know what to write in "//from mainImage to cubetex ?????" part).

 private Texture2D mainImage;
 private Cubemap cubetex = new Cubemap (2048, TextureFormat.RGB24, false);
 private Material mat;
 
 mainImage = new Texture2D (www.texture.width, www.texture.height);
 mainImage.SetPixels32 (www.texture.GetPixels32());
 mainImage.Apply ();
 
 // from mainImage to cubetex ?????
 
 mat = Resources.Load("main") as Material;
 mat.SetTexture ("_Tex", cubetex);




Comment
Add comment · Show 2
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 ktsein · Mar 28, 2017 at 03:45 PM 0
Share

Did you figure it out now? I am trying to do the same. I am trying to get color[] from Texture2D and setting it in Cubemap. Another way i want to try would be to break it down to six and load them according to the skybox. ,@lukephx Did you manage to figure it out? I am trying to do the same. I am thinking about trying getting color[] from Texture2D and setting them to Cubemap. The another way would be to break the Texture2D down to six sides and load them accordingly in the Skybox.

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Get Texture 2D after all shader passes are applied 0 Answers

in game - how to partly invisible an object ? 2 Answers

Convert Texture to Texture2D e.g. renderer.material.mainTexture 3 Answers

Cubemap vs. Texture speed on mobile 0 Answers

How to make dynamically texturable object model? 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