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
1
Question by Krizzen · May 29, 2014 at 06:00 AM · shaderterraingeometry

Transform all Terrain Vertices to Map to Sphere

alt text

I want to map cube coordinates to a sphere. Don't worry, I already have an algorithm to do this. I basically have posXinSphere = (math involving vertex x, y, and z coords), and the same thing for posYinSphere, and posZinSphere.

How would I apply this to a terrain in Unity, i.e. how would I transform each individual vertex? I'm looking for an efficient method. Is it possible to do this in a geometry shader in Unity Free?

Comment
Add comment · Show 4
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 gnp89 · Jun 05, 2014 at 12:58 PM 0
Share

you want to transform the terrain into a cube and then into a sphere? or directly the terrain into a sphere?

avatar image tanoshimi · Jun 05, 2014 at 07:10 PM 0
Share

As @gnp89 commented - not sure how your cube->sphere algorithm is going to help - terrains aren't cubes, they're heightmaps with an array of regularly-spaced elevation samples above a base height.

To answer the second part of your question though, yes you can create geometry shaders in Unity free.

avatar image Krizzen · Jun 10, 2014 at 04:54 PM 0
Share

@tanoshimi my algorithm can transform each plane onto a sphere. I've researched the problem I'm having, and I believe I can answer my own question. I can successfully transform heightmaps using my algorithm onto a sphere, but the problem is that Unity doesn't support rotating Terrain objects. This can probably be solved in the shader, but adds quite a bit of overhead. Also, there are weird terrain LOD details that would need to be sorted out.

It seems geometry shaders aren't required since I discovered they're for creating geometry rather than simply modifying it.

avatar image DMGregory · Jun 10, 2014 at 05:42 PM 0
Share

Terrain comes with a whole pile of extra features, including collisions, grass & trees, and LoD. A shader technique that moves rendered vertices may not play nice with the LoD, culling, or grass/trees, and won't do anything to match the collision representation to the visual.

Rather than hack each of these systems, it may be simpler to create your own spherized cube mesh using the $$anonymous$$esh class. You'll have to replicate the specialized Terrain functionality that you need, but you'll have more flexibility and won't need to hack around a system that was made to do something very different from what you're trying to do.

You might even find that performance is better this way since you're spending your cycles directly creating the behaviour you want, not fighting the behaviour you don't.

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.

Follow this Question

Answers Answers and Comments

23 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

Related Questions

Geomorphing terrain with a vertex shader (custom vertex data maybe?+ 0 Answers

How does the unity terrain shader handle an arbitrary amount of textures ? 1 Answer

Unity Terrain - shader for custom post-splat? 0 Answers

How to automatically apply different textures on terrain based on height? 5 Answers

Shader for ZTest Between Terrain and Objects 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