Part 2 with water reflections
Part 1 older, refractions only
Demo using Ogre-Next 3.0 rendering engine for nature scenes.
Featuring:
- Scene - 5 presets
- Terrain - with 4 layers and triplanar. Possible 2nd terrain for horizon.
- Water - flat, animated, with reflection, refraction and depth color shading
- Vegetation - 9 models: tree, palm, plant or (3 pines), 4 rocks, 2 ferns
- Atmosphere - with fog, sun, sky and adjustable parameters. Few static skies with clouds.
- Cars - 3 models, with dynamic reflections
- particles - basic fire with smoke
- camera - with inertia
Based on Tutorial_Terrain. No real PBR textures yet just values.
Models and textures from Stunt Rally 3, details in: _Licenses.txt, _Licenses.txt, _terrain.txt and _skies-new.txt.
F1 - Help text cycle
F3..F8 - Load scene
W,S, A,D, Q,E - move camera: forward,backward, left,right, down,up
Hold:
Shift - for smaller chages,
Ctrl - for bigger chages (for all)
V - Add vegetation (can be used more times)
C - remove all vegetation
G - Add Car in front, next model
H - remove all cars
T - toggle Terrain / flat plane.
P - terrain triplanar toggle
R - terrain wireframe toggle
N - Add Water, at set height (param -1)
M - remove water
K - Add / remove Sky dome, next texture
F - Add fire with smoke particles
I - remove all particles
Up,Down - previous / next parameter e.g. Fog (at param 0)
Left,Right - dec / increase parameter
Numpad /,* - rotate sun yaw
Numpad +,- - change sun pitch (time of day)
To reload shaders (after editing):
Ctrl-F1 - PBS, Ctrl-F2 - Unlit, Ctrl-F3 - Compute, Ctrl-F4 - Terrain
Ctrl-F5 - Force device reelection
Top line meaning:
Fps (frames per second), f face (triangles) count [k = 1000], d draw count, i instances
Veget - total vegetation models on scene
See CMakeLists.txt for details, and adjust fixes if needed.
Guide below has setup steps for empty Debian 11 or 12 (works also on Debian based, like Ubuntu):
-
Basic setup for building C++ etc:
sudo apt-get install g++ binutils gdb git make cmake ninja-build
-
First install Ogre dependencies, as in here
sudo apt-get install libfreetype6-dev libfreeimage-dev libzzip-dev libxrandr-dev libxcb-randr0-dev libxaw7-dev freeglut3-dev libgl1-mesa-dev libglu1-mesa-dev libx11-xcb-dev libxcb-keysyms1-dev doxygen graphviz python-clang libsdl2-dev
-
Build Ogre-Next from sources, using scripts.
-
Save the file build_ogre_linux_c++latest.sh and put it inside our root folder, called here e.g.
dev/
-
Go into
dev/
and start it:
cd dev/
chmod +x ./build_ogre_linux_c++latest.sh
./build_ogre_linux_c++latest.sh
-
This should succeed after a longer while and build Ogre-Next with its dependencies.
-
If so you can start and check Ogre demos and samples inside:
dev/Ogre/ogre-next/build/Release/bin/
- Go into
dev/
, clone this repo, and build:
git clone https://github.com/cryham/ogre3ter-demo.git demo
cd demo
mkdir build
cd build
cmake ../ -DCMAKE_BUILD_TYPE="Release"
make -j5
(or: ninja - if not using makefile)
dev/
demo - this repo inside
Ogre
ogre-next - Ogre-Next build inside
ogre-next-deps
Tested on Windows 10.
Ogre-Next approach is different. It needs a Dependencies
subdir inside this project.
So create a Dependencies dir after pulling this repo.
Then you can just link to Ogre dir. So: create a symbolic link to Ogre dir, and put inside Dependencies.
Run CMake-Gui, pick this project path for sources, and the same with subir build\
for build output.
Press Configure
.
There can be an error that I just fixed by copying that:
OgreBuildSettings.h
(found some file inside Ogre, for Release build if many) into:
Ogre\build\ogre-next\build\Release\include\
After that Configure
has succeeded for me.
Pressing Generate
creates sln
file inside demo\build\
.
Open it with Visual Studio (same version as chosen in CMake).
Try building.
For me it failed few times, and I fixed it by adding in VS paths that were wrong or missing.
(this isn't the best way, as you can't press Generate in CMake anymore, it would loose any editing in VS).
Open properties for TerrainDemo project.
dev/
demo - this repo inside
Dependencies
Ogre - this can be a symbolic link
ogre-next - Ogre-Next build inside
build
Release
include
OgreBuildSettings.h
ogre-next-deps
Some key locations in code are marked with //**
also for crucial changes in code from OgreNext.
Materials are in Media/materials,
e.g. for: water, vegetation, terrain and (in simpler syntax) for cars
Used compositor workspaces are defined in: compositor file
Quick links for Ogre-Next documentation:
- Manual - need to read it when beginning.
- Compositor - for effects, RTTs, reflections, etc.
- HLMS doc - long read, explains all.
- HLMS shaders
- Terrain