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
2
Question by ODPaterson · Nov 22, 2010 at 07:48 PM · terrainupside-down

Is there a way of creating upside-down terrain?

Hi

I'm involved making a game which involves switching gravity as a core mechanic and want to create two terrains which can both be travelled on; one normal one and another which is flipped upside-down.

There could be a really easy way doing this that I've missed but anyway, any help would be very much appreciated!

(and it should be mentioned that I'm really awful at scripting!)

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

3 Replies

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

Answer by Eric5h5 · Nov 22, 2010 at 07:52 PM

Unity terrains can't be flipped or rotated. In order to do that you have to use a standard mesh.

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 ODPaterson · Nov 22, 2010 at 08:10 PM 0
Share

Thanks for the heads-up :)

avatar image
2

Answer by OndrejP · May 21, 2019 at 08:55 AM

We're using upside-down terrain as ceiling for caves. What is needed is custom terrain shader with flipped normals and "Cull Front"

What is not working properly is shadows from Directional Light (sun), there are issues caused by Bias a SlopeBias, because shadow shader is applying them in opposive way. We didn't try to fix it since we don't need sun in caves.


We've taken original terrain shader, made a copy and changed few lines. Similar changes has been done in other shaders (Add pass, Base, Base-gen, Picking, Selection)

Zip archive with all shaders & material (Unity 2019.1): TerrainFlip.zip

 // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
 
 Shader "Nature/Terrain/Standard (flipped)" {
     Properties {
         // used in fallback on old cards & base map
         [HideInInspector] _MainTex ("BaseMap (RGB)", 2D) = "white" {}
         [HideInInspector] _Color ("Main Color", Color) = (1,1,1,1)
     }
 
     SubShader {
         Tags {
             "Queue" = "Geometry-100"
             "RenderType" = "Opaque"
         }
 
         Cull Front // FIRST CHANGE
 
         CGPROGRAM
         #pragma surface surf Standard vertex:SplatmapVert finalcolor:SplatmapFinalColor finalgbuffer:SplatmapFinalGBuffer addshadow fullforwardshadows
         #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap forwardadd
         #pragma multi_compile_fog // needed because finalcolor oppresses fog code generation.
         #pragma target 3.0
         // needs more than 8 texcoords
         #pragma exclude_renderers gles
         #include "UnityPBSLighting.cginc"
 
         #pragma multi_compile __ _NORMALMAP
 
         #define TERRAIN_STANDARD_SHADER
         #define TERRAIN_INSTANCED_PERPIXEL_NORMAL
         #define TERRAIN_SURFACE_OUTPUT SurfaceOutputStandard
         #include "TerrainSplatmapCommon.cginc"
 
         half _Metallic0;
         half _Metallic1;
         half _Metallic2;
         half _Metallic3;
 
         half _Smoothness0;
         half _Smoothness1;
         half _Smoothness2;
         half _Smoothness3;
 
         void surf (Input IN, inout SurfaceOutputStandard o) {
             half4 splat_control;
             half weight;
             fixed4 mixedDiffuse;
             half4 defaultSmoothness = half4(_Smoothness0, _Smoothness1, _Smoothness2, _Smoothness3);
             SplatmapMix(IN, defaultSmoothness, splat_control, weight, mixedDiffuse, o.Normal);
             o.Albedo = mixedDiffuse.rgb;
             o.Alpha = weight;
             o.Normal *= -1; // SECOND CHANGE
             o.Smoothness = mixedDiffuse.a;
             o.Metallic = dot(splat_control, half4(_Metallic0, _Metallic1, _Metallic2, _Metallic3));
         }
         ENDCG
 
         UsePass "Hidden/Nature/Terrain/Utilities-flip/PICKING"
         UsePass "Hidden/Nature/Terrain/Utilities-flip/SELECTION"
     }

     // THIRD CHANGE (using flipped dependencies)
     Dependency "AddPassShader"    = "Hidden/TerrainEngine/Splatmap/Standard-flip-AddPass"
     Dependency "BaseMapShader"    = "Hidden/TerrainEngine/Splatmap/Standard-flip-Base"
     Dependency "BaseMapGenShader" = "Hidden/TerrainEngine/Splatmap/Standard-flip-BaseGen"
 
     Fallback "Nature/Terrain/Diffuse"
 } 



terrainflip.zip (7.8 kB)
Comment
Add comment · Show 3 · 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 jesscorp · Jun 02, 2019 at 11:48 PM 0
Share

@OndrejP This is exactly what I was looking for I just don't know how to use what you provided here.I am just learning Unity. I have a $$anonymous$$ap$$anonymous$$agic terrain and I plan to use the same terrain as the ceiling. Could you possibly elaborate on how I could achieve this? Thank you.

avatar image OndrejP · Jun 03, 2019 at 07:14 AM 0
Share

Don't know what $$anonymous$$ap$$anonymous$$agic is. You download terrainflip.zip and unpack it somewhere into your project. Then on Terrain component in settings choose custom shader / material and assign TerrainFlip material there.

avatar image jesscorp OndrejP · Jun 04, 2019 at 05:00 PM 1
Share

Thanks for the quick response! So what I learned was that $$anonymous$$icroSplat creates its own shader based on a texture array and this is don automatically every time you update the array. So I just added an option in $$anonymous$$icroSplat to invert the shader and ins$$anonymous$$d of cull back I just set it to automatically cull front.. I did not set the normal to -1 but I am getting the desired effect. Now to solve the shadow issue :) I really do appreciate you sharing this information!

avatar image
0

Answer by Adil_Alhilali · Jul 03, 2020 at 11:30 AM

Export the unity terrain to any 3d modeling software save it as plain then imported back to unity

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Make a simple tree 1 Answer

iam using raycast.hit function.am trying to move vehicle over the terrain ups and down?? 0 Answers

How I start to create a person with movement ? 2 Answers

procedural path painting on terrain 1 Answer

Ingame voxel terrain manipulation(sorry for last post) 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