Glass Effect

Started by san14, July 16, 2007, 08:38:26 AM

Previous topic - Next topic

san14

HI
   
    I have fps type example. Which contains some objects of glass. I have given transparency to those object in MAX. I want it to appear as glass when I load it to jpct.  How do i handle it. Can any one help me for same. or any eacmples.

I tried to put glass texture to those object's, but did not serve the purpose.

With Regards
San14
San14

EgonOlsen

You somehow have to identity transparent objects in the Object3D[]-array that the loader returns (for example based on the object's name or its texture), set it to transparent in jPCT (and don't merge it with the rest in case you are doing so, because transparency is object based) and you are done.

Melssj5

you cant have refraction efect on jpct! You can apply transparency, texture or even a mini reflection efect.

for just giving the object a transparency efect you have to get the glass objects and apply to them the setTransparency value, but dont merge them with other non transparent objects.
Nada por ahora

san14

#3
 
Hi
    Do i need to load glass object separately.
    My object name is Box62 But it is one of The part of entire room in max file
    I tried in this way.


   Object3D[] levelParts = Loader.load3DS("3ds" + File.separator + "Full_final_Light.3DS", 0.02f);   
   
    level = new Object3D(0);

    for (int i = 0; i < levelParts.length; i++) {
      Object3D part = levelParts [ i ];
 
      part.setCenter(SimpleVector.ORIGIN);
      part.rotateX( (float) - Math.PI / 2);
      part.rotateMesh();
      part.setRotationMatrix(new Matrix());
     
      level = Object3D.mergeObjects(level, part);
     
      Object3D part2 = levelParts[582]
      part2.setTransparency(155);
     
    }
With Regards
San14
San14

Melssj5



Object3D[] levelParts = Loader.load3DS("3ds" + File.separator + "Full_final_Light.3DS", 0.02f);   
   
    level = new Object3D(0);
    glass = new Object3D(0);

    for (int i = 0; i < levelParts.length; i++) {
      Object3D part = levelParts [ i ];

      part.setCenter(SimpleVector.ORIGIN);
      part.rotateX( (float) - Math.PI / 2);
      part.rotateMesh();
      part.setRotationMatrix(new Matrix());
     
      if (!part.getName ().startswith ("Box62"))
           level = Object3D.mergeObjects(level, part);
     else
           glass = Object3D.mergeObjects(glass, part);

    }
     glass.setTransparency (1);

Nada por ahora

EgonOlsen

And don't do something like part2.setTransparency(155); as it won't be transparent anymore. 0 is the lowest possible value (i.e. the most transparent...how transparent can be tweaked in Config). 155 is...well, not transparent at all.

san14

#6
HI

    Thanks A lot EgonOlsen and Melssj5 It worked.  :D
    Can I Increase Reflection on Those glass Object


With Regards

San14
San14

Melssj5

mmm, put it an enviroment map! but it will result more like plastic than like a window. Have a look at the car.zip file on the download section, there is demostrated how to load something like a reflection over an object3D! this is avaible only on the beta release of jpct becausse Egon made some changes. There is thread on the support section called "Reflection effect"
Nada por ahora

san14

#8
HI

    Thanks Melssj5 It worked It gave some reflection effecte to glass.
    Can we have some thing like Mirror effect. Where user can see him self. In the Mirror ?
     

      Object3D[] levelParts = Loader.load3DS("3ds" + File.separator + "Full_final_Light.3DS", 0.02f);     
       
      level = new Object3D(0);
      glass = new Object3D(0);
   
      for (int i = 0; i < levelParts.length; i++) {
         Object3D part = levelParts;
     
         part.setCenter(SimpleVector.ORIGIN);
         part.rotateX( (float) - Math.PI / 2);
         part.rotateMesh();
         part.setRotationMatrix(new Matrix());
     
      if (!part.getName ().startsWith("Glass"))
          level = Object3D.mergeObjects(level, part);
           
      else {
          glass = Object3D.mergeObjects(glass, part);
            
         }
      }
       
       glass.setTransparency (1);

   
       glass.createTriangleStrips(2);
       glass.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
       glass.setCollisionOptimization(Object3D.COLLISION_DETECTION_OPTIMIZED);
   
       glass.setTexture("envmap");
       glass.setEnvmapped(Object3D.ENVMAP_ENABLED);
       glass.setEnvmapMode(Object3D.ENVMAP_WORLDSPACE);
     
       theWorld.addObject(glass);
     

     


With Regards
San14
San14

EgonOlsen

Not really. You can play around with render to texture effects and render the scene twice, but i consider this to be overkill in this case. It's also quite complicated to make it look good/real.