4 Replies Latest reply on Apr 27, 2012 12:57 PM by dir-developer

    Director New 3D Features

    dir-developer Level 1

      in this post id like to open a discussion that is focused on the new features of patch

      since the documentation on some of these features are considered to be incomplete or absent


      to begin with the cubemapping

      member(whichCastmember).newTexture(newTextureName ,#cubemapTexture, cubeEdgeLength, sourceRef1, sourceRef2, sourceRef3, sourceRef4, sourceRef5, sourceRef6)


      my findings so far:


      member(whitchCastmember) <-- obviausly the member of the 3D envirement we wish to creat a cubemap in


      newTextureName <-- should be something like "mySkybox"


      #cubemapTexture <-- this shud be the command that tells director its dealing with a cubemap however  , whenever you use this parameter director will produce an error saying this is an invalide parameter ... (so wat i see is that direcor dosant suport this feature) and i havent been proven otherwise yet but that may change in this post


      cubeEdgeLength <-- since adobe didnt provide a valide input example i asume it shud be the cubic root of te size of the bitmap used , so if its a 256 X 256 bitmap the "cubeEdgeLength" =6.3496


      sourceRef1 till 6 <-- acoording to the documentation this should refere to a bitmap referance or a castmember (aslong as its a bitmap)


      making it look like this:

      p1  = member(11).image

      p2  = member(12).image

      p3  = member(13).image

      p4  = member(14).image

      p5  = member(15).image

      p6  = member(16).image


        env.newTexture("mySkybox" ,#cubemapTexture ,6.3496, p1,  p2,  p3,  p4,  p5,  p6)


      but this example dosant work ..

        • 1. Re: Director New 3D Features
          Owen Buddenbaum Level 1



          i cannot explain your bug but i suggest an alternative method


          i don't use this "cubemap" for my skyboxes... i prefer using 6 models, set them half-transparent and discard camera.colorBuffer.clearAtRender, so i have a nice blur effect

          • 2. Re: Director New 3D Features
            dir-developer Level 1

            thank you
            ive considered that witch im working on it right now
            the question was actualy aimed at the staff of adobe it self since they were the ones
            that directed me to forums for the corect awnser


            the cube map or sky map  is going to be part of a render sequence
            the idea is to let the envirement behave like that of most games
            were the sky map only rotates along with a rotating and translating world (depending on the the cameras position)



            anoter strange bug i encountered is getting a cast member image to display on the stage

            the images are rendered textures:



            camera[1], myRT)

            member(5).image = myRT.image



            i have images i can see within the cast member
            i can copy it from the cast to photoshop and photoshop will display it
            but whenever i drag the image to the stage it becomes a black image with thite holes on the places were it shud have colors
            as a mask
            ive also tried:

            _movie.stage.image.copyPixels(member(5).image, rect(0,0,512,512),rect(0,0,512,512))


            but also makes the image apear like a black masked image

            ive tried to use several renderformats on casting the textures like rgba8880 a8888 and a5550



            • 3. Re: Director New 3D Features
              dir-developer Level 1

              shoot me



              (5).image.useAlpha = FALSE


              • 4. Re: Director New 3D Features
                dir-developer Level 1

                ok , sry  to say , but adobe .... examples... examples , ffs we need examples 

                and like usual i can figure it out on my own

                anyhows for everyone that couldn't decipher directors cubemap help


                here is a correct use


                its not a map used as an envirement a.k.a skybox , but a 3D reflection map

                adobe failed to mention wat theyre difinition is of a cubeEdgeLength is.

                instead of a cubical root of the projection image size they refere to the actual image size
                so you just fill in the horizontal or vertical size (dimentions have to be the same)

                asuming you are going to use 256 X 256 images for the cubemap:





                env = member("3Dworld")

                --first make the textures--

                basemap = env.newTexture("base", #fromCastMember, member("base"))
                basemap.nearFiltering = 1
                basemap.renderFormat =#rgba8880

                cubemap = env.newTexture("cube" ,#cubemapTexture, 256, member("side1"), member("side2"), member("side3"), member("side4"), member("side5"), member("side6"))

                cubemap.nearFiltering = 1
                cubemap.renderFormat =#rgba8880

                --now we have the textures we need make a shader, stick in the textures and tell each texture how to behave within the shader--

                myShader = env.newShader("Shader1", #standard) --pity i cauld only make it work on standard and not the normal--


                myShader.textureList[1] = basemap --some form of base image--

                myShader.textureCoordGenModeList[1] = #normal --here i got exited for a moment i taught cool i can make a normal map , but its just normal as in ordinary--
                --no blendfunction set for this layer--

                myShader.textureList[4] = cubemap --on top of that we add the cubemap .. ! in the 4th layer--

                textureCoordGenModeList[4] =

                myShader.blendFunctionList[4] = #add --i set the blend of the cubemap to add ,making it apear like reflecting light--


                env.model[1].shaderlist[1] = myShader


                mby adobe will perhaps ventilate if its posible to and how to stick a cubemap on a normal shader
                on another note i got a mail from someone saying cubemaps dont work in opengl
                i havent tried it yet