Sphere > inside texture only?

Software: Away3D 4.x

Lucid, Member
Posted: 02 March 2012 09:29 AM   Total Posts: 93

Is there a way to have a textured sphere where the inside is textured but the outside is transparent?

Essentially I would like two states. When the camera is inside the sphere it sees the inside texture. When the camera is outside the sphere (viewing the sphere from a distance), the outer material is transparent - so the inside texture is seen within the sphere.

or, if possible… have the inside texture with a scaleX=-1 and the outer texture with a scaleX=1. Is this possible?* I would not want to change (or tween) the single texture scaleX to -1 or 1.

Is it possible to have two separate materials (textures) on each side of a sphere?.. or have the outside transparent?

   

Avatar
Fabrice Closier, Administrator
Posted: 02 March 2012 10:36 AM   Total Posts: 1265   [ # 1 ]

You could do 2 Meshes (spheresGeometries), both having a different material.
then do MeshHelper.invertFaces(sphereInner);
then merge.apply(sphereOutter, sphereInner);
the resulting mesh “sphereOutter” should be what you describe.

 

   

Lucid, Member
Posted: 02 March 2012 11:50 AM   Total Posts: 93   [ # 2 ]

Hmm. I’ve actually got a high-resolution video applied as a texture to the sphere. Creating two of these video-textures wouldn’t be a practical solution.

 

   

Avatar
theMightyAtom, Sr. Member
Posted: 02 March 2012 12:59 PM   Total Posts: 669   [ # 3 ]

If I’m not mistaken, what you describe is the default effect if you have a sphere with normals flipped, and no lights. Inside it’s like a panorama, from the outside you see through the face with it’s back to you, into the sphere and the image on the “far wall” of the sphere.

What results are you getting?

Cheers!

 

   

Lucid, Member
Posted: 02 March 2012 01:17 PM   Total Posts: 93   [ # 4 ]

What you described is precisely what I’m after. When the sphere is at a 0,0,0 position we see the panoramic texture inside of the sphere. When we move the sphere away from us (in the distance) you see ‘into’ the sphere (not the outside texture)

How does one flip the normals to accomplish what you’ve described.

 

   

Lucid, Member
Posted: 02 March 2012 01:25 PM   Total Posts: 93   [ # 5 ]

It should be noted:

MeshHelper.invertFaces(mesh)

does not accomplish this (or work at all, in fact)

 

   

Lucid, Member
Posted: 02 March 2012 01:46 PM   Total Posts: 93   [ # 6 ]

Also to be noted:

mesh.scaleX = -1 does flip the inside texture if mesh.material.bothSides = true; (which is what we want)

BUT we want the outside texture to be transparent, so we can see ‘inside’ the sphere.

 

   

Avatar
theMightyAtom, Sr. Member
Posted: 02 March 2012 03:36 PM   Total Posts: 669   [ # 7 ]

try this mesh, an inverted Sphere, radius 100. (scale as necessary)

You DON’T want bothsides=true if you want to see into the Sphere.

 

File Attachments
invertedSphere.3DS  (File Size: 24KB - Downloads: 0)
   

Lucid, Member
Posted: 02 March 2012 03:52 PM   Total Posts: 93   [ # 8 ]

I am not able to download this invertedSphere.3DS file - nor do I know how to build the sphere using a .3DS file in Away 4 beta.

 

   

Avatar
theMightyAtom, Sr. Member
Posted: 02 March 2012 03:59 PM   Total Posts: 669   [ # 9 ]

I’ll try zipping it

 

File Attachments
invertedSphere.zip  (File Size: 9KB - Downloads: 152)
   

Lucid, Member
Posted: 02 March 2012 04:02 PM   Total Posts: 93   [ # 10 ]

Thanks MightyAtom,

Just so I can avoid countless attempts to get this right, what’s the proper code for creating a mesh using the invertedSphere.3DS file? Also, I’m applying a VideoTexture to this.

 

   

Lucid, Member
Posted: 02 March 2012 04:07 PM   Total Posts: 93   [ # 11 ]

@ MightyAtom

I’m reviewing your earlier post describing the method of loading a .3ds
I’ll assume this is the same approach.

 

   

Lucid, Member
Posted: 02 March 2012 04:17 PM   Total Posts: 93   [ # 12 ]

Trying this.. not working..
(where to I attach the video texture material to the loader object?)

Loader3D.enableParser(Max3DSParser);
loader = new Loader3D();
loader.load(new URLRequest(‘invertedSphere.3ds’))
view.scene.addChild(loader)
vt = new VideoTexture(‘beach.mov’,2048,1024,true,true)

 

   

Lucid, Member
Posted: 02 March 2012 04:54 PM   Total Posts: 93   [ # 13 ]

having no luck here. Trying to create an instance of the invertedSphere object, add it to the scene and (in one way or another) apply a video texture to it.

No success.

 

   

Lucid, Member
Posted: 05 March 2012 09:37 AM   Total Posts: 93   [ # 14 ]

@ theMightyAtom

I’m not familiar with the procedure of creating a mesh using an .3DS file and applying a video texture to it. Would you mind providing some rudimentary code on this? Thanks!

 

   
   
‹‹ Texture Swapping

X

Away3D Forum

Member Login

Username

Password

Remember_me



X