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
0
Question by bhavesh · Aug 02, 2011 at 06:42 AM · meshmaterials

How To Create and Set Mesh Dynamically Using Script (C# or Javascript) On Sphere

Hello Everybody,

I am creating appolication like google earth. I want to create partition of sphere like which is created for actual earth using langitide and latitude.

For that I have created Mesh in Maya and then imported it in Unity. This Mesh contains different Materials and I can also change texture of this material run time using script.

But I want to create Mesh with different Matirials in Unity using scripting so that for each material I can set different texture dynamically.

I am trying to do this things since many days but not getting how accomplish this.

If you can provide code for that then it will be better for me.

Thanks in Advance.

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 Graham-Dunnett ♦♦ · Aug 02, 2011 at 01:35 PM 0
Share

You had accidentally made all your question bold. I fixed that for you.

avatar image Deepschalappatta · Aug 09, 2013 at 06:40 AM 0
Share

hi Graham Dunnett : do you know how to load different objects in to the same prefab.... and how to change the models via javascript at runtime.can u help me?

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Graham-Dunnett · Aug 02, 2011 at 02:01 PM

Hi Bhavesh. You don't say what things you have tried, so guess I can only answer by going back to basics. I think you might want to create a sphere that has multiple textures. Think of it a bit like an onion with different shells. On the outside you have your regular world map and you use this when the zoom level tells you that most of the world is visible. Beneath this you might have a couple of second texture shells, that you constantly change the textures that are on them. You use some alpha values to control which of these three shells/textures are visible. I would imagine that all 3 shells can share the same UV map that you already have in place. However if you have a high res map of India that you want to use when the user is zoomed in on that sub-continent, you will want to recompute the UV values it uses. Possibly you can submit to your shader the Longitude and Latitude values that are at the centre of the screen, and the values that are at the bottom left and top right corners of your India texture. I'd suggest you look at how to convert the UVs from your world map into the UVs that apply to India.

Not sure how well I explained that. Think about it this way. Take your globe and stick a small postage stamp onto it. The postage stamp has UVs in the range 0..1. You've placed this on your global centred at some long/lat. What is the equation that converts long/lat into the UV range on the stamp.

Summarising, I think you have some maths to do, and then write a shader that can render the layers that you need, using the textures that you have. (And if you are not up for writing a shader yet, then emulate this with 3 spheres that are all slightly different sizes and just select which one to render. And you might be able to set texture offset and scale to emulate the UV calculations.)

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 Deepschalappatta · Aug 09, 2013 at 06:40 AM -1
Share

hi Graham Dunnett : do you know how to load different objects in to the same prefab.... and how to change the models via javascript at runtime.can u help me?

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

How do I properly apply a transparent texture to a mesh? 2 Answers

Change uvs on texture packing 0 Answers

Is it possible to use Multiple Materials on a single mesh? 0 Answers

CombineMeshes with Different Materials 8 Answers

My mesh didn’t appear in Unity 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