Professional Web Applications Themes

Texture problem with alpha channel - Macromedia Director 3D

[code] on createMySphere sr= p3d.newModelResource("mySphere01", #sphere) s = p3d.newModel("s", sr) s.transform.position = vector (0,0,0) s.shader = p3d.newShader("sShdr2", #standard) txS= p3d.newTexture("txS", #fromcastmember, member("image")) s.shader.textureList[1] = txS sr.radius = 100 sr.resolution =60 end [code] im using png image format for textures, because i want to make user to its alpha channel. The problem comes when the image has the alpha, The sphere disappears no matter how the alpha is painted. how do i make use of the alpha channel, it doesn't even have to be in the same image....

Sponsored Links
  1. #1

    Default Texture problem with alpha channel

    [code]
    on createMySphere
    sr= p3d.newModelResource("mySphere01", #sphere)
    s = p3d.newModel("s", sr)
    s.transform.position = vector (0,0,0)
    s.shader = p3d.newShader("sShdr2", #standard)
    txS= p3d.newTexture("txS", #fromcastmember, member("image"))
    s.shader.textureList[1] = txS
    sr.radius = 100
    sr.resolution =60

    end
    [code]
    im using png image format for textures, because i want to make user to its
    alpha channel. The problem comes when the image has the alpha, The sphere
    disappears no matter how the alpha is painted.
    how do i make use of the alpha channel, it doesn't even have to be in the same
    image.


    Sponsored Links
    Lamefif Guest

  2. #2

    Default Re: Texture problem with alpha channel

    When giving an model a shader with an alpha channel, it affects the way that it
    is sorted against other models. Could it be there's another model with an alpha
    texture very close to your sphere which it is now being sorted behind?

    Maybe you could upload a sample .dir file that demonstrates the problem?

    - Ben


    duckets Guest

  3. #3

    Default Re: Texture problem with alpha channel

    good thinking Ben, but i was looking at it from the transparent side. Doh

    but i have another question now how do i make a plane map from both sides,
    because when i give it a texture now it only one side is textured.

    a plane is one object right is not like a box.

    thanks

    Lamefif Guest

  4. #4

    Default Re: Texture problem with alpha channel

    Check out the 'visibility' property of models. You can set it to #both to
    render both sides of each face. Note that the backside won't be detected by
    modelsUnderRay calls, even though it's visible.

    - ben


    duckets Guest

  5. #5

    Default Re: Texture problem with alpha channel

    thanks i used #both on my sphere it shows up but i dont see the image only
    black the other side.

    i used it on my plane and the texture is gone.

    on createPlane
    planeR = p3d.newModelResource("plane01", #plane)
    planeO = p3d.newModel("planeO", planeR)
    planeO.transform.position = vector (0,0,0)

    p3d.model("planeO").visibility = #both

    planeO.shader = p3d.newShader("pShdr", #standard)
    txPlaneO = p3d.newTexture("txPlaneO", #fromcastmember, member("Asphalt10"))
    planeO.shader.textureList[1] = txPlaneO
    planeR.width = 5000.0
    planeR.length = 5000.0
    planeO.rotate (90, 90, 0)
    end createPlane


    Lamefif Guest

  6. #6

    Default Re: Texture problem with alpha channel

    Below is the behavior I used on an empty shockwave3D member. Notice that I
    use...

    planeO.shaderList = p3D.newShader(...)

    ... rather than .shaderList[1]

    This rather bizarre syntax applies the shader to all meshes at once.





    property p3D, planeO

    on beginSprite(me)
    p3D = sprite(me.spriteNum).member
    p3D.resetWorld()
    p3D.ambientColor = rgb("#FFFFFF")
    me.createPlane()
    end

    on createPlane
    planeR = p3d.newModelResource("plane01", #plane)
    planeO = p3d.newModel("planeO", planeR)

    p3d.model("planeO").visibility = #both

    planeO.shaderList = p3d.newShader("pShdr", #standard)

    txPlaneO = p3d.newTexture("txPlaneO", #fromcastmember, member("Asphalt10"))

    planeO.shader.textureList[1] = txPlaneO
    planeR.width = 50.0
    planeR.length = 50.0
    end createPlane


    on enterFrame()
    planeO.rotate(0, 10, 0)
    end enterFrame

    openspark Guest

  7. #7

    Default Re: Texture problem with alpha channel

    thanks guys all good now
    Lamefif Guest

Similar Threads

  1. Flash as interactive texture with alpha channel viacopyPixels
    By eone in forum Macromedia Director 3D
    Replies: 4
    Last Post: August 9th, 01:07 PM
  2. texture blend whit alpha channel
    By belin-chu in forum Macromedia Director 3D
    Replies: 2
    Last Post: July 12th, 12:39 PM
  3. Alpha channel query
    By yittk in forum Macromedia Freehand
    Replies: 0
    Last Post: June 14th, 08:18 AM
  4. DTS, multi-texture & alpha channel
    By fivan webforumsuser@macromedia.com in forum Macromedia Director 3D
    Replies: 3
    Last Post: December 11th, 08:11 AM
  5. Alpha Channel and CopyPixels
    By Daniel Pliscoff in forum Macromedia Director Lingo
    Replies: 1
    Last Post: August 13th, 11:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139