These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

inserting textures

fran33
fran33's picture
Registered: Aug 24 2011
Posts: 19

Hi,
 
I have followed the post "Color Control on 3D objec".
 
I understand the basis to change and asign different colors to the escene, but how to embbed textures to the PDF?
The goal is to asign different textures to the same object.
When the object is inserted brings to the 3Dannotations his own texture.
How to include new textures and where are they get located so a button executing a javascript can find them?
 
Thanks

My Product Information:
Acrobat Pro Extended 9.0, Windows
UVSAR
UVSAR's picture
Expert
Registered: Oct 29 2008
Posts: 1357
Textures must be embedded as JPEG images in the Resources tab of your 3D annotation (not as attachments to the PDF file itself).

See my Tech Talk for everything you need to know about JS and 3D:
.
.

http://acrobatusers.com/events/2129/tech-talk-talking-3d-and-flash-acrobat-javascript
fran33
fran33's picture
Registered: Aug 24 2011
Posts: 19
Hi Dave,

thanks for your time and teaching.
Is there some place to download the utilityfunctions.js that you menction at your video?
About changing textures I have embedded 013.jpg image in the Resources tab of the 3D annotation.
This is what console window says

C3D = getAnnots3D(0)[0].context3D;

Material = C3D.scene.materials.getByName("azul");
mtl.diffuseTexture.image = new Image( new Resource( "pdf://013.jpg" ) );
mtl is not defined
1:Console:Exec
undefined


What is wrong? It says that material is not defined but the "azul" material is working when I change the diffuse color. This is about changing color and it works fine.

C3D = getAnnots3D(0)[0].context3D;

Material = C3D.scene.materials.getByName("azul");
Material.diffuseColor.set(0,1,0);

undefined


thanks again



UVSAR
UVSAR's picture
Expert
Registered: Oct 29 2008
Posts: 1357
Your script isn't working because you start off using the variable name "Material" then switch to "mtl" on the next line.

The sample files from my Tech Talk are available here.
fran33
fran33's picture
Registered: Aug 24 2011
Posts: 19
I am sorry but still is not working

C3D = getAnnots3D(0)[0].context3D;

Material = C3D.scene.materials.getByName("azul");
Material.diffuseTexture.image = new Image( new Resource( "pdf://001.jpg" ) );
Image is not defined
1:Console:Exec
undefined


UVSAR
UVSAR's picture
Expert
Registered: Oct 29 2008
Posts: 1357
you have to prepend your objects with "C3D." to refer to the 3D API - for example you must say "new C3D.Image" as the Image object only exists in the context of the 3D API, not the Acrobat API.

It's far easier to do this from within the 3D API itself (by embedding a function within the 3D annotation) - then calling it from the document. Then you're not fighting over namespaces.
fran33
fran33's picture
Registered: Aug 24 2011
Posts: 19
Hi Dave,
if a prepend C3D to the image it says that the resource is not defined.

C3D = getAnnots3D(0)[0].context3D;

Material = C3D.scene.materials.getByName("azul");
Material.diffuseTexture.image = new C3D.Image( new Resource( "pdf://001.jpg" ) );
Resource is not defined
1:Console:Exec
undefined

If I go for the plan B,
What function do I have to embed within the 3D annotation ?

UVSAR
UVSAR's picture
Expert
Registered: Oct 29 2008
Posts: 1357
C3D.Resource

_everything_ is in the context of the 3D API.
fran33
fran33's picture
Registered: Aug 24 2011
Posts: 19
Well I guess I have to give up.
I am not a programmer so I do not understand the basis to establish the diferent functions.
I have tried all the options that I can imagine following your advices but it seems that I don`t get it.

Or the resource is not defined or there is an error writing the function.


Material.diffuseTexture.image = new C3D.Image( new C3D.Resource( "pdf://help.gif" ) );

Material.diffuseTexture.image = new C3D.Image( C3D.Resource( "pdf://help.gif" ) );

Material.diffuseTexture.image = new C3D.Image( new Resource( "pdf://C3D.help.gif" ) );

Material.diffuseTexture.image = new C3D.Image( new Resource( "C3D.pdf://help.gif" ) );

Thanks anyway