Giter VIP home page Giter VIP logo

mightyterrainmesh's Introduction

MightyTerrainMesh

A Unity Plugin for Converting Terrain 2 Mesh with LOD & QuadTree infomation.

There are some introduction & result here :

https://zhuanlan.zhihu.com/p/64809281

And thanks for parahunter, I used his triangle-net-for-unity as the tessellation solution.

Update At 27th Dec. 2021

What I have done in this update:

  • read the height data from terrain data directly, remove the physically sampling methods.
  • changed the texture baking method, make the mesh baking runs faster and more stable.
  • supports runtime virtual texture by converting terrain to data sets which can baking the "multi-layer blending material" into a simple material with only sampling 2 tertures at runtime.
  • converts the terrain details(grass) into data sets which can be rendered at runtime by unity jobs system.
  • The converted grass system supports wind, water floats and interaction with player.

Parts of the works have been done at Camel Games(https://www.camelgames.com/), where I worked there as a graphics progammer. Special thanks to Kai, who drived & supported this project to achieved this result.

How to Use the mesh creator

  • click MightTerrainMesh->MeshCreator open the mesh editor interface
  • Drag the terrain you want to convert to the Convert Target
  • Fill in the parameters as the screen shot, you will get a prefab which cut this terrain into a 4 by 4 total 16 meshes, each has 2 2048 textures including albeto + ao + normal + metallic + roughness informations. mesh_editor
  • after the converting, the mesh, the texture are all yours, you can editing as you want, but pls remember that, if you need a comparable visual look by staic meshes and textures, the amount of the resources gonna be huge.

How to Use the data creator

  • click MightTerrainMesh->DataCreator open the mesh editor interface
  • Drag the terrain you want to convert to the Convert Target
  • Fill the parameters as the screen shot, then you will get the runtime virtual texture data set.
  • watch out the data pack parameter, which pack 64 mesh data into one .bytes data, cause we are spliting the terrain into 6464 patch, which may crash your file system if we dont do any packing policy.
  • data_editor
  • after baking all the terrains, I put then into the ArtRes/BakedData, and put the meshdata into Resources folder, since they will be loaded at runtime.
  • pls check the VTDemo Scene, all the setting are pretty readable.
  • watch out the VTCreator Game Object, which is the virtual texture generator, the Tex Quality setting is the one you may concern the most, 'half' can give us even better visual result then unity terrain, since its mipmap sucks, 'quater' means render the virtual texture as 1/4 resolusion, which looks also promising and can bring you 60 fps on medium end mobile device. have fun!

mightyterrainmesh's People

Contributors

jinsek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mightyterrainmesh's Issues

Possability for HDRP Support?

Hey there,
I was interested to see what this is all about, but I happened to be using an HDRP project and quickly noticed all shaders I came across were for Universal pipeline. I know it is not a trivial venture, but are there any plans to also support HDRP?

Thanks,
-MH

A Typo in README.md

A Unity Plugin for Converting Terrain 2 Mesh with LOD & QaudTree QuadTree infomation.

:)

Alterations for DOTS support, almost working

I am sorry to bother you again, but I had hopefully one last question.

Bearing in mind I know essentially nothing about shaders, I was able to get the MTTerrainLit shader to render within a DOTS SubScene (the newer/current Entities.Graphics package) , but I can't seem to get the additional "MTTerrainLitAdd" shader to work along with it, which seems to be blending additional textures into the mesh. In the example I was testing, there are dark spots where rock texture typically would be. (Seen in the images below)

I had to make adjustments, such as:

# File - MTTerrainLit.shader

#pragma target 4.5
#pragma multi_compile _ DOTS_INSTANCING_ON
# ^ These changes I had to make in a few files
#File - MTTerrainLitInput.hlsl

# Had to change this CBUFFER_START(Terrain) to the following:
CBUFFER_START(UnityPerMaterial)

Then I had to comment out a few things having to do with TerrainArray to get rid of some errors, but upon doing so, rendering worked in Entities.Graphics/SubScenes, seemingly properly to my extreme surprise, minus that one thing with the TerrainLitAdd not rendering.

I have a feeling that it is either something very easy, or something very difficult that would require much more knowledge than I have in shaders to fix. I feel that I simply got lucky that the changes I made worked at all, and there are probably bigger implications, but I am wondering if you happen to know of something off the top of your head that might be causing this behavior?

If not, I completely understand. It was a long shot to begin with on my part. I really just wanted to see if it would be done in the first place since Entities.Graphics doesn't yet have native terrain rendering capability. I have been looking for some sort of working mesh conversion, and this was the closest I have gotten/found.

Original

Exported mesh within SubScene

Thanks,
-MH

holes?

How do I get the terrain holes in the mesh?

How can i use MeshCreator?

Hi, I am a very beginner to unity, so i am slightly confused about using your great plugin.
in readme, instruction 1. click MightTerrainMesh->MeshCreator open the mesh editor interface.
Q: where are MeightTerrainMesh and MeshCreator button??
I tried really hard to find that button or its role, but I just can't find it.
i uploaded my view of the unity in linux, i clone your project to the unity folder, and only open the TerrainDemo scene.

please help me.. thankyou

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.