Tutorials for Beginngers
This introduction to blender documentation prepared by Michael Cai will be useful for students new to 3D programming.
Use this link to convert the Google Doc tutorial shown above to a dw content.
https://cgcookie.com/ offers many Blender tutorials.
</panel>
Useful tips for creating objects in the Blender night sky
A preliminary version of the celestial sphere simulation by using NASA HDRI maps as the Blender World Background Texture was created and the tutorial on how to create such “Night Sky World” is shown in
Simulating Celestial Sphere in Blender.
You need to download relevant NASA star maps and link them in the node editor to see the starry background.
In Blender rendering, because we are rendering only the changes of the background pixelated images (and no 3-D object), we can turn off ray tracing (Render → Light Paths → max bounce = 1) and set the cycles render's sampling to be 1 (Sampling → Render → Max Samples = 1). Then, it should take less than 10 sec per scene (~20 min rendering for 240 frame animation).
See these examples for creating a virtual, realistic, night sky in Blender:
Check this
3D Star Map Add-on in Blender which uses a dataset of real nearby ~3,000 stars. This also shows how to simulate a night sky (i.e., celestial sphere). A free demo version has 299 stars without constellation markings. ⇒ This shows a good tip on how to display texts on the scene (text fixed with respect to a camera)
NASA image as the HDRI background with constellation lines:
Blender-Night-Sky ⇒ This demo also provides a Blender file that shows tips on how to use dynamic camera control (i.e., dynamically changing camera position, origin [i.e., camera field-of-view], etc.)
-
-
This package can simulate an orbit of a planet around a central star with all user-configurable physical parameters (mass, rotation rate, rotation axis tilt angle, orbital elements, etc.).
This package also display animated orbital elements annotations in the 3D render.
Simulate/Visualize Orbital Motions
Blender Add-ons for Space Scene
Python in Blender
Good tutorials from YouTube on Python in Blender
Share project with others
Unity object, asset, prefab, and package
component: fundamental ingredients such as button, text, image, audio, etc.
game object: a basic container of components
asset: a file representing any item that can be used in the project
prefab: a saved, fully configured GameObject that can be used in other scenes or projects
package: a collection of files and data for a Unity project stored in a single file
Orbiting/Rotating Earth on a tilted axis
Physically Based Sky Virtual Sky
This page describes how to create a Unity HDRP virtual sky model with the Physically Based Sky from the scratch. I used the hints from https://www.youtube.com/watch?v=tpTzwyiGByE in using the PBS.
It is assumed that there is a separate folder, named “PBR_Tutorial”, in the Project section (under Assets) where the sample scene is to be created and stored. If the folder does not exist, you can create one (or store subsequent items in your folder).
Steps
Make sure that you are using the HDRP rendering pipeline
-
download the star map, coordinate grid map, constellation boundary, and constellation shape.
store them in “Textures” folder so that other projects can use them as well.
convert the image to the Cube Shape (click the image –> Texture Shape in the Inspector –> select “Cube”. Set the right “Max Size” under “Default”
Delete everything in the current hierarchy.
Create a new scene: Right-click on the Assests folder –> Create –> Scene
Create a Global Volume: Right-click on the hierarchy –> Volume –> Global Volume
Click “New” in the Inspector panel.
Click “Add Override” –> Sky –> Physically Based Sky
Select Model–>Type = Earth (Advanced)
Click Space –> Space Emission Texture and set it to the downloaded deepsky image.
Click “Add Override” –> Visual Environment
Set Sky Type to “Physically Based Sky”
Diurnal rotation of the sky can be simulated by “Gloval Volume” –> “Space” –> “Space Rotation”
Changing the angle of the directional light can simulate the movement of the Sun in the sky. Also, the diurnal rotation can be controlled as shown in the below image.
Improvements to be added
Check if multiple textures can be blended (i.e., displaying deep sky map with alpha-channel coordinate grid) =⇒ we may have to use the Shader Graph to blend textures.
Script controlling of the Sun and sky rotation
Overlay toggleable coordinate grid, constellation maps. How? Is it possible?
Add horizon etc.
— Inseok Song 2024/11/18 18:38
Check SimpleKeplerOrbits
There is a free asset called, SimplerKeplerOrbits, in the Unity asset store. It has three sample scenes and we can use this package as the starting point to create our desired Solar System simulation. Especially, check Example 3 in the included scenes which allows users' tilting and zooming actions in the rendered window (i.e. in the GamePlay mode), and it also allows to set the observing date (set to “now” automatically). There is a UI slider that can speed up and go backward in time as well. Nice! We can recycle most of these in our 3-D model.
We can create a realistic Solar System model with three free Unity assets (Simple Kepler Orbits, Planets of the Solar System, and MilkyWay).
For example, we can create a simple model by following the sequence of operations below.
Start a new 3D Unity project
Set project setting (Edit → Project Settings; pay attention to Graphics [Rendering], Quality etc.)
Import necessary assets (Package Manager: Install assets from My Assets)
In the main camera setting, choose the right Renderer and select “Post Processing”. Choose the MilkyWay skybox (drag one onto the main camera).
Create three objects (two spheres and one object). You can drag and drop Sun and Earth from “Planets of the Solar System”. One sphere is an attractor (i.e., the central star), the other sphere is an orbiting object (e.g., Earth), and the 3rd object is a velocity indicator. This is an easy approach, but in our desired model, we want to calculate orbital motion by solving Kepler equation in conjunction with six orbital elements.
Drag and drop “KeplerOrbitMover” script on the orbiting object. Drop “KeplerOrbitLineDisplay” on the orbiting object as well if orbits need to be displayed with curves.
Then, select the central object as the attractor and set the right mass value.
Set velocity handle, length scale, and time scale.
Render and you can see an animation.
Procedural (Script-based) Sun-Earth-Moon Model Creation
Click here to see detailed step-by-step procedure to create a Sun-Earth-Moon model
Remember that in Unity, the Y-axis is chosen to be the vertical axis unlike the astronomical convention, Blender, and even Unreal Engine.
The following C# code is to implement a rotation of a GameObject (e.g., planet). Just attach this script to an object and set two parameters (rotation w.r.t and speed).
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Rotate : MonoBehaviour
{
public Transform target;
public int speed;
// Update is called once per frame
void Update()
{
transform.RotateAround(target.transform.position, target.transform.up, speed * Time.deltaTime);
}
}
This example creates a model of Sun-Earth-Moon with realistic surface textures and rotational/orbital motions.
Create a new project from Unity Hub (Choose the Universal 3D Core [Not the one with Build-in Render Pipeline])
In the Unity Editor
Configure Build parameters: File → Build Settings: Check if the platform is correct.
Configure Project settings: Edit → Project Settings;
Import relevant assets: Window → Package Manager, select 'My Assests' and import the following assets (these assets can be purchased for free in Unity Asset Store)
Create a folder to store C# scripts: In the Project > Assests, right-click on the background and create a folder named “Scripts”.
Simulation background setting: Click the “main camera”, then Component > Rendering > Skybox. Then choose the Milky Way skybox in the “Custrom Skybox” panel.
Make the Sun (and set its rotate it)
Prpare for the Solar System Container: Since objects in this example are automatically created through the script “JPLOrbitLoader.cs”, we need to prepare a container and attach this script to the container.
Create an empty, “SEM Container” and make it inactive (click the check mark off from the inspector panel).
Create an empty under SEM_Container, “BodyTemplate”, with two child objects: “Velocity” empty and “View” sphere mesh.
Create an empty under SEM_Container, “ScreenSpaceOrbitLineTemplate”.
Attach “JPLOrbitLoader.cs” to SEM_Container and set the followings:
set G-constant (6.67E-11)
Scale_per_diameter (0.1)
Body Template = 'BodyTemplate'
Jason Data = <yourinput.json>
Attch “TimeController.cs” and set default date/time
Attach “ScreenSpaceOrbitsDisplay” and set
Target Camera → Main Camera
Line Template → “ScreenSpaceOrbitLineTemplate”
Cam Distance = 0.7
Attach “KeplerOrbitMover.cs” to “BodyTemplate” and set
Velocity Handle = “Velocity” ←- the empty under BodyTemplate
Time Scale = 1
Lock Orbit Editing = True
Attach “KeplerOrbitLineDisplay” to “BodyTemplate” and set
Line Renderer Reference = “ScreenSpaceOrbitLineTemplate”
Select desired Gizmo options
Create UI canvas and panel with Input fields for YYYY/MM/DD HH:MM:SS, buttons (reset and set_time_now), and timescale input field and slider.
Attach “TimeControlPanel.cs” to panel and set corresponding items to the UI objects.
Check the Canvas Scaler setting: Resolution = 1280×1024
Click “Play” and you will see an animated Solar System objects showing orbital motions.
Drag and drop 'Rotate.cs' on Sun Empty: set target (Sun Empty) and speed.
Future Improvements:
Add “Rotate.cs” to a certain script so that we can set the rotation of each object (with correct tilt of the rotation axis)
Add realistic texture material for each object.
Add additional camera views
top-view camera
Earth-following camera (same orbital speed but slightly displace from the Earth so that one can see the shadowing of the Earth or Moon (i.e., eclipses)).
Add shadow cones to see the relationship among Sun, Earth, and Moon's position and shadows
Mars-tracking camera (to demonstrate the retrograde motion of Mars)
Moon-tracking camera (to see the phase change and libration)
Sample WebGL model of the Sun-Earth-Moon System
This embedded WebGL rendering of the Sun-Earth-Moon system created with Unity can be played in any modern web browser. The right mouse button can tilt/rotate the scene, the middle mouse button scroll adjusts a zoom level. Click the image below to access the model.
.
Setup VR with a Quest Headset
Detailed step-by-step tutorial (created by Ricky Correia):unity_to_vr.docx
General Steps:
Create a Meta account
Enable Developer mode
Enable Quest Link
Meta Quest Developer Hub (MQDH)
MicroSoft also has this tutorial: MS + Quest
Creating AR
This video describes the steps to create an AR video using Unity. Blender files can be imported to Unity.
Render 2+ camera views
Create cameras as you need. Then, change the “Viewport Rect” (Width and Height and X & Y) to set the desired location and size you need. In the render view then, you will have more than one camera views.
You can add many UI components in three different ways in Unity by changing the “Render Mode”: (1) screen overlay (always displayed on screen), (2) camera space (displayed over camera view), and (3) world space (as if they are regular objects).