[SOLVED] Shader function "sample2DTextureVec3" not working anymore...

Feature requests, bug reports and related discussion
Post Reply
4 posts • Page 1 of 1
easyarchitect
Posts: 38
Joined: Fri Jan 12, 2007 1:49 am

[SOLVED] Shader function "sample2DTextureVec3" not working anymore...

Post by easyarchitect » Sun Mar 29, 2020 7:46 pm

Hi, I'm trying to export an Indigo scene from my CAD application.

The shader below does't work anymore (it worked with an older Indigo version)


This is the shader.

I've done some test, the shader works, is the function "sample2DTextureVec3" that seems to always return (0,0,0)

Please help !!

Thank you

Antonio

Code: Select all

<material> <!-- IgsMaterialType : "IgsDiffuse" -->
  <name>Material_12</name>
  <diffuse>
    <texture>
      <!-- TextureMap[0] : "Immagine primaria" -->
      <uv_set>default</uv_set>
      <path>.\MAINA SALA (baco)\MATTONI%20PIETRA%20ECRU_BUMP_IMG1.bmp</path>
      <exponent>2.2</exponent>
      <b>1</b>
      <c>0</c>
    </texture>
    <texture>
      <!-- TextureMap[1] : "Mappa livello bumping" -->
      <uv_set>uv_set1</uv_set>
      <path>.\MAINA SALA (baco)\MATTONI%20PIETRA%20ECRU_BUMP_BUMP.bmp</path>
      <exponent>2.2</exponent>
      <b>0.001000</b>
      <c>0</c>
    </texture>
    <albedo>
      <shader>
        <shader>
          <![CDATA[
            def multiplyColor(vec3 col1, vec3 col2) vec3: vec3(mul(doti(col1),doti(col2)),mul(dotj(col1),dotj(col2)),mul(dotk(col1),dotk(col2)))
            def eval(vec3 pos) vec3 : multiplyColor(sample2DTextureVec3(0,getTexCoords(0)),vec3(0.992157,0.960784,0.901961))
          ]]>
        </shader>
      </shader>
    </albedo>
    <bump>
      <texture>
        <texture_index>1</texture_index>
      </texture>
    </bump>
  </diffuse>
</material>
Last edited by easyarchitect on Sun Mar 29, 2020 9:59 pm, edited 1 time in total.

easyarchitect
Posts: 38
Joined: Fri Jan 12, 2007 1:49 am

Re: Shader function "sample2DTextureVec3" not working anymore...

Post by easyarchitect » Sun Mar 29, 2020 8:03 pm

To help you, I've created a sample Image.

The vase has this Material below:

Code: Select all

<material> 
  <name>Material_14</name>
  <diffuse>
    <texture>
      <uv_set>default</uv_set>
      <path>CAST_IMG1_V2.bmp</path>
      <exponent>2.2</exponent>
      <b>1</b>
      <c>0</c>
    </texture>
    <albedo>
      <shader>
        <shader>
          <![CDATA[            
            def eval(vec3 pos) vec3 : sample2DTextureVec3(0,getTexCoords(0))
          ]]>
        </shader>
      </shader>
    </albedo>
  </diffuse>
</material>
Everything else has this material below:

Code: Select all

<material>
    <name>Material_17</name>
    <diffuse>
      <texture>
        <uv_set>default</uv_set>
        <path>CAST_IMG1_V2.bmp</path>
        <exponent>2.2</exponent>
        <b>1</b>
        <c>0</c>
      </texture>
      <albedo>
        <texture>
          <texture_index>0</texture_index>
        </texture>
      </albedo>
    </diffuse>
  </material>
This is the result
ShaderBug.png

User avatar
Zom-B
1st Place 100
Posts: 4684
Joined: Tue Jul 04, 2006 4:18 pm
Location: ´'`\_(ò_Ó)_/´'`
Contact:

Re: Shader function "sample2DTextureVec3" not working anymore...

Post by Zom-B » Sun Mar 29, 2020 9:36 pm

easyarchitect wrote:
Sun Mar 29, 2020 7:46 pm
The shader below does't work anymore (it worked with an older Indigo version)
Can you tell the Indigo version where this shader worked?

I added this issue to the bugtracker, so thank you for reporting!
polygonmanufaktur.de

easyarchitect
Posts: 38
Joined: Fri Jan 12, 2007 1:49 am

Re: Shader function "sample2DTextureVec3" not working anymore...

Post by easyarchitect » Sun Mar 29, 2020 9:59 pm

[SOLVED]

Starting from Indigo 3.6.14, the texture used by shader must be declared locally to the shader...

Here is the correct shader:

Code: Select all

<material> 
  <name>Material_14</name>
  <diffuse>
    <texture>
      <uv_set>default</uv_set>
      <path>CAST_IMG1_V2.bmp</path>
      <exponent>2.2</exponent>
      <b>1</b>
      <c>0</c>
    </texture>
    <albedo>
      <shader>
    	<texture>
            <path>CAST_IMG1_V2.bmp</path>
    	</texture>
        <shader>
          <![CDATA[            
            def eval(vec3 pos) vec3 : sample2DTextureVec3(0,getTexCoords(0))
          ]]>
        </shader>
      </shader>
    </albedo>
  </diffuse>
</material>
bye
R

Post Reply
4 posts • Page 1 of 1

Who is online

Users browsing this forum: Semrush [Bot] and 4 guests