« Return to Thread: Problems applying MovieMaterial + Shader combos to .dae

Re: Problems applying MovieMaterial + Shader combos to .dae

by Kim Daniel Arthur-2 :: Rate this Message:

Reply to Author | View in Thread

The reason it doesnt work is that the DAE has child objects that will
use the ShadedMaterials, some of the child objects are the ones that
should be registered with the material.

A complete hack: not sure if this is a bug in the ShadedMaterial
behaviour or what, but in your ShadedMaterial.as file
(papervision3d/materials/shaders/) in the drawTriangle function.

After this existing line:
var sod:ShaderObjectData = shaderObjectData[face3D.instance];

add this line:
if( sod == null )
{
    this.registerObject( face3D.instance );
    sod = shaderObjectData[face3D.instance];
}

your DAE with shadedmaterial then renders for me here.

On Jan 15, 2008 5:57 PM, vrabete <vrabete@...> wrote:

>
> it doesn't seem to work... thanks for the response though...
> these are the files, please see the lines commented with "vrabete" at the
> end, they're the troublemakers...
> any hint is highly appreciated...
> thank you ;)
> http://www.nabble.com/file/p14841705/dae.zip dae.zip
>
>
>
> Kim Daniel Arthur wrote:
> >
> > can it be related to the same issue as on the cube with shaders?
> >
> > could you try to call .registerObject( daeFile ) on all your materials
> > in the materials list?
> >
> >
> >
> > On Jan 15, 2008 2:29 PM, vrabete <vrabete@...> wrote:
> >>
> >> I have the exact same problem, but it doesn't get solved this way :(.
> >> If I build the Sphere with shaders, it works just fine, but if I load a
> >> .dae
> >> object by
> >>
> >> daeFile = new DAE();
> >> daeFile.load("collada.DAE",myMatList);
> >>
> >> where myMatList has a shaded material defined exactly as the Sphere one.
> >> Neither of the approaches seems to work, the
> >> daeFile.replaceMaterialByName
> >> and the myMatList.addMaterial ones. I get the same #1009 error and the
> >> part
> >> doesn't display.
> >>
> >> If I use a movieAssetMaterial instead... no problem, all works fine.
> >>
> >> Any clues?
> >> Thanks.
> >>
> >>
> >> EToth wrote:
> >> >
> >> > Happy New Year everyone,
> >> >
> >> > Well, I think I figured this one out, and I thought I'd share it for
> >> the
> >> > benefit of future generations. :)
> >> >
> >> > I had complete success with using something like this:
> >> >
> >> > ------
> >> > objectName.replaceMaterialByName (newShadedMaterialName,
> >> > "originalMaterialName");
> >> > ------
> >> >
> >> > or in case of my particular example:
> >> >
> >> > ------
> >> > object.replaceMaterialByName (shadedMat, "blinn1SG");
> >> > ------
> >> >
> >> > This works beautifully, even multiple material+shader combos or shaded
> >> > materials can be applied per loaded .dae object.
> >> >
> >> > That's about it.
> >> > Enjoy.
> >> >
> >> >
> >> >
> >> >
> >> > EToth wrote:
> >> >>
> >> >>
> >> >> I continued experimenting with this... tried it with a BitmapMaterial
> >> +
> >> >> Shader combo instead of using a MovieMaterial. No luck, the same error
> >> >> remains:
> >> >>
> >> >>
> >> >> TypeError: Error #1009: Cannot access a property or method of a null
> >> >> object reference.
> >> >>      at
> >> org.papervision3d.materials.shaders::ShadedMaterial/drawTriangle()
> >> >>      at org.papervision3d.core.render.command::RenderTriangle/render()
> >> >>      at
> >> >>
> >> org.papervision3d.render::BasicRenderEngine/org.papervision3d.render:BasicRenderEngine::doRender()
> >> >>      at org.papervision3d.render::BasicRenderEngine/renderScene()
> >> >>
> >> >>
> >> >> This is highly annoying. I don't know if I'm missing something here,
> >> but
> >> >> I'm wondering if anyone has successfully managed to replace a material
> >> on
> >> >> a .dae with a material + shader combo... any ideas would be greatly
> >> >> appreciated.
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> EToth wrote:
> >> >>>
> >> >>> Hi all,
> >> >>>
> >> >>> I'm running into puzzling problems when loading a .dae, and trying to
> >> >>> replace its single placeholder material with my own MovieMaterial +
> >> >>> Shader combination.
> >> >>>
> >> >>> The basic setup looks something like this:
> >> >>>
> >> >>> --------
> >> >>> myMatList = new MaterialsList();
> >> >>> myMat = new MovieMaterial (texture, false, false);
> >> >>> cellShader = new CellShader (pointLight, 0x00ff00, 0x000000);
> >> >>> shadedMat = new ShadedMaterial (myMat, cellShader);
> >> >>> --------
> >> >>>
> >> >>>
> >> >>> If I do this:
> >> >>> -----
> >> >>> myMatList.addMaterial(myMat, "blinn1SG");
> >> >>> object = new Collada ("et.dae", myMatList);
> >> >>> -----
> >> >>> ..., everything works fine, and the .dae's material is replaced by
> >> >>> myMat, which of course points to a MovieClip in the library.
> >> >>>
> >> >>>
> >> >>> However, if I try to do this to apply the MovieMaterial + Shader
> >> combo
> >> >>> to the object:
> >> >>> -----
> >> >>> myMatList.addMaterial(shadedMat, "blinn1SG");
> >> >>> object = new Collada ("et.dae", myMatList);
> >> >>> -----
> >> >>> ...the the renderer.renderScene (scene3d, camera, viewport); line
> >> throws
> >> >>> the following error:
> >> >>>
> >> >>> TypeError: Error #1009: Cannot access a property or method of a null
> >> >>> object reference.
> >> >>>     at
> >> org.papervision3d.materials.shaders::ShadedMaterial/drawTriangle()
> >> >>>     at org.papervision3d.core.render.command::RenderTriangle/render()
> >> >>>     at org.papervision3d.render::BasicRenderEngine/doRender()
> >> >>>     at org.papervision3d.render::BasicRenderEngine/renderScene()
> >> >>>
> >> >>> I'm usually pretty good at tracking down and fixing issues, but I'm
> >> >>> clueless at this point. I tried to experiment with the .dae export
> >> >>> settings, tried .dae objects of different complexity, tried different
> >> >>> MovieMaterial + shader combinations, tried to apply straight
> >> >>> FlatShadeMaterials / CellMaterials instead of combos, all to no
> >> avail.
> >> >>> To make matters worse, if I use the DAE parser instead of the Collada
> >> >>> one, the object does not show up at all (not even with only the
> >> >>> MovieMaterial applied). But this is a separate issue for later... :)
> >> >>>
> >> >>> Thanks in advance for any insight into this.
> >> >>>
> >> >>> -E-
> >> >>>
> >> >>>
> >> >>
> >> >>
> >> > =)=)=)=)=)=)=)=)=)=)=)=)=)=)
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Problems-applying-MovieMaterial-%2B-Shader-combos-to-.dae-tp14461186p14806630.html
> >> Sent from the Papervision3D mailing list archive at Nabble.com.
> >>
> >>
> >> _______________________________________________
> >> Papervision3D mailing list
> >> Papervision3D@...
> >> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >>
> >
> > _______________________________________________
> > Papervision3D mailing list
> > Papervision3D@...
> > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Problems-applying-MovieMaterial-%2B-Shader-combos-to-.dae-tp14461186p14841705.html
>
> Sent from the Papervision3D mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>

_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

 « Return to Thread: Problems applying MovieMaterial + Shader combos to .dae