Built-in shader include files //内置的材质包含文件

本文介绍了Unity中内置的着色器包含文件,包括HLSLSupport.cginc、UnityShaderVariables.cginc等,详细解释了这些文件的作用及包含的内容,并提供了文件的具体位置。

Built-in shader include files  内置的材质包含文件

Unity contains several files that can be used by your shader programs to bring in predefined variables and helper functions. This is done by the standard #includedirective, e.g.:

Unity包含几个文件,这些文件可以被你的着色程序用来引入预先定义的变量和帮助函数。这是由标准的include指令完成的,例如:

CGPROGRAM
// ...
#include "UnityCG.cginc"
// ...
ENDCG

Shader include files in Unity are with .cginc extension, and the built-in ones are:

Shader包括了unity的文件。cginc的扩展,内置的是:

  • HLSLSupport.cginc - (automatically included) Helper macros and definitions for cross-platform shader compilation.
  • (自动包含)帮助器宏和跨平台着色编译的定义。
  • UnityShaderVariables.cginc - (automatically included) Commonly used global variables.
  • (自动包含)常用的全局变量。
  • UnityCG.cginc - commonly used helper functions.
  • 常用的辅助函数。
  • AutoLight.cginc - lighting & shadowing functionality, e.g. surface shaders use this file internally.
  • 照明和阴影功能,如表面着色器在内部使用这个文件。
  • Lighting.cginc - standard surface shader lighting models; automatically included when you’re writing surface shaders.
  • TerrainEngine.cginc - helper functions for Terrain & Vegetation shaders.
  • 标准的表面着色照明模型;当你书写表面着色时,自动包括。 TerrainEngine。cginc-辅助功能,用于地形和植被的着色。

These files are found inside Unity application ({unity install path}/Data/CGIncludes/UnityCG.cginc on Windows,/Applications/Unity/Unity.app/Contents/CGIncludes/UnityCG.cginc on Mac), if you want to take a look at what exactly is done in any of the helper code.

这些文件在里面统一应用程序({统一安装路径} /数据/ CGIncludes / UnityCG。cginc在Windows上,/应用程序/ / Unity.app /内容/ CGIncludes / UnityCG统一。在Mac上的cginc),如果你想看看在任何辅助代码中都做了什么。

HLSLSupport.cginc

This file is automatically included when compiling CGPROGRAM shaders (but not included for HLSLPROGRAM ones). It declares various preprocessor macros to aid in multi-platform shader development.

在编译CGPROGRAM着色器时,这个文件会自动被包含(但是对于HLSLPROGRAM的文件不包括在内)。它声明了各种预处理器宏来支持多平台的着色开发。

UnityShaderVariables.cginc

This file is automatically included when compiling CGPROGRAM shaders (but not included for HLSLPROGRAM ones). It declares various built-in global variables that are commonly used in shaders.

在编译CGPROGRAM着色器时,这个文件会自动被包含(但是对于HLSLPROGRAM的文件不包括在内)。它声明了在着色器中常用的各种内置全局变量。

UnityCG.cginc

This file is often included in Unity shaders. It declares many built-in helper functions and data structures.

这个文件通常包含在统一着色。它宣布许多内置的辅助函数和数据结构。

Data structures in UnityCG.cginc 数据结构在UnityCG.cginc
  • struct appdata_base: vertex shader input with position, normal, one texture coordinate.
  • struct appdata_tan: vertex shader input with position, normal, tangent, one texture coordinate.
  • struct appdata_full: vertex shader input with position, normal, tangent, vertex color and two texture coordinates.
  • struct appdata_img: vertex shader input with position and one texture coordinate.
luckes@luckes-Legion-Y7000P-IRX9:~/PX4-Autopilot$ make px4_sitl_default # 重新 编译 -- PX4 version: v1.14.0 (1.14.0) -- Found PythonInterp: /usr/local/bin/python3 (found suitable version "3.10.9", minimum required is "3") -- PX4 config file: /home/luckes/PX4-Autopilot/boards/px4/sitl/default.px4board -- PLATFORM posix -- ROMFSROOT px4fmu_common -- ROOTFSDIR . -- TESTING y -- ETHERNET y -- PX4 config: px4_sitl_default -- PX4 platform: posix -- PX4 lockstep: enabled -- The CXX compiler identification is GNU 9.4.0 -- The C compiler identification is GNU 9.4.0 -- The ASM compiler identification is GNU -- Found assembler: /usr/bin/cc -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- cmake build type: RelWithDebInfo -- Could NOT find gz-transport (missing: gz-transport_DIR) -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") -- Checking for module 'bullet>=2.82' -- Found bullet, version 2.88 -- Found ccd: /usr/include (found suitable version "2.0", minimum required is "2.0") -- Found fcl: /usr/include (found suitable version "0.5.0", minimum required is "0.3.2") -- Found assimp: /usr/include (found version "5.0.0") -- Found DART: /usr/include (Required is at least version "6.6") found components: dart -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.40.0") found components: thread system filesystem program_options regex iostreams date_time -- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.6.1") -- Looking for ignition-math6 -- found version 6.15.1 -- Searching for dependencies of ignition-math6 -- Looking for OGRE... -- OGRE_PREFIX_WATCH changed. -- Checking for module 'OGRE' -- Found OGRE, version 1.9.0 -- Found Ogre Ghadamon (1.9.0) -- Found OGRE: optimized;/usr/lib/x86_64-linux-gnu/libOgreMain.so;debug;/usr/lib/x86_64-linux-gnu/libOgreMain.so -- Looking for OGRE_Paging... -- Found OGRE_Paging: optimized;/usr/lib/x86_64-linux-gnu/libOgrePaging.so;debug;/usr/lib/x86_64-linux-gnu/libOgrePaging.so -- Looking for OGRE_Terrain... -- Found OGRE_Terrain: optimized;/usr/lib/x86_64-linux-gnu/libOgreTerrain.so;debug;/usr/lib/x86_64-linux-gnu/libOgreTerrain.so -- Looking for OGRE_Property... -- Found OGRE_Property: optimized;/usr/lib/x86_64-linux-gnu/libOgreProperty.so;debug;/usr/lib/x86_64-linux-gnu/libOgreProperty.so -- Looking for OGRE_RTShaderSystem... -- Found OGRE_RTShaderSystem: optimized;/usr/lib/x86_64-linux-gnu/libOgreRTShaderSystem.so;debug;/usr/lib/x86_64-linux-gnu/libOgreRTShaderSystem.so -- Looking for OGRE_Volume... -- Found OGRE_Volume: optimized;/usr/lib/x86_64-linux-gnu/libOgreVolume.so;debug;/usr/lib/x86_64-linux-gnu/libOgreVolume.so -- Looking for OGRE_Overlay... -- Found OGRE_Overlay: optimized;/usr/lib/x86_64-linux-gnu/libOgreOverlay.so;debug;/usr/lib/x86_64-linux-gnu/libOgreOverlay.so -- Looking for ignition-math6 -- found version 6.15.1 -- Looking for ignition-transport8 -- found version 8.5.0 -- Searching for dependencies of ignition-transport8 -- Config-file not installed for ZeroMQ -- checking for pkg-config -- Checking for module 'libzmq >= 4' -- Found libzmq , version 4.3.2 -- Found ZeroMQ: TRUE (Required is at least version "4") -- Checking for module 'uuid' -- Found uuid, version 2.34.0 -- Found UUID: TRUE -- Looking for ignition-msgs5 -- found version 5.11.0 -- Searching for dependencies of ignition-msgs5 -- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found suitable version "3.6.1", minimum required is "3") -- Looking for ignition-math6 -- found version 6.15.1 -- Checking for module 'tinyxml2' -- Found tinyxml2, version 6.2.0 -- Looking for ignition-msgs5 -- found version 5.11.0 -- Looking for ignition-common3 -- found version 3.17.0 -- Searching for dependencies of ignition-common3 -- Looking for dlfcn.h - found -- Looking for libdl - found -- Found DL: TRUE -- Searching for <ignition-common3> component [graphics] -- Looking for ignition-common3-graphics -- found version 3.17.0 -- Searching for dependencies of ignition-common3-graphics -- Looking for ignition-math6 -- found version 6.15.1 -- Looking for ignition-fuel_tools4 -- found version 4.9.1 -- Searching for dependencies of ignition-fuel_tools4 -- Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so (found version "7.68.0") -- Checking for module 'jsoncpp' -- Found jsoncpp, version 1.7.4 -- Found JSONCPP: TRUE -- Checking for module 'yaml-0.1' -- Found yaml-0.1, version 0.2.2 -- Found YAML: TRUE -- Checking for module 'libzip' -- Found libzip, version 1.5.1 -- Found ZIP: TRUE -- Looking for ignition-common3 -- found version 3.17.0 -- Looking for ignition-math6 -- found version 6.15.1 -- Looking for ignition-msgs5 -- found version 5.11.0 -- Found gazebo-classic 11.15.1, including sitl_gazebo-classic simulator and gazebo-classic targets -- Could NOT find Java (missing: Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE) -- ROMFS: ROMFS/px4fmu_common Architecture: amd64 ==> CPACK_INSTALL_PREFIX = @DEB_INSTALL_PREFIX@ -- Configuring done -- Generating done -- Build files have been written to: /home/luckes/PX4-Autopilot/build/px4_sitl_default Scanning dependencies of target events_header Scanning dependencies of target flighttasks_generated Scanning dependencies of target drivers_board Scanning dependencies of target uorb_headers [ 0%] Generating combined event json file [ 0%] Generating Flight Tasks [ 0%] Generating uORB topic headers [ 0%] Building CXX object boards/px4/sitl/src/CMakeFiles/drivers_board.dir/board_shutdown.cpp.o [ 0%] Generating px4 event header file Traceback (most recent call last): File "/home/luckes/PX4-Autopilot/Tools/msg/px_generate_uorb_topic_files.py", line 249, in <module> generate_output_from_file(generate_idx, f, args.outputdir, args.package, args.templatedir, INCL_DEFAULT) File "/home/luckes/PX4-Autopilot/Tools/msg/px_generate_uorb_topic_files.py", line 166, in generate_output_from_file return generate_by_template(output_file, template_file, em_globals) File "/home/luckes/PX4-Autopilot/Tools/msg/px_generate_uorb_topic_files.py", line 182, in generate_by_template em.RAW_OPT: True, em.BUFFERED_OPT: True}) AttributeError: module 'em' has no attribute 'RAW_OPT' [ 0%] Built target flighttasks_generated make[3]: *** [msg/CMakeFiles/uorb_headers.dir/build.make:431:uORB/topics/action_request.h] 错误 1 make[3]: *** 正在删除文件“uORB/topics/action_request.h” make[2]: *** [CMakeFiles/Makefile2:7357:msg/CMakeFiles/uorb_headers.dir/all] 错误 2 make[2]: *** 正在等待未完成的任务.... Scanning dependencies of target git_micro_xrce_dds_client [ 0%] Building C object boards/px4/sitl/src/CMakeFiles/drivers_board.dir/sitl_led.c.o [ 0%] git submodule src/modules/uxrce_dds_client/Micro-XRCE-DDS-Client [ 0%] Built target git_micro_xrce_dds_client [ 0%] Linking CXX static library libdrivers_board.a [ 0%] Built target events_header [ 0%] Built target drivers_board make[1]: *** [Makefile:152:all] 错误 2 make: *** [Makefile:227:px4_sitl_default] 错误 2
最新发布
09-06
有报错。surongfeng@surongfeng:~$ # 安装编译依赖 sudo apt install libogre-1.12-dev libbullet-dev libsimbody-dev # 克隆指定版本源码(如gazebo11) git clone -b gazebo11 https://github.com/osrf/gazebo cd gazebo && mkdir build && cd build cmake ../ make -j$(nproc) sudo make install [sudo] surongfeng 的密码: 正在读取软件包列表... 完成 正在分析软件包的依赖关系树... 完成 正在读取状态信息... 完成 libogre-1.12-dev 已经是最新版 (1.12.10+dfsg2-3+b1)。 libbullet-dev 已经是最新版 (3.24+dfsg-2)。 libsimbody-dev 已经是最新版 (3.7+dfsg-3)。 升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。 正克隆到 'gazebo'... remote: Enumerating objects: 289952, done. remote: Counting objects: 100% (294/294), done. remote: Compressing objects: 100% (145/145), done. remote: Total 289952 (delta 201), reused 151 (delta 149), pack-reused 289658 (from 4) 接收对象中: 100% (289952/289952), 544.94 MiB | 1.13 MiB/s, 完成. 处理 delta 中: 100% (225254/225254), 完成. 正在更新文件: 100% (3714/3714), 完成. -- The C compiler identification is GNU 12.2.0 -- The CXX compiler identification is GNU 12.2.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Gazebo version 11.15.1 -- Found CPack generators: DEB -- Found Doxygen: /usr/bin/doxygen (found version "1.9.4") found components: doxygen dot -- High memory tests: enabled -- ====== Finding 3rd Party Packages ====== -- Operating system is Linux -- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.1") -- Checking for module 'freeimage>=3.9.0' -- Package 'freeimage', required by 'virtual:world', not found -- freeimage.pc not found, trying freeimage_include_dir and freeimage_library_dir flags. -- Looking for FreeImage.h - not found -- Missing: Unable to find FreeImage.h -- Looking for libfreeimage - not found -- Missing: Unable to find libfreeimage -- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so (found version "3.21.12") -- Missing: Google Protobuf Compiler Library (libprotoc-dev) CMake Warning (dev) at /usr/share/cmake-3.25/Modules/FindOpenGL.cmake:315 (message): Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when available. Run "cmake --help-policy CMP0072" for policy details. Use the cmake_policy command to set the policy and suppress this warning. FindOpenGL found both a legacy GL library: OPENGL_gl_LIBRARY: /usr/lib/x86_64-linux-gnu/libGL.so and GLVND libraries for OpenGL and GLX: OPENGL_opengl_LIBRARY: /usr/lib/x86_64-linux-gnu/libOpenGL.so OPENGL_glx_LIBRARY: /usr/lib/x86_64-linux-gnu/libGLX.so OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for compatibility with CMake 3.10 and below the legacy GL library will be used. Call Stack (most recent call first): cmake/SearchForStuff.cmake:74 (include) CMakeLists.txt:163 (include) This warning is for project developers. Use -Wno-dev to suppress it. -- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so -- Could NOT find OpenAL (missing: OPENAL_LIBRARY OPENAL_INCLUDE_DIR) -- OpenAL not found, audio support will be disabled. -- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS C CXX) (found version "") -- HDF5 not found -- Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR) -- Checking for module 'libprofiler' -- Package 'libprofiler', required by 'virtual:world', not found -- Looking for libprofiler - not found -- Checking for module 'libtcmalloc' -- Package 'libtcmalloc', required by 'virtual:world', not found -- Looking for libtcmalloc - not found -- Looking for Simbody - found -- Could NOT find DART (missing: DART_DIR) -- Looking for DART - not found -- DART 6.6 not found, for dart physics engine option, please install libdart6.6-dev. -- Using system tinyxml. -- Checking for module 'tinyxml' -- Package 'tinyxml', required by 'virtual:world', not found -- Looking for tinyxml headers - not found -- Looking for tinyxml library - not found -- Looking for tinyxml.h - not found -- Missing: tinyxml -- Using system tinyxml2. -- Checking for module 'tinyxml2' -- Package 'tinyxml2', required by 'virtual:world', not found -- Looking for tinyxml2 headers - not found -- Looking for tinyxml2 library - not found -- Looking for tinyxml2 library dirs - not found -- Looking for tinyxml2.h - not found -- Missing: tinyxml2 -- Looking for libtar.h - not found -- Looking for libtar.so - not found -- Missing: libtar -- Checking for module 'tbb' -- Found tbb, version 2021.8.0 -- Checking for module 'OGRE-RTShaderSystem>=1.7.4' -- Found OGRE-RTShaderSystem, version 1.12.10 -- Checking for module 'OGRE>=1.7.4' -- Found OGRE, version 1.12.10 -- Checking for module 'OGRE-Terrain' -- Found OGRE-Terrain, version 1.12.10 -- Checking for module 'OGRE-Overlay' -- Found OGRE-Overlay, version 1.12.10 -- Checking for module 'ccd>=1.4' -- Package 'ccd', required by 'virtual:world', not found -- Using internal copy of libccd -- Checking for module 'libswscale' -- Found libswscale, version 6.7.100 -- Checking for module 'libavdevice>=56.4.100' -- Package 'libavdevice', required by 'virtual:world', not found -- libavdevice not found. Recording to a video device will be disabled. -- Checking for module 'libavformat' -- Found libavformat, version 59.27.100 -- Checking for module 'libavcodec' -- Found libavcodec, version 59.37.100 -- Checking for module 'libavutil' -- Found libavutil, version 57.28.100 -- Checking for modules 'playercore>=3.0;playerc++;playerwkb' -- Package 'playercore', required by 'virtual:world', not found -- Package 'playerc++', required by 'virtual:world', not found -- Package 'playerwkb', required by 'virtual:world', not found -- Player not found, gazebo plugin for player will not be built. -- Checking for module 'gts' -- Package 'gts', required by 'virtual:world', not found -- GNU Triangulation Surface library not found - Gazebo will not have CSG support. -- Checking for module 'bullet>=2.82' -- Found bullet, version 3.24 -- Bullet found: 3.24 -- Checking for module 'libusb-1.0' -- Found libusb-1.0, version 1.0.26 -- Looking for libusb-1.0 - found. USB peripherals support enabled. -- Checking for module 'OculusVR' -- Package 'OculusVR', required by 'virtual:world', not found -- Oculus Rift support will be disabled. CMake Error at cmake/SearchForStuff.cmake:648 (find_package): By not providing "Findsdformat9.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "sdformat9", but CMake did not find one. Could not find a package configuration file provided by "sdformat9" (requested version 9.8) with any of the following names: sdformat9Config.cmake sdformat9-config.cmake Add the installation prefix of "sdformat9" to CMAKE_PREFIX_PATH or set "sdformat9_DIR" to a directory containing one of the above files. If "sdformat9" provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): CMakeLists.txt:163 (include) -- Configuring incomplete, errors occurred! See also "/home/surongfeng/gazebo/build/CMakeFiles/CMakeOutput.log". make: *** 没有指明目标并且找不到 makefile。 停止。 make: *** 没有规则可制作目标“install”。 停止。 surongfeng@surongfeng:~/gazebo/build$
05-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值