Genevieve Young <[EMAIL PROTECTED]> wrote:
> I have created models in 3D Studio Max. When I imported them into Director,
> and applied a shader to these models, it appears to be a  flat color.

Hi Genevieve,

A shader on its own is a flat color... or rather four flat colors, each of
which reacts to light somewhat differently:

ambiant  - determines which colors of light are reflected
diffuse  - blends in with the first texture in certain circumstances
emissive - appears to glow
specular - colors the reflections from specular lights

To get your model to look as if it is made of some kind of material (stone,
wood, wallpaper, cloth, ...) you need to use a texture as part of the
shader.  A texture is like magic paint, in the way it makes an image appear.
A shader is like a magic paintbrush, in the way it applies the texture to
the object.

You can experiment with shaders and textures at:

>>           http://perso.planetb.fr/newton/3D/shaders.dcr

The open source version of this movie will be on the CD-Rom that accompanies
my book: Director Shockwave Studio Developers Guide, ISBN 0072132655, which
will be available in the USA from 28 January 2002.

> Is there any command in lingo that I may use to define the shader?

Below is a simple behavior that you can drop on an empty Shockwave 3D
member.  It creates a box model and applies a shader with a texture to the
top face.  To use it, you'll need to create a bitmap image called "Bitmap".
For best results, use a square image with dimensions which are a power of 2:
1, 2, 4, 8, 16, 32, 64, ...

Cheers,

James


on beginSprite(me)
  t3DMember = sprite(me.spriteNum).member
  t3DMember.resetWorld()
  
  -- Create a box model
  tResource = t3DMember.newModelResource("Box resource", #box)
  tModel    = t3DMember.newModel("Box model", tResource)
  
  -- Create a shader with an integerated texture
  tShader   = t3DMember.newShader("Shader", #standard)
  tTexture  = t3DMember.newTexture("Texture")
  tShader.textureList[1] = tTexture -- or tShader.texture = tTexture
  tTexture.member = member("Bitmap") -- ASSUMES THAT THIS EXISTS
  
  -- Add the shader to the top face of the box model
  tModel.shaderList[5] = tShader
  
  -- Place the camera so that we can see the top of the model
  tCamera = t3DMember.camera(1)
  tCamera.worldPosition = vector(60, 90, 120)
  tCamera.pointAt(tModel)
end


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to