2 Replies Latest reply on Oct 16, 2006 8:39 AM by otterman

    shader and reflections

    otterman
      Im trying to create an app that I can change the 'paint colour' of the models, whilst having a reflection. Having created a shader within director, how do I then 'blend' the reflection over that colour ????

      Ive included the lingo Ive banged out so far.....

      This will work one way or the other, ie- the shader works just fine, so does the reflection, but together, the reflection just overrides the shader ????

      Any help please, would love to nail this puppy down!
        • 1. Re: shader and reflections
          duckets Level 1

          I think there's two problems here:

          You're getting slightly confused between setting texture list properties, and setting the first item of those lists. This may not actually be the cause of your problem, but does look like you're using the commands a little differently to how they are documented, so it might help:

          textureList, blendConstantList, blendFunctionList, and textureModeList are all lists, so you should be assigning values to a particular index (position) within that list. The lists each have 8 items, which represent the 8 texture layers that a shader can make use of.

          In your case, it looks like you want the reflection texture to appear over the base diffuse colour of the shader, rather than a base diffuse texture, so your reflection texture can go in channel 1 of the texture list, like this:

          redShader.textureList[1] = sky

          Then you can set the other properties for that specific texture channel like this:

          redShader.blendConstantList[1] = 50
          redShader.blendFunctionList[1] = #add
          redShader.textureModeList[1] = #reflection

          If you wanted to have your reflection appear on top of a diffuse texture, your diffuse texture would go in channel 1, and your reflection texture would go in channel 2.

          ---

          The other problem is, there's another property which you need to set because you want your diffuse colour to show through when using texture. By default, if you use any textures, the diffuse colour of the shader is ignored. This property makes it include the diffuse colour with the textures which I think is what you're after:

          redShader.useDiffuseWithTexture = true


          hope this helps!

          - Ben
          • 2. Re: shader and reflections
            otterman Level 1
            Ben, I thank you but what do you know, I worked it out for myself. Was just about to post the answer but you beat me to it.

            My nemesis thus nolonger- Mymember.shader[MyShaderNo].useDiffuseWithTexture = 1

            Tell you one thing, your wrong, "Im not slightly confused" am hitting a brickwall here. Im a little rusty with lingo and had all but abandoned it...

            Seriously, thanks for your thorough explaination, my head feels a little less fuzzy thanks to your endeavours.....Ta.