3D - OpenGL
Seccions d'aquesta pàgina 15
01General#
- 3DSite
- 3D links (Rich Coutts)
- 3DGC - 3D Graphics in MPEG-4
- Mark Kilgard Home Page
- Graphics resources (Zhar)
- Conceptes / Concepts
- Graphics
pileline / rendering pipeline: 3D -> 2D
- Application: collision detection, animation, morphing, acceleration; quadtrees (2D), octrees (3D)
- Geometry: operations with polygons and vertices ->
vertex shader
- model and camera transformation
- projection: to cube
- world matrix * camera matrix * projection matrix
- lighting
- clipping
- window - viewport transformation
- Rasterization
- Shaders
- "a shader is a computer program that calculates the appropriate levels of light, darkness, and color during the rendering of a 3D scene—a process known as shading."
- perform Shading
(depiction of depth perception in 3D models)
- shading techniques
- flat shading
- smooth shading
- Gouraud shading
- Phong shading
- deferred shading
- shading techniques
- Info
- Shaders (Godot)
- The Book of Shaders
- OpenGL book
- shading languages
- "Shading languages are used to program the GPU's rendering pipeline, which has mostly superseded the fixed-function pipeline of the past that only allowed for common geometry transforming and pixel-shading functions; with shaders, customized effects can be used."
-
API shading language Khronos Group OpenGL OpenGL Shading Language - GLSL
Vulkan
Microsoft Direct3D High Level Shader - HLS (Cg) Apple Metal framework Metal Shading Language Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- types
-
type introduced describes performs 3D shaders:
act on 3D modelsvertex shader
attributes of a vertex: position, texture coordinates, colours... geometry is transformed
geometry shader OpenGL 3.2
some changes of the geometries in the scene are perfomed
tessellation shader OpenGL 4.0
geometries are subdivided (and then triangulated)
primitive and mesh shaders
ray tracing shader
2D shaders:
act on digital images (textures)pixel shader /
fragment shader
traits of a pixel: colour, z-depth, alpha value fragment quads (after triangles have been broken) are modified Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
-
- Graphics
pileline / rendering pipeline: 3D -> 2D
02OpenGL#
03Mesa#
- The Mesa 3-D graphics library
- Do
all intel gpu's use software rendering (Mesa) only?
glxinfo | fgrep directLIBGL_ALWAYS_SOFTWARE=1 glxinfo|grep '\<renderer\>'
- Eines / Tools
- glxinfo
- glxinfo -B
glxinfo | fgrep directLIBGL_ALWAYS_SOFTWARE=1 glxinfo|grep '\<renderer\>'
- glxinfo -B
- glxinfo
- Demos
- glxgears
- source
- freedesktop / mesa-demos / xdemos / glxgears.c
- dependències
- Mageia
sudo dnf install autoconf automake libtool lib64glew-devel
- Alma 8
sudo dnf install glew-devel
- Mageia
- compilació / compilation
./autogen.sh./configure- make
- sudo make install
- Problemes / Problems
configure.ac:38: error: possibly undefined macro: AC_PROG_LIBTOOL
- install
- Mageia
sudo dnf install mesa-demos
- Mageia
- usage
glxgears- DISPLAY=:0 glxgears
glxgears -display :0 -info -geometry 400x400+200+100- disable vsync
- Disable vertical sync for glxgears
- Chapter 11. Specifying OpenGL Environment Variable Settings (470.82.01)
- Appendix B. X Config Options (Screen or Device section)
- [X11][EGL] Detect (roughly) correct screen refresh rates
- using nvidia-settings?
- mesa:
vblank_mode=0 glxgears
- nvidia:
__GL_SYNC_TO_VBLANK=0 glxgears
- enable vsync
- ...
- Problemes / Problems
- ...
- Solució / Solution
- ...
- ...
- problems
- vsync not honoured on AWS EC2 g4dn with nvidia drivers
- source
- glxspheres64
- install
- Mageia
sudo dnf install glxspheres
- Alma Linux
- installed by VirtualGL
- Mageia
- usage
glxspheresglxspheres64- /opt/VirtualGL/bin/glxspheres64
- install
- glxgears
04Open Inventor#
05GLUT#
- Glut specification
- Spec
- Examples (local):
- normal: /usr/share/src/GLUT/examples
- Inventor: /usr/share/src/GLUT/inventor (glutduck)
06VirtualGL#
- usually used with dummy driver (to be able to run in background) but using hardware acceleration
- Install
- Mageia
sudo dnf install virtualgl
- Alma
- get package from download page
- Mageia
- ...
07Programari / Software#
- Modeladors / Modellers
- Art of illusion
- Blender
- Arquitectura / Architecture
- Stereoscopic rendering in Blender
- DWG
DXF support
- Importing
DXF files to Blender 2.8
- Edit -> Preferences -> Add-ons: DXF
- Blender 3D importing DWG files?
- DWG support for Blender
- Importing
DXF files to Blender 2.8
- DraftSight (dwg)
- Google Sketchup
- Google 3D Warehouse (Online 3D Model Repository)
- Google Sketchup on Linux
- wine ...
- k-3D
- K3Studio
- Mistif model 3D
- Moonlight 3D
- OpenFX
- Top Mod
- Wings3D
- 3dPM
- AC3D
- Visualitzadors / Viewers
- CAD
- Arquitectura / Architecture
- Sweet Home 3D (Java)
- Home Design and Remodeling Software
- Room arranger
- Octree (architecture)
- Blender for architecture
- Motors / Engines
- Mons virtuals / Virtual worlds
- File formats
- Collada
- VRML
- X3D (wp)
- DXF
- Used by:
- Documents
- AutoCAD 2000 DXF Reference
- DXF Reference (pdf) (AutoCAD)
- The DXF File Specification
- Exemples
- recta / straight
- corba / curve
- ...
- API
- O3D (es) (wp) (Google)
- WWW
- Canvas 3D
- Web3D
- WebGL (wiki)
(Javascript on HTML5)
(wp)
- Getting a WebGL Implementation
- Demo repository (Khronos)
- Demos: GPU Acceleration and WebGL (Chrome)
- VTK
- Bullet 3D Game Multiphysics Library
- urpmi libbullet2
- Ray-tracing
- OpenVDB (DreamWorks): hierarchical data structure
- Framerate limiter
- libstrangle
- compilació
- dependències
- Alma 8
sudo dnf install ...
- Alma 8
- passos / steps
git clone https://gitlab.com/torkel104/libstrangle.gitcd libstranglemake 64-bitsudo -imake install-common install-64- echo "/usr/local/lib/libstrangle/lib64" >/etc/ld.so.conf.d/libstrangle.conf
- ldconfig
- dependències
- ús
strangle 60 /path/to/game
- compilació
- libstrangle
08Desenvolupament / Development#
- OpenGL
- GLSL - OpenGL Shading Language
- Info
- molt semblant a C, però el compilador és un altre i els binaris generats corren a la GPU
- OpenGL Shading Language (wp)
- basat en la seva sintaxi existeix una biblioteca, anomenada GLM, que és per a C++ i aprofita les funcionalitats bàsiques de GLSL
- Especificació / Specification
- Info
- GLSL - OpenGL Shading Language
- GLM
- biblioteca basada en GLSL, però s'executa a la CPU i no a la GPU
- OpenGL Mathematics (GLM) is a header only C++ mathematics library for graphics software based on the OpenGL Shading Language (GLSL) specifications.
- glm (openFramworks)
- learn c++
- implementacions
- C++
- g-truc / glm
- C
- exemples
- swizzle operators
-
#define GLM_FORCE_SWIZZLE // Or defined when building (e.g. -DGLM_FORCE_SWIZZLE)
#include <glm/glm.hpp>
void foo()
{
glm::vec3 const PositionA = glm::vec3(1.0f, 0.5f, 0.0f);
glm::vec2 const PositionB = PositionA.xy() * 2.0f;
}g++ -c swizzle_1.cpp -o swizzle_1.o
#define GLM_FORCE_SWIZZLE // Or defined when building (e.g. -DGLM_FORCE_SWIZZLE)
#include <glm/glm.hpp>
void foo()
{
glm::vec3 const PositionA = glm::vec3(1.0f, 0.5f, 0.0f);
glm::vec2 const PositionB = PositionA.xy * 2.0f;
}g++ -c swizzle_2.cpp -o swizzle_2.oswizzle_2.cpp: In function 'void foo()':
swizzle_2.cpp:7:43: error: invalid use of member function 'glm::vec<2, T, Q> glm::vec<3, T, Q>::xy() const [with T = float; glm::qualifier Q = glm::packed_highp]' (did you forget the '()' ?)
7 | glm::vec2 const PositionB = PositionA.xy * 2.0f;
| ~~~~~~~~~~^~
| ()g++ ...
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- compilació perquè no doni error: ...
- How to compile C code with anonymous structs / unions?
- How to achieve vector swizzling in C++?
- C
- C++
- ...
- anonymous union
- Other data types
- typedef
- union
- anonymous unions
- Constructors and member initializer lists
#define GLM_FORCE_SWIZZLE // Or defined when building (e.g. -DGLM_FORCE_SWIZZLE)
#include <vector>
#include <glm/glm.hpp>
enum class VariantType { isUndef, isHeader, isInt, isDouble, isStr, isVec3, isVector,isLayer,isAngle,isDelimiter };
typedef struct SELECT_TYPE {
SELECT_TYPE() :type(VariantType::isUndef), z_Editable(false), hasBase(false),label(nullptr), header({0,0,nullptr,false,nullptr}) {};
VariantType type;
const char* label;
//int flags;
bool z_Editable;
bool hasBase;
union {
struct {
int id;
int layer;
char* title;
bool* base_z_set;
double* z;
} header;
glm::vec3* point;
std::vector<glm::vec3>* pointlist;
const char* str;
int i;
double d;
};
} SELECT;
void foo()
{
glm::vec3 const PositionA = glm::vec3(1.0f, 0.5f, 0.0f);
glm::vec2 const PositionB = PositionA.xy() * 2.0f;
}- select.cpp: In constructor
'SELECT_TYPE::SELECT_TYPE()':
select.cpp:8:96: error: no matching function for call to 'SELECT_TYPE::<unnamed union>::<unnamed struct>::._anon_95(<brace-enclosed initializer list>)'
8 | SELECT_TYPE() :type(VariantType::isUndef), z_Editable(false), hasBase(false),label(nullptr), header({0,0,nullptr,false,nullptr}) {};
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
select.cpp:15:12: note: candidate: 'SELECT_TYPE::<unnamed union>::<unnamed struct>::<constructor>()'
15 | struct {
| ^
select.cpp:15:12: note: candidate expects 0 arguments, 1 provided
select.cpp:15:12: note: candidate: 'constexpr SELECT_TYPE::<unnamed union>::<unnamed struct>::<constructor>(const SELECT_TYPE::<unnamed union>::<unnamed struct>&)'
select.cpp:15:12: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const SELECT_TYPE::<unnamed union>::<unnamed struct>&'
select.cpp:15:12: note: candidate: 'constexpr SELECT_TYPE::<unnamed union>::<unnamed struct>::<constructor>(SELECT_TYPE::<unnamed union>::<unnamed struct>&&)'
select.cpp:15:12: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'SELECT_TYPE::<unnamed union>::<unnamed struct>&&'
- ...
- CUDA
- Intro to CUDA (Linux Magazine)
- CUDA versions
- 11.4 (nvidia driver 470)
- ...
- Video game development platforms (List
of game engines)
- Unity
- Unreal Engine
- Godot
- Unity3D
- Install
Unity3D on Linux
- Passos / Steps
wget https://public-cdn.cloud.unity3d.com/hub/prod/UnityHub.AppImagechmod +x UnityHub.AppImage./UnityHub.AppImage
- Passos / Steps
- Virtual display
- How
to run Unity on Amazon Cloud or without Monitor
- Running Unity app with graphics on a server without monitor
- Running Unity app offscreen on your local machine
- Run Unity app with graphics on Amazon Cloud!
-
deps setup X server launch unity Running Unity app with graphics on a server without monitor xserver-xorg sudo nvidia-xconfig -a --use-display-device=None --virtual=1280x1024 sudo /usr/bin/X :0 & DISPLAY=:0 $your_unity_exec Running Unity app offscreen on your local machine xorg-video-abi-15
x11-driver-video-dummy
virtualgl# xorg.conf from XDummy
wget http://xpra.org/xorg.conf .Xorg -noreset +extension GLX +extension RENDER -logfile ./10.log -config ./xorg.conf :10 DISPLAY=:10 vglrun $your_unity_exec Run Unity app with graphics on Amazon Cloud (EC2: gxx) xserver-xorg
mesa-utils# disable nouveau
...
sudo nvidia-xconfig -a --use-display-device=None --virtual=1280x1024sudo /usr/bin/X :0 & DISPLAY=:0 $your_unity_exec Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- ...
- How
to run Unity on Amazon Cloud or without Monitor
- Eines relacionades / Related tools
- Instruccions antigues / Old instructions
- Unity on Linux: Release Notes and Known Issues
- Unity 3D est disponible en preview pour Linux
- Instal·lació / Installation
- Download autoinstallation script (2.2GB)
wget http://beta.unity3d.com/download/b7d937b6f596/unity-editor-installer-5.6.0xb3Linux.sh
- ...
- Download autoinstallation script (2.2GB)
- Errors
- Empty screen
- Install
Unity3D on Linux
09Unity3D#
- Instal·lació / Installation
- Raspberry Pi
- Install
the Unity Hub and Editor
wget https://public-cdn.cloud.unity3d.com/hub/prod/UnityHubBeta.tar.gztar xvf UnityHubBeta.tar.gzcd Unity\ Hubchmod +x INSTALL.sh- mkdir -p ~/.local/share/applications/
./INSTALL.sh
- Manual
- Problemes / Problems
- Ús / Usage
${HOME}/Applications/UnityHub.AppImage
- Plugins
- Video players (play a video from inside Unity)
- ffmpeg
for Unity
- NON906
- ffmpeg-build-script
- modified version of ffmpeg, which includes unitybuf
- fftools_lib
- to build file libffmpegDll.so
- ffmpeg-build-script
- NON906
- vlc-unity
- by VideoLABS
- Videolabs (Unity asset store)
- Linux
support
- VLC version 4?
- by VideoLABS
- NexPlayer
- AVPro Video
- ffmpeg
for Unity
- FEMTP
- WebRTC
- com.unity.webrtc
- WebRTC
- install: libc++1 libc++abi1
- libc++
- Problemes / Problems
- CentOS / Alma8
- install: libc++1 libc++abi1
- Video players (play a video from inside Unity)
- ...
10Javascript#
11VRML#
- Web3D Consortium (VRML)
- Cosmoworld
- Cosmo for IRIX
- Cosmo development (VRML)
- VRML works
- VRML.SGI.COM
- Editors
- Navegadors / Browsers
12Impressió / Print#
| type | format | free | examples | comments | |
|---|---|---|---|---|---|
| GLpr (dwnld) | vector | PS, | - | It works with Inventor. | |
| PS render | vector | PS | × | GLUT | Not all the primitives are implemented. |
| GLP | vector | PS | × | Mesa | |
| TGS (3D Master Suite) | 2D vector | PS | - | Not for 3D scenes. | |
| Iv2Ras | bitmap | PS, rgb | × | ||
| iv2ps | bitmap | PS | × | ||
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
13Ray-tracing, radiosity#
14Reconstrucció / Reconstruction#
- Canonview: Scene Summarization for Online Image Collections (U. Washington)
- Photosynth (Microsoft)
- Photo to 3D
15Mons virtuals / Virtual worlds#
http://www.francescpinyol.cat/opengl.html
Primera versió: / First version:
Darrera modificació: 1 de juny de 2024 / Last update: 1st June
2024