Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
1.0.0:default-material [2023/02/27 16:00] – [Properties] admin1.0.0:default-material [2023/04/17 08:59] (current) – [Adding new Textures at DesignTime] admin
Line 239: Line 239:
   * LOCALS.**Diffuse**   * LOCALS.**Diffuse**
   * LOCALS.**Specular**   * LOCALS.**Specular**
 +  * LOCALS.**Emissive**
   * LOCALS.**TexCoord0**   * LOCALS.**TexCoord0**
 +  * LOCALS.**TexCoord1**
 +  * LOCALS.**TexCoord2**
 +  * LOCALS.**TexCoord3**
   * LOCALS.**TransfVertPos**   * LOCALS.**TransfVertPos**
 +  * LOCALS.**FragDepth**
   * LOCALS.**Normal**   * LOCALS.**Normal**
   * LOCALS.**FragViewDir**   * LOCALS.**FragViewDir**
Line 348: Line 353:
 | - | TGorillaGLSLClippingPlaneGetNode| Sets the locals value for **LOCALS.ClippingPlane**. | | - | TGorillaGLSLClippingPlaneGetNode| Sets the locals value for **LOCALS.ClippingPlane**. |
 | - | TGorillaGLSLVertexShaderOutputNode| Automatically sets the following locals and varying parameters<WRAP> | - | TGorillaGLSLVertexShaderOutputNode| Automatically sets the following locals and varying parameters<WRAP>
 +  * **LOCALS.Position**
   * **LOCALS.TransfVertexPos**   * **LOCALS.TransfVertexPos**
   * **LOCALS.WorldViewProjVertPos**   * **LOCALS.WorldViewProjVertPos**
   * **LOCALS.TexCoord0**   * **LOCALS.TexCoord0**
 +  * **LOCALS.TexCoord1**
 +  * **LOCALS.TexCoord2**
 +  * **LOCALS.TexCoord3**
   * **LOCALS.Color0**   * **LOCALS.Color0**
   * **LOCALS.Normal**   * **LOCALS.Normal**
   * **LOCALS.Tangent**   * **LOCALS.Tangent**
   * **LOCALS.Binormal**   * **LOCALS.Binormal**
 +  * **LOCALS.Displace**
 +  * **LOCALS.ClippingPlane**
   * **vars.v_TBN**   * **vars.v_TBN**
   * **vars.v_TBN_UT**   * **vars.v_TBN_UT**
Line 965: Line 976:
 | _NormalMapTexture | FragmentShader | sampler2D | If GORILLA_GLSL_DEFINE_NORMALMAP is activated. | | _NormalMapTexture | FragmentShader | sampler2D | If GORILLA_GLSL_DEFINE_NORMALMAP is activated. |
 | _SpecularMapTexture | FragmentShader | sampler2D | If GORILLA_GLSL_DEFINE_USE_SPECULAR is activated. | | _SpecularMapTexture | FragmentShader | sampler2D | If GORILLA_GLSL_DEFINE_USE_SPECULAR is activated. |
 +| _EmissiveTexture | FragmentShader | sampler2D | If GORILLA_GLSL_DEFINE_USE_EMISSIVE is activated. |
 | _DepthTexture | FragmentShader | sampler2D | If GORILLA_GLSL_DEFINE_DEPTH is activated. | | _DepthTexture | FragmentShader | sampler2D | If GORILLA_GLSL_DEFINE_DEPTH is activated. |
 | _EnvironmentTexture | FragmentShader | samplerCube | If GORILLA_GLSL_DEFINE_ENVIRONMENT is activated. | | _EnvironmentTexture | FragmentShader | samplerCube | If GORILLA_GLSL_DEFINE_ENVIRONMENT is activated. |
Line 1009: Line 1021:
 </file> </file>
  
-**__NOTICE:__** Deactivating "UseTexture0" will remove "Texture" property availability! You can no longer use a Texture0 in your shader. Deactivate this property if you want only to use the diffuse color for rendering.+**__NOTICE:__** Deactivating "UseTexture0" will remove "Texture" property availability! You can no longer use a Texture0 in your shader. Deactivate this property if you just want to use the diffuse color as base color.
 ===== Extending the default material ===== ===== Extending the default material =====
  
Line 1454: Line 1466:
 </file> </file>
  
 +Read more about TLocals structure in VertexShader/SurfaceShader in section [[#tgorillaglobalsnode_globals|TGorillaGlobalsNode]]
 +at //TGorillaGLSLVertexShaderLocalsStructNode// and //TGorillaGLSLFragmentShaderLocalsStructNode//.
 +
 +==== Adding new Textures at DesignTime ====
 +
 +Besides the possibility of adding textures by code at runtime, you can also add new textures at designtime.
 +
 +Move inside the object inspector to the specific material source (inherited from TGorillaDefaultMaterialSource).
 +
 +__Steps:__
 +  * Open the design editor of the "**Bitmaps**" property
 +  * Add a new item
 +  * Input a name for the texture
 +  * Choose where the texture will be available: PixelShader or VertexShader
 +
 +__//NOTICE://__ The name will be important to access the texture in your shader!
 +
 +Due to Firemonkey implementation, you will access your texture with the **prefix "_"**. So for example, if you name your texture "**MyTexture**", you will
 +access it by "**_MyTexture**".
 +
 +When you choose the shader your texture will be available, you can access it also at design time in the corresponding property:
 +
 +^ShaderKind^Property^
 +|PixelShader|<TGorillaDefaultMaterialSource>.SurfaceShader|
 +|VertexShader|<TGorillaDefaultMaterialSource>.VertexShader|
 +
 +
 +In the collection item you can configure further properties of your texture and you can of course load the image data itself.
 +
 +__//NOTICE//__: Not all of the properties are fully restorable at runtime, because there are some automatisms which can't be overwritten by Gorilla3D. Use the "**ProtectFormatSettings**" property to at least try to protect those properties from implicit modification.
 +
 +__//WARNING//__: When adding new texture always add them at the end of the collection, to not intercept default textures.
 +
 +=== Availabled Properties ===
 +
 +^Property^Descr^
 +|Bitmap|Image data loadable from BMP, PNG or JPEG|
 +|BorderColor|Defines a texture border color.|
 +|DataType|Defines the data type of the internal texture format. See OpenGL specification for further information.|
 +|Format|Defines the general texture format. See OpenGL specification for further information.|
 +|IgnoreInArray|Internally arrays of textures are used for specific topics (shadows), where the name of the texture becomes obsolete.|
 +|InternalFormat|Defines the internal texture format. See OpenGL specification for further information.|
 +|IsDynamic|The texture will automatically retrieve its image data from a renderpass or other dynamic source. It's not recommended to use this with user specific textures.|
 +|MagFilter|Defines the magnification texture filtering in combination with the MinFilter property.|
 +|MinFilter|Defines the minification texture filtering in combination with the MagFilter property.|
 +|Name|A name for the texture will always be needed! Access the texture in shaders with the prefix "_"|
 +|ProtoectFormatSettings|TRUE/FALSE to protect the texture from implicit modification on re-init during runtime.|
 +|ShaderKind|Defines where the texture will be available. In PixelShader or VertexShader.|
 +|TextureKind|Kind of the texture: 2D, 3D, CubeMap, 2DArray (**recommened: only 2D**)|
 +|TilingX|Tiling of the texture on x-axis (2D)|
 +|TilingY|Tiling of the texture on y-axis (2D)|
 +|WrapR|Texture wrapping on R-axis (for 3D textures)|
 +|WrapS|Texture wrapping on S-axis|
 +|WrapT|Texture wrapping on T-axis|