From b4b28c367c41cbde8f0ec166966fca69767b9681 Mon Sep 17 00:00:00 2001 From: cutealien Date: Tue, 28 Feb 2023 20:21:00 +0000 Subject: [PATCH] Document some shader behaviour S3DVertexTangents also documents that it's passed as TEXCOORD1 and TEXCOORD2, but easy to miss, so added some comments to the hlsl shader. Also not all materials work well as base materials. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6452 dfc29bdd-3216-0410-991c-e03cc46cb475 --- examples/10.Shaders/main.cpp | 5 +++++ media/d3d9.hlsl | 11 ++++++++--- tests/tests-last-passed-at.txt | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/examples/10.Shaders/main.cpp b/examples/10.Shaders/main.cpp index 2cc89b5d..0286cc9d 100644 --- a/examples/10.Shaders/main.cpp +++ b/examples/10.Shaders/main.cpp @@ -288,6 +288,11 @@ int main() To demonstrate this, we create two materials with a different base material, one with EMT_SOLID and one with EMT_TRANSPARENT_ADD_COLOR. + The role of the base material is to set the alpha (transparency) + and blending settings as used in the base material. Avoid the + EMT_NORMAL_... or EMT_PARALLAX... types as base materials as they + are internally shaders themselves and will only create conflicts with + your shaders. */ // create materials diff --git a/media/d3d9.hlsl b/media/d3d9.hlsl index 07809e5f..ff52d6fa 100644 --- a/media/d3d9.hlsl +++ b/media/d3d9.hlsl @@ -19,12 +19,17 @@ struct VS_OUTPUT float4 Position : POSITION; // vertex position float4 Diffuse : COLOR0; // vertex diffuse color float2 TexCoord : TEXCOORD0; // tex coords +// float3 Tangent : TEXCOORD1; // Not used in this example, but additional values can be passed on as tex coords +// float3 Binormal : TEXCOORD2; // Not used in this example, but additional values can be passed on as tex coords }; -VS_OUTPUT vertexMain(in float4 vPosition : POSITION, - in float3 vNormal : NORMAL, - float2 texCoord : TEXCOORD0 ) +VS_OUTPUT vertexMain( in float4 vPosition : POSITION + , in float3 vNormal : NORMAL + , float2 texCoord : TEXCOORD0 + //,float3 Tangent : TEXCOORD1; // Used for Tangent when working with S3DVertexTangents + //,float3 Binormal : TEXCOORD2; // Used for Binormal when working with S3DVertexTangents + ) { VS_OUTPUT Output; diff --git a/tests/tests-last-passed-at.txt b/tests/tests-last-passed-at.txt index 3a1f3d89..922e932b 100644 --- a/tests/tests-last-passed-at.txt +++ b/tests/tests-last-passed-at.txt @@ -1,4 +1,4 @@ Tests finished. 72 tests of 72 passed. Compiled as DEBUG -Test suite pass at GMT Thu Nov 17 16:31:49 2022 +Test suite pass at GMT Thu Jan 05 13:43:13 2023