I'm looking to create some procedurally-generated planets in unity. I'm not looking to make huge, realistic planets, but very small, walkable ones (like Super Mario Galaxy).
I've run into a problem though - Terrain objects cannot be rotated, so I can't really make a sphere out of 6 separate squares.
I've tried importing a hi-res icosphere with limited success. It's difficult to make look good (even with a high number of faces) when up close. There's also limited support on terrain-like features on non-terrain objects - like how to blend textures, add grass, or place objects on the surface.
I have seen a few unity store assets that do exactly what I'm requesting, so I know something like this is possible. I just can't figure out where to start. I've searched for nearly anything related to the topic and found nothing.
Thank you!
You can write a shader that will curve your flat surface, like this:
https://www.assetstore.unity3d.com/en/#!/content/26165
and here is base code:
https://alastaira.wordpress.com/2013/10/25/animal-crossing-curved-world-shader/
I have used it while ago and with upgrades it works well.
Related
I've decided to use Minecraft like characters in my small game since I do not know how to make 3d models (nor I want to learn how to do such thing in the near future).
However the task now seem a little harder than expected:
I've tried looking in the asset store for prefabs to use but without success.
So, I've decided to try and make a model on blender(by not knowing a thing about non parametric 3d modeling, my knowledge of blender is extremely limited) and import it into my unity game.
And surprisingly, I managed to create the model using McPrep, export it and import it into unity maintaining objects that drive the bones (the output is a bit messy but I think I can manage to clean it up a little).
However the imported version does not have any skin and appears in a gray shade.
Turns out that the output does not keep materials/textures with it!
I've tried getting the texture used by blender and it returns the same skin I fed into mcprep so, by using the same skin, I've tried creating a material with it by getting the .png and using it as texture in a unlit texture material.
However, the result is a bit messy as shown here (left is Blender, right is Unity):
How may I make the texture on unity3d be better and right? (I've heard there is a way using a C# script but I really don't know what it is nor how to do it)
EDIT:
Thanks for the answers before, I did set the filter to point obtaining the texture to be a bit better. However the part that should be transparent is displayed in black on top of the other part (I think).
The image on the right is only filter point and the one on the left is point + alpha is transparency and the transparent shader using unlit transparent
ANSWER FOUND:
As Bart said, make sure the textures' Filter Mode is set to Point, but additionally:
Minecraft player characters are made of 2 layers, the second layer usually has lots of transparency and is used for clothing or other relief detail. So you need to use a transparency-capable shader on your material in Unity.
You're running into a filtering issue. In your case you want no filtering to happen. So select your texture, and in the inspector change the import settings so that your "Filter Mode" is set to "Point". In this case it will do no filtering of the input and your large pixels should appear sharp as you want.
I am new to Unity and would like to be able to emulate the idea of 'digging' a hole in the 'earth' with a spade, at runtime and have the terrain slightly ahead of my camera lower slightly, then move that dug 'earth' into a pile somewhere next to the hole.
I have created a terrain using the preview terrain tools and now want to alter it at runtime a little like you see in this part of this video : https://youtu.be/l_2uGpjBMl4?t=2970
I want to be able to make a small 'dig' into my environment, just like a spade making a hole in the earth, and that state to then be something I can persist.
I then want to be able to move the 'dig' volume, i.e the 'earth' onto somewhere else in the terrain - literally imagine what happens when you dig a hole.
If I want to follow this guy's video, he is generating his terrain, and I am not sure how to apply his logic, because I would likely want to shoot a raycast from my camera, and where it intersects with the world, then alter the 'mesh' of my painted terrain, and then add to a 'pile' of earth somewhere else. I am not sure about just doing the piles of earth with just changing the height of the terrain, because there would need to be a volume associated with the 'earth' you have dug, so it's more of a object, than a terrain if you see what I mean.
I realise this is a bit of a braindump, but I am looking for direction and have done research these are the questions I would like answered, I want this to be a sounding board for whether my thoughts are on the right path, and if not, what is an optimal course for learning some techniques for achieving this.
You need to use Terrain.terrainData which contains the GetHeights and SetHeightsDelayLOD methods. SetHeights is also available, but is not as efficient. Check the documentation to see how they work!
I'm new to shaders and with the new Shader Graph from Unity I'm trying to experiment and archive some effects that I have in mind for my games.
I want to get something like this:
https://imgur.com/vqy9y3H
I want a glow effect to go arround my object. In my case it's a square neon light, so it's simple I think.
What I have so far, experimenting and unifying different tutorials, effects, etc.:
https://imgur.com/aPW95S0
This is the current Shader Graph, i know its a mess and maybe there are useless nodes, etc.:
https://imgur.com/J3jzGE6
This is the tutorial I think it's the most accurate to what I need:
https://www.youtube.com/watch?v=UJUlGJS3QpY
Thanks in advance for any tip that help me find the correct path to archive the effect.
EDIT:
To make it clear, the real problem for me is the motion effect. I already setup the glow effect with post-processing and bloom. My problem is how to do the effect arround the object. In my case it's a neon tube, so it's easiest I think, as the effect can be on all the object but from the start of the tube to the end. As the tube is closed, it will start again from the begining almost at the same point. Hope it make it clear.
you can use post processing to get the effect your after, specifically bloom and tone mapping effects.
With post processing applied you just need to increase the color into HDR levels in your shader.
Applying a blur outside of post processing is actually extremely expensive and isn't really recommended unless there is absolutely no other option.
So i try to make a adventure game and in one point my character need to eat some food and get fatter and fatter, smoothly every second.I've found only one solution in asset store.The MCS(Morph 3D) has this feature.But problem is i don't want to use one of their character.I have my on low-poly 3d character and i want to use this.
This is an example of what i need :
MCS Morph 3D
So where should i start? What should i look in to? Is there simple way to this or is it really hard?
Thanks already :)
This would normally be done with a frag/vert shader. You would modify the vertices of the mesh in the stomach area based on some value. This could be done really simply in which the distance of the stomach vertices from some given point located in the character's core would just increase based on your given value. I believe your thoughts are imagining something much prettier than this, but anything else would be much more involved for something that is purely visual. If you are not experienced with shaders, I would highly recommend purchasing a visual shader editor, such as Amplify (ASE) or Shader Forge. They make the jump into shaders much easier.
Imagine a large free-roam game in Unity,
The yellow size indicates about the largest you can make a typical Terrain in Unity.
Art dept. will completely build, meter by meter, the entire scene.
Please note, this has absolutely no connection to repeating scenery (as in runners) or procedural scenery (as in say some race games).
Really, what is the correct and good way to do this in Unity?
use say 50 or so terrains, each perhaps 100m x 100m ?
can you even have or use that many terrains?
or what?
For anyone googling here.
The correct solution is indeed
Terrain stitching
that's it.
In practice you must use one of the tools available to do this (eg, TerrainFormer) or, your team will write from scratch a terrain stitcher.
Yes, you just use "many terrains".
The best approach to the exact problem posed,
is in fact to just:
"use lots of Terrains".
It seems to be perfectly viable in Unity to have many (dozens) of Terrain units, basically "sitting next to each other".
In practice, you'll need TerrainFormer
https://assetstore.unity.com/packages/tools/terrain/terrain-former-20052
or one of the similar tools.
(Or, I suppose, from scratch write your own tool to stitch terrains, and allow you manipulate them all at once, join the edge-heights perfectly, etc etc.)
It's not realistically possible to just perfectly sit many Terrains together (by hand), matching all the edges, etc etc. So you're going to need a "stitcher" package for putting many Terrain squares together.
So, this huge area ..
has about 12 Terrain.
So that's the answer, you can indeed have "many, many" Terrain in a Unity project, you do indeed essentially just "sit them next to each other". In practice it's not achievable unless you use one of the editor tools such as TerrainFormer.
The proper way to do this would have been with procedural mesh generation with MeshFilter and Mesh API but you mentioned that this not at all random or generative so that one is eliminated.
It's just simply a very long, thin, hand-made environment
The best way in this case would be a Modular Level Design. You need to create Modular Assets. With this you can have a long road in pieces which can be tileable. A good modeling artist should be able to create and texture modular assets with 3D modeling packages like Blender, Maya or 3ds Max.
All the programmer has to do is make each asset a prefab then use the Instantiate function to instantiate them to create any distance of environment. You can also create a static environment in the scene from the Editor. Almost anything can be made into a modular Asset especially buildings and roads.
After assembling them in Unity, you can do static batch on all the instantiated modular parts with Unity's StaticBatchingUtility.Combine to improve performance of the game since they are not being moved.
Below is an example of a modular road asset that can be used to create almost any amount of road:
You already answered your question
in this case would it be better to not bother with Unity's otherwise excellent Terrain, and the modellers would just outright build the long course/scenery? (Obviously you'd have to chunk it so it all occludes fine)
I think it's the way to go. If the performance is an issue, try putting each chunk in different scenes and then have a master scene to load them async and additively. And of course you want to unload each scene as it becomes invisible in the camera.
I personally go with your own solution which is letting the Unity Occlusion Culling system to take care of the hiding and showing chunks. I only go with the separate scenes approach if I'm not getting enough performance this way.
I recently had the same problem. We build a tilebased infinite runner with road crossings. The camera was positioned behind and over the car looking down on the street and the player car. So the setup is quite comparable.
We used Curvy from the Asset store to create paths for moving the player and also for creating the geometry of the streets and the surroundings among the streets.
https://assetstore.unity.com/packages/tools/level-design/curvy-splines-7038
It is also easy to spawn tiles with curvy paths and combine them at runtime. So you can separate long distances into smaller segments and spawn them randomly.
We also used QuickBrush from ProCore to quickly paint environment detail to the geometry like trees, bushes or stones. I think procore tools are now implemented in the new Unity 2018 version.
Worked quite well.