This would be the support forum for TOZ Planet Renderer and modified TOZ Noise to go with it.
BUY FROM ASSETSTORE
Images
Videos
https://www.youtube.com/watch?v=3d5y1oh2IdI
https://www.youtube.com/watch?v=4NLgbW_BmyU
Documentation for TOZ Planet Renderer
RELEASE NOTES :
Version 1.0b (Initial beta release)
WHAT IT DOES :
This pack is able to help you render whole planet bodies in space with the help of quadtree planes shaped to look like a planetoid with high and optimal frame rates acceptable for a computer game or a real-time simulation.
Can continuously render a dozen planets at the same time without losing much speed thanks to the multi-threaded architecture, smart coding and optimal shaders.
There are various options in the package that helps you shape the planets and there are various helpers to control collisions, oceans and atmospherics.
HOW TO USE :
-
Create an empty scene for your level
-
Delete default Directional Light
-
On the Lighting tab, both global illuminations are unnecessary, so you may or may not remove those.
-
Drop in the SolarSystem prefab into your scene and adjust variables as desired (check NOTES for variable explanations)
-
Drop in the Planet prefab into your scene and adjust variables as desired (check NOTES for variable explanations)
-
Adjust your MainCamera farclipping plane to a reasonable value according to average planet radius
-
To be able to move, add the sample FlyingCamera.cs component to your MainCamera (check NOTES for variable explanations) this script is only meant to be an example, you will have to write your own for specific situations.
-
Fly around with WASD + Q + E, 110% speed with shift and 1100% speed with R keys.
-
Thats it.
Further examination of the provided Demo scene will give you more insights of how things work. Please check the Lighting tab and Quality Tab of Unity Editor as well.
NOTES :
Source code is fully included in this release, you should check the script files to see various variables and how things are done.
SolarSystem.cs
Description
SolarSystem prefab has various children and components. This prefab is the main controller for LOD environment and there should be only one instance on each scene. The script doesnt have any means to control the singleton usage, so it is the users responsibility to make sure there is only one instance.
Variables
All variables are under TOZ.Celestial namespace.
public float LODUpdateInterval = How many times per second is the LOD updated. 0 for continuous, 1 for 1 second…etc
public float Radius = This is the value for the radius of visible sun mesh.
public float Intensity = Intensity effects the sun flare strength, the lighting and realtime shadows as well as various atmosphere shaders. This value must be in the range of 0.5f and 1.5f
internal float _DistanceToCamera = This property gives the distance from Sun Mesh and the MainCamera transform.
_LOD.cs
Description
This is a static class that runs the lod functions and caches some useful variables for your own scripts. This is the first script to look at if you need to interact with various lod related objects. Dont forget the namespace is TOZ.Celestial.
Variables
All variables are under TOZ.Celestial namespace.
internal static Transform _Camera = this is the refference to Camera.main.transform.
internal static List _Planets = this list holds refferences to all planets currently available in the current scene.
internal static Planet _TargetPlanet = this is the refference to the nearest planet to the camera.
internal static Vector3 _Gravity = this is the normalized vector to the _TargetPlanet.
Planet.cs
Description
This script runs the whole planet procedures and controls sub-procedures, mainly automatic but user interaction and setup is needed before game start.
Variables
All variables are under TOZ.Celestial namespace.
public int Id = The id of the planet, automatically recieved and might change during gameplay if any other planet is destroyed or disabled.
public PlanetQualityType Quality = Quality (Mesh density) of the planet, there are 4 options from low to ultra.
public float Radius = Radius of the planet.
internal float GroundThickness = Radius * 0.025f
internal float AtmosphereThickness = GroundThickness * 3f
internal float AtmosphereRadius = Radius + AtmosphereThickness
internal float CloudsThickness = GroundThickness * 2f
internal float CloudsRadius = Radius + CloudsThickness
internal float CloudsRadiusRatio = CloudsThickness / AtmosphereThickness
public bool HasAtmosphere = If the planet has Atmosphere
public bool HasClouds = If the planet has Clouds (Unused in this version)
public bool HasWater = If the planet has water surface
public bool HasGround = If the planet has visible surfaces
public bool HasBumpMap = If the planet surface shader has bumpmap as well.
public float Shininess = Water surface Specularity
public Color WaterColor = Water and underwater fog color
public Cubemap ReflectionTexture = Water reflections cubemap
public Texture2D RefractionTexture = Water refreactions texture
public Texture2D WaveTexture = Water bumpmap
public Vector4 Bounds = The bounds of the generated heightmap (TOZ Noise related variable, please check TOZ Noise Documents for detailed descriptions)
public int Seed = The seed value for procedural heightmap (TOZ Noise related variable, please check TOZ Noise Documents for detailed descriptions)
public Color FogColor = Color of the planets general fog, should be smiliar to atmosphere color for best usage
public Gradient ColorBand = The gradient used to generate procedural texture for the planet, 0% is bottom of the ocean, 50% is the sea level, 100% is the highest mountain level.
public Texture2D DetailTexture = The detail texture to cover entire planet.
internal float DistanceToCore = This property gives the distance from planet.transform the MainCamera transform.
internal float DistanceToGround = This property gives the distance from planet sea level and the MainCamera transform.
internal float DistanceToAtmosphere = This property gives the distance from planet atmosphere and the MainCamera transform.
internal float DistanceToClouds = This property gives the distance from planet clouds layer and the MainCamera transform. (WIP)
internal float DistanceToSun = This property gives the distance from Sun Mesh and the planet transform.
internal Vector3 DirectionToSun = This property gives the direction from Sun Mesh to the planet transform.
internal Vector3 DirectionToCamera = This property gives the direction from planet to the MainCamera transform.
internal float LDotE = This property gives the dot angle between DirectionToSun and DirectionToCamera.
Atmosphere.cs
Description
If a planet has Atmosphere, this script takes over the management of planets atmosphere, mostly automatic, there is only one variable for user interaction which is the duskColor.
Variables
All variables are under TOZ.Celestial namespace.
public Color DuskColor = This is the color value for the atmospheres dusk and dawn color, the Zenith also is calculated from this color mostly as inverted r and b channels, in this version; needs trial and error to find correct values per planet.
Clouds.cs
Description
Currently WIP and unused, it will be ready in the next update.
Variables
Currently WIP and unused, it will be ready in the next update.
KNOWN ISSUES :
-
Normals calculation is not accurate, currently just approximating, accurate calculation is already inside the code but needs optimisation and will be corrected on the next release.
-
Currently the whole planet uses a shared heightmap for all quadtree faces for speed concerns, which causes distorted edges on north and south poles. Future release will bring individual heightmapping for each face which automatically removes this issue but then the codebase will be much larger to support both desktops and mobile platforms.
ROADMAP :
The basics of the below planned features are already inside the source, and if you want you can add your self if you trust in your coding. But if you want to wait, here is my roadmap in the mentioned order.
-
Saving and loading of heightmaps created with TOZ Noise (Check TOZ Noise documents)
-
Improvements on the main documentation
-
Help files for undocumented extra plugins and tools
-
Shader improvements
-
Waypoints and pathfinding
-
Better normals calculation
-
Getting rid of skirts and proper sewing of patch connections
-
Individual heightmaps for each quad face
-
Realtime mesh deformations (meteor strikes, explosions)
-
Custom object placement, grass, trees and detail objects
-
…TBA
Documentation for TOZ Noise
RELEASE NOTES :
Version 2.0
WHAT IT DOES :
This package is an enhanced copy of LibNoise for C++ adapted for Unity Game Engine. Used for generating heightmaps for Unity Terrain, TOZ Planet Renderer and mesh objects. Also used for generating procedural textures and bumpmaps and lightmaps. This package also can generate 3d volume textures.
This package is provided for free on my website www.tozmar.com and a slightly modified version is also provided for free and as a support tool with TOZ Planet Renderer
HOW TO USE :
-
This can be used both from editor and from scripting.
-
“Window/TOZ/Tools/Noise Editor” menu opens up the noise editor, for scripting; you should check the scripts inside folder “TOZ/_Shared/Noise”
-
In the editor, there are four panels; Modules, Module Options, Render Options and Gradient Options
-
Modules is a list of modules you can add and remove on top of each other, position in the list doesnt matter and the selected module is rendered/applied.
-
Module options give you various options to change the currently selected module properties.
-
Render options give you options to change renderer properties such as; planar or spherical projection, lightmapping, bumpmapping, noise boundaries…etc
-
If you chose box projection, you can only save a 3d volume texture on disc, other options will render a texture on the fly and a new window will pop up with the texture and more options whether to save it on disc as a texture, apply it as a heightmap to a Unity Terrain or to displace any mesh object in your scene. BEWARE that displacing mesh objects is a permanent procedure, there is no undo.
Further examination of the folders and the editor will give you more insights of how things work.
NOTES :
Source code is fully included in this release, you should check the script files to see various variables and how things are done.
KNOWN ISSUES :
ROADMAP :
- Saving and loading of heightmaps for TOZ Planet Renderer created with TOZ Noise